本帖最后由 一只耳朵怪 于 2018-6-21 10:08 编辑
最近用设备树文件去配置一个6x8(6列8行)的矩阵键盘,驱动用的是内核里面的matrix_keypad.c通用矩阵键盘驱动;
遇到的问题:在通过加载设备树启动后只有部分按键功能有效;如上图2、3、4、5行的所有按键没都反应,第6列的所有按键一按下就会把该按键所在行的所有按键的键值报上去,其他按键上报的的code和value都是正确的。驱动我就加了点注释内核原有的驱动程序应该没bug的吧?
内核是Linux-3.8.13
交叉编译器用的是
ti-sdk-am335x-evm-08.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/
ARM-linux-gnueabihf-
设备树配置如下:
- / [
- compatible = "ti,beaglebone-black";
- /* identification */
- part-number = "HCN-KEYpads-01";
- version = "00A0";
- /* state the resources this cape uses */
- exclusive-use =
- /* the pin header uses */
- "P8.18", /* gpio2_1 */
- "P8.26", /* gpio1_29 */
- "P9.12", /* gpio1_28 */
- "P9.11", /* gpio0_30 */
- "P9.13", /* gpio0_31 */
- "P8.14", /* gpio0_26 */
- "P8.17", /* gpio0_27 */
- "P8.12", /* gpio1_12 */ ------------》八行
- "P8.11", /* gpio1_13 */
- "P8.16", /* gpio1_14 */
- "P8.15", /* gpio1_15 */
- "P9.15", /* gpio1_16 */
- "P9.23", /* gpio1_17 */
- "P9.16", /* gpio1_19 */------------》六列
- /* the hardware IP uses */
- "gpio2_1",
- "gpio1_29",
- "gpio1_28",
- "gpio0_30",
- "gpio0_31",
- "gpio0_26",
- "gpio0_27",
- "gpio1_12",
- "gpio1_13",
- "gpio1_14",
- "gpio1_15",
- "gpio1_16",
- "gpio1_17",
- "gpio1_19";
- fragment@0 [
- target = <&am33xx_pinmux>;
- __overlay__ [
- matrix_keypad_s0: matrix_keypad_s0 [
- pinctrl-single,pins = <
- 0x08c 0x37 /* gpio2_1 INPUT_PULLUP | MODE7 */
- 0x07c 0x37 /* gpio1_29 INPUT_PULLUP | MODE7 */
- 0x078 0x37 /* gpio1_28 INPUT_PULLUP | MODE7 */
- 0x070 0x37 /* gpio0_30 INPUT_PULLUP | MODE7 */
- 0x074 0x37 /* gpio0_31 INPUT_PULLUP | MODE7 */
- 0x028 0x37 /* gpio0_26 INPUT_PULLUP | MODE7 */
- 0x02c 0x37 /* gpio0_27 INPUT_PULLUP | MODE7 */
- 0x030 0x37 /* gpio1_12 INPUT_PULLUP | MODE7 */
- 0x034 0x7 /* gpio1_13 OUTPUT | MODE7 */
- 0x038 0x7 /* gpio1_14 OUTPUT | MODE7 */
- 0x03c 0x7 /* gpio1_15 OUTPUT | MODE7 */
- 0x040 0x7 /* gpio1_16 OUTPUT | MODE7 */
- 0x044 0x7 /* gpio1_17 OUTPUT | MODE7 */
- 0x04c 0x7 /* gpio1_19 OUTPUT | MODE7 */
- >;
- ];
- ];
- ];
- fragment@1 [
- target = <&ocp>;
- __overlay__ [
- matrix_keypad [
- compatible = "gpio-matrix-keypad";
- pinctrl-names = "default";
- pinctrl-0 = <&matrix_keypad_s0>;
- debounce-delay-ms = <5>;
- col-scan-delay-us = <2>;
- row-gpios = <&gpio3 1 0>, /* Bank2, pin1 */
- <&gpio2 29 0>, /* Bank1, pin29 */
- <&gpio2 28 0>,
- <&gpio1 30 0>,
- <&gpio1 31 0>,
- <&gpio1 26 0>,
- <&gpio1 27 0>,
- <&gpio2 12 0>; /* Bank1, pin12 */
- col-gpios = <&gpio2 13 0>,
- <&gpio2 14 0>, /* Bank1, pin14 */
- <&gpio2 15 0>,
- <&gpio2 16 0>,
- <&gpio2 17 0>,
- <&gpio2 19 0>; /* Bank1, pin19 */
- linux,keymap = <0x0000002f /* */
- 0x0100003b
- 0x0200003c
- 0x03000067
- 0x0400006a
- 0x0500006c
- 0x06000010
- 0x07000069
- 0x00010012 /* */
- 0x01010068
- 0x0201006d
- 0x03010013
- 0x04010014
- 0x0501001c
- 0x06010011
- 0x07010022
- 0x00020015 /* */
- 0x01020016
- 0x02020004
- 0x03020007
- 0x0402000a
- 0x0502000c
- 0x06020017
- 0x07020023
- 0x00030018 /* */
- 0x01030019
- 0x02030003
- 0x03030006
- 0x04030009
- 0x05030053
- 0x0603001f
- 0x07030024
- 0x0004001e /* */
- 0x01040020
- 0x02040002
- 0x03040005
- 0x04040008
- 0x0504000b
- 0x06040021
- 0x07040025
- 0x00050001 /* */
- 0x0105000e
- 0x0205000f
- 0x0305003d
- 0x0405003e
- 0x0505003f
- 0x06050066
- 0x07050026>; /* */
- ];
检查了引脚复用没错误,行列的gpio分配,还有keymap。内核启动时设备树文件能顺利加载,上面通过检测程序去检测dev/input/event1上的按键事件,部分按键上报code和value是对的。
请各位帮我看看到底是哪里的问题。