diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-02-17 13:04:35 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 16:17:28 -0500 |
commit | 3383d23d86791503559cb87837491af37469d9e5 (patch) | |
tree | 81755ca266174145fac1c14b5cf4ab9499d505ce /drivers | |
parent | 7ee422dc6e947fcdc153246d47f26ae0b7cf083d (diff) |
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 <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/wm831x-gpio.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c index b4468b616890..c5a00f7a7bf0 100644 --- a/drivers/gpio/wm831x-gpio.c +++ b/drivers/gpio/wm831x-gpio.c | |||
@@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int wm831x_gpio_direction_out(struct gpio_chip *chip, | 63 | static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
64 | unsigned offset, int value) | ||
65 | { | 64 | { |
66 | struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); | 65 | struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); |
67 | struct wm831x *wm831x = wm831x_gpio->wm831x; | 66 | struct wm831x *wm831x = wm831x_gpio->wm831x; |
68 | 67 | ||
69 | return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset, | 68 | wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset, |
70 | WM831X_GPN_DIR | WM831X_GPN_TRI, 0); | 69 | value << offset); |
71 | } | 70 | } |
72 | 71 | ||
73 | static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 72 | static int wm831x_gpio_direction_out(struct gpio_chip *chip, |
73 | unsigned offset, int value) | ||
74 | { | 74 | { |
75 | struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); | 75 | struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); |
76 | struct wm831x *wm831x = wm831x_gpio->wm831x; | 76 | struct wm831x *wm831x = wm831x_gpio->wm831x; |
77 | int ret; | ||
77 | 78 | ||
78 | wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset, | 79 | ret = wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset, |
79 | value << offset); | 80 | WM831X_GPN_DIR | WM831X_GPN_TRI, 0); |
81 | if (ret < 0) | ||
82 | return ret; | ||
83 | |||
84 | /* Can only set GPIO state once it's in output mode */ | ||
85 | wm831x_gpio_set(chip, offset, value); | ||
86 | |||
87 | return 0; | ||
80 | } | 88 | } |
81 | 89 | ||
82 | static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 90 | static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |