How to calculate linux, keymap for 3x2 keypad.

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate linux, keymap for 3x2 keypad.

299 Views
purvi_billore1
Contributor III

Hello,

I have to use 3x2 keypad for my iMX6 custom board;

where the interfacing with rows are like:

                                                   KEY_ROW0

                                                   KEY_ROW2

and where the interfacing with columns are like:                                               

                                                   KEY_COL0

                                                   KEY_COL2

                                                   KEY_COL4

Can, anyone guide me to calculate linux, keymap to be added in my device tree:

&kpp {
            compatible = "fsl,imx6q-kpp", "fsl,imx21-kpp";
            clocks = <&clks IMX6QDL_CLK_IPG>;
            pinctrl-0 = <&pinctrl_kpp>;
            linux,keymap = < ?             //KEY_UP

                                        ?             //KEY_DOWN

                                        ?             //KEY_LEFT

                                        ?             //KEY_RIGHT

                                        ?             //KEY_ESC

                                        ?             //KEY_ENTER

                                        >;
            keypad,num-rows = <2>;
            keypad,num-columns = <3>;

};

pinctrl_kpp:kpp_grp_1{
              fsl,pins = <
                           MX6QDL_PAD_KEY_COL0__KEY_COL0 0x80000000
                           MX6QDL_PAD_KEY_ROW0__KEY_ROW0 0x80000000
                           MX6QDL_PAD_KEY_COL2__KEY_COL2 0x80000000
                           MX6QDL_PAD_KEY_ROW2__KEY_ROW2 0x80000000
                           MX6QDL_PAD_KEY_COL4__KEY_COL4 0x80000000
>;
};

Labels (3)
0 Kudos
4 Replies

115 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Purvi

one can look at keypad tutorial

4x4 Matrix keypad Interfacing with i-MX6 - Toradex Community 

https://community.nxp.com/thread/394434 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

115 Views
purvi_billore1
Contributor III

Hello,
I have updated my dtsi file as below:
&kpp {
compatible = "fsl,imx6q-kpp", "fsl,imx21-kpp";
clocks = <&clks IMX6QDL_CLK_IPG>;
pinctrl-0 = <&pinctrl_kpp>;
linux,keymap = < MATRIX_KEY(0x0, 0x0, KEY_U) //ROW0 COL0 UP
MATRIX_KEY(0x0, 0x2, KEY_D) //ROW0 COL2 DOWN
MATRIX_KEY(0x0, 0x4, KEY_E) //ROW0 COL4 ENTER
MATRIX_KEY(0x2, 0x0, KEY_C) //ROW2 COL0 ESC
MATRIX_KEY(0x2, 0x2, KEY_R) //ROW2 COL2 RIGHT
MATRIX_KEY(0x2, 0x4, KEY_L) //ROW2 COL4 LEFT
>;
keypad,num-rows = <2>;
keypad,num-columns = <3>;

};

pinctrl_kpp:kpp_grp_1{
fsl,pins = <
MX6QDL_PAD_KEY_COL0__KEY_COL0 0x80000000
MX6QDL_PAD_KEY_ROW0__KEY_ROW0 0x80000000
MX6QDL_PAD_KEY_COL2__KEY_COL2 0x80000000
MX6QDL_PAD_KEY_ROW2__KEY_ROW2 0x80000000
MX6QDL_PAD_KEY_COL4__KEY_COL4 0x80000000
>;
};

Now, keypad driver is throwing an error:
                                           "too many keys pressed, control pins initialisation"
What more I have to update!!

0 Kudos

115 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Purvi

 

one can look at similar error on
iMX7D Matrix Keypad "to many keys pressed" error - Toradex Community 

 Best regards
igor

115 Views
purvi_billore1
Contributor III

Hello,

I have updated my dtsi file as below:

&kpp {
            compatible = "fsl,imx6q-kpp", "fsl,imx21-kpp";
            clocks = <&clks IMX6QDL_CLK_IPG>;
            pinctrl-0 = <&pinctrl_kpp>;
            linux,keymap = < 

                                          MATRIX_KEY(0x0, 0x0, KEY_U) //ROW0 COL0 UP
                                          MATRIX_KEY(0x0, 0x2, KEY_D) //ROW0 COL2 DOWN
                                          MATRIX_KEY(0x0, 0x4, KEY_E) //ROW0 COL4 ENTER
                                          MATRIX_KEY(0x2, 0x0, KEY_C) //ROW2 COL0 ESC
                                          MATRIX_KEY(0x2, 0x2, KEY_R) //ROW2 COL2 RIGHT
                                          MATRIX_KEY(0x2, 0x4, KEY_L) //ROW2 COL4 LEFT

                                        >;
            keypad,num-rows = <2>;
            keypad,num-columns = <3>;

};

pinctrl_kpp:kpp_grp_1{
              fsl,pins = < 
                           MX6QDL_PAD_KEY_COL0__KEY_COL0 0x80000000
                           MX6QDL_PAD_KEY_ROW0__KEY_ROW0 0x80000000
                           MX6QDL_PAD_KEY_COL2__KEY_COL2 0x80000000
                           MX6QDL_PAD_KEY_ROW2__KEY_ROW2 0x80000000
                           MX6QDL_PAD_KEY_COL4__KEY_COL4 0x80000000
>;
};

Now, driver is throwing an error:

"too many keys pressed, control pins initialisation\n"

0 Kudos