Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8d4f7f8 authored by Patrice Chotard's avatar Patrice Chotard Committed by Linus Walleij
Browse files

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: default avatarPatrice Chotard <patrice.chotard@st.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 61ce1356
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -162,10 +162,23 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)
{
{
	struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
	struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
	bool bit;
	bool bit;
	bool is_out;
	u8 gpio_offset = offset - 1;
	int ret;
	int ret;


	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,
		ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
				  offset, &bit);
				gpio_offset, &bit);
	if (ret < 0) {
	if (ret < 0) {
		dev_err(pct->dev, "%s failed\n", __func__);
		dev_err(pct->dev, "%s failed\n", __func__);
		return ret;
		return ret;