diff options
| author | Esti Kummer <ester.kummer@intel.com> | 2008-07-18 01:53:07 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:09 -0400 |
| commit | c785d1d5018b93878a9280b0c04df96682cc6eff (patch) | |
| tree | cadf03b8975ed742f25c965ec50e9a5488f10a35 | |
| parent | 3ce84b9f2f495f59c4a4e68d814c348eaa497f65 (diff) | |
iwlwifi: set led register in disassociation
This patch sets the led register in disassociation flow according to
rf-kill state : off - in case of rf_kill, on - otherwise.
Signed-off-by: Esti Kummer <ester.kummer@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-led.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index 61250e6a7d1b..0a01f091c516 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
| @@ -161,12 +161,32 @@ int iwl4965_led_off(struct iwl_priv *priv, int led_id) | |||
| 161 | /* Set led register off */ | 161 | /* Set led register off */ |
| 162 | static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id) | 162 | static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id) |
| 163 | { | 163 | { |
| 164 | IWL_DEBUG_LED("radio off\n"); | 164 | IWL_DEBUG_LED("LED Reg off\n"); |
| 165 | iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF); | 165 | iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF); |
| 166 | return 0; | 166 | return 0; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | /* | 169 | /* |
| 170 | * Set led register in case of disassociation according to rfkill state | ||
| 171 | */ | ||
| 172 | static int iwl_led_associate(struct iwl_priv *priv, int led_id) | ||
| 173 | { | ||
| 174 | IWL_DEBUG_LED("Associated\n"); | ||
| 175 | priv->allow_blinking = 1; | ||
| 176 | return iwl4965_led_on_reg(priv, led_id); | ||
| 177 | } | ||
| 178 | static int iwl_led_disassociate(struct iwl_priv *priv, int led_id) | ||
| 179 | { | ||
| 180 | priv->allow_blinking = 0; | ||
| 181 | if (iwl_is_rfkill(priv)) | ||
| 182 | iwl4965_led_off_reg(priv, led_id); | ||
| 183 | else | ||
| 184 | iwl4965_led_on_reg(priv, led_id); | ||
| 185 | |||
| 186 | return 0; | ||
| 187 | } | ||
| 188 | |||
| 189 | /* | ||
| 170 | * brightness call back function for Tx/Rx LED | 190 | * brightness call back function for Tx/Rx LED |
| 171 | */ | 191 | */ |
| 172 | static int iwl_led_associated(struct iwl_priv *priv, int led_id) | 192 | static int iwl_led_associated(struct iwl_priv *priv, int led_id) |
| @@ -199,16 +219,10 @@ static void iwl_led_brightness_set(struct led_classdev *led_cdev, | |||
| 199 | led_type_str[led->type], brightness); | 219 | led_type_str[led->type], brightness); |
| 200 | switch (brightness) { | 220 | switch (brightness) { |
| 201 | case LED_FULL: | 221 | case LED_FULL: |
| 202 | if (led->type == IWL_LED_TRG_ASSOC) | ||
| 203 | priv->allow_blinking = 1; | ||
| 204 | |||
| 205 | if (led->led_on) | 222 | if (led->led_on) |
| 206 | led->led_on(priv, IWL_LED_LINK); | 223 | led->led_on(priv, IWL_LED_LINK); |
| 207 | break; | 224 | break; |
| 208 | case LED_OFF: | 225 | case LED_OFF: |
| 209 | if (led->type == IWL_LED_TRG_ASSOC) | ||
| 210 | priv->allow_blinking = 0; | ||
| 211 | |||
| 212 | if (led->led_off) | 226 | if (led->led_off) |
| 213 | led->led_off(priv, IWL_LED_LINK); | 227 | led->led_off(priv, IWL_LED_LINK); |
| 214 | break; | 228 | break; |
| @@ -284,12 +298,6 @@ static int iwl_get_blink_rate(struct iwl_priv *priv) | |||
| 284 | return i; | 298 | return i; |
| 285 | } | 299 | } |
| 286 | 300 | ||
| 287 | static inline int is_rf_kill(struct iwl_priv *priv) | ||
| 288 | { | ||
| 289 | return test_bit(STATUS_RF_KILL_HW, &priv->status) || | ||
| 290 | test_bit(STATUS_RF_KILL_SW, &priv->status); | ||
| 291 | } | ||
| 292 | |||
| 293 | /* | 301 | /* |
| 294 | * this function called from handler. Since setting Led command can | 302 | * this function called from handler. Since setting Led command can |
| 295 | * happen very frequent we postpone led command to be called from | 303 | * happen very frequent we postpone led command to be called from |
| @@ -303,7 +311,7 @@ void iwl_leds_background(struct iwl_priv *priv) | |||
| 303 | priv->last_blink_time = 0; | 311 | priv->last_blink_time = 0; |
| 304 | return; | 312 | return; |
| 305 | } | 313 | } |
| 306 | if (is_rf_kill(priv)) { | 314 | if (iwl_is_rfkill(priv)) { |
| 307 | priv->last_blink_time = 0; | 315 | priv->last_blink_time = 0; |
| 308 | return; | 316 | return; |
| 309 | } | 317 | } |
| @@ -366,8 +374,8 @@ int iwl_leds_register(struct iwl_priv *priv) | |||
| 366 | IWL_LED_TRG_ASSOC, 0, name, trigger); | 374 | IWL_LED_TRG_ASSOC, 0, name, trigger); |
| 367 | 375 | ||
| 368 | /* for assoc always turn led on */ | 376 | /* for assoc always turn led on */ |
| 369 | priv->led[IWL_LED_TRG_ASSOC].led_on = iwl4965_led_on_reg; | 377 | priv->led[IWL_LED_TRG_ASSOC].led_on = iwl_led_associate; |
| 370 | priv->led[IWL_LED_TRG_ASSOC].led_off = iwl4965_led_on_reg; | 378 | priv->led[IWL_LED_TRG_ASSOC].led_off = iwl_led_disassociate; |
| 371 | priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL; | 379 | priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL; |
| 372 | 380 | ||
| 373 | if (ret) | 381 | if (ret) |
