summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAswin Murugan <[email protected]>2025-05-08 17:06:46 +0530
committerTom Rini <[email protected]>2025-06-24 07:53:33 -0600
commitddc527ac4331b3cc73f29d30127944f477d6a6f0 (patch)
tree43b47cce22669aeba6924fce6d58bf353cbf17ca
parent35811a7b0d68ce1a32446953e3ccf7a2186f08f8 (diff)
gpio: msm_gpio: return correct value for gpio read
In the current implementation, the GPIO read operation considers both the input and outbut bits (bits 0 and 1). It should only consider the state of input bit, i.e bit 0. To address this, mask input bit alone and read it. Signed-off-by: Aswin Murugan <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Casey Connolly <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Casey Connolly <[email protected]>
-rw-r--r--drivers/gpio/msm_gpio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c
index 6783fc756f4..7de332c66ae 100644
--- a/drivers/gpio/msm_gpio.c
+++ b/drivers/gpio/msm_gpio.c
@@ -202,7 +202,7 @@ static int msm_gpio_get_value(struct udevice *dev, unsigned int gpio)
if (qcom_is_special_pin(priv->pin_data, gpio))
return msm_gpio_get_value_special(priv, gpio);
- return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) >> GPIO_IN);
+ return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) & BIT(GPIO_IN));
}
static int msm_gpio_get_function_special(struct msm_gpio_bank *priv,