linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Cc: michael.hennerich@analog.com, linus.walleij@linaro.org,
	gnurou@gmail.com, linux-gpio@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 2/2] input: adp5588-keys: get value from data out when dir is out
Date: Sat, 15 Feb 2014 13:14:04 -0800	[thread overview]
Message-ID: <20140215211404.GA5373@core.coreip.homeip.net> (raw)
In-Reply-To: <1392051929-32290-2-git-send-email-jeff.dagenais@gmail.com>

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

  reply	other threads:[~2014-02-15 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-02-10 20:16 ` [PATCH 1/2] gpio: adp5588: " Hennerich, Michael
2014-02-13 12:50 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140215211404.GA5373@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=jeff.dagenais@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).