Closed embedclub closed 6 years ago
The gpio-keys module does not exist in Kernel 3.10 (was added in 3.13) and thus will not work.
I do not understand this. In kernel 3.10 has a file named gpio_keys.c(drivers/input/keyboard/). Your meaning is that the exist gpio_keys.c has some problems? If I want to used keys in kernel 3.10, what I should do?
You are correct, though that module is currently not compiled with my Kernel binary releases.
I had been compiled the kernel 3.10 with CONFIG_KEYBOARD_GPIO=m by myself, but insmod gpio_keys.ko failed, error is listed: [18985.552673] input: gpio_keys_polled.19 as /devices/soc.0/gpio_keys_polled.19/input/input3 [18985.554094] Bad mode in Synchronous Abort handler detected, code 0x86000005 [18985.560030] CPU: 3 PID: 2125 Comm: insmod Not tainted 3.10.65 #19 [18985.560030] task: ffffffc02d93c4c0 ti: ffffffc02d340000 task.ti: ffffffc02d340000 [18985.560030] PC is at 0x100000000 [18985.560030] LR is at 0x100000000 ……………………………………
I do not know why? I hope you can add gpio_keys modules device tree file and test this function!
I do not know why? I hope you can add gpio_keys modules device tree file and test this function!
No. Feel free to submit a pull request with a fix and i will be willing to review, merge and eventually include it in my binary releases.
Even though it "crashes" on load for some reason, it still works. You have to:
pinctrl@01c20800
):
button_0: button_0@0 {
allwinner,pins = "PC11";
allwinner,function = "gpio_in";
allwinner,muxsel = <0x0>;
allwinner,pull = <0x1>;
allwinner,drive = <0x0>;
allwinner,data = <0xffffffff>;
};
pio
label to the pin controller node (pio: pinctrl@01c20800
) or use a phandle value instead of &pio
label gpio_keys_polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <100>;
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&button_0>;
button@0 {
label = "GPIO Key UP";
linux,code = <103>;
gpios = <&pio 2 11 0 0 0 0>;
};
};
For the gpios specifier - first cell is the pin bank number, second one is the pin number, others - no idea but looks like they can be set to 0 since the configuration is determined in the pinmux node.
Testing:
root@pine64:~# evtest /dev/input/by-path/platform-gpio_keys_polled.1-event
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio_keys_polled.1"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 103 (KEY_UP)
Key repeat handling:
Repeat type 20 (EV_REP)
Repeat code 0 (REP_DELAY)
Value 250
Repeat code 1 (REP_PERIOD)
Value 33
Properties:
Testing ... (interrupt to exit)
Event: time 1495632664.652229, type 1 (EV_KEY), code 103 (KEY_UP), value 1
Event: time 1495632664.652229, -------------- SYN_REPORT ------------
Event: time 1495632664.852193, type 1 (EV_KEY), code 103 (KEY_UP), value 0
Event: time 1495632664.852193, -------------- SYN_REPORT ------------
^C
root@pine64:~#
Closing, assuming working with the instructions posted.
Hi, I want to use gpio-keys modules, but I have some problem with device tree file. I do not know how to set the paramenter--gpios. Try the following example, 1457 keys:gpio_keys{ 1458 compatible = "gpio-keys"; 1459 #address-cells = <1>; 1460 #size-cells = <0>; 1461 autorepeat; 1465 key-1{ 1466 wakeup-source; 1467 label = "GPIO Power"; 1468 gpios=<&pio PG 6 6 1 2 0>; 1469 debounce-interval = <20>; 1470 linux,code = <116>; 1471 }; 1472 }; 1473 but insmod gpio_keys.ko failed, I hope you can provide an correct example. And the gpios parameter meaning