gpio: pca953x: Fix register reading past 8th GPIO
PATCH 1/1 gpio: pca953x: Fix register reading past 8th GPIO
A bug in the pca953x driver prevents correct reading of GPIO input values beyond the 8th GPIO; all values are reported as zero. Setting of GPIO output values is not affected.
This patch fixes the reading behavior.
--- drivers/gpio/pca953x_gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/pca953x_gpio.c +3 -1
@@ -145,11 +145,13 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset)int ret;u8 val =0 ; +int off = offset %BANK_SZ ; + ret =pca953x_read_single (dev,PCA953X_INPUT , &val, offset);if (ret)return ret; -return (val >> offset) &0x1 ; +return (val >> off) &0x1 ; } static int pca953x_set_value(struct udevice *dev, unsigned offset,
Signature · 1 line
2.7.0.GIT
PATCH 1/1 gpio: pca953x: Fix register reading past 8th GPIO
Hi Mario,
Quoted 7 lines · Mario Six
A bug in the pca953x driver prevents correct reading of GPIO input values beyond the 8th GPIO; all values are reported as zero. Setting of GPIO output values is not affected.
This patch fixes the reading behavior.
Signed-off-by Mario Six <[email protected]>
Regards,
Peng.
Quoted 26 lines
---
drivers/gpio/pca953x_gpio.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpio/pca953x_gpio.c +3
-1@@ -145,11 +145,13 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset)int ret;u8 val =0 ; +int off = offset %BANK_SZ ; + ret =pca953x_read_single (dev,PCA953X_INPUT , &val, offset);if (ret)return ret; -return (val >> offset) &0x1 ; +return (val >> off) &0x1 ; } static int pca953x_set_value(struct udevice *dev, unsigned offset,Signature · 1 line
2.7.0.GIT
PATCH 1/1 gpio: pca953x: Fix register reading past 8th GPIO
Quoted 7 lines · Peng Fan
Hi Mario,
Quoted 4 lines · Mario Six
A bug in the pca953x driver prevents correct reading of GPIO input values beyond the 8th GPIO; all values are reported as zero. Setting of GPIO output values is not affected.
Quoted 5 lines
Quoted 3 lines
This patch fixes the reading behavior.
Signed-off-by Mario Six <[email protected]>Reviewed-by Peng Fan <[email protected]>
PATCH 1/1 gpio: pca953x: Fix register reading past 8th GPIO
Quoted 8 lines · Simon Glass
Quoted 7 lines · Peng Fan
Hi Mario,
Quoted 4 lines · Mario Six
A bug in the pca953x driver prevents correct reading of GPIO input values beyond the 8th GPIO; all values are reported as zero. Setting of GPIO output values is not affected.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
This patch fixes the reading behavior.
Signed-off-by Mario Six <[email protected]>Reviewed-by Peng Fan <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot-dm, thanks!