Skip to content

Commit

Permalink
gpio: amd-fch: Set proper output level for direction_output
Browse files Browse the repository at this point in the history
Current amd_fch_gpio_direction_output implementation ignores the value
argument, fix it so direction_output will set proper output level.

Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Reviewed-by: Enrico Weigelt <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
AxelLin authored and linusw committed Mar 8, 2019
1 parent deb63b0 commit f777cda
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/gpio/gpio-amd-fch.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,18 @@ static int amd_fch_gpio_direction_output(struct gpio_chip *gc,
unsigned long flags;
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
void __iomem *ptr = amd_fch_gpio_addr(priv, gpio);
u32 val;

spin_lock_irqsave(&priv->lock, flags);
writel_relaxed(readl_relaxed(ptr) | AMD_FCH_GPIO_FLAG_DIRECTION, ptr);

val = readl_relaxed(ptr);
if (value)
val |= AMD_FCH_GPIO_FLAG_WRITE;
else
val &= ~AMD_FCH_GPIO_FLAG_WRITE;

writel_relaxed(val | AMD_FCH_GPIO_FLAG_DIRECTION, ptr);

spin_unlock_irqrestore(&priv->lock, flags);

return 0;
Expand Down

0 comments on commit f777cda

Please sign in to comment.