diff options
author | Jean-Francois Dagenais <jeff.dagenais@gmail.com> | 2014-02-12 18:14:28 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-02-15 16:13:17 -0500 |
commit | 910a9f5636f5c128c02bf9ccd71ac03325700b57 (patch) | |
tree | 9826ada0e6b80bb99e17ab280d45d2e00ecd0008 /drivers/input/keyboard | |
parent | 55df811f2066fcaec2548248f0a1a6a0c12dc6b8 (diff) |
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 <jeff.dagenais@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/adp5588-keys.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index bb3b57bea8ba..5ef7fcf0e250 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
@@ -76,8 +76,18 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) | |||
76 | struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); | 76 | struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); |
77 | unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); | 77 | unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); |
78 | unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); | 78 | unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); |
79 | int val; | ||
79 | 80 | ||
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); | ||
81 | } | 91 | } |
82 | 92 | ||
83 | static void adp5588_gpio_set_value(struct gpio_chip *chip, | 93 | static void adp5588_gpio_set_value(struct gpio_chip *chip, |