Commit 9d2b2e83 authored by Nuno Sá's avatar Nuno Sá Committed by Dmitry Torokhov

Input: adp5588-keys - support gpi key events as 'gpio keys'

This change replaces the support for GPIs as key event generators.
Instead of reporting the events directly, we add a gpio based irqchip
so that these events can be consumed by keys defined in the gpio-keys
driver (as it's goal is indeed for keys on GPIOs capable of generating
interrupts). With this, the gpio-adp5588 driver can also be dropped.

The basic idea is that all the pins that are not being used as part of
the keymap matrix can be possibly requested as GPIOs by gpio-keys
(it's also fine to use these pins as plain interrupts though that's not
really the point).

Since the gpiochip now also has irqchip capabilities, we should only
remove it after we free the device interrupt (otherwise we could, in
theory, be handling GPIs interrupts while the gpiochip is concurrently
removed). Thus the call 'adp5588_gpio_add()' is moved and since the
setup phase also needs to come before making the gpios visible, we also
need to move 'adp5588_setup()'.

While at it, always select GPIOLIB so that we don't need to use #ifdef
guards.
Signed-off-by: default avatarNuno Sá <nuno.sa@analog.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220829131553.690063-2-nuno.sa@analog.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent f8f7f47d
...@@ -40,6 +40,8 @@ config KEYBOARD_ADP5520 ...@@ -40,6 +40,8 @@ config KEYBOARD_ADP5520
config KEYBOARD_ADP5588 config KEYBOARD_ADP5588
tristate "ADP5588/87 I2C QWERTY Keypad and IO Expander" tristate "ADP5588/87 I2C QWERTY Keypad and IO Expander"
depends on I2C depends on I2C
select GPIOLIB
select GPIOLIB_IRQCHIP
help help
Say Y here if you want to use a ADP5588/87 attached to your Say Y here if you want to use a ADP5588/87 attached to your
system I2C bus. system I2C bus.
......
This diff is collapsed.
...@@ -147,8 +147,6 @@ struct adp5588_kpad_platform_data { ...@@ -147,8 +147,6 @@ struct adp5588_kpad_platform_data {
unsigned en_keylock:1; /* Enable Key Lock feature */ unsigned en_keylock:1; /* Enable Key Lock feature */
unsigned short unlock_key1; /* Unlock Key 1 */ unsigned short unlock_key1; /* Unlock Key 1 */
unsigned short unlock_key2; /* Unlock Key 2 */ unsigned short unlock_key2; /* Unlock Key 2 */
const struct adp5588_gpi_map *gpimap;
unsigned short gpimapsize;
const struct adp5588_gpio_platform_data *gpio_data; const struct adp5588_gpio_platform_data *gpio_data;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment