aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Spinadel <david.spinadel@intel.com>2012-03-15 05:22:31 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-04-16 17:36:54 -0400
commitcfd8544e9e350848cf580380418cbebcd09015be (patch)
tree95dd0b1d560dd06b8c4abbfc0d53e2b0589d3ad1
parentbfb45f5422deb3bbf12d8f67f5f76e4b9a7eb766 (diff)
iwlwifi: phy db channel to tx power channel group
Implement mapping of channel to TX power channel group, for sending channel specific data before add context. Signed-off-by: David Spinadel <david.spinadel@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-phy-db.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-phy-db.h6
2 files changed, 24 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/iwlwifi/iwl-phy-db.c
index d65305d08ebf..1a791af82d15 100644
--- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c
+++ b/drivers/net/wireless/iwlwifi/iwl-phy-db.c
@@ -228,8 +228,24 @@ static u16 channel_id_to_papd(u16 ch_id)
228 228
229static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id) 229static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id)
230{ 230{
231 /* TODO David*/ 231 struct iwl_phy_db_chg_txp *txp_chg;
232 return 0; 232 int i;
233 u8 ch_index = ch_id_to_ch_index(ch_id);
234 if (ch_index == 0xff)
235 return 0xff;
236
237 for (i = 0; i < IWL_NUM_TXP_CH_GROUPS; i++) {
238 txp_chg = (void *)phy_db->calib_ch_group_txp[i].data;
239 if (!txp_chg)
240 return 0xff;
241 /*
242 * Looking for the first channel group that its max channel is
243 * higher then wanted channel.
244 */
245 if (le16_to_cpu(txp_chg->max_channel_idx) >= ch_index)
246 return i;
247 }
248 return 0xff;
233} 249}
234 250
235int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, 251int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db,
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.h b/drivers/net/wireless/iwlwifi/iwl-phy-db.h
index ba91a8b28398..5e86305de66a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-phy-db.h
+++ b/drivers/net/wireless/iwlwifi/iwl-phy-db.h
@@ -108,6 +108,12 @@ enum iwl_phy_db_section_type {
108 IWL_PHY_DB_MAX 108 IWL_PHY_DB_MAX
109}; 109};
110 110
111/* for parsing of tx power channel group data that comes from the firmware*/
112struct iwl_phy_db_chg_txp {
113 __le32 space;
114 __le16 max_channel_idx;
115} __packed;
116
111struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd); 117struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd);
112 118
113void iwl_phy_db_free(struct iwl_phy_db *phy_db); 119void iwl_phy_db_free(struct iwl_phy_db *phy_db);