Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: adp5589-keys - fix adp5589_gpio_get_value()

The adp5589 seems to have the same behavior as similar devices as
explained in commit 910a9f5636f5 ("Input: adp5588-keys - get value from
data out when dir is out").

Basically, when the gpio is set as output we need to get the value from
ADP5589_GPO_DATA_OUT_A register instead of ADP5589_GPI_STATUS_A.

Fixes: 9d2e173644bb ("Input: ADP5589 - new driver for I2C Keypad Decoder and I/O Expander")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20241001-b4-dev-adp5589-fw-conversion-v1-2-fca0149dfc47@analog.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Nuno Sa and committed by
Dmitry Torokhov
c6847716 fb5cc65f

+10 -3
+10 -3
drivers/input/keyboard/adp5589-keys.c
··· 391 391 struct adp5589_kpad *kpad = gpiochip_get_data(chip); 392 392 unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); 393 393 unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); 394 + int val; 394 395 395 - return !!(adp5589_read(kpad->client, 396 - kpad->var->reg(ADP5589_GPI_STATUS_A) + bank) & 397 - bit); 396 + mutex_lock(&kpad->gpio_lock); 397 + if (kpad->dir[bank] & bit) 398 + val = kpad->dat_out[bank]; 399 + else 400 + val = adp5589_read(kpad->client, 401 + kpad->var->reg(ADP5589_GPI_STATUS_A) + bank); 402 + mutex_unlock(&kpad->gpio_lock); 403 + 404 + return !!(val & bit); 398 405 } 399 406 400 407 static void adp5589_gpio_set_value(struct gpio_chip *chip,