diff options
author | Patrice Chotard <patrice.chotard@st.com> | 2013-06-20 10:05:43 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-24 07:31:00 -0400 |
commit | d8d4f7f875bb8f94c52583a788e456eabbd6281a (patch) | |
tree | c922e7462c737b1a25ddc146fc57ee26aabfb600 /drivers/pinctrl/pinctrl-abx500.c | |
parent | 61ce135679d2b0b38f55edc7833b4b1f32c890ed (diff) |
pinctrl: abx500: fix abx500_gpio_get()
- allow to get output GPIO value
- as there is no GPIO0 on ABX500, use correct offset with
abx500_gpio_get_bit()
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-abx500.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-abx500.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index caa7ab6811d1..d9d7ffc35c3e 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
@@ -162,10 +162,23 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
162 | { | 162 | { |
163 | struct abx500_pinctrl *pct = to_abx500_pinctrl(chip); | 163 | struct abx500_pinctrl *pct = to_abx500_pinctrl(chip); |
164 | bool bit; | 164 | bool bit; |
165 | bool is_out; | ||
166 | u8 gpio_offset = offset - 1; | ||
165 | int ret; | 167 | int ret; |
166 | 168 | ||
167 | ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, | 169 | ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, |
168 | offset, &bit); | 170 | gpio_offset, &is_out); |
171 | if (ret < 0) { | ||
172 | dev_err(pct->dev, "%s failed\n", __func__); | ||
173 | return ret; | ||
174 | } | ||
175 | |||
176 | if (is_out) | ||
177 | ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG, | ||
178 | gpio_offset, &bit); | ||
179 | else | ||
180 | ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, | ||
181 | gpio_offset, &bit); | ||
169 | if (ret < 0) { | 182 | if (ret < 0) { |
170 | dev_err(pct->dev, "%s failed\n", __func__); | 183 | dev_err(pct->dev, "%s failed\n", __func__); |
171 | return ret; | 184 | return ret; |