aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c88
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h25
6 files changed, 128 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index db540910b110..0e027f787fbc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -315,6 +315,7 @@ struct iwl_cfg iwl100_bgn_cfg = {
315 .mod_params = &iwlagn_mod_params, 315 .mod_params = &iwlagn_mod_params,
316 .base_params = &iwl1000_base_params, 316 .base_params = &iwl1000_base_params,
317 .ht_params = &iwl1000_ht_params, 317 .ht_params = &iwl1000_ht_params,
318 .use_new_eeprom_reading = true,
318}; 319};
319 320
320struct iwl_cfg iwl100_bg_cfg = { 321struct iwl_cfg iwl100_bg_cfg = {
@@ -330,6 +331,7 @@ struct iwl_cfg iwl100_bg_cfg = {
330 .ops = &iwl1000_ops, 331 .ops = &iwl1000_ops,
331 .mod_params = &iwlagn_mod_params, 332 .mod_params = &iwlagn_mod_params,
332 .base_params = &iwl1000_base_params, 333 .base_params = &iwl1000_base_params,
334 .use_new_eeprom_reading = true,
333}; 335};
334 336
335MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); 337MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 11e6532fc573..0ceeaac85eda 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -561,6 +561,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
561 .ht_params = &iwl6000_ht_params, 561 .ht_params = &iwl6000_ht_params,
562 .need_dc_calib = true, 562 .need_dc_calib = true,
563 .need_temp_offset_calib = true, 563 .need_temp_offset_calib = true,
564 .use_new_eeprom_reading = true,
564}; 565};
565 566
566struct iwl_cfg iwl6000g2a_2abg_cfg = { 567struct iwl_cfg iwl6000g2a_2abg_cfg = {
@@ -578,6 +579,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
578 .base_params = &iwl6000_base_params, 579 .base_params = &iwl6000_base_params,
579 .need_dc_calib = true, 580 .need_dc_calib = true,
580 .need_temp_offset_calib = true, 581 .need_temp_offset_calib = true,
582 .use_new_eeprom_reading = true,
581}; 583};
582 584
583struct iwl_cfg iwl6000g2a_2bg_cfg = { 585struct iwl_cfg iwl6000g2a_2bg_cfg = {
@@ -595,6 +597,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
595 .base_params = &iwl6000_base_params, 597 .base_params = &iwl6000_base_params,
596 .need_dc_calib = true, 598 .need_dc_calib = true,
597 .need_temp_offset_calib = true, 599 .need_temp_offset_calib = true,
600 .use_new_eeprom_reading = true,
598}; 601};
599 602
600struct iwl_cfg iwl6000g2b_2agn_cfg = { 603struct iwl_cfg iwl6000g2b_2agn_cfg = {
@@ -616,6 +619,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
616 .need_temp_offset_calib = true, 619 .need_temp_offset_calib = true,
617 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 620 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
618 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 621 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
622 .use_new_eeprom_reading = true,
619}; 623};
620 624
621struct iwl_cfg iwl6000g2b_2abg_cfg = { 625struct iwl_cfg iwl6000g2b_2abg_cfg = {
@@ -636,6 +640,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
636 .need_temp_offset_calib = true, 640 .need_temp_offset_calib = true,
637 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 641 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
638 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 642 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
643 .use_new_eeprom_reading = true,
639}; 644};
640 645
641struct iwl_cfg iwl6000g2b_2bgn_cfg = { 646struct iwl_cfg iwl6000g2b_2bgn_cfg = {
@@ -657,6 +662,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
657 .need_temp_offset_calib = true, 662 .need_temp_offset_calib = true,
658 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 663 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
659 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 664 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
665 .use_new_eeprom_reading = true,
660}; 666};
661 667
662struct iwl_cfg iwl6000g2b_2bg_cfg = { 668struct iwl_cfg iwl6000g2b_2bg_cfg = {
@@ -677,6 +683,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
677 .need_temp_offset_calib = true, 683 .need_temp_offset_calib = true,
678 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 684 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
679 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 685 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
686 .use_new_eeprom_reading = true,
680}; 687};
681 688
682struct iwl_cfg iwl6000g2b_bgn_cfg = { 689struct iwl_cfg iwl6000g2b_bgn_cfg = {
@@ -698,6 +705,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
698 .need_temp_offset_calib = true, 705 .need_temp_offset_calib = true,
699 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 706 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
700 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 707 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
708 .use_new_eeprom_reading = true,
701}; 709};
702 710
703struct iwl_cfg iwl6000g2b_bg_cfg = { 711struct iwl_cfg iwl6000g2b_bg_cfg = {
@@ -718,6 +726,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
718 .need_temp_offset_calib = true, 726 .need_temp_offset_calib = true,
719 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 727 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
720 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 728 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
729 .use_new_eeprom_reading = true,
721}; 730};
722 731
723/* 732/*
@@ -804,6 +813,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
804 .base_params = &iwl6050_base_params, 813 .base_params = &iwl6050_base_params,
805 .ht_params = &iwl6000_ht_params, 814 .ht_params = &iwl6000_ht_params,
806 .need_dc_calib = true, 815 .need_dc_calib = true,
816 .use_new_eeprom_reading = true,
807}; 817};
808 818
809struct iwl_cfg iwl6050_2abg_cfg = { 819struct iwl_cfg iwl6050_2abg_cfg = {
@@ -857,6 +867,7 @@ struct iwl_cfg iwl130_bgn_cfg = {
857 .need_dc_calib = true, 867 .need_dc_calib = true,
858 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 868 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
859 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 869 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
870 .use_new_eeprom_reading = true,
860}; 871};
861 872
862struct iwl_cfg iwl130_bg_cfg = { 873struct iwl_cfg iwl130_bg_cfg = {
@@ -876,6 +887,7 @@ struct iwl_cfg iwl130_bg_cfg = {
876 .need_dc_calib = true, 887 .need_dc_calib = true,
877 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 888 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
878 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 889 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
890 .use_new_eeprom_reading = true,
879}; 891};
880 892
881MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); 893MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
index a650baba0809..9eeeda18748d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
@@ -392,7 +392,7 @@ static s8 iwl_update_channel_txpower(struct iwl_priv *priv,
392/** 392/**
393 * iwlcore_eeprom_enhanced_txpower: process enhanced tx power info 393 * iwlcore_eeprom_enhanced_txpower: process enhanced tx power info
394 */ 394 */
395void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) 395static void iwlcore_eeprom_enhanced_txpower_old(struct iwl_priv *priv)
396{ 396{
397 int eeprom_section_count = 0; 397 int eeprom_section_count = 0;
398 int section, element; 398 int section, element;
@@ -419,7 +419,8 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
419 * always check for valid entry before process 419 * always check for valid entry before process
420 * the information 420 * the information
421 */ 421 */
422 if (!enhanced_txpower->common || enhanced_txpower->reserved) 422 if (!(enhanced_txpower->flags || enhanced_txpower->channel) ||
423 enhanced_txpower->delta_20_in_40)
423 continue; 424 continue;
424 425
425 for (element = 0; element < eeprom_section_count; element++) { 426 for (element = 0; element < eeprom_section_count; element++) {
@@ -452,3 +453,86 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
452 } 453 }
453 } 454 }
454} 455}
456
457static void
458iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv,
459 struct iwl_eeprom_enhanced_txpwr *txp,
460 s8 max_txpower_avg)
461{
462 int ch_idx;
463 bool is_ht40 = txp->flags & IWL_EEPROM_ENH_TXP_FL_40MHZ;
464 enum ieee80211_band band;
465
466 band = txp->flags & IWL_EEPROM_ENH_TXP_FL_BAND_52G ?
467 IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ;
468
469 for (ch_idx = 0; ch_idx < priv->channel_count; ch_idx++) {
470 struct iwl_channel_info *ch_info = &priv->channel_info[ch_idx];
471
472 /* update matching channel or from common data only */
473 if (txp->channel != 0 && ch_info->channel != txp->channel)
474 continue;
475
476 /* update matching band only */
477 if (band != ch_info->band)
478 continue;
479
480 if (ch_info->max_power_avg < max_txpower_avg && !is_ht40) {
481 ch_info->max_power_avg = max_txpower_avg;
482 ch_info->curr_txpow = max_txpower_avg;
483 ch_info->scan_power = max_txpower_avg;
484 }
485
486 if (is_ht40 && ch_info->ht40_max_power_avg < max_txpower_avg)
487 ch_info->ht40_max_power_avg = max_txpower_avg;
488 }
489}
490
491#define EEPROM_TXP_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT)
492#define EEPROM_TXP_ENTRY_LEN sizeof(struct iwl_eeprom_enhanced_txpwr)
493#define EEPROM_TXP_SZ_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT_SIZE)
494
495static void iwlcore_eeprom_enhanced_txpower_new(struct iwl_priv *priv)
496{
497 struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
498 int idx, entries;
499 __le16 *txp_len;
500 s8 max_txp_avg, max_txp_avg_halfdbm;
501
502 BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8);
503
504 /* the length is in 16-bit words, but we want entries */
505 txp_len = (__le16 *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_SZ_OFFS);
506 entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN;
507
508 txp_array = (void *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_OFFS);
509 for (idx = 0; idx < entries; idx++) {
510 txp = &txp_array[idx];
511
512 /* skip invalid entries */
513 if (!(txp->flags & IWL_EEPROM_ENH_TXP_FL_VALID))
514 continue;
515
516 max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx,
517 &max_txp_avg_halfdbm);
518
519 /*
520 * Update the user limit values values to the highest
521 * power supported by any channel
522 */
523 if (max_txp_avg > priv->tx_power_user_lmt)
524 priv->tx_power_user_lmt = max_txp_avg;
525 if (max_txp_avg_halfdbm > priv->tx_power_lmt_in_half_dbm)
526 priv->tx_power_lmt_in_half_dbm = max_txp_avg_halfdbm;
527
528 iwlcore_eeprom_enh_txp_read_element(priv, txp, max_txp_avg);
529 }
530}
531
532void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
533{
534 if (priv->cfg->use_new_eeprom_reading)
535 iwlcore_eeprom_enhanced_txpower_new(priv);
536 else
537 iwlcore_eeprom_enhanced_txpower_old(priv);
538}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index b555edd53354..554afb7d9670 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -569,6 +569,12 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
569 case INDIRECT_REGULATORY: 569 case INDIRECT_REGULATORY:
570 offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY); 570 offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY);
571 break; 571 break;
572 case INDIRECT_TXP_LIMIT:
573 offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT);
574 break;
575 case INDIRECT_TXP_LIMIT_SIZE:
576 offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE);
577 break;
572 case INDIRECT_CALIBRATION: 578 case INDIRECT_CALIBRATION:
573 offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION); 579 offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION);
574 break; 580 break;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 64527def059f..954ecc2c34c4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -390,6 +390,7 @@ struct iwl_cfg {
390 const bool need_temp_offset_calib; /* if used set to true */ 390 const bool need_temp_offset_calib; /* if used set to true */
391 u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; 391 u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
392 u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; 392 u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
393 const bool use_new_eeprom_reading; /* temporary, remove later */
393}; 394};
394 395
395/*************************** 396/***************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index d9b590625ae4..e3a279d2d0b6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -120,6 +120,17 @@ struct iwl_eeprom_channel {
120 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ 120 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
121} __packed; 121} __packed;
122 122
123enum iwl_eeprom_enhanced_txpwr_flags {
124 IWL_EEPROM_ENH_TXP_FL_VALID = BIT(0),
125 IWL_EEPROM_ENH_TXP_FL_BAND_52G = BIT(1),
126 IWL_EEPROM_ENH_TXP_FL_OFDM = BIT(2),
127 IWL_EEPROM_ENH_TXP_FL_40MHZ = BIT(3),
128 IWL_EEPROM_ENH_TXP_FL_HT_AP = BIT(4),
129 IWL_EEPROM_ENH_TXP_FL_RES1 = BIT(5),
130 IWL_EEPROM_ENH_TXP_FL_RES2 = BIT(6),
131 IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE = BIT(7),
132};
133
123/** 134/**
124 * iwl_eeprom_enhanced_txpwr structure 135 * iwl_eeprom_enhanced_txpwr structure
125 * This structure presents the enhanced regulatory tx power limit layout 136 * This structure presents the enhanced regulatory tx power limit layout
@@ -127,21 +138,23 @@ struct iwl_eeprom_channel {
127 * Enhanced regulatory tx power portion of eeprom image can be broken down 138 * Enhanced regulatory tx power portion of eeprom image can be broken down
128 * into individual structures; each one is 8 bytes in size and contain the 139 * into individual structures; each one is 8 bytes in size and contain the
129 * following information 140 * following information
130 * @common: (desc + channel) not used by driver, should _NOT_ be "zero" 141 * @flags: entry flags
142 * @channel: channel number
131 * @chain_a_max_pwr: chain a max power in 1/2 dBm 143 * @chain_a_max_pwr: chain a max power in 1/2 dBm
132 * @chain_b_max_pwr: chain b max power in 1/2 dBm 144 * @chain_b_max_pwr: chain b max power in 1/2 dBm
133 * @chain_c_max_pwr: chain c max power in 1/2 dBm 145 * @chain_c_max_pwr: chain c max power in 1/2 dBm
134 * @reserved: not used, should be "zero" 146 * @delta_20_in_40: 20-in-40 deltas (hi/lo)
135 * @mimo2_max_pwr: mimo2 max power in 1/2 dBm 147 * @mimo2_max_pwr: mimo2 max power in 1/2 dBm
136 * @mimo3_max_pwr: mimo3 max power in 1/2 dBm 148 * @mimo3_max_pwr: mimo3 max power in 1/2 dBm
137 * 149 *
138 */ 150 */
139struct iwl_eeprom_enhanced_txpwr { 151struct iwl_eeprom_enhanced_txpwr {
140 __le16 common; 152 u8 flags;
153 u8 channel;
141 s8 chain_a_max; 154 s8 chain_a_max;
142 s8 chain_b_max; 155 s8 chain_b_max;
143 s8 chain_c_max; 156 s8 chain_c_max;
144 s8 reserved; 157 u8 delta_20_in_40;
145 s8 mimo2_max; 158 s8 mimo2_max;
146 s8 mimo3_max; 159 s8 mimo3_max;
147} __packed; 160} __packed;
@@ -186,6 +199,8 @@ struct iwl_eeprom_enhanced_txpwr {
186#define EEPROM_LINK_CALIBRATION (2*0x67) 199#define EEPROM_LINK_CALIBRATION (2*0x67)
187#define EEPROM_LINK_PROCESS_ADJST (2*0x68) 200#define EEPROM_LINK_PROCESS_ADJST (2*0x68)
188#define EEPROM_LINK_OTHERS (2*0x69) 201#define EEPROM_LINK_OTHERS (2*0x69)
202#define EEPROM_LINK_TXP_LIMIT (2*0x6a)
203#define EEPROM_LINK_TXP_LIMIT_SIZE (2*0x6b)
189 204
190/* agn regulatory - indirect access */ 205/* agn regulatory - indirect access */
191#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\ 206#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\
@@ -389,6 +404,8 @@ struct iwl_eeprom_calib_info {
389#define INDIRECT_CALIBRATION 0x00040000 404#define INDIRECT_CALIBRATION 0x00040000
390#define INDIRECT_PROCESS_ADJST 0x00050000 405#define INDIRECT_PROCESS_ADJST 0x00050000
391#define INDIRECT_OTHERS 0x00060000 406#define INDIRECT_OTHERS 0x00060000
407#define INDIRECT_TXP_LIMIT 0x00070000
408#define INDIRECT_TXP_LIMIT_SIZE 0x00080000
392#define INDIRECT_ADDRESS 0x00100000 409#define INDIRECT_ADDRESS 0x00100000
393 410
394/* General */ 411/* General */