Lines Matching refs:phy_db
62 struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db), in iwl_phy_db_init() local
65 if (!phy_db) in iwl_phy_db_init()
66 return phy_db; in iwl_phy_db_init()
68 phy_db->trans = trans; in iwl_phy_db_init()
70 phy_db->n_group_txp = -1; in iwl_phy_db_init()
71 phy_db->n_group_papd = -1; in iwl_phy_db_init()
74 return phy_db; in iwl_phy_db_init()
83 iwl_phy_db_get_section(struct iwl_phy_db *phy_db, in iwl_phy_db_get_section() argument
87 if (!phy_db || type >= IWL_PHY_DB_MAX) in iwl_phy_db_get_section()
92 return &phy_db->cfg; in iwl_phy_db_get_section()
94 return &phy_db->calib_nch; in iwl_phy_db_get_section()
96 if (chg_id >= phy_db->n_group_papd) in iwl_phy_db_get_section()
98 return &phy_db->calib_ch_group_papd[chg_id]; in iwl_phy_db_get_section()
100 if (chg_id >= phy_db->n_group_txp) in iwl_phy_db_get_section()
102 return &phy_db->calib_ch_group_txp[chg_id]; in iwl_phy_db_get_section()
109 static void iwl_phy_db_free_section(struct iwl_phy_db *phy_db, in iwl_phy_db_free_section() argument
114 iwl_phy_db_get_section(phy_db, type, chg_id); in iwl_phy_db_free_section()
123 void iwl_phy_db_free(struct iwl_phy_db *phy_db) in iwl_phy_db_free() argument
127 if (!phy_db) in iwl_phy_db_free()
130 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CFG, 0); in iwl_phy_db_free()
131 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_NCH, 0); in iwl_phy_db_free()
133 for (i = 0; i < phy_db->n_group_papd; i++) in iwl_phy_db_free()
134 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CHG_PAPD, i); in iwl_phy_db_free()
135 kfree(phy_db->calib_ch_group_papd); in iwl_phy_db_free()
137 for (i = 0; i < phy_db->n_group_txp; i++) in iwl_phy_db_free()
138 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CHG_TXP, i); in iwl_phy_db_free()
139 kfree(phy_db->calib_ch_group_txp); in iwl_phy_db_free()
141 kfree(phy_db); in iwl_phy_db_free()
145 int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, in iwl_phy_db_set_section() argument
165 if (!phy_db) in iwl_phy_db_set_section()
170 if (phy_db && !phy_db->calib_ch_group_papd) { in iwl_phy_db_set_section()
175 phy_db->calib_ch_group_papd = kcalloc(chg_id + 1, in iwl_phy_db_set_section()
178 if (!phy_db->calib_ch_group_papd) in iwl_phy_db_set_section()
180 phy_db->n_group_papd = chg_id + 1; in iwl_phy_db_set_section()
184 if (phy_db && !phy_db->calib_ch_group_txp) { in iwl_phy_db_set_section()
189 phy_db->calib_ch_group_txp = kcalloc(chg_id + 1, in iwl_phy_db_set_section()
192 if (!phy_db->calib_ch_group_txp) in iwl_phy_db_set_section()
194 phy_db->n_group_txp = chg_id + 1; in iwl_phy_db_set_section()
198 entry = iwl_phy_db_get_section(phy_db, type, chg_id); in iwl_phy_db_set_section()
211 IWL_DEBUG_INFO(phy_db->trans, in iwl_phy_db_set_section()
258 static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id) in channel_id_to_txp() argument
266 for (i = 0; i < phy_db->n_group_txp; i++) { in channel_id_to_txp()
267 txp_chg = (void *)phy_db->calib_ch_group_txp[i].data; in channel_id_to_txp()
280 int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, in iwl_phy_db_get_section_data() argument
286 if (!phy_db) in iwl_phy_db_get_section_data()
293 ch_group_id = channel_id_to_txp(phy_db, ch_id); in iwl_phy_db_get_section_data()
295 entry = iwl_phy_db_get_section(phy_db, type, ch_group_id); in iwl_phy_db_get_section_data()
302 IWL_DEBUG_INFO(phy_db->trans, in iwl_phy_db_get_section_data()
309 static int iwl_send_phy_db_cmd(struct iwl_phy_db *phy_db, u16 type, in iwl_send_phy_db_cmd() argument
317 IWL_DEBUG_INFO(phy_db->trans, in iwl_send_phy_db_cmd()
332 return iwl_trans_send_cmd(phy_db->trans, &cmd); in iwl_send_phy_db_cmd()
336 struct iwl_phy_db *phy_db, in iwl_phy_db_send_all_channel_groups() argument
346 entry = iwl_phy_db_get_section(phy_db, in iwl_phy_db_send_all_channel_groups()
356 err = iwl_send_phy_db_cmd(phy_db, in iwl_phy_db_send_all_channel_groups()
361 IWL_ERR(phy_db->trans, in iwl_phy_db_send_all_channel_groups()
367 IWL_DEBUG_INFO(phy_db->trans, in iwl_phy_db_send_all_channel_groups()
375 int iwl_send_phy_db_data(struct iwl_phy_db *phy_db) in iwl_send_phy_db_data() argument
381 IWL_DEBUG_INFO(phy_db->trans, in iwl_send_phy_db_data()
385 err = iwl_phy_db_get_section_data(phy_db, IWL_PHY_DB_CFG, in iwl_send_phy_db_data()
388 IWL_ERR(phy_db->trans, "Cannot get Phy DB cfg section\n"); in iwl_send_phy_db_data()
392 err = iwl_send_phy_db_cmd(phy_db, IWL_PHY_DB_CFG, size, data); in iwl_send_phy_db_data()
394 IWL_ERR(phy_db->trans, in iwl_send_phy_db_data()
399 err = iwl_phy_db_get_section_data(phy_db, IWL_PHY_DB_CALIB_NCH, in iwl_send_phy_db_data()
402 IWL_ERR(phy_db->trans, in iwl_send_phy_db_data()
407 err = iwl_send_phy_db_cmd(phy_db, IWL_PHY_DB_CALIB_NCH, size, data); in iwl_send_phy_db_data()
409 IWL_ERR(phy_db->trans, in iwl_send_phy_db_data()
415 err = iwl_phy_db_send_all_channel_groups(phy_db, in iwl_send_phy_db_data()
417 phy_db->n_group_papd); in iwl_send_phy_db_data()
419 IWL_ERR(phy_db->trans, in iwl_send_phy_db_data()
425 err = iwl_phy_db_send_all_channel_groups(phy_db, in iwl_send_phy_db_data()
427 phy_db->n_group_txp); in iwl_send_phy_db_data()
429 IWL_ERR(phy_db->trans, in iwl_send_phy_db_data()
434 IWL_DEBUG_INFO(phy_db->trans, in iwl_send_phy_db_data()