[OpenWrt-Devel] [PATCH 3/6] [kernel] ath79: new functions for passing GPIO data to wireless module
Michal Cieslakiewicz
michal.cieslakiewicz at wp.pl
Wed Jan 20 18:12:19 EST 2016
From: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
Patch provides functions for passing additional platform data
(WLAN LED name and GPIO buttons information) to Atheros wireless module.
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
---
This patch is essential for passing platform GPIO data to ath9k module.
It adds information about buttons and WLAN LED name.
dev-ap9x-pci.c | 30 ++++++++++++++++++++++++++++++
dev-ap9x-pci.h | 10 ++++++++++
2 files changed, 40 insertions(+)
diff -pruN a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
--- a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c 2016-01-20 19:52:14.447743832 +0100
+++ b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c 2016-01-20 19:52:14.351749501 +0100
@@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(
}
}
+__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
+{
+ switch (wmac) {
+ case 0:
+ ap9x_wmac0_data.led_name = led_name;
+ break;
+ case 1:
+ ap9x_wmac1_data.led_name = led_name;
+ break;
+ }
+}
+
__init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
{
switch (wmac) {
@@ -81,6 +93,24 @@ __init void ap9x_pci_setup_wmac_leds(uns
}
}
+__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
+ struct gpio_keys_button *btns,
+ unsigned num_btns, unsigned poll_interval)
+{
+ struct ath9k_platform_data *ap9x_wmac_data;
+
+ if (wmac == 0)
+ ap9x_wmac_data = &ap9x_wmac0_data;
+ else if (wmac == 1)
+ ap9x_wmac_data = &ap9x_wmac1_data;
+ else
+ return;
+
+ ap9x_wmac_data->btns = btns;
+ ap9x_wmac_data->num_btns = num_btns;
+ ap9x_wmac_data->btn_poll_interval = poll_interval;
+}
+
static int ap91_pci_plat_dev_init(struct pci_dev *dev)
{
switch (PCI_SLOT(dev->devfn)) {
diff -pruN a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
--- a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h 2016-01-20 19:52:14.455743360 +0100
+++ b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h 2016-01-20 19:52:14.359749028 +0100
@@ -12,13 +12,17 @@
#define _ATH79_DEV_AP9X_PCI_H
struct gpio_led;
+struct gpio_keys_button;
struct ath9k_platform_data;
#if defined(CONFIG_ATH79_DEV_AP9X_PCI)
void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
+void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
int num_leds);
+void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
+ unsigned num_btns, unsigned poll_interval);
struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
@@ -28,11 +32,17 @@ void ap94_pci_init(u8 *cal_data0, u8 *ma
#else
static inline void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin) {}
+static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
+ const char *led_name) {}
static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
u32 mask, u32 val) {}
static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
struct gpio_led *leds,
int num_leds) {}
+static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
+ struct gpio_keys_button *btns,
+ unsigned num_btns,
+ unsigned poll_interval) {}
static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
{
return NULL;
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list