Issue for adding gpio-matrix keypad to iMX6 UItraLite

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue for adding gpio-matrix keypad to iMX6 UItraLite

3,046 Views
bruceg
Contributor I

Hi,

I am trying to add gpio-matrix keypad to iMX6 UItraLite device tree, but there is no response when I press the keypad, it looks that keypad scanning function is not working. Below is the matrix keypad device tree:

matrix_keypad: matrix_keypad@0 {   

   status = "okay";
   compatible = "gpio-matrix-keypad";
   wakeup-source;
   debounce-delay-ms = <5>;
   col-scan-delay-us = <2>;

   row-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH
                        &gpio1 28 GPIO_ACTIVE_HIGH
                        &gpio1 9 GPIO_ACTIVE_HIGH
                        &gpio1 29 GPIO_ACTIVE_HIGH>;

   col-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH
                        &gpio1 1 GPIO_ACTIVE_HIGH
                        &gpio1 2 GPIO_ACTIVE_HIGH
                        &gpio1 4 GPIO_ACTIVE_HIGH>;

   linux,keymap = <0x00000001 /* KEY1 */
                              0x01000004 /* KEY4 */
                              0x02000007 /* KEY7 */
                              0x0300000B /* KEYSTAR */

                              0x00010002 /* KEY2 */
                              0x01010005 /* KEY5 */
                              0x02010008 /* KEY8 */
                              0x0301000A /* KEY0 */

                              0x00020003 /* KEY3 */
                              0x01020006 /* KEY6 */
                              0x02020009 /* KEY9 */
                              0x0302000C /* KEYPOUND */

                              0x0003000D /* KEYSTART */
                              0x0103000E /* KEYEXIT */
                              0x0203000F /* Key ENTER */
                              0x03030010>;
};

pinctrl_keypad_row: keypad_row {
   fsl,pins = <

      MX6UL_PAD_GPIO1_IO05__GPIO1_IO05 0x1b010

      MX6UL_PAD_UART4_TX_DATA__GPIO1_IO28 0x1b010

      MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0x1b010

      MX6UL_PAD_UART4_RX_DATA__GPIO1_IO29 0x1b010

   >;

}

pinctrl_keypad_col: keypad_col {

   fsl,pins = <

      MX6UL_PAD_SNVS_TAMPER1__GPIO5_IO01 0x110b0

      MX6UL_PAD_GPIO1_IO01__GPIO1_IO01 0x110b0

      MX6UL_PAD_GPIO1_IO02__GPIO1_IO02 0x110b0

      MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0x110b0

   >;

};

I configure the column pins to "out" and row pins to "in" before running evtest. I don't know if the device tree is not correct or something else is missing. Any help will be appreciated.

Thanks,

-Bruce

Labels (3)
0 Kudos
9 Replies

2,621 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Dear Bruce,

   I.MX6UL supports 8x8 hardware keypad port :

pastedImage_1.png

pastedImage_2.png

So why not use existing hardware interfaces and combine KEYPAD with GPIO?

About your questions:

1. No issues were found in your device tree.

2. I feel pinctrl_keypad_row & pinctrl_keypad_col were not run.

So my suggestion is that we firstly ensure all GPIOs for KEYs can be multiplexed correctly, then configure their inputs and outputs.

Have a nice day!

Best Regards,

NXP TIC Weidong

0 Kudos

2,623 Views
bruceg
Contributor I

Hi Weidong,

Thanks for your information. We tried to drive these pins high and low as GPIO pins, they work fine. The keypad that we are testing worked with other processor (such as TI am335x), which is configured as gpio-matrix keypad, I don’t know if I am missing something.

Regards,

Bruce

0 Kudos

2,623 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Dear Bruce,

     Which part number are you using ?

MCIMX6G3xxxx is designed for POS, it's Tamper Pins can't be multiplexed to be GPIO. For other part numbers, like MCIMX6G2xxxx, MCIMX6G1xxx, have no problem on Tamper pins.

So check it, please!

Have a nice day!

BR,

Weidong

0 Kudos

2,623 Views
bruceg
Contributor I

Hi Weidong,

We are using 6ULL Y2 version.

Best regards,

-Bruce

0 Kudos

2,623 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Bruce,

   I feel your GPIO multiplexing is not valid.  you can pull one of GPIOs up to HIGH or down to LOW to test it.

When do you load these 2 pin control?

pinctrl_keypad_row

pinctrl_keypad_col

Is it possible to show your full dts file to me?

Have a nice day!

Best Regards,

Weidong

0 Kudos

2,624 Views
bruceg
Contributor I

Hi Weidong,

I tested to pull up or pull down these GPIO pins, they look fine. Attached is the device tree including gpio-matrix keypad configuration (take a look at pinctrl_keypad_row, pinctrl_keypad_col and matrix_keypad).

Best regards,

-Bruce

0 Kudos

2,624 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Dear Bruce,

    No errors were found in your device tree file. There is no GPIO matrix keyboard circuit available for testing on EVK, so I don't have test conditions on hand. However, I have a question: your linux, keymap configuration is keymap code, and you use the matrix keyboard mode, linux, keymap nodes should use scan code.

So try scanning code instead.

--------------------------------------------------------

在你的dts文件中,看不出来错误。因为EVK上没有使用GPIO矩阵键盘,所以我这里也没有测试条件,还没法测试一下。但是,我有一个疑问:你的linux,keymap使用的是keymap code,而你使用的是矩阵键盘模式,那么这里应该是scan code 才对。所以,你试一下修改成scan code,看看行不行。

--------------------------------------------------------

Have a nice day!

NXP TIC Weidong

0 Kudos

2,624 Views
bruceg
Contributor I

Hi Weidong,

Thank you very much for your help.

As per your question, I follow use keymap configuration based on the documentation of

~ linux-imx/Documentation/devicetree/bindings/input/matrix-keymap.txt

I will continue to try.

Best regards,

-Bruce

0 Kudos

1,821 Views
gondarajkumar
Contributor I

Hi bruceg

Myself is also interfacing keypad with ti-am3358 board.I followed the procedure taught by you in this post .But iam unable to get the correct keyvalues as output.please could you help me regarding this issue.

Thanks in advance

0 Kudos