SUPERH platform development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] gpio-rcar: Use OUTDT when reading GPIOs configured as output
Date: Mon, 17 Jun 2013 10:58:57 +0000	[thread overview]
Message-ID: <1599004.HmR35SYjby@avalon> (raw)
In-Reply-To: <20130616234152.23721.85467.sendpatchset@w520>

Hi Magnus,

On Monday 17 June 2013 08:41:52 Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Testing on r8a7790 shows that INDT does not indicate the correct
> pin state when reading a GPIO configured as output, so update
> the gpio_rcar_get() function to handle this case.

Have you checked whether this is true on the other SoCs as well ? Reading back 
the output register instead of the input register will not allow detection of 
conflicts. If the hardware can't provide that, fine, but otherwise it would be 
a nice feature to keep (although it might not get used in practice).

> Signed-off-by: Magnus Damm <damm@opensource.se>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> 
>  drivers/gpio/gpio-rcar.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> --- 0001/drivers/gpio/gpio-rcar.c
> +++ work/drivers/gpio/gpio-rcar.c	2013-06-12 09:23:53.000000000 +0900
> @@ -230,7 +230,14 @@ static int gpio_rcar_direction_input(str
> 
>  static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset)
>  {
> -	return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & BIT(offset));
> +	u32 bit = BIT(offset);
> +
> +	/* testing on r8a7790 shows that INDT does not show correct pin state
> +	 * when configured as output, so use OUTDT in case of output pins */
> +	if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit)
> +		return (int)(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit);
> +	else
> +		return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit);
>  }
> 
>  static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int
> value)
-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2013-06-17 10:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16 23:41 [PATCH] gpio-rcar: Use OUTDT when reading GPIOs configured as output Magnus Damm
2013-06-17  8:35 ` Linus Walleij
2013-06-17  9:22 ` Magnus Damm
2013-06-17 10:58 ` Laurent Pinchart [this message]
2013-06-17 11:45 ` Magnus Damm

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=1599004.HmR35SYjby@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-sh@vger.kernel.org \
    /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