From: viresh kumar Date: Wed, 21 Apr 2010 08:42:05 +0000 (+0100) Subject: ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to OUT. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64b997c5142a13373857de09599afd2f079c2f7a;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to OUT. pl061_direction_output doesn't set value of gpio to value passed to it. This patch sets value of GPIO pin to requested value after changing direction to OUT. Signed-off-by: Viresh Kumar Acked-by: Baruch Siach Signed-off-by: Russell King --- diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c index cc3b5e0b595a..2196f318114c 100644 --- a/drivers/gpio/pl061.c +++ b/drivers/gpio/pl061.c @@ -91,6 +91,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset, gpiodir = readb(chip->base + GPIODIR); gpiodir |= 1 << offset; writeb(gpiodir, chip->base + GPIODIR); + + /* + * gpio value is set again, because pl061 doesn't allow to set value of + * a gpio pin before configuring it in OUT mode. + */ + writeb(!!value << offset, chip->base + (1 << (offset + 2))); spin_unlock_irqrestore(&chip->lock, flags); return 0;