Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170549
b: refs/heads/master
c: f2d0d0e
h: refs/heads/master
i:
  170547: d1d94fd
v: v3
  • Loading branch information
Wey-Yi Guy authored and John W. Linville committed Oct 7, 2009
1 parent 3f51cd3 commit f8c3b1e
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c812ee24855e20f43cf211e51e3eb53fe6dc6f1d
refs/heads/master: f2d0d0e2bab7a325071dbaba3bef51c90868e1e6
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,6 @@ struct iwl_cfg iwl1000_bgn_cfg = {
.max_ll_items = OTP_MAX_LL_ITEMS_1000,
.shadow_ram_support = false,
.ht_greenfield_support = true,
.led_compensation = 51,
};

2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
.mod_params = &iwl3945_mod_params,
.use_isr_legacy = true,
.ht_greenfield_support = false,
.led_compensation = 64,
};

static struct iwl_cfg iwl3945_abg_cfg = {
Expand All @@ -2908,6 +2909,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
.mod_params = &iwl3945_mod_params,
.use_isr_legacy = true,
.ht_greenfield_support = false,
.led_compensation = 64,
};

struct pci_device_id iwl3945_hw_card_ids[] = {
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
.use_isr_legacy = true,
.ht_greenfield_support = false,
.broken_powersave = true,
.led_compensation = 61,
};

/* Module firmware */
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
.valid_rx_ant = ANT_ABC,
.need_pll_cfg = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl5100_bg_cfg = {
Expand All @@ -1673,6 +1674,7 @@ struct iwl_cfg iwl5100_bg_cfg = {
.valid_rx_ant = ANT_AB,
.need_pll_cfg = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl5100_abg_cfg = {
Expand All @@ -1690,6 +1692,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
.valid_rx_ant = ANT_AB,
.need_pll_cfg = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl5100_agn_cfg = {
Expand All @@ -1707,6 +1710,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
.valid_rx_ant = ANT_AB,
.need_pll_cfg = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl5350_agn_cfg = {
Expand All @@ -1724,6 +1728,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
.valid_rx_ant = ANT_ABC,
.need_pll_cfg = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl5150_agn_cfg = {
Expand All @@ -1741,6 +1746,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
.valid_rx_ant = ANT_AB,
.need_pll_cfg = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ struct iwl_cfg iwl6000h_2agn_cfg = {
.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
.shadow_ram_support = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

/*
Expand All @@ -281,6 +282,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
.shadow_ram_support = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl6050_2agn_cfg = {
Expand All @@ -301,6 +303,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
.shadow_ram_support = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl6000_3agn_cfg = {
Expand All @@ -321,6 +324,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
.shadow_ram_support = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

struct iwl_cfg iwl6050_3agn_cfg = {
Expand All @@ -341,6 +345,7 @@ struct iwl_cfg iwl6050_3agn_cfg = {
.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
.shadow_ram_support = true,
.ht_greenfield_support = true,
.led_compensation = 51,
};

MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ struct iwl_mod_params {
* @pa_type: used by 6000 series only to identify the type of Power Amplifier
* @max_ll_items: max number of OTP blocks
* @shadow_ram_support: shadow support for OTP memory
* @led_compensation: compensate on the led on/off time per HW according
* to the deviation to achieve the desired led frequency.
* The detail algorithm is described in iwl-led.c
*
* 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 @@ -255,6 +258,7 @@ struct iwl_cfg {
const bool shadow_ram_support;
const bool ht_greenfield_support;
const bool broken_powersave;
u16 led_compensation;
};

/***************************
Expand Down
33 changes: 31 additions & 2 deletions trunk/drivers/net/wireless/iwlwifi/iwl-led.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@ static const struct {
#define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /* exclude SOLID_ON */
#define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1)

/*
* Adjust led blink rate to compensate on a MAC Clock difference on every HW
* Led blink rate analysis showed an average deviation of 0% on 3945,
* 5% on 4965 HW and 20% on 5000 series and up.
* Need to compensate on the led on/off time per HW according to the deviation
* to achieve the desired led frequency
* The calculation is: (100-averageDeviation)/100 * blinkTime
* For code efficiency the calculation will be:
* compensation = (100 - averageDeviation) * 64 / 100
* NewBlinkTime = (compensation * BlinkTime) / 64
*/
static inline u8 iwl_blink_compensation(struct iwl_priv *priv,
u8 time, u16 compensation)
{
if (!compensation) {
IWL_ERR(priv, "undefined blink compensation: "
"use pre-defined blinking time\n");
return time;
}

return (u8)((time * compensation) >> 6);
}

/* [0-256] -> [0..8] FIXME: we need [0..10] */
static inline int iwl_brightness_to_idx(enum led_brightness brightness)
{
Expand Down Expand Up @@ -114,8 +137,14 @@ static int iwl_led_pattern(struct iwl_priv *priv, int led_id,

BUG_ON(idx > IWL_MAX_BLINK_TBL);

led_cmd.on = blink_tbl[idx].on_time;
led_cmd.off = blink_tbl[idx].off_time;
IWL_DEBUG_LED(priv, "Led blink time compensation= %u\n",
priv->cfg->led_compensation);
led_cmd.on =
iwl_blink_compensation(priv, blink_tbl[idx].on_time,
priv->cfg->led_compensation);
led_cmd.off =
iwl_blink_compensation(priv, blink_tbl[idx].off_time,
priv->cfg->led_compensation);

return iwl_send_led_cmd(priv, &led_cmd);
}
Expand Down

0 comments on commit f8c3b1e

Please sign in to comment.