iwlagn: More detail tx power logging
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 3 Dec 2010 18:33:36 +0000 (10:33 -0800)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Mon, 13 Dec 2010 23:53:09 +0000 (15:53 -0800)
For enhanced tx power table in EEPROM, add more detail logging
to help debugging

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c

index 77d92b71be81fb5fc882054b568e85985048ccc5..97906dd442e628ea733dec41f6aac79c26b7c8d1 100644 (file)
@@ -203,15 +203,6 @@ static s8 iwl_get_max_txpower_avg(struct iwl_priv *priv,
 {
        s8 max_txpower_avg = 0; /* (dBm) */
 
-       IWL_DEBUG_EEPROM(priv, "%d - "
-                       "chain_a: %d dB chain_b: %d dB "
-                       "chain_c: %d dB mimo2: %d dB mimo3: %d dB\n",
-                       element,
-                       enhanced_txpower[element].chain_a_max >> 1,
-                       enhanced_txpower[element].chain_b_max >> 1,
-                       enhanced_txpower[element].chain_c_max >> 1,
-                       enhanced_txpower[element].mimo2_max >> 1,
-                       enhanced_txpower[element].mimo3_max >> 1);
        /* Take the highest tx power from any valid chains */
        if ((priv->cfg->valid_tx_ant & ANT_A) &&
            (enhanced_txpower[element].chain_a_max > max_txpower_avg))
@@ -279,6 +270,9 @@ iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv,
 #define EEPROM_TXP_ENTRY_LEN sizeof(struct iwl_eeprom_enhanced_txpwr)
 #define EEPROM_TXP_SZ_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT_SIZE)
 
+#define TXP_CHECK_AND_PRINT(x) ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) \
+                           ? # x " " : "")
+
 void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
 {
        struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
@@ -293,13 +287,39 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
        entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN;
 
        txp_array = (void *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_OFFS);
+
        for (idx = 0; idx < entries; idx++) {
                txp = &txp_array[idx];
-
                /* skip invalid entries */
                if (!(txp->flags & IWL_EEPROM_ENH_TXP_FL_VALID))
                        continue;
 
+               IWL_DEBUG_EEPROM(priv, "%s %d:\t %s%s%s%s%s%s%s%s (0x%02x)\n",
+                                (txp->channel && (txp->flags &
+                                       IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE)) ?
+                                       "Common " : (txp->channel) ?
+                                       "Channel" : "Common",
+                                (txp->channel),
+                                TXP_CHECK_AND_PRINT(VALID),
+                                TXP_CHECK_AND_PRINT(BAND_52G),
+                                TXP_CHECK_AND_PRINT(OFDM),
+                                TXP_CHECK_AND_PRINT(40MHZ),
+                                TXP_CHECK_AND_PRINT(HT_AP),
+                                TXP_CHECK_AND_PRINT(RES1),
+                                TXP_CHECK_AND_PRINT(RES2),
+                                TXP_CHECK_AND_PRINT(COMMON_TYPE),
+                                txp->flags);
+               IWL_DEBUG_EEPROM(priv, "\t\t chain_A: 0x%02x "
+                                "chain_B: 0X%02x chain_C: 0X%02x\n",
+                                txp->chain_a_max, txp->chain_b_max,
+                                txp->chain_c_max);
+               IWL_DEBUG_EEPROM(priv, "\t\t MIMO2: 0x%02x "
+                                "MIMO3: 0x%02x High 20_on_40: 0x%02x "
+                                "Low 20_on_40: 0x%02x\n",
+                                txp->mimo2_max, txp->mimo3_max,
+                                ((txp->delta_20_in_40 & 0xf0) >> 4),
+                                (txp->delta_20_in_40 & 0x0f));
+
                max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx,
                                                      &max_txp_avg_halfdbm);