[PATCH v1 1/1] gpio: msm_gpio: return correct value for gpio read
Casey Connolly
casey.connolly at linaro.org
Fri May 9 12:42:21 CEST 2025
On 5/8/25 13:36, Aswin Murugan wrote:
> 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.
oof, nice find :D>
> Signed-off-by: Aswin Murugan <aswin.murugan at oss.qualcomm.com>
Reviewed-by: Casey Connolly <casey.connolly at linaro.org>> ---
> drivers/gpio/msm_gpio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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,
--
Casey (she/they)
More information about the U-Boot
mailing list