• Eric Miao's avatar
    Input: add support for generic GPIO-based matrix keypad · bab7614d
    Eric Miao authored
    Original patch by Marek Vasut, modified by Eric in:
    
    1. use delayed work to simplify the debouncing
    2. combine col_polarity/row_polarity into a single active_low field
    3. use a generic bit array based XOR algorithm to detect key
       press/release, which should make the column assertion time
       shorter and code a bit cleaner
    4. remove the ALT_FN handling, which is no way generic, the ALT_FN
       key should be treated as no different from other keys, and
       translation will be done by user space by commands like 'loadkeys'.
    5. explicitly disable row IRQs and flush potential pending work,
       and schedule an immediate scan after resuming as suggested
       by Uli Luckas
    6. incorporate review comments from many others
    
    Patch tested on Littleton/PXA310 (though PXA310 has a dedicate keypad
    controller, I have to configure those pins as generic GPIO to use this
    driver, works quite well, though), and Sharp Zaurus model SL-C7x0
    and SL-C1000.
    
    [dtor@mail.ru: fix error unwinding path, support changing keymap
     from userspace]
    Signed-off-by: default avatarMarek Vasut <marek.vasut@gmail.com>
    Reviewed-by: default avatarTrilok Soni <soni.trilok@gmail.com>
    Reviewed-by: default avatarUli Luckas <u.luckas@road.de>
    Reviewed-by: default avatarRussell King <linux@arm.linux.org.uk>
    Reviewed-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
    Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
    Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
    bab7614d
matrix_keypad.c 11.2 KB