mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 11:09:57 +08:00
switch to gpio-keys-polled
SVN-Revision: 31491
This commit is contained in:
parent
1c29057519
commit
e047cf1899
@ -15,7 +15,7 @@ MAINTAINER:=Florian Fainelli <florian@openwrt.org>
|
|||||||
|
|
||||||
include $(INCLUDE_DIR)/target.mk
|
include $(INCLUDE_DIR)/target.mk
|
||||||
|
|
||||||
DEFAULT_PACKAGES += kmod-switch kmod-input-gpio-buttons \
|
DEFAULT_PACKAGES += kmod-switch kmod-input-gpio-keys-polled \
|
||||||
kmod-button-hotplug
|
kmod-button-hotplug
|
||||||
|
|
||||||
define Target/Description
|
define Target/Description
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <linux/mtd/partitions.h>
|
#include <linux/mtd/partitions.h>
|
||||||
#include <linux/mtd/physmap.h>
|
#include <linux/mtd/physmap.h>
|
||||||
#include <linux/ssb/ssb.h>
|
#include <linux/ssb/ssb.h>
|
||||||
+#include <linux/gpio_buttons.h>
|
+#include <linux/gpio_keys.h>
|
||||||
+#include <linux/input.h>
|
+#include <linux/input.h>
|
||||||
#include <asm/addrspace.h>
|
#include <asm/addrspace.h>
|
||||||
#include <bcm63xx_board.h>
|
#include <bcm63xx_board.h>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
};
|
};
|
||||||
@ -37,7 +37,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
};
|
};
|
||||||
@ -47,14 +47,14 @@
|
|||||||
.dev.platform_data = &bcm63xx_led_data,
|
.dev.platform_data = &bcm63xx_led_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
+static struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = {
|
+static struct gpio_keys_platform_data bcm63xx_gpio_keys_data = {
|
||||||
+ .poll_interval = 20,
|
+ .poll_interval = 20,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+static struct platform_device bcm63xx_gpio_buttons_device = {
|
+static struct platform_device bcm63xx_gpio_keys_device = {
|
||||||
+ .name = "gpio-buttons",
|
+ .name = "gpio-keys-polled",
|
||||||
+ .id = 0,
|
+ .id = 0,
|
||||||
+ .dev.platform_data = &bcm63xx_gpio_buttons_data,
|
+ .dev.platform_data = &bcm63xx_gpio_keys_data,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
/*
|
/*
|
||||||
@ -76,10 +76,10 @@
|
|||||||
+ button_count++;
|
+ button_count++;
|
||||||
+
|
+
|
||||||
+ if (button_count) {
|
+ if (button_count) {
|
||||||
+ bcm63xx_gpio_buttons_data.nbuttons = button_count;
|
+ bcm63xx_gpio_keys_data.nbuttons = button_count;
|
||||||
+ bcm63xx_gpio_buttons_data.buttons = board.buttons;
|
+ bcm63xx_gpio_keys_data.buttons = board.buttons;
|
||||||
+
|
+
|
||||||
+ platform_device_register(&bcm63xx_gpio_buttons_device);
|
+ platform_device_register(&bcm63xx_gpio_keys_device);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
return 0;
|
return 0;
|
||||||
@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
+#include <linux/gpio_buttons.h>
|
+#include <linux/gpio_keys.h>
|
||||||
#include <linux/leds.h>
|
#include <linux/leds.h>
|
||||||
#include <bcm63xx_dev_enet.h>
|
#include <bcm63xx_dev_enet.h>
|
||||||
#include <bcm63xx_dev_dsp.h>
|
#include <bcm63xx_dev_dsp.h>
|
||||||
@ -100,7 +100,7 @@
|
|||||||
struct gpio_led leds[5];
|
struct gpio_led leds[5];
|
||||||
+
|
+
|
||||||
+ /* Buttons */
|
+ /* Buttons */
|
||||||
+ struct gpio_button buttons[4];
|
+ struct gpio_keys_button buttons[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ! BOARD_BCM963XX_H_ */
|
#endif /* ! BOARD_BCM963XX_H_ */
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
@@ -61,6 +61,10 @@ struct board_info {
|
@@ -61,6 +61,10 @@ struct board_info {
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
struct gpio_button buttons[4];
|
struct gpio_keys_button buttons[4];
|
||||||
+
|
+
|
||||||
+ /* Additional platform devices */
|
+ /* Additional platform devices */
|
||||||
+ struct platform_device **devs;
|
+ struct platform_device **devs;
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -140,14 +140,14 @@
|
|||||||
+ .gpio = 34,
|
+ .gpio = 34,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 37,
|
+ .gpio = 37,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+ .devs = nb4_devices,
|
+ .devs = nb4_devices,
|
||||||
@ -233,14 +233,14 @@
|
|||||||
+ .gpio = 34,
|
+ .gpio = 34,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 37,
|
+ .gpio = 37,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+ .devs = nb4_devices,
|
+ .devs = nb4_devices,
|
||||||
@ -326,14 +326,14 @@
|
|||||||
+ .gpio = 34,
|
+ .gpio = 34,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 37,
|
+ .gpio = 37,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+ .devs = nb4_devices,
|
+ .devs = nb4_devices,
|
||||||
@ -414,14 +414,14 @@
|
|||||||
+ .gpio = 34,
|
+ .gpio = 34,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 37,
|
+ .gpio = 37,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+ .devs = nb4_devices,
|
+ .devs = nb4_devices,
|
||||||
@ -502,14 +502,14 @@
|
|||||||
+ .gpio = 34,
|
+ .gpio = 34,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 37,
|
+ .gpio = 37,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+ .devs = nb4_devices,
|
+ .devs = nb4_devices,
|
||||||
|
@ -83,14 +83,14 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 37,
|
+ .gpio = 37,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
@ -103,7 +103,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
+ .gpio = 11,
|
+ .gpio = 11,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "ses",
|
+ .desc = "ses",
|
||||||
@ -66,7 +66,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ }
|
+ }
|
||||||
+};
|
+};
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wifi",
|
+ .desc = "wifi",
|
||||||
@ -52,7 +52,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = BTN_0,
|
+ .code = BTN_0,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
@ -60,7 +60,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
|
@ -87,14 +87,14 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ {
|
+ {
|
||||||
+ .desc = "wps",
|
+ .desc = "wps",
|
||||||
+ .gpio = 34,
|
+ .gpio = 34,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_WPS_BUTTON,
|
+ .code = KEY_WPS_BUTTON,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
+ .active_low = 1,
|
+ .active_low = 1,
|
||||||
+ .type = EV_KEY,
|
+ .type = EV_KEY,
|
||||||
+ .code = KEY_RESTART,
|
+ .code = KEY_RESTART,
|
||||||
+ .threshold = 3,
|
+ .debounce_interval = 60,
|
||||||
+ },
|
+ },
|
||||||
+ },
|
+ },
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user