* [PATCH 1/2] gpio: adp5588: get value from data out when dir is out
@ 2014-02-10 17:05 Jean-Francois Dagenais
2014-02-10 17:05 ` [PATCH 2/2] input: adp5588-keys: " Jean-Francois Dagenais
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jean-Francois Dagenais @ 2014-02-10 17:05 UTC (permalink / raw)
To: michael.hennerich, dmitry.torokhov, dtor, linus.walleij, gnurou
Cc: linux-gpio, linux-input, Jean-Francois Dagenais
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>
---
drivers/gpio/gpio-adp5588.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
index 3f190e6..7d3c8d9 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -67,9 +67,20 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
{
struct adp5588_gpio *dev =
container_of(chip, struct adp5588_gpio, gpio_chip);
+ unsigned bank = ADP5588_BANK(off);
+ unsigned bit = ADP5588_BIT(off);
+ int val;
- return !!(adp5588_gpio_read(dev->client,
- GPIO_DAT_STAT1 + ADP5588_BANK(off)) & ADP5588_BIT(off));
+ mutex_lock(&dev->lock);
+
+ if (dev->dir[bank] & bit)
+ val = dev->dat_out[bank];
+ else
+ val = adp5588_gpio_read(dev->client, GPIO_DAT_STAT1 + bank);
+
+ mutex_unlock(&dev->lock);
+
+ return !!(val & bit);
}
static void adp5588_gpio_set_value(struct gpio_chip *chip,
--
1.8.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] input: adp5588-keys: get value from data out when dir is out
2014-02-10 17:05 [PATCH 1/2] gpio: adp5588: get value from data out when dir is out Jean-Francois Dagenais
@ 2014-02-10 17:05 ` Jean-Francois Dagenais
2014-02-15 21:14 ` Dmitry Torokhov
2014-02-10 20:16 ` [PATCH 1/2] gpio: adp5588: " Hennerich, Michael
2014-02-13 12:50 ` Linus Walleij
2 siblings, 1 reply; 5+ messages in thread
From: Jean-Francois Dagenais @ 2014-02-10 17:05 UTC (permalink / raw)
To: michael.hennerich, dmitry.torokhov, dtor, linus.walleij, gnurou
Cc: linux-gpio, linux-input, Jean-Francois Dagenais
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>
---
drivers/input/keyboard/adp5588-keys.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index bb3b57b..5ef7fcf 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)
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
+ int val;
- return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit);
+ mutex_lock(&kpad->gpio_lock);
+
+ if (kpad->dir[bank] & bit)
+ val = kpad->dat_out[bank];
+ else
+ val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank);
+
+ mutex_unlock(&kpad->gpio_lock);
+
+ return !!(val & bit);
}
static void adp5588_gpio_set_value(struct gpio_chip *chip,
--
1.8.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH 1/2] gpio: adp5588: get value from data out when dir is out
2014-02-10 17:05 [PATCH 1/2] gpio: adp5588: get value from data out when dir is out Jean-Francois Dagenais
2014-02-10 17:05 ` [PATCH 2/2] input: adp5588-keys: " Jean-Francois Dagenais
@ 2014-02-10 20:16 ` Hennerich, Michael
2014-02-13 12:50 ` Linus Walleij
2 siblings, 0 replies; 5+ messages in thread
From: Hennerich, Michael @ 2014-02-10 20:16 UTC (permalink / raw)
To: Jean-Francois Dagenais, dmitry.torokhov@gmail.com, dtor@mail.ru,
linus.walleij@linaro.org, gnurou@gmail.com
Cc: linux-gpio@vger.kernel.org, linux-input@vger.kernel.org
-----Original Message-----
From: Jean-Francois Dagenais [mailto:jeff.dagenais@gmail.com]
Sent: Montag, 10. Februar 2014 18:05
To: Hennerich, Michael; dmitry.torokhov@gmail.com; dtor@mail.ru; linus.walleij@linaro.org; gnurou@gmail.com
Cc: linux-gpio@vger.kernel.org; linux-input@vger.kernel.org; Jean-Francois Dagenais
Subject: [PATCH 1/2] gpio: adp5588: 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>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/gpio/gpio-adp5588.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 3f190e6..7d3c8d9 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -67,9 +67,20 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) {
struct adp5588_gpio *dev =
container_of(chip, struct adp5588_gpio, gpio_chip);
+ unsigned bank = ADP5588_BANK(off);
+ unsigned bit = ADP5588_BIT(off);
+ int val;
- return !!(adp5588_gpio_read(dev->client,
- GPIO_DAT_STAT1 + ADP5588_BANK(off)) & ADP5588_BIT(off));
+ mutex_lock(&dev->lock);
+
+ if (dev->dir[bank] & bit)
+ val = dev->dat_out[bank];
+ else
+ val = adp5588_gpio_read(dev->client, GPIO_DAT_STAT1 + bank);
+
+ mutex_unlock(&dev->lock);
+
+ return !!(val & bit);
}
static void adp5588_gpio_set_value(struct gpio_chip *chip,
--
1.8.5.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gpio: adp5588: get value from data out when dir is out
2014-02-10 17:05 [PATCH 1/2] gpio: adp5588: get value from data out when dir is out Jean-Francois Dagenais
2014-02-10 17:05 ` [PATCH 2/2] input: adp5588-keys: " Jean-Francois Dagenais
2014-02-10 20:16 ` [PATCH 1/2] gpio: adp5588: " Hennerich, Michael
@ 2014-02-13 12:50 ` Linus Walleij
2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2014-02-13 12:50 UTC (permalink / raw)
To: Jean-Francois Dagenais
Cc: Michael Hennerich, Dmitry Torokhov, dtor, Alexandre Courbot,
linux-gpio@vger.kernel.org, Linux Input
On Mon, Feb 10, 2014 at 6:05 PM, Jean-Francois Dagenais
<jeff.dagenais@gmail.com> wrote:
> 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>
Patch applied with Michael's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] input: adp5588-keys: get value from data out when dir is out
2014-02-10 17:05 ` [PATCH 2/2] input: adp5588-keys: " Jean-Francois Dagenais
@ 2014-02-15 21:14 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2014-02-15 21:14 UTC (permalink / raw)
To: Jean-Francois Dagenais
Cc: michael.hennerich, linus.walleij, gnurou, linux-gpio, linux-input
On Mon, Feb 10, 2014 at 12:05:29PM -0500, Jean-Francois Dagenais wrote:
> 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>
Applied, thank you.
> ---
> drivers/input/keyboard/adp5588-keys.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index bb3b57b..5ef7fcf 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)
> struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
> unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
> unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
> + int val;
>
> - return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit);
> + mutex_lock(&kpad->gpio_lock);
> +
> + if (kpad->dir[bank] & bit)
> + val = kpad->dat_out[bank];
> + else
> + val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank);
> +
> + mutex_unlock(&kpad->gpio_lock);
> +
> + return !!(val & bit);
> }
>
> static void adp5588_gpio_set_value(struct gpio_chip *chip,
> --
> 1.8.5.3
>
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-15 21:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-10 17:05 [PATCH 1/2] gpio: adp5588: get value from data out when dir is out Jean-Francois Dagenais
2014-02-10 17:05 ` [PATCH 2/2] input: adp5588-keys: " Jean-Francois Dagenais
2014-02-15 21:14 ` Dmitry Torokhov
2014-02-10 20:16 ` [PATCH 1/2] gpio: adp5588: " Hennerich, Michael
2014-02-13 12:50 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).