根据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 = <®_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,是否还有其他地方需要设置? 谢谢
离线
根据 https://whycan.cn/t_1916.html 的信息,中断号改成30/34,表现均一致。
离线
没有找到F100C的手册,看F1C600的lradc基地址应该是0x01C23400,下午设备树改成0x01C23400试一下:
4.1.5. KEYADC Register List
Module Name Base Address
KEYADC 0x01C23400
Register Name Offset Description
离线
那么,问题来了,如果基地址要改,那中断号也应该是不对的...
离线
https://whycan.cn/t_1728.html
链接分享的是音频口作adc,我这边只是想把f1c100s的keyadc用起来而已,还没到用音频adc这个层次,谢谢。
离线