[source] brcm47xx: fix button inversion for Asus WL-500W

LEDE Commits lede-commits at lists.infradead.org
Wed Feb 15 15:20:51 PST 2017


rmilecki pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/7efe538ac1ba9a43edd32573c55749b76d43bc04

commit 7efe538ac1ba9a43edd32573c55749b76d43bc04
Author: Mirko Parthey <mirko.parthey at web.de>
AuthorDate: Tue Feb 14 22:38:17 2017 +0100

    brcm47xx: fix button inversion for Asus WL-500W
    
    The Asus WL-500W buttons are active high,
    but the software treats them as active low.
    Fix the inverted logic.
    
    Signed-off-by: Mirko Parthey <mirko.parthey at web.de>
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 ...7xx-Fix-button-inversion-for-Asus-WL-500W.patch | 38 ++++++++++++++++++++++
 ...S-BCM47XX-Devices-database-update-for-4.x.patch | 16 ++++-----
 2 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/target/linux/brcm47xx/patches-4.4/130-MIPS-bcm47xx-Fix-button-inversion-for-Asus-WL-500W.patch b/target/linux/brcm47xx/patches-4.4/130-MIPS-bcm47xx-Fix-button-inversion-for-Asus-WL-500W.patch
new file mode 100644
index 0000000..7d671cf
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.4/130-MIPS-bcm47xx-Fix-button-inversion-for-Asus-WL-500W.patch
@@ -0,0 +1,38 @@
+From: Mirko Parthey <mirko.parthey at web.de>
+Subject: [PATCH] MIPS: bcm47xx: Fix button inversion for Asus WL-500W
+
+The Asus WL-500W buttons are active high,
+but the software treats them as active low.
+Fix the inverted logic.
+
+Signed-off-by: Mirko Parthey <mirko.parthey at web.de>
+---
+ arch/mips/bcm47xx/buttons.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/bcm47xx/buttons.c
++++ b/arch/mips/bcm47xx/buttons.c
+@@ -17,6 +17,12 @@
+ 		.active_low	= 1,					\
+ 	}
+ 
++#define BCM47XX_GPIO_KEY_H(_gpio, _code)				\
++	{								\
++		.code		= _code,				\
++		.gpio		= _gpio,				\
++	}
++
+ /* Asus */
+ 
+ static const struct gpio_keys_button
+@@ -79,8 +85,8 @@ bcm47xx_buttons_asus_wl500gpv2[] __initc
+ 
+ static const struct gpio_keys_button
+ bcm47xx_buttons_asus_wl500w[] __initconst = {
+-	BCM47XX_GPIO_KEY(6, KEY_RESTART),
+-	BCM47XX_GPIO_KEY(7, KEY_WPS_BUTTON),
++	BCM47XX_GPIO_KEY_H(6, KEY_RESTART),
++	BCM47XX_GPIO_KEY_H(7, KEY_WPS_BUTTON),
+ };
+ 
+ static const struct gpio_keys_button
diff --git a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
index 08d5709..8230385 100644
--- a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
+++ b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
@@ -31,7 +31,7 @@
  	{{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
 --- a/arch/mips/bcm47xx/buttons.c
 +++ b/arch/mips/bcm47xx/buttons.c
-@@ -20,6 +20,12 @@
+@@ -26,6 +26,12 @@
  /* Asus */
  
  static const struct gpio_keys_button
@@ -44,7 +44,7 @@
  bcm47xx_buttons_asus_rtn12[] __initconst = {
  	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
  	BCM47XX_GPIO_KEY(1, KEY_RESTART),
-@@ -270,6 +276,18 @@ bcm47xx_buttons_linksys_wrt310nv1[] __in
+@@ -276,6 +282,18 @@ bcm47xx_buttons_linksys_wrt310nv1[] __in
  };
  
  static const struct gpio_keys_button
@@ -63,7 +63,7 @@
  bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = {
  	BCM47XX_GPIO_KEY(5, KEY_WIMAX),
  	BCM47XX_GPIO_KEY(6, KEY_RESTART),
-@@ -378,6 +396,17 @@ bcm47xx_buttons_motorola_wr850gv2v3[] __
+@@ -384,6 +402,17 @@ bcm47xx_buttons_motorola_wr850gv2v3[] __
  /* Netgear */
  
  static const struct gpio_keys_button
@@ -81,7 +81,7 @@
  bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
  	BCM47XX_GPIO_KEY(4, KEY_RESTART),
  	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -405,6 +434,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
+@@ -411,6 +440,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
  };
  
  static const struct gpio_keys_button
@@ -93,7 +93,7 @@
  bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
  	BCM47XX_GPIO_KEY(4, KEY_RESTART),
  	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -458,6 +492,9 @@ int __init bcm47xx_buttons_register(void
+@@ -464,6 +498,9 @@ int __init bcm47xx_buttons_register(void
  	int err;
  
  	switch (board) {
@@ -103,7 +103,7 @@
  	case BCM47XX_BOARD_ASUS_RTN12:
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
  		break;
-@@ -588,6 +625,12 @@ int __init bcm47xx_buttons_register(void
+@@ -594,6 +631,12 @@ int __init bcm47xx_buttons_register(void
  	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
  		break;
@@ -116,7 +116,7 @@
  	case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
  		break;
-@@ -651,6 +694,12 @@ int __init bcm47xx_buttons_register(void
+@@ -657,6 +700,12 @@ int __init bcm47xx_buttons_register(void
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
  		break;
  
@@ -129,7 +129,7 @@
  	case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
  		break;
-@@ -663,6 +712,9 @@ int __init bcm47xx_buttons_register(void
+@@ -669,6 +718,9 @@ int __init bcm47xx_buttons_register(void
  	case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
  		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
  		break;



More information about the lede-commits mailing list