Skip to content

Commit 910a9f5

Browse files
jeff-dagenaisdtor
authored andcommitted
Input: adp5588-keys - get value from data out when dir is out
As discussed here: http://ez.analog.com/message/35852, the 5587 revC and 5588 revB spec sheets contain a mistake in the GPIO_DAT_STATx register description. According to R.Shnell at ADI, as well as my own observations, it should read: "GPIO data status (shows GPIO state when read for inputs)". This commit changes the get value function accordingly. Signed-off-by: Jean-Francois Dagenais <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 55df811 commit 910a9f5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/input/keyboard/adp5588-keys.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,18 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
7676
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
7777
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
7878
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
79+
int val;
7980

80-
return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit);
81+
mutex_lock(&kpad->gpio_lock);
82+
83+
if (kpad->dir[bank] & bit)
84+
val = kpad->dat_out[bank];
85+
else
86+
val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank);
87+
88+
mutex_unlock(&kpad->gpio_lock);
89+
90+
return !!(val & bit);
8191
}
8292

8393
static void adp5588_gpio_set_value(struct gpio_chip *chip,

0 commit comments

Comments
 (0)