WhyCan Forum

人过留名,雁过留声,感谢各位朋友不离不弃地支持。 QQ: 516333132, 微信: whycan_cn (哇酷网/挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2019-03-22 20:56:08

fogwizard
会员
注册时间: 2019-03-19
累计积分: 19

请教F1C100S lradc 不产生中断问题

根据Document下的文档,文件suniv-f1c100s-licheepi-nano.dts增加:
/dts-v1/;
#include "suniv-f1c100s.dtsi"
+#include "suniv-lradc.dtsi"
 
#include <dt-bindings/gpio/gpio.h>
 
@@ -46,6 +47,12 @@
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
    };
+    reg_vcc3v0: vcc3v0 {
+        compatible = "regulator-fixed";
+        regulator-name = "vcc3v0";
+        regulator-min-microvolt = <3000000>;
+        regulator-max-microvolt = <3000000>;
+    };

新增 suniv-lradc.dtsi,内容如下:
#include <dt-bindings/input/input.h>

/ {
lradc:
    lradc@1c22800 {
        compatible = "allwinner,sun4i-a10-lradc-keys";
        reg = <0x01c22800 0x100>;
        interrupts = <31>;
        vref-supply = <&reg_vcc3v0>;

        button@191 {
            label = "Volume Up";
            linux,code =
            <KEY_VOLUMEUP>;
            channel = <0>;
            voltage = <191274>;
        };

        button@392 {
            label = "Volume Down";
            linux,code =
            <KEY_VOLUMEDOWN>;
            channel = <0>;
            voltage = <392644>;
        };

        button@601 {
            label = "Menu";
            linux,code = <KEY_MENU>;
            channel = <0>;
            voltage = <601151>;
        };

        button@795 {
            label = "Enter";
            linux,code =
            <KEY_ENTER>;
            channel = <0>;
            voltage = <795090>;
        };

        button@987 {
            label = "Home";
            linux,code =
            <KEY_HOMEPAGE>;
            channel = <0>;
            voltage = <987387>;
        };
    };
};
(内核使用git clone https://github.com/Icenowy/linux.git)

现象为:系统起来之后会生成event0, 然而改变lradc引脚的电压,并没有按键事件
产生,查看adc的中断数,一直是0,是否还有其他地方需要设置? 谢谢

离线

#2 2019-03-23 08:52:48

fogwizard
会员
注册时间: 2019-03-19
累计积分: 19

Re: 请教F1C100S lradc 不产生中断问题

根据  https://whycan.cn/t_1916.html  的信息,中断号改成30/34,表现均一致。

离线

#3 2019-03-23 12:04:48

fogwizard
会员
注册时间: 2019-03-19
累计积分: 19

Re: 请教F1C100S lradc 不产生中断问题

没有找到F100C的手册,看F1C600的lradc基地址应该是0x01C23400,下午设备树改成0x01C23400试一下:
4.1.5. KEYADC Register List
Module Name Base Address
KEYADC 0x01C23400
Register Name Offset Description

离线

#4 2019-03-23 12:09:13

fogwizard
会员
注册时间: 2019-03-19
累计积分: 19

Re: 请教F1C100S lradc 不产生中断问题

那么,问题来了,如果基地址要改,那中断号也应该是不对的...

离线

#5 2019-03-23 17:22:19

达克罗德
会员
注册时间: 2018-04-10
累计积分: 656

Re: 请教F1C100S lradc 不产生中断问题

楼主要的是这个吗?
https://whycan.cn/t_1728.html

离线

#6 2019-03-23 18:19:37

fogwizard
会员
注册时间: 2019-03-19
累计积分: 19

Re: 请教F1C100S lradc 不产生中断问题

https://whycan.cn/t_1728.html
链接分享的是音频口作adc,我这边只是想把f1c100s的keyadc用起来而已,还没到用音频adc这个层次,谢谢。

离线

#7 2019-05-22 11:51:36

上山打逗比
会员
注册时间: 2019-05-16
累计积分: 13

Re: 请教F1C100S lradc 不产生中断问题

我也遇到这个问题,请问楼主解决了吗

离线

#8 2019-08-09 16:29:11

firstman
会员
注册时间: 2019-04-06
累计积分: 184

Re: 请教F1C100S lradc 不产生中断问题

fogwizard 说:

没有找到F100C的手册,看F1C600的lradc基地址应该是0x01C23400,下午设备树改成0x01C23400试一下:
4.1.5. KEYADC Register List
Module Name Base Address
KEYADC 0x01C23400
Register Name Offset Description

请问最后 LRADC 用作 Key 可以了吗?

离线

#9 2019-08-09 16:35:35

firstman
会员
注册时间: 2019-04-06
累计积分: 184

Re: 请教F1C100S lradc 不产生中断问题

fogwizard 说:

根据  https://whycan.cn/t_1916.html  的信息,中断号改成30/34,表现均一致。

手册写的中断不是应该改成 22 吗? 30/34 是怎么算出来的?

spi0: spi@1c05000 {
                        compatible = "allwinner,suniv-spi",
                                     "allwinner,sun8i-h3-spi";
                        reg = <0x01c05000 0x1000>;
                        interrupts = <10>;
                        clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
                        clock-names = "ahb", "mod";
                        resets = <&ccu RST_BUS_SPI0>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };

                spi1: spi@1c06000 {
                        compatible = "allwinner,suniv-spi",
                                     "allwinner,sun8i-h3-spi";
                        reg = <0x01c06000 0x1000>;
                        interrupts = <11>;
                        clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_BUS_SPI1>;
                        clock-names = "ahb", "mod";
                        resets = <&ccu RST_BUS_SPI1>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };

2019-08-09_163424.png

离线

#10 2019-08-09 17:06:59

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,531

Re: 请教F1C100S lradc 不产生中断问题

上面的中断有问题, 就是 22

arch/arm/boot/dts/suniv.dtsi 添加:

lradc: lradc@1c23400 {
        compatible = "allwinner,sun4i-a10-lradc-keys";
        reg = <0x01c23400 0x400>;
        interrupts = <22>;
        status = "disabled";
};
&lradc {
        vref-supply = <&reg_vcc3v3>;
        status = "okay";

        button@200 {
                label = "Volume Up";
                linux,code = <KEY_VOLUMEUP>;
                channel = <0>;
                voltage = <200000>;
        };

        button@400 {
                label = "Volume Down";
                linux,code = <KEY_VOLUMEDOWN>;
                channel = <0>;
                voltage = <400000>;
        };

        button@600 {
                label = "Select";
                linux,code = <KEY_SELECT>;
                channel = <0>;
                voltage = <600000>;
        };

        button@800 {
                label = "Start";
                linux,code = <KEY_OK>;
                channel = <0>;
                voltage = <800000>;
        };
};

用我的吧, 保证药到病除.

离线

#11 2019-08-10 09:02:46

firstman
会员
注册时间: 2019-04-06
累计积分: 184

Re: 请教F1C100S lradc 不产生中断问题

lichee_nano.jpg

终于搞定, 感谢万能的晕哥.

# /mnt/sdcard/evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      1c23400.lradc
/dev/input/event1:      1c24800.rtp
Select the device event number [0-1]: 0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "1c23400.lradc"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 352 (KEY_OK)
    Event code 353 (KEY_SELECT)
Properties:
Testing ... (interrupt to exit)
Event: time 26.366489, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 26.366489, -------------- SYN_REPORT ------------
Event: time 26.539027, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 26.539027, -------------- SYN_REPORT ------------
Event: time 29.266293, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 29.266293, -------------- SYN_REPORT ------------
Event: time 29.445736, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 29.445736, -------------- SYN_REPORT ------------
Event: time 29.957952, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 29.957952, -------------- SYN_REPORT ------------
Event: time 30.121078, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 30.121078, -------------- SYN_REPORT ------------
Event: time 30.447588, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 30.447588, -------------- SYN_REPORT ------------
Event: time 30.607447, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 30.607447, -------------- SYN_REPORT ------------
Event: time 31.299260, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 31.299260, -------------- SYN_REPORT ------------
Event: time 31.459163, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 31.459163, -------------- SYN_REPORT ------------
Event: time 31.883504, type 1 (EV_KEY), code 353 (KEY_SELECT), value 1
Event: time 31.883504, -------------- SYN_REPORT ------------
Event: time 32.076111, type 1 (EV_KEY), code 353 (KEY_SELECT), value 0
Event: time 32.076111, -------------- SYN_REPORT ------------
Event: time 32.539590, type 1 (EV_KEY), code 353 (KEY_SELECT), value 1
Event: time 32.539590, -------------- SYN_REPORT ------------
Event: time 32.699518, type 1 (EV_KEY), code 353 (KEY_SELECT), value 0
Event: time 32.699518, -------------- SYN_REPORT ------------
Event: time 33.156510, type 1 (EV_KEY), code 352 (KEY_OK), value 1
Event: time 33.156510, -------------- SYN_REPORT ------------
Event: time 33.322983, type 1 (EV_KEY), code 352 (KEY_OK), value 0
Event: time 33.322983, -------------- SYN_REPORT ------------
Event: time 34.149170, type 1 (EV_KEY), code 352 (KEY_OK), value 1
Event: time 34.149170, -------------- SYN_REPORT ------------
Event: time 34.328744, type 1 (EV_KEY), code 352 (KEY_OK), value 0
Event: time 34.328744, -------------- SYN_REPORT ------------

离线

#12 2019-08-10 10:17:50

firstman
会员
注册时间: 2019-04-06
累计积分: 184

Re: 请教F1C100S lradc 不产生中断问题

顺便传一个控制荔枝派 nano 底板 三色LED 的脚本:

#########控制PE4 (绿) 4*32 + 4 = 132
echo 132 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio132/direction
#打开绿灯
echo 0 > /sys/class/gpio/gpio132/value
#关闭绿灯
echo 1 > /sys/class/gpio/gpio132/value

#########控制PE5 (蓝) 4*32 + 5 = 133
echo 133 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio133/direction
#打开蓝灯
echo 0 > /sys/class/gpio/gpio133/value
#关闭蓝灯
echo 1 > /sys/class/gpio/gpio133/value

#########控制PE6 (红) 4*32 + 6 = 134
echo 134 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio134/direction
#打开红灯
echo 0 > /sys/class/gpio/gpio134/value
#关闭红灯
echo 1 > /sys/class/gpio/gpio134/value

离线

页脚