gpiolib: Actually set output state in wm831x_gpio_direction_output()
PATCH 1/1 gpiolib: Actually set output state in wm831x_gpio_direction_output()
wm831x_gpio_direction_output() ignored the state passed into it.
Signed-off-by Mark Brown <[email protected]>
---
Ideally this could make it into 2.6.33, though it's not super critical and it's probably reasonable to handle it via the stable releases.
drivers/gpio/wm831x-gpio.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-)
drivers/gpio/wm831x-gpio.c +15 -7
@@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)return 0 ; } -static int wm831x_gpio_direction_out (struct gpio_chip *chip, -unsigned offset,int value) +static void wm831x_gpio_set (struct gpio_chip *chip,unsigned offset,int value) {struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip);struct wm831x *wm831x = wm831x_gpio->wm831x; -return wm831x_set_bits (wm831x,WM831X_GPIO1_CONTROL + offset, -WM831X_GPN_DIR |WM831X_GPN_TRI ,0 ); +wm831x_set_bits (wm831x,WM831X_GPIO_LEVEL ,1 << offset, + value << offset); } -static void wm831x_gpio_set (struct gpio_chip *chip,unsigned offset,int value) +static int wm831x_gpio_direction_out (struct gpio_chip *chip, +unsigned offset,int value) {struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip);struct wm831x *wm831x = wm831x_gpio->wm831x; +int ret; -wm831x_set_bits (wm831x,WM831X_GPIO_LEVEL ,1 << offset, - value << offset); + ret =wm831x_set_bits (wm831x,WM831X_GPIO1_CONTROL + offset, +WM831X_GPN_DIR |WM831X_GPN_TRI ,0 ); +if (ret <0 ) +return ret; + +/* Can only set GPIO state once it's in output mode */ +wm831x_gpio_set (chip, offset, value); + +return 0 ; }static int wm831x_gpio_to_irq (struct gpio_chip *chip,unsigned offset)
Signature · 1 line
1.6.6.1
Hi Mark,
Quoted 8 lines · Mark Brown
wm831x_gpio_direction_output()ignored the state passed into it.Signed-off-by Mark Brown <[email protected]>---
Ideally this could make it into 2.6.33, though it's not super critical and it's probably reasonable to handle it via the stable releases.
Agreed. I'll push it upstream through my for-next branch, thanks.
Cheers,
Samuel.
Quoted 49 lines
drivers/gpio/wm831x-gpio.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-)drivers/gpio/wm831x-gpio.c +15
-7@@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)return 0 ; } -static int wm831x_gpio_direction_out (struct gpio_chip *chip, -unsigned offset,int value) +static void wm831x_gpio_set (struct gpio_chip *chip,unsigned offset,int value) {struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip);struct wm831x *wm831x = wm831x_gpio->wm831x; -return wm831x_set_bits (wm831x,WM831X_GPIO1_CONTROL + offset, -WM831X_GPN_DIR |WM831X_GPN_TRI ,0 ); +wm831x_set_bits (wm831x,WM831X_GPIO_LEVEL ,1 << offset, + value << offset); } -static void wm831x_gpio_set (struct gpio_chip *chip,unsigned offset,int value) +static int wm831x_gpio_direction_out (struct gpio_chip *chip, +unsigned offset,int value) {struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip);struct wm831x *wm831x = wm831x_gpio->wm831x; +int ret; -wm831x_set_bits (wm831x,WM831X_GPIO_LEVEL ,1 << offset, - value << offset); + ret =wm831x_set_bits (wm831x,WM831X_GPIO1_CONTROL + offset, +WM831X_GPN_DIR |WM831X_GPN_TRI ,0 ); +if (ret <0 ) +return ret; + +/* Can only set GPIO state once it's in output mode */ +wm831x_gpio_set (chip, offset, value); + +return 0 ; }static int wm831x_gpio_to_irq (struct gpio_chip *chip,unsigned offset)Signature · 1 line
1.6.6.1
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/