[PATCH v2] input: MXC: add mxc-keypad driver to support the Keypad Port present in the mxc application processors family.

Dmitry Torokhov dmitry.torokhov at gmail.com
Tue Jan 26 04:52:17 EST 2010


Hi Alberto,

On Sat, Jan 16, 2010 at 06:48:45PM +0100, Alberto Panizzo wrote:
> Version 2 for this driver proposal.
> --------------------------------------------------------------------------------
> The MXC family of Application Processors is shipped with a Keypad Port 
> supported now by this driver.
> 
> The peripheral can control up to an 8x8 matrix key pad where all the scanning 
> procedure is done via software.
> 
> The hardware provide two interrupts: one for a key pressed (KDI) and one for 
> all key releases (KRI). There is also a simple circuit for glitch reduction 
> (said for synchronization) made by two series of 3 D-latches clocked by the 
> keypad-clock that stabilize the interrupts sources.
> KDI and KRI are fired only if the respective conditions are maintained for at 
> last 4 keypad-clock cycle.
> 
> Those simple synchronization circuits are used also for multiple key pressures: 
> between a KDI and a KRI the driver reset the sync circuit and re-enable the KDI
> interrupt so after 3 keypad-clock cycle another KDI is fired making possible to
> repeat the matrix scan operation.
> 

Nicely looking driver, thank you.

> This algorithm is done via a threaded management of the keypad interrupt source
> and delayed by a proper (and longer) debounce interval controlled by the 
> platform initialization.

This I am not so sure about - the core of the matrix scan routine does
not sleep so I wonder if starting a separate thread is not too wasteful
in this case - you can easily do whan you want with a timer, no?

> +
> +	/*
> +	 * Search for rows and cols enabled
> +	 */
> +	keymap_data = (struct matrix_keymap_data *) pdata->keymap_data;

Why do you need to cast away constness instead of declaring keymap_data
as const pointer?

-- 
Dmitry



More information about the linux-arm-kernel mailing list