[PATCH] gpio: amd-fch: Set proper output level for direction_output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <axel.lin@xxxxxxxxxx>
---
Hi Enrico,
I don't have h/w to test, so please help review and test it.
Thanks,
Axel
 drivers/gpio/gpio-amd-fch.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-amd-fch.c b/drivers/gpio/gpio-amd-fch.c
index 4fd66444ea33..aa9237eacd7c 100644
--- a/drivers/gpio/gpio-amd-fch.c
+++ b/drivers/gpio/gpio-amd-fch.c
@@ -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 *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;
-- 
2.17.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux