All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set
@ 2020-01-31 12:29 Axel Lin
  2020-01-31 12:29 ` [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get Axel Lin
  2020-02-04 10:32 ` [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Srinivas Kandagatla
  0 siblings, 2 replies; 6+ messages in thread
From: Axel Lin @ 2020-01-31 12:29 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Srinivas Kandagatla, Bartosz Golaszewski, linux-gpio, Axel Lin

The .set callback should just set output value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi Srinivas,
I don't have this h/w to test, so please help to review and test the patchs.
Thanks,
Axel
 drivers/gpio/gpio-wcd934x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
index 74913f2e5697..9d4ec8941b9b 100644
--- a/drivers/gpio/gpio-wcd934x.c
+++ b/drivers/gpio/gpio-wcd934x.c
@@ -66,7 +66,10 @@ static int wcd_gpio_get(struct gpio_chip *chip, unsigned int pin)
 
 static void wcd_gpio_set(struct gpio_chip *chip, unsigned int pin, int val)
 {
-	wcd_gpio_direction_output(chip, pin, val);
+	struct wcd_gpio_data *data = gpiochip_get_data(chip);
+
+	regmap_update_bits(data->map, WCD_REG_VAL_CTL_OFFSET,
+			   WCD_PIN_MASK(pin), val ? WCD_PIN_MASK(pin) : 0);
 }
 
 static int wcd_gpio_probe(struct platform_device *pdev)
-- 
2.20.1


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

* [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get
  2020-01-31 12:29 [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Axel Lin
@ 2020-01-31 12:29 ` Axel Lin
  2020-02-04 10:33   ` Srinivas Kandagatla
  2020-02-04 10:32 ` [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Srinivas Kandagatla
  1 sibling, 1 reply; 6+ messages in thread
From: Axel Lin @ 2020-01-31 12:29 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Srinivas Kandagatla, Bartosz Golaszewski, linux-gpio, Axel Lin

The check with register value and mask should be & rather than &&.
While at it, also use "unsigned int" for value variable because
regmap_read() takes unsigned int *val argument.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/gpio-wcd934x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
index 9d4ec8941b9b..1cbce5990855 100644
--- a/drivers/gpio/gpio-wcd934x.c
+++ b/drivers/gpio/gpio-wcd934x.c
@@ -57,11 +57,11 @@ static int wcd_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
 static int wcd_gpio_get(struct gpio_chip *chip, unsigned int pin)
 {
 	struct wcd_gpio_data *data = gpiochip_get_data(chip);
-	int value;
+	unsigned int value;
 
 	regmap_read(data->map, WCD_REG_VAL_CTL_OFFSET, &value);
 
-	return !!(value && WCD_PIN_MASK(pin));
+	return !!(value & WCD_PIN_MASK(pin));
 }
 
 static void wcd_gpio_set(struct gpio_chip *chip, unsigned int pin, int val)
-- 
2.20.1


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

* Re: [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set
  2020-01-31 12:29 [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Axel Lin
  2020-01-31 12:29 ` [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get Axel Lin
@ 2020-02-04 10:32 ` Srinivas Kandagatla
  2020-02-04 14:19   ` Bartosz Golaszewski
  1 sibling, 1 reply; 6+ messages in thread
From: Srinivas Kandagatla @ 2020-02-04 10:32 UTC (permalink / raw)
  To: Axel Lin, Linus Walleij; +Cc: Bartosz Golaszewski, linux-gpio

Thanks for the patch!

On 31/01/2020 12:29, Axel Lin wrote:
> The .set callback should just set output value.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---
> Hi Srinivas,
> I don't have this h/w to test, so please help to review and test the patchs.
> Thanks,
> Axel
>   drivers/gpio/gpio-wcd934x.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
> index 74913f2e5697..9d4ec8941b9b 100644
> --- a/drivers/gpio/gpio-wcd934x.c
> +++ b/drivers/gpio/gpio-wcd934x.c
> @@ -66,7 +66,10 @@ static int wcd_gpio_get(struct gpio_chip *chip, unsigned int pin)
>   
>   static void wcd_gpio_set(struct gpio_chip *chip, unsigned int pin, int val)
>   {
> -	wcd_gpio_direction_output(chip, pin, val);
> +	struct wcd_gpio_data *data = gpiochip_get_data(chip);
> +
> +	regmap_update_bits(data->map, WCD_REG_VAL_CTL_OFFSET,
> +			   WCD_PIN_MASK(pin), val ? WCD_PIN_MASK(pin) : 0);
>   }
>   
>   static int wcd_gpio_probe(struct platform_device *pdev)
> 

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

* Re: [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get
  2020-01-31 12:29 ` [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get Axel Lin
@ 2020-02-04 10:33   ` Srinivas Kandagatla
  2020-02-04 14:19     ` Bartosz Golaszewski
  0 siblings, 1 reply; 6+ messages in thread
From: Srinivas Kandagatla @ 2020-02-04 10:33 UTC (permalink / raw)
  To: Axel Lin, Linus Walleij; +Cc: Bartosz Golaszewski, linux-gpio

Thanks for the patch!

On 31/01/2020 12:29, Axel Lin wrote:
> The check with register value and mask should be & rather than &&.
> While at it, also use "unsigned int" for value variable because
> regmap_read() takes unsigned int *val argument.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


> ---
>   drivers/gpio/gpio-wcd934x.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
> index 9d4ec8941b9b..1cbce5990855 100644
> --- a/drivers/gpio/gpio-wcd934x.c
> +++ b/drivers/gpio/gpio-wcd934x.c
> @@ -57,11 +57,11 @@ static int wcd_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
>   static int wcd_gpio_get(struct gpio_chip *chip, unsigned int pin)
>   {
>   	struct wcd_gpio_data *data = gpiochip_get_data(chip);
> -	int value;
> +	unsigned int value;
>   
>   	regmap_read(data->map, WCD_REG_VAL_CTL_OFFSET, &value);
>   
> -	return !!(value && WCD_PIN_MASK(pin));
> +	return !!(value & WCD_PIN_MASK(pin));
>   }
>   
>   static void wcd_gpio_set(struct gpio_chip *chip, unsigned int pin, int val)
> 

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

* Re: [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set
  2020-02-04 10:32 ` [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Srinivas Kandagatla
@ 2020-02-04 14:19   ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2020-02-04 14:19 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: Axel Lin, Linus Walleij, linux-gpio

wt., 4 lut 2020 o 11:32 Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> napisał(a):
>
> Thanks for the patch!
>
> On 31/01/2020 12:29, Axel Lin wrote:
> > The .set callback should just set output value.
> >
> > Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>

Applied with Srinivas' tag.

Bartosz

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

* Re: [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get
  2020-02-04 10:33   ` Srinivas Kandagatla
@ 2020-02-04 14:19     ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2020-02-04 14:19 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: Axel Lin, Linus Walleij, linux-gpio

wt., 4 lut 2020 o 11:33 Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> napisał(a):
>
> Thanks for the patch!
>
> On 31/01/2020 12:29, Axel Lin wrote:
> > The check with register value and mask should be & rather than &&.
> > While at it, also use "unsigned int" for value variable because
> > regmap_read() takes unsigned int *val argument.
> >
> > Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>

Applied with Srinivas' tag.

Bartosz

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

end of thread, other threads:[~2020-02-04 14:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 12:29 [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Axel Lin
2020-01-31 12:29 ` [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get Axel Lin
2020-02-04 10:33   ` Srinivas Kandagatla
2020-02-04 14:19     ` Bartosz Golaszewski
2020-02-04 10:32 ` [PATCH 1/2] gpio: wcd934x: Don't change gpio direction in wcd_gpio_set Srinivas Kandagatla
2020-02-04 14:19   ` Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.