ath5k: extract LED code into a separate file
PATCH 1/3 ath5k: extract LED code into a separate file
Move LED code out of base.c for clarity.
Changes-licensed-under: 3-Clause-BSD
Signed-off-by Bob Copeland <[email protected]>
---
This series just has a few cleanups to the LED code and addition of a new system ID.
drivers/net/wireless/ath5k/Makefile | 1 + drivers/net/wireless/ath5k/ath5k.h | 6 ++ drivers/net/wireless/ath5k/base.c | 140 ----------------------------- drivers/net/wireless/ath5k/led.c | 169 +++++++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+), 140 deletions(-) create mode 100644 drivers/net/wireless/ath5k/led.c
drivers/net/wireless/ath5k/Makefile +1 -0
@@ -10,5 +10,6 @@ ath5k-y += phy.o ath5k-y += reset.o ath5k-y += attach.o ath5k-y += base.o +ath5k-y += led.o ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o obj-$(CONFIG_ATH5K) += ath5k.o
drivers/net/wireless/ath5k/ath5k.h +6 -0
@@ -1129,6 +1129,12 @@ struct ath5k_hw {extern struct ath5k_hw *ath5k_hw_attach (struct ath5k_softc *sc,u8 mac_version);extern void ath5k_hw_detach (struct ath5k_hw *ah); +/* LED functions */ +extern int ath5k_init_leds (struct ath5k_softc *sc); +extern void ath5k_led_enable (struct ath5k_softc *sc); +extern void ath5k_led_off (struct ath5k_softc *sc); +extern void ath5k_unregister_leds (struct ath5k_softc *sc); +/* Reset Functions */ extern int ath5k_hw_nic_wakeup (struct ath5k_hw *ah,int flags,bool initial);extern int ath5k_hw_reset (struct ath5k_hw *ah,enum nl80211_iftype op_mode,struct ieee80211_channel *channel,bool change_channel);
drivers/net/wireless/ath5k/base.c +0 -140
152 lines not on this page · raw message
drivers/net/wireless/ath5k/led.c new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 2/3 ath5k: use a table for LED parameters
Put the device id-to-gpio mapping in a table to make it easier to add new devices. The list of supported devices is unchanged.
Signed-off-by Bob Copeland <[email protected]>
Acked-by Jiri Slaby <[email protected]>
--- drivers/net/wireless/ath5k/led.c | 53 ++++++++++++++++++++------------------ 1 files changed, 28 insertions(+), 25 deletions(-)
drivers/net/wireless/ath5k/led.c +28 -25
@@ -43,6 +43,29 @@#include "ath5k.h" #include "base.h" +#define ATH_SDEVICE (subv,subd) \ + .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ + .subvendor = (subv), .subdevice = (subd) + +#define ATH_LED (pin,polarity) .driver_data = (((pin) << 8) | (polarity)) +#define ATH_PIN (data) ((data) >> 8) +#define ATH_POLARITY (data) ((data) & 0xff) + +/* Devices we match on for LED config info (typically laptops) */ +static const struct pci_device_id ath5k_led_devices[] = { +/* IBM-specific AR5212 */ + {PCI_VDEVICE (ATHEROS ,PCI_DEVICE_ID_ATHEROS_AR5212_IBM ),ATH_LED (0 ,0 ) }, +/* AR5211 */ + {PCI_VDEVICE (ATHEROS ,PCI_DEVICE_ID_ATHEROS_AR5211 ),ATH_LED (0 ,0 ) }, +/* HP Compaq nc6xx, nc4000, nx6000 */ + {ATH_SDEVICE (PCI_VENDOR_ID_COMPAQ ,PCI_ANY_ID ),ATH_LED (1 ,1 ) }, +/* Acer Aspire One A150 ([email protected]) */ + {ATH_SDEVICE (PCI_VENDOR_ID_FOXCONN ,PCI_ANY_ID ),ATH_LED (3 ,0 ) }, +/* E-machines E510 ([email protected]) */ + {ATH_SDEVICE (PCI_VENDOR_ID_AMBIT ,PCI_ANY_ID ),ATH_LED (3 ,0 ) }, + { } +}; +void ath5k_led_enable (struct ath5k_softc *sc) {if (test_bit (ATH_STAT_LEDSOFT , sc->status)) {
@@ -114,39 +137,19 @@ void ath5k_unregister_leds(struct ath5k_softc *sc)ath5k_unregister_led (&sc->tx_led); } -int ath5k_init_leds (struct ath5k_softc *sc) {int ret =0 ;struct ieee80211_hw *hw = sc->hw;struct pci_dev *pdev = sc->pdev;char name[ATH5K_LED_MAX_NAME_LEN +1 ]; +const struct pci_device_id *match; -/* -* Auto-enable soft led processing for IBM cards and for -* 5211 minipci cards. -*/ -if (pdev->device ==PCI_DEVICE_ID_ATHEROS_AR5212_IBM || - pdev->device ==PCI_DEVICE_ID_ATHEROS_AR5211 ) { -__set_bit (ATH_STAT_LEDSOFT , sc->status); - sc->led_pin =0 ; - sc->led_on =0 ;/* active low */ - } -/* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */ -if (pdev->subsystem_vendor ==PCI_VENDOR_ID_COMPAQ ) { -__set_bit (ATH_STAT_LEDSOFT , sc->status); - sc->led_pin =1 ; - sc->led_on =1 ;/* active high */ - } -/* -* Pin 3 on Foxconn chips used in Acer Aspire One (0x105b:e008) and -* in emachines notebooks with AMBIT subsystem. -*/ -if (pdev->subsystem_vendor ==PCI_VENDOR_ID_FOXCONN || - pdev->subsystem_vendor ==PCI_VENDOR_ID_AMBIT ) { + match =pci_match_id (&ath5k_led_devices[0 ], pdev); +if (match) {__set_bit (ATH_STAT_LEDSOFT , sc->status); - sc->led_pin =3 ; - sc->led_on =0 ;/* active low */ + sc->led_pin =ATH_PIN (match->driver_data); + sc->led_on =ATH_POLARITY (match->driver_data); }if (!test_bit (ATH_STAT_LEDSOFT , sc->status))
Signature · 1 line
1.6.0.6
PATCH 3/3 ath5k: update LED table with reported devices
In reply to Bob CopelandThis patch adds support for Acer Ferrari 5000, and also specifies the subsystem device ids for previously reported e-machines e510 and Acer Aspire One A150.
Signed-off-by Bob Copeland <[email protected]>
--- drivers/net/wireless/ath5k/led.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath5k/led.c +4 -2
@@ -60,9 +60,11 @@ static const struct pci_device_id ath5k_led_devices[] = {/* HP Compaq nc6xx, nc4000, nx6000 */ { ATH_SDEVICE(PCI_VENDOR_ID_COMPAQ, PCI_ANY_ID), ATH_LED(1, 1) },/* Acer Aspire One A150 ([email protected]) */ - { ATH_SDEVICE(PCI_VENDOR_ID_FOXCONN, PCI_ANY_ID), ATH_LED(3, 0) }, + { ATH_SDEVICE(PCI_VENDOR_ID_FOXCONN, 0xe008), ATH_LED(3, 0) }, +/* Acer Ferrari 5000 ([email protected]) */ + { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0422), ATH_LED(1, 1) },/* E-machines E510 ([email protected]) */ - { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, PCI_ANY_ID), ATH_LED(3, 0) }, + { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0428), ATH_LED(3, 0) }, { } };
Signature · 1 line
1.6.0.6