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

Commit 24b35ed9 authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: htc-egpio: read output value from cache



When the hardware is in output mode, reading the value from the
hardware is not giving the correct value back. Instead read the
value from the cache so we get the right value.

Suggested-by: default avatarRussell King <linux@arm.linux.org.uk>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 9298539c
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -160,11 +160,15 @@ static int egpio_get(struct gpio_chip *chip, unsigned offset)
	bit   = egpio_bit(ei, offset);
	reg   = egpio->reg_start + egpio_pos(ei, offset);

	if (test_bit(offset, &egpio->is_out)) {
		return !!(egpio->cached_values & (1 << offset));
	} else {
		value = egpio_readw(ei, reg);
		pr_debug("readw(%p + %x) = %x\n",
			 ei->base_addr, reg << ei->bus_shift, value);
		return !!(value & bit);
	}
}

static int egpio_direction_input(struct gpio_chip *chip, unsigned offset)
{