summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/iwl-phy-db.c
diff options
context:
space:
mode:
authorDavid Spinadel <david.spinadel@intel.com>2012-03-15 13:22:31 +0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-04-17 01:36:54 +0400
commitcfd8544e9e350848cf580380418cbebcd09015be (patch)
tree95dd0b1d560dd06b8c4abbfc0d53e2b0589d3ad1 /drivers/net/wireless/iwlwifi/iwl-phy-db.c
parentbfb45f5422deb3bbf12d8f67f5f76e4b9a7eb766 (diff)
downloadlinux-cfd8544e9e350848cf580380418cbebcd09015be.tar.xz
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-phy-db.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-phy-db.c20
1 files changed, 18 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)
static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id)
{
- /* TODO David*/
- return 0;
+ struct iwl_phy_db_chg_txp *txp_chg;
+ int i;
+ u8 ch_index = ch_id_to_ch_index(ch_id);
+ if (ch_index == 0xff)
+ return 0xff;
+
+ for (i = 0; i < IWL_NUM_TXP_CH_GROUPS; i++) {
+ txp_chg = (void *)phy_db->calib_ch_group_txp[i].data;
+ if (!txp_chg)
+ return 0xff;
+ /*
+ * Looking for the first channel group that its max channel is
+ * higher then wanted channel.
+ */
+ if (le16_to_cpu(txp_chg->max_channel_idx) >= ch_index)
+ return i;
+ }
+ return 0xff;
}
int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db,