aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-03-08 00:10:21 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:37 -0400
commitcdb02dc6146950155e79a4e3225e1b58cf2b0c54 (patch)
treeae8163c32e94353cd57343f0edebcf4380a8dae7 /drivers
parent0ed4548f81b69363a6257dbc23086fc9fe4a23cb (diff)
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 <me@bobcopeland.com> Acked-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath5k/led.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/drivers/net/wireless/ath5k/led.c b/drivers/net/wireless/ath5k/led.c
index 7cef2bb408df..e365fbd34237 100644
--- a/drivers/net/wireless/ath5k/led.c
+++ b/drivers/net/wireless/ath5k/led.c
@@ -43,6 +43,29 @@
43#include "ath5k.h" 43#include "ath5k.h"
44#include "base.h" 44#include "base.h"
45 45
46#define ATH_SDEVICE(subv,subd) \
47 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
48 .subvendor = (subv), .subdevice = (subd)
49
50#define ATH_LED(pin,polarity) .driver_data = (((pin) << 8) | (polarity))
51#define ATH_PIN(data) ((data) >> 8)
52#define ATH_POLARITY(data) ((data) & 0xff)
53
54/* Devices we match on for LED config info (typically laptops) */
55static const struct pci_device_id ath5k_led_devices[] = {
56 /* IBM-specific AR5212 */
57 { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5212_IBM), ATH_LED(0, 0) },
58 /* AR5211 */
59 { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5211), ATH_LED(0, 0) },
60 /* HP Compaq nc6xx, nc4000, nx6000 */
61 { ATH_SDEVICE(PCI_VENDOR_ID_COMPAQ, PCI_ANY_ID), ATH_LED(1, 1) },
62 /* Acer Aspire One A150 (maximlevitsky@gmail.com) */
63 { ATH_SDEVICE(PCI_VENDOR_ID_FOXCONN, PCI_ANY_ID), ATH_LED(3, 0) },
64 /* E-machines E510 (tuliom@gmail.com) */
65 { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, PCI_ANY_ID), ATH_LED(3, 0) },
66 { }
67};
68
46void ath5k_led_enable(struct ath5k_softc *sc) 69void ath5k_led_enable(struct ath5k_softc *sc)
47{ 70{
48 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { 71 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) {
@@ -114,39 +137,19 @@ void ath5k_unregister_leds(struct ath5k_softc *sc)
114 ath5k_unregister_led(&sc->tx_led); 137 ath5k_unregister_led(&sc->tx_led);
115} 138}
116 139
117
118int ath5k_init_leds(struct ath5k_softc *sc) 140int ath5k_init_leds(struct ath5k_softc *sc)
119{ 141{
120 int ret = 0; 142 int ret = 0;
121 struct ieee80211_hw *hw = sc->hw; 143 struct ieee80211_hw *hw = sc->hw;
122 struct pci_dev *pdev = sc->pdev; 144 struct pci_dev *pdev = sc->pdev;
123 char name[ATH5K_LED_MAX_NAME_LEN + 1]; 145 char name[ATH5K_LED_MAX_NAME_LEN + 1];
146 const struct pci_device_id *match;
124 147
125 /* 148 match = pci_match_id(&ath5k_led_devices[0], pdev);
126 * Auto-enable soft led processing for IBM cards and for 149 if (match) {
127 * 5211 minipci cards.
128 */
129 if (pdev->device == PCI_DEVICE_ID_ATHEROS_AR5212_IBM ||
130 pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) {
131 __set_bit(ATH_STAT_LEDSOFT, sc->status);
132 sc->led_pin = 0;
133 sc->led_on = 0; /* active low */
134 }
135 /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */
136 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) {
137 __set_bit(ATH_STAT_LEDSOFT, sc->status);
138 sc->led_pin = 1;
139 sc->led_on = 1; /* active high */
140 }
141 /*
142 * Pin 3 on Foxconn chips used in Acer Aspire One (0x105b:e008) and
143 * in emachines notebooks with AMBIT subsystem.
144 */
145 if (pdev->subsystem_vendor == PCI_VENDOR_ID_FOXCONN ||
146 pdev->subsystem_vendor == PCI_VENDOR_ID_AMBIT) {
147 __set_bit(ATH_STAT_LEDSOFT, sc->status); 150 __set_bit(ATH_STAT_LEDSOFT, sc->status);
148 sc->led_pin = 3; 151 sc->led_pin = ATH_PIN(match->driver_data);
149 sc->led_on = 0; /* active low */ 152 sc->led_on = ATH_POLARITY(match->driver_data);
150 } 153 }
151 154
152 if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) 155 if (!test_bit(ATH_STAT_LEDSOFT, sc->status))