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@web.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
Mirko Parthey 2017-02-14 22:38:17 +01:00 committed by Rafał Miłecki
parent be007c580e
commit 7efe538ac1
2 changed files with 46 additions and 8 deletions

View File

@ -0,0 +1,38 @@
From: Mirko Parthey <mirko.parthey@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@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

View File

@ -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;