IMX6Q PAD_KEY Configuration: key scan registers entire row

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

IMX6Q PAD_KEY Configuration: key scan registers entire row

Jump to solution
1,677 Views
keo
Contributor II

Background

I'm trying to integrate a keypad with IMX6Q board. 4 rows, and 4 columns. To start, I have enabled only one row (ROW0), and one column (COL1).

External Keypad: Columns=<open-drain output>, Rows=<input>

#pin control

arch/arm/boot/dts/imx6qdl-sabresd.dtsi

MX6QDL_PAD_KEY_COL0__KEY_COL0   0x80000000 /* No PAD ctrl*/
MX6QDL_PAD_KEY_ROW0__KEY_ROW0   0x000000e0 

#driver

drivers/input/keyboard/imx_keypad.c

Problem

When I press ANY of the the keys on ROW0, events get generated for all keys in ROW0 instead of just the one key.

Questions

1. How do I determine what the correct PAD key configuration to use is? Mux-config register has a number of "nobs" which I have no idea of what the correct combination to use is and/or how to calculate the correct configuration.

1 Solution
1,330 Views
igorpadykov
NXP Employee
NXP Employee

Hi Keo

I am afraid there is no way to generate interrupt just for one pad,

so interrupt will be genetared pressing/release by any of the the keys

on row, check description of bits KPKD, KPKR register KPP_KPSR in RM

Best regards

igor

View solution in original post

0 Kudos
Reply
5 Replies
1,330 Views
igorpadykov
NXP Employee
NXP Employee

Hi Keo

seems KPP_KPDR should be then read in interrupt handler, driver implementation can be found

(for older kernel)  in Chapter 16 Setting Up the Keypad Port (KPP) i.MX53 System Development User’s Guide

http://www.freescale.com/files/32bit/doc/user_guide/MX53UG.pdf

Best regards

igor

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

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

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

1,330 Views
keo
Contributor II

Hi, Igor - Thank you for the prompt reply. Unfortunately, the IMX53 guide says to set PAD config to "No PAD Ctrl" - I have previously confirmed that that does not work for my setup.

For example, when using "NO_PAD_CTRL" in the device tree fsl,pins = <>, default settings are applied on the PADs. For example: ROW1, COL1

root@dut:/ # grep -r "" /sys/kernel/debug/pinctrl/20e0000.iomuxc/pinconf-pins | grep -E "PAD_KEY_(COL1|ROW1)"  

/sys/kernel/debug/pinctrl/20e0000.iomuxc/pinconf-pins:pin 146 (MX6DL_PAD_KEY_COL1):0x1b0b0

/sys/kernel/debug/pinctrl/20e0000.iomuxc/pinconf-pins:pin 151 (MX6DL_PAD_KEY_ROW1):0x1b0b0

I have only been able to get events, albeit incorrectly (which is what I'm trying to fix), by using experimental config options like the following for:

root@dut:/ # grep -r "" /sys/kernel/debug/pinctrl/20e0000.iomuxc/pinconf-pins | grep -E "PAD_KEY_(COL0|ROW0)"

/sys/kernel/debug/pinctrl/20e0000.iomuxc/pinconf-pins:pin 145 (MX6DL_PAD_KEY_COL0):0x1b8b0

/sys/kernel/debug/pinctrl/20e0000.iomuxc/pinconf-pins:pin 150 (MX6DL_PAD_KEY_ROW0):0x100b0

So, I'm trying to understand how we come up with the correct configuration for the PADs.

Any other suggestions will be greatly appreciated.

Thanks,

Keo

0 Kudos
Reply
1,331 Views
igorpadykov
NXP Employee
NXP Employee

Hi Keo

I am afraid there is no way to generate interrupt just for one pad,

so interrupt will be genetared pressing/release by any of the the keys

on row, check description of bits KPKD, KPKR register KPP_KPSR in RM

Best regards

igor

0 Kudos
Reply
1,330 Views
keo
Contributor II

My issue, in case somebody stumbles upon this thread/issue, was that keypad circuitry was keeping rows held low. So column scan always picked the up the entire row. Reversing row states on the keypad hardware fixed this issue.

0 Kudos
Reply
1,330 Views
keo
Contributor II

Thank you for the advice Igor. I will investigate further and update the thread.

0 Kudos
Reply