* [PATCH 1/2] input: adp5588-keys - get value from data out when dir out
@ 2012-01-09 15:05 Jean-François Dagenais
2012-01-09 15:05 ` [PATCH 2/2] gpio: adp5588 " Jean-François Dagenais
0 siblings, 1 reply; 6+ messages in thread
From: Jean-François Dagenais @ 2012-01-09 15:05 UTC (permalink / raw)
To: linux-kernel; +Cc: michael.hennerich, grant.likely, Jean-François 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.
A similar patch for gpio-adp5588 follows.
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/input/keyboard/adp5588-keys.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 6412ced..b7a0f1a 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -78,6 +78,13 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
+ mutex_lock(&kpad->gpio_lock);
+ if (kpad->dir[bank] & bit) {
+ int result = !!(kpad->dat_out[bank] & bit);
+ mutex_unlock(&kpad->gpio_lock);
+ return result;
+ }
+ mutex_unlock(&kpad->gpio_lock);
return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit);
}
--
1.7.8.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/2] gpio: adp5588 - get value from data out when dir out
2012-01-09 15:05 [PATCH 1/2] input: adp5588-keys - get value from data out when dir out Jean-François Dagenais
@ 2012-01-09 15:05 ` Jean-François Dagenais
2012-01-09 16:37 ` [RESEND PATCH " Jean-François Dagenais
2012-01-09 16:50 ` [PATCH 1/2] input: adp5588 - add support for gpio names Jean-François Dagenais
0 siblings, 2 replies; 6+ messages in thread
From: Jean-François Dagenais @ 2012-01-09 15:05 UTC (permalink / raw)
To: linux-kernel; +Cc: michael.hennerich, grant.likely, Jean-François 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.
Follows a similar patch for adp5588-keys.
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.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.8.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [RESEND PATCH 2/2] gpio: adp5588 - get value from data out when dir out
2012-01-09 15:05 ` [PATCH 2/2] gpio: adp5588 " Jean-François Dagenais
@ 2012-01-09 16:37 ` Jean-François Dagenais
2012-01-09 16:50 ` [PATCH 1/2] input: adp5588 - add support for gpio names Jean-François Dagenais
1 sibling, 0 replies; 6+ messages in thread
From: Jean-François Dagenais @ 2012-01-09 16:37 UTC (permalink / raw)
To: linux-kernel; +Cc: michael.hennerich, grant.likely, Jean-François 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.
Follows a similar patch for adp5588-keys.
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.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.8.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] input: adp5588 - add support for gpio names
2012-01-09 15:05 ` [PATCH 2/2] gpio: adp5588 " Jean-François Dagenais
2012-01-09 16:37 ` [RESEND PATCH " Jean-François Dagenais
@ 2012-01-09 16:50 ` Jean-François Dagenais
2012-01-09 19:16 ` Jean-Francois Dagenais
1 sibling, 1 reply; 6+ messages in thread
From: Jean-François Dagenais @ 2012-01-09 16:50 UTC (permalink / raw)
To: linux-kernel; +Cc: michael.hennerich, grant.likely, Jean-François Dagenais
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/input/keyboard/adp5588-keys.c | 1 +
include/linux/i2c/adp5588.h | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index e34eeb8..6412ced 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -197,6 +197,7 @@ static int __devinit adp5588_gpio_add(struct adp5588_kpad *kpad)
kpad->gc.base = gpio_data->gpio_start;
kpad->gc.label = kpad->client->name;
kpad->gc.owner = THIS_MODULE;
+ kpad->gc.names = gpio_data->names;
mutex_init(&kpad->gpio_lock);
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index cec17cf..d8341cb 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -157,6 +157,7 @@ struct i2c_client; /* forward declaration */
struct adp5588_gpio_platform_data {
int gpio_start; /* GPIO Chip base # */
+ const char *const *names;
unsigned irq_base; /* interrupt base # */
unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
int (*setup)(struct i2c_client *client,
--
1.7.8.2
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] input: adp5588 - add support for gpio names
2012-01-09 16:50 ` [PATCH 1/2] input: adp5588 - add support for gpio names Jean-François Dagenais
@ 2012-01-09 19:16 ` Jean-Francois Dagenais
0 siblings, 0 replies; 6+ messages in thread
From: Jean-Francois Dagenais @ 2012-01-09 19:16 UTC (permalink / raw)
To: Jean-François Dagenais; +Cc: linux-kernel, michael.hennerich, grant.likely
Sorry, disregard. Bad "reply-to", wrong destination. Will resend.
On Jan 9, 2012, at 11:50, Jean-François Dagenais wrote:
>
> Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com>
> Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
> drivers/input/keyboard/adp5588-keys.c | 1 +
> include/linux/i2c/adp5588.h | 1 +
> 2 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index e34eeb8..6412ced 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -197,6 +197,7 @@ static int __devinit adp5588_gpio_add(struct adp5588_kpad *kpad)
> kpad->gc.base = gpio_data->gpio_start;
> kpad->gc.label = kpad->client->name;
> kpad->gc.owner = THIS_MODULE;
> + kpad->gc.names = gpio_data->names;
>
> mutex_init(&kpad->gpio_lock);
>
> diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
> index cec17cf..d8341cb 100644
> --- a/include/linux/i2c/adp5588.h
> +++ b/include/linux/i2c/adp5588.h
> @@ -157,6 +157,7 @@ struct i2c_client; /* forward declaration */
>
> struct adp5588_gpio_platform_data {
> int gpio_start; /* GPIO Chip base # */
> + const char *const *names;
> unsigned irq_base; /* interrupt base # */
> unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
> int (*setup)(struct i2c_client *client,
> --
> 1.7.8.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] input: adp5588-keys - get value from data out when dir out
@ 2012-04-20 15:32 Jean-François Dagenais
2012-04-20 15:32 ` [PATCH 2/2] gpio: adp5588 " Jean-François Dagenais
0 siblings, 1 reply; 6+ messages in thread
From: Jean-François Dagenais @ 2012-04-20 15:32 UTC (permalink / raw)
To: grant.likely, dtor, dmitry.torokhov, linus.walleij, linux-kernel
Cc: linux-input, michael.hennerich, Jean-François 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.
A similar patch for gpio-adp5588 follows.
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/input/keyboard/adp5588-keys.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 6412ced..b7a0f1a 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -78,6 +78,13 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
+ mutex_lock(&kpad->gpio_lock);
+ if (kpad->dir[bank] & bit) {
+ int result = !!(kpad->dat_out[bank] & bit);
+ mutex_unlock(&kpad->gpio_lock);
+ return result;
+ }
+ mutex_unlock(&kpad->gpio_lock);
return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit);
}
--
1.7.9
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/2] gpio: adp5588 - get value from data out when dir out
2012-04-20 15:32 [PATCH 1/2] input: adp5588-keys - get value from data out when dir out Jean-François Dagenais
@ 2012-04-20 15:32 ` Jean-François Dagenais
0 siblings, 0 replies; 6+ messages in thread
From: Jean-François Dagenais @ 2012-04-20 15:32 UTC (permalink / raw)
To: grant.likely, dtor, dmitry.torokhov, linus.walleij, linux-kernel
Cc: linux-input, michael.hennerich, Jean-François 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.
Follows a similar patch for adp5588-keys.
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-20 15:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-09 15:05 [PATCH 1/2] input: adp5588-keys - get value from data out when dir out Jean-François Dagenais
2012-01-09 15:05 ` [PATCH 2/2] gpio: adp5588 " Jean-François Dagenais
2012-01-09 16:37 ` [RESEND PATCH " Jean-François Dagenais
2012-01-09 16:50 ` [PATCH 1/2] input: adp5588 - add support for gpio names Jean-François Dagenais
2012-01-09 19:16 ` Jean-Francois Dagenais
2012-04-20 15:32 [PATCH 1/2] input: adp5588-keys - get value from data out when dir out Jean-François Dagenais
2012-04-20 15:32 ` [PATCH 2/2] gpio: adp5588 " Jean-François Dagenais
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®