Skip to content

Commit

Permalink
iwlwifi: change default led mode for different devices
Browse files Browse the repository at this point in the history
Set the default led mode for different devices.

For the newer devices such as 6000g2a, 6000g2b and newer,
the default led mode is On/Off instead of blinking.

The led_mode still can be control through module parameter
  0: system default
  1: On/Off
  2: blinking

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
  • Loading branch information
Wey-Yi Guy committed Nov 16, 2010
1 parent 05433df commit 564b344
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 6 deletions.
4 changes: 4 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ struct iwl_cfg iwl1000_bgn_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl1000_base_params,
.ht_params = &iwl1000_ht_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl1000_bg_cfg = {
Expand All @@ -302,6 +303,7 @@ struct iwl_cfg iwl1000_bg_cfg = {
.ops = &iwl1000_ops,
.mod_params = &iwlagn_mod_params,
.base_params = &iwl1000_base_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl100_bgn_cfg = {
Expand All @@ -318,6 +320,7 @@ struct iwl_cfg iwl100_bgn_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl1000_base_params,
.ht_params = &iwl1000_ht_params,
.led_mode = IWL_LED_RF_STATE,
};

struct iwl_cfg iwl100_bg_cfg = {
Expand All @@ -333,6 +336,7 @@ struct iwl_cfg iwl100_bg_cfg = {
.ops = &iwl1000_ops,
.mod_params = &iwlagn_mod_params,
.base_params = &iwl1000_base_params,
.led_mode = IWL_LED_RF_STATE,
};

MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
.ops = &iwl3945_ops,
.mod_params = &iwl3945_mod_params,
.base_params = &iwl3945_base_params,
.led_mode = IWL_LED_BLINK,
};

static struct iwl_cfg iwl3945_abg_cfg = {
Expand All @@ -2800,6 +2801,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
.ops = &iwl3945_ops,
.mod_params = &iwl3945_mod_params,
.base_params = &iwl3945_base_params,
.led_mode = IWL_LED_BLINK,
};

DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = {
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -2636,6 +2636,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
.ops = &iwl4965_ops,
.mod_params = &iwlagn_mod_params,
.base_params = &iwl4965_base_params,
.led_mode = IWL_LED_BLINK,
/*
* Force use of chains B and C for scan RX on 5 GHz band
* because the device has off-channel reception on chain A.
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl5000_base_params,
.ht_params = &iwl5000_ht_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl5100_bgn_cfg = {
Expand All @@ -552,6 +553,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl5000_base_params,
.ht_params = &iwl5000_ht_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl5100_abg_cfg = {
Expand All @@ -567,6 +569,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
.ops = &iwl5000_ops,
.mod_params = &iwlagn_mod_params,
.base_params = &iwl5000_base_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl5100_agn_cfg = {
Expand All @@ -583,6 +586,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl5000_base_params,
.ht_params = &iwl5000_ht_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl5350_agn_cfg = {
Expand All @@ -599,6 +603,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl5000_base_params,
.ht_params = &iwl5000_ht_params,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl5150_agn_cfg = {
Expand All @@ -616,6 +621,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
.base_params = &iwl5000_base_params,
.ht_params = &iwl5000_ht_params,
.need_dc_calib = true,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl5150_abg_cfg = {
Expand All @@ -632,6 +638,7 @@ struct iwl_cfg iwl5150_abg_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl5000_base_params,
.need_dc_calib = true,
.led_mode = IWL_LED_BLINK,
};

MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
Expand Down
18 changes: 18 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
};

struct iwl_cfg iwl6000g2a_2abg_cfg = {
Expand All @@ -584,6 +585,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
.base_params = &iwl6000_base_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
};

struct iwl_cfg iwl6000g2a_2bg_cfg = {
Expand All @@ -601,6 +603,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
.base_params = &iwl6000_base_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
};

struct iwl_cfg iwl6000g2b_2agn_cfg = {
Expand All @@ -620,6 +623,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -640,6 +644,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
.bt_params = &iwl6000_bt_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -661,6 +666,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -681,6 +687,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
.bt_params = &iwl6000_bt_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -702,6 +709,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -722,6 +730,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
.bt_params = &iwl6000_bt_params,
.need_dc_calib = true,
.need_temp_offset_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -744,6 +753,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
.base_params = &iwl6000_base_params,
.ht_params = &iwl6000_ht_params,
.pa_type = IWL_PA_INTERNAL,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl6000i_2abg_cfg = {
Expand All @@ -760,6 +770,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl6000_base_params,
.pa_type = IWL_PA_INTERNAL,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl6000i_2bg_cfg = {
Expand All @@ -776,6 +787,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl6000_base_params,
.pa_type = IWL_PA_INTERNAL,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl6050_2agn_cfg = {
Expand All @@ -793,6 +805,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
.base_params = &iwl6050_base_params,
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl6050g2_bgn_cfg = {
Expand All @@ -810,6 +823,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
.base_params = &iwl6050_base_params,
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.led_mode = IWL_LED_RF_STATE,
};

struct iwl_cfg iwl6050_2abg_cfg = {
Expand All @@ -826,6 +840,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
.mod_params = &iwlagn_mod_params,
.base_params = &iwl6050_base_params,
.need_dc_calib = true,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl6000_3agn_cfg = {
Expand All @@ -843,6 +858,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
.base_params = &iwl6000_base_params,
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.led_mode = IWL_LED_BLINK,
};

struct iwl_cfg iwl130_bgn_cfg = {
Expand All @@ -861,6 +877,7 @@ struct iwl_cfg iwl130_bgn_cfg = {
.bt_params = &iwl6000_bt_params,
.ht_params = &iwl6000_ht_params,
.need_dc_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand All @@ -880,6 +897,7 @@ struct iwl_cfg iwl130_bg_cfg = {
.base_params = &iwl6000_coex_base_params,
.bt_params = &iwl6000_bt_params,
.need_dc_calib = true,
.led_mode = IWL_LED_RF_STATE,
/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
.scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
};
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ struct iwl_ht_params {
* @need_dc_calib: need to perform init dc calibration
* @need_temp_offset_calib: need to perform temperature offset calibration
* @scan_antennas: available antenna for scan operation
* @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off)
*
* We enable the driver to be backward compatible wrt API version. The
* driver specifies which APIs it supports (with @ucode_api_max being the
Expand Down Expand Up @@ -409,6 +410,7 @@ struct iwl_cfg {
const bool need_temp_offset_calib; /* if used set to true */
u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
enum iwl_led_mode led_mode;
};

/***************************
Expand Down
10 changes: 6 additions & 4 deletions drivers/net/wireless/iwlwifi/iwl-led.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@
/* default: IWL_LED_BLINK(0) using blinking index table */
static int led_mode;
module_param(led_mode, int, S_IRUGO);
MODULE_PARM_DESC(led_mode, "led mode: 0=blinking, 1=On(RF On)/Off(RF Off), "
"(default 0)");

MODULE_PARM_DESC(led_mode, "led mode: 0=system default, "
"1=On(RF On)/Off(RF Off), 2=blinking");

static const struct {
u16 tpt; /* Mb/s */
Expand Down Expand Up @@ -128,7 +127,7 @@ EXPORT_SYMBOL(iwl_led_start);
int iwl_led_associate(struct iwl_priv *priv)
{
IWL_DEBUG_LED(priv, "Associated\n");
if (led_mode == IWL_LED_BLINK)
if (priv->cfg->led_mode == IWL_LED_BLINK)
priv->allow_blinking = 1;
priv->last_blink_time = jiffies;

Expand Down Expand Up @@ -223,5 +222,8 @@ void iwl_leds_init(struct iwl_priv *priv)
priv->last_blink_rate = 0;
priv->last_blink_time = 0;
priv->allow_blinking = 0;
if (led_mode != IWL_LED_DEFAULT &&
led_mode != priv->cfg->led_mode)
priv->cfg->led_mode = led_mode;
}
EXPORT_SYMBOL(iwl_leds_init);
6 changes: 4 additions & 2 deletions drivers/net/wireless/iwlwifi/iwl-led.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ enum led_type {

/*
* LED mode
* IWL_LED_BLINK: adjust led blink rate based on blink table
* IWL_LED_DEFAULT: use system default
* IWL_LED_RF_STATE: turn LED on/off based on RF state
* LED ON = RF ON
* LED OFF = RF OFF
* IWL_LED_BLINK: adjust led blink rate based on blink table
*/
enum iwl_led_mode {
IWL_LED_BLINK,
IWL_LED_DEFAULT,
IWL_LED_RF_STATE,
IWL_LED_BLINK,
};

void iwl_leds_init(struct iwl_priv *priv);
Expand Down

0 comments on commit 564b344

Please sign in to comment.