Skip to content

Commit

Permalink
pinctrl: abx500: fix abx500_gpio_get()
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Patrice Chotard authored and Linus Walleij committed Jun 24, 2013
1 parent 61ce135 commit d8d4f7f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions drivers/pinctrl/pinctrl-abx500.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,23 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
bool bit;
bool is_out;
u8 gpio_offset = offset - 1;
int ret;

ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
offset, &bit);
ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG,
gpio_offset, &is_out);
if (ret < 0) {
dev_err(pct->dev, "%s failed\n", __func__);
return ret;
}

if (is_out)
ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG,
gpio_offset, &bit);
else
ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
gpio_offset, &bit);
if (ret < 0) {
dev_err(pct->dev, "%s failed\n", __func__);
return ret;
Expand Down

0 comments on commit d8d4f7f

Please sign in to comment.