aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorVivek Natarajan <vivek.natraj@gmail.com>2009-08-14 02:00:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-20 11:35:52 -0400
commit08fc5c1ba026de0904aeeba9785f95f6603d58f7 (patch)
treed3eb522787b2bec24ac6d76b0960493fe769d68a /drivers/net
parentd340b1f0e5e374fc902a020cb6ef9ebd7fb9f368 (diff)
ath9k: Enable LEDs for AR9287 chipsets.
Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c27
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c6
4 files changed, 22 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 2fd663c01b8e..2c9f6628a8e7 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -454,7 +454,8 @@ struct ath_ani {
454/* LED Control */ 454/* LED Control */
455/********************/ 455/********************/
456 456
457#define ATH_LED_PIN 1 457#define ATH_LED_PIN_DEF 1
458#define ATH_LED_PIN_9287 8
458#define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */ 459#define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */
459#define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */ 460#define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */
460 461
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 0336981a70ec..de31a1595f12 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -522,6 +522,7 @@ struct ath_hw {
522 u32 originalGain[22]; 522 u32 originalGain[22];
523 int initPDADC; 523 int initPDADC;
524 int PDADCdelta; 524 int PDADCdelta;
525 u8 led_pin;
525 526
526 struct ar5416IniArray iniModes; 527 struct ar5416IniArray iniModes;
527 struct ar5416IniArray iniCommon; 528 struct ar5416IniArray iniCommon;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index fa4c6e74f977..3e09b9ac165b 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -968,9 +968,9 @@ static void ath_led_blink_work(struct work_struct *work)
968 968
969 if ((sc->led_on_duration == ATH_LED_ON_DURATION_IDLE) || 969 if ((sc->led_on_duration == ATH_LED_ON_DURATION_IDLE) ||
970 (sc->led_off_duration == ATH_LED_OFF_DURATION_IDLE)) 970 (sc->led_off_duration == ATH_LED_OFF_DURATION_IDLE))
971 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0); 971 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 0);
972 else 972 else
973 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 973 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin,
974 (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0); 974 (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0);
975 975
976 ieee80211_queue_delayed_work(sc->hw, 976 ieee80211_queue_delayed_work(sc->hw,
@@ -1002,7 +1002,7 @@ static void ath_led_brightness(struct led_classdev *led_cdev,
1002 case LED_OFF: 1002 case LED_OFF:
1003 if (led->led_type == ATH_LED_ASSOC || 1003 if (led->led_type == ATH_LED_ASSOC ||
1004 led->led_type == ATH_LED_RADIO) { 1004 led->led_type == ATH_LED_RADIO) {
1005 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1005 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin,
1006 (led->led_type == ATH_LED_RADIO)); 1006 (led->led_type == ATH_LED_RADIO));
1007 sc->sc_flags &= ~SC_OP_LED_ASSOCIATED; 1007 sc->sc_flags &= ~SC_OP_LED_ASSOCIATED;
1008 if (led->led_type == ATH_LED_RADIO) 1008 if (led->led_type == ATH_LED_RADIO)
@@ -1017,7 +1017,7 @@ static void ath_led_brightness(struct led_classdev *led_cdev,
1017 ieee80211_queue_delayed_work(sc->hw, 1017 ieee80211_queue_delayed_work(sc->hw,
1018 &sc->ath_led_blink_work, 0); 1018 &sc->ath_led_blink_work, 0);
1019 } else if (led->led_type == ATH_LED_RADIO) { 1019 } else if (led->led_type == ATH_LED_RADIO) {
1020 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0); 1020 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 0);
1021 sc->sc_flags |= SC_OP_LED_ON; 1021 sc->sc_flags |= SC_OP_LED_ON;
1022 } else { 1022 } else {
1023 sc->led_on_cnt++; 1023 sc->led_on_cnt++;
@@ -1062,7 +1062,7 @@ static void ath_deinit_leds(struct ath_softc *sc)
1062 ath_unregister_led(&sc->tx_led); 1062 ath_unregister_led(&sc->tx_led);
1063 ath_unregister_led(&sc->rx_led); 1063 ath_unregister_led(&sc->rx_led);
1064 ath_unregister_led(&sc->radio_led); 1064 ath_unregister_led(&sc->radio_led);
1065 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); 1065 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
1066} 1066}
1067 1067
1068static void ath_init_leds(struct ath_softc *sc) 1068static void ath_init_leds(struct ath_softc *sc)
@@ -1070,11 +1070,16 @@ static void ath_init_leds(struct ath_softc *sc)
1070 char *trigger; 1070 char *trigger;
1071 int ret; 1071 int ret;
1072 1072
1073 if (AR_SREV_9287(sc->sc_ah))
1074 sc->sc_ah->led_pin = ATH_LED_PIN_9287;
1075 else
1076 sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
1077
1073 /* Configure gpio 1 for output */ 1078 /* Configure gpio 1 for output */
1074 ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN, 1079 ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
1075 AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 1080 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
1076 /* LED off, active low */ 1081 /* LED off, active low */
1077 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); 1082 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
1078 1083
1079 INIT_DELAYED_WORK(&sc->ath_led_blink_work, ath_led_blink_work); 1084 INIT_DELAYED_WORK(&sc->ath_led_blink_work, ath_led_blink_work);
1080 1085
@@ -1153,9 +1158,9 @@ void ath_radio_enable(struct ath_softc *sc)
1153 ath9k_hw_set_interrupts(ah, sc->imask); 1158 ath9k_hw_set_interrupts(ah, sc->imask);
1154 1159
1155 /* Enable LED */ 1160 /* Enable LED */
1156 ath9k_hw_cfg_output(ah, ATH_LED_PIN, 1161 ath9k_hw_cfg_output(ah, ah->led_pin,
1157 AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 1162 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
1158 ath9k_hw_set_gpio(ah, ATH_LED_PIN, 0); 1163 ath9k_hw_set_gpio(ah, ah->led_pin, 0);
1159 1164
1160 ieee80211_wake_queues(sc->hw); 1165 ieee80211_wake_queues(sc->hw);
1161 ath9k_ps_restore(sc); 1166 ath9k_ps_restore(sc);
@@ -1171,8 +1176,8 @@ void ath_radio_disable(struct ath_softc *sc)
1171 ieee80211_stop_queues(sc->hw); 1176 ieee80211_stop_queues(sc->hw);
1172 1177
1173 /* Disable LED */ 1178 /* Disable LED */
1174 ath9k_hw_set_gpio(ah, ATH_LED_PIN, 1); 1179 ath9k_hw_set_gpio(ah, ah->led_pin, 1);
1175 ath9k_hw_cfg_gpio_input(ah, ATH_LED_PIN); 1180 ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
1176 1181
1177 /* Disable interrupts */ 1182 /* Disable interrupts */
1178 ath9k_hw_set_interrupts(ah, 0); 1183 ath9k_hw_set_interrupts(ah, 0);
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 616bdff2b6a1..685a8cebb468 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -236,7 +236,7 @@ static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state)
236 struct ath_wiphy *aphy = hw->priv; 236 struct ath_wiphy *aphy = hw->priv;
237 struct ath_softc *sc = aphy->sc; 237 struct ath_softc *sc = aphy->sc;
238 238
239 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); 239 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
240 240
241 pci_save_state(pdev); 241 pci_save_state(pdev);
242 pci_disable_device(pdev); 242 pci_disable_device(pdev);
@@ -269,9 +269,9 @@ static int ath_pci_resume(struct pci_dev *pdev)
269 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 269 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
270 270
271 /* Enable LED */ 271 /* Enable LED */
272 ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN, 272 ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
273 AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 273 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
274 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); 274 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
275 275
276 return 0; 276 return 0;
277} 277}