[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1334935921-13016-2-git-send-email-jeff.dagenais@gmail.com>
Date: Fri, 20 Apr 2012 11:32:01 -0400
From: Jean-François Dagenais <jeff.dagenais@...il.com>
To: grant.likely@...retlab.ca, dtor@...l.ru, dmitry.torokhov@...il.com,
linus.walleij@...ricsson.com, linux-kernel@...r.kernel.org
Cc: linux-input@...r.kernel.org, michael.hennerich@...log.com,
Jean-François Dagenais <jeff.dagenais@...il.com>
Subject: [PATCH 2/2] gpio: adp5588 - get value from data out when dir 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.
Follows a similar patch for adp5588-keys.
Signed-off-by: Jean-François Dagenais <jeff.dagenais@...il.com>
Acked-by: Michael Hennerich <michael.hennerich@...log.com>
---
drivers/gpio/gpio-adp5588.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
index 3122713..293ddb6 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -65,11 +65,23 @@ static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val)
static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
{
+ unsigned bank, bit;
struct adp5588_gpio *dev =
container_of(chip, struct adp5588_gpio, gpio_chip);
+ bank = ADP5588_BANK(off);
+ bit = ADP5588_BIT(off);
+
+ mutex_lock(&dev->lock);
+ if (dev->dir[bank] & bit) {
+ int result = !!(dev->dat_out[bank] & bit);
+ mutex_unlock(&dev->lock);
+ return result;
+ }
+ mutex_unlock(&dev->lock);
+
return !!(adp5588_gpio_read(dev->client,
- GPIO_DAT_STAT1 + ADP5588_BANK(off)) & ADP5588_BIT(off));
+ GPIO_DAT_STAT1 + bank) & bit);
}
static void adp5588_gpio_set_value(struct gpio_chip *chip,
--
1.7.9
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists