]> Git Repo - linux.git/commitdiff
gpio: amd-fch: Set proper output level for direction_output
authorAxel Lin <[email protected]>
Wed, 6 Mar 2019 14:02:55 +0000 (22:02 +0800)
committerLinus Walleij <[email protected]>
Fri, 8 Mar 2019 13:11:30 +0000 (14:11 +0100)
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]>
drivers/gpio/gpio-amd-fch.c

index 4c585d4e7e7430e5ca37dcc21ec2361edbce1100..38c3f4a3d4aa8fa0751a1a358997ffde8692092c 100644 (file)
@@ -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;
This page took 0.052094 seconds and 4 git commands to generate.