linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] gpio: max77620: get gpio value based on direction
@ 2016-06-27 10:56 Venkat Reddy Talla
  2016-06-29  5:08 ` Alexandre Courbot
  2016-07-04  9:40 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Venkat Reddy Talla @ 2016-06-27 10:56 UTC (permalink / raw)
  To: linus.walleij, gnurou, linux-gpio, linux-kernel; +Cc: ldewangan, vreddytalla

Gpio direction is determined by DIRx bit of GPIO
configuration register, return max77620 gpio value
based on direction in or out.

Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
---
 drivers/gpio/gpio-max77620.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 8658c32..b46b436 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -123,7 +123,10 @@ static int max77620_gpio_get(struct gpio_chip *gc, unsigned int offset)
 		return ret;
 	}
 
-	return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK);
+	if  (val & MAX77620_CNFG_GPIO_DIR_MASK)
+		return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK);
+	else
+		return !!(val & MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK);
 }
 
 static int max77620_gpio_dir_output(struct gpio_chip *gc, unsigned int offset,
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] gpio: max77620: get gpio value based on direction
  2016-06-27 10:56 [PATCH 1/1] gpio: max77620: get gpio value based on direction Venkat Reddy Talla
@ 2016-06-29  5:08 ` Alexandre Courbot
  2016-07-04  9:40 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2016-06-29  5:08 UTC (permalink / raw)
  To: Venkat Reddy Talla
  Cc: Linus Walleij, linux-gpio@vger.kernel.org,
	Linux Kernel Mailing List, Laxman Dewangan

On Mon, Jun 27, 2016 at 7:56 PM, Venkat Reddy Talla
<vreddytalla@nvidia.com> wrote:
> Gpio direction is determined by DIRx bit of GPIO
> configuration register, return max77620 gpio value
> based on direction in or out.
>
> Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
> ---
>  drivers/gpio/gpio-max77620.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
> index 8658c32..b46b436 100644
> --- a/drivers/gpio/gpio-max77620.c
> +++ b/drivers/gpio/gpio-max77620.c
> @@ -123,7 +123,10 @@ static int max77620_gpio_get(struct gpio_chip *gc, unsigned int offset)
>                 return ret;
>         }
>
> -       return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK);
> +       if  (val & MAX77620_CNFG_GPIO_DIR_MASK)
> +               return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK);
> +       else
> +               return !!(val & MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK);

Looks sensible!

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] gpio: max77620: get gpio value based on direction
  2016-06-27 10:56 [PATCH 1/1] gpio: max77620: get gpio value based on direction Venkat Reddy Talla
  2016-06-29  5:08 ` Alexandre Courbot
@ 2016-07-04  9:40 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2016-07-04  9:40 UTC (permalink / raw)
  To: Venkat Reddy Talla
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, Laxman Dewangan

On Mon, Jun 27, 2016 at 12:56 PM, Venkat Reddy Talla
<vreddytalla@nvidia.com> wrote:

> Gpio direction is determined by DIRx bit of GPIO
> configuration register, return max77620 gpio value
> based on direction in or out.
>
> Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>

Patch applied with Alex' ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-04  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-27 10:56 [PATCH 1/1] gpio: max77620: get gpio value based on direction Venkat Reddy Talla
2016-06-29  5:08 ` Alexandre Courbot
2016-07-04  9:40 ` 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).