This fix is for anyone on 3.10 using the pca953x driver. A regression
was introduced when this driver was converted to using 8-bit
reads/writes the bitmask in pca953x_gpio_get_value wasn't adjusted with
the modulus BANK_SZ and consequently looks at the wrong bits in the
input register.

This backports the following commit from the mainline linux kernel:
40a625daa88653d7942dc85483f6f289cd687cb7

Signed-off-by: Pushpal Sidhu <[email protected]>
---
 .../350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 
target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch

diff --git 
a/target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch
 
b/target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch
new file mode 100644
index 0000000..654fccf
--- /dev/null
+++ 
b/target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch
@@ -0,0 +1,13 @@
+Index: linux-3.10.49/drivers/gpio/gpio-pca953x.c
+===================================================================
+--- linux-3.10.49.orig/drivers/gpio/gpio-pca953x.c     2014-07-17 
15:58:15.000000000 -0700
++++ linux-3.10.49/drivers/gpio/gpio-pca953x.c  2014-10-08 14:49:46.974913692 
-0700
+@@ -308,7 +308,7 @@
+               return 0;
+       }
+ 
+-      return (reg_val & (1u << off)) ? 1 : 0;
++      return (reg_val & (1u << (off % BANK_SZ))) ? 1 : 0;
+ }
+ 
+ static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int 
val)
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to