gpio: wcd934x: Don't change gpio direction in wcd_gpio_set
PATCH 1/2 gpio: wcd934x: Don't change gpio direction in wcd_gpio_set
The .set callback should just set output value.
---
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(-)
drivers/gpio/gpio-wcd934x.c +4 -1
@@ -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)
Signature · 1 line
2.20.1
PATCH 2/2 gpio: wcd934x: Fix logic of wcd_gpio_get
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.
--- drivers/gpio/gpio-wcd934x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-wcd934x.c +2 -2
@@ -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)
Signature · 1 line
2.20.1
Re: [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get
Thanks for the patch!
Quoted 5 lines · 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 <[email protected]>
Quoted 23 lines
--- drivers/gpio/gpio-wcd934x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-wcd934x.c +2
-2@@ -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)
Re: [PATCH 2/2] gpio: wcd934x: Fix logic of wcd_gpio_get
wt., 4 lut 2020 o 11:33 Srinivas Kandagatla
<[email protected]> napisał(a):
Quoted 12 lines
Thanks for the patch!
Quoted 5 lines · 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 <[email protected]>Reviewed-by Srinivas Kandagatla <[email protected]>
Applied with Srinivas' tag.
Bartosz
Thanks for the patch!
Quoted 3 lines · Axel Lin
The .set callback should just set output value.
Signed-off-by Axel Lin <[email protected]>
Quoted 25 lines
---
Hi Srinivas,
I don't have this h/w to test, so please help to review and test the patchs. Thanks,
Axeldrivers/gpio/gpio-wcd934x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpio/gpio-wcd934x.c +4
-1@@ -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)
wt., 4 lut 2020 o 11:32 Srinivas Kandagatla
<[email protected]> napisał(a):
Quoted 10 lines
Thanks for the patch!
Quoted 3 lines · Axel Lin
The .set callback should just set output value.
Signed-off-by Axel Lin <[email protected]>Reviewed-by Srinivas Kandagatla <[email protected]>
Applied with Srinivas' tag.
Bartosz