aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_cmd.c
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@nokia.com>2009-11-23 16:22:17 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-28 15:04:30 -0500
commit98b5dd5ded8cb59b598b2c0c396100054779eda7 (patch)
tree9b659aed8b6d20827c7138d4845082a3b7f1db4f /drivers/net/wireless/wl12xx/wl1271_cmd.c
parentcc7defa366ea770efb25add8711defe88862197b (diff)
wl1271: fix radio and general parameters commands
We were missing the command header in the radio and general parameters commands. This was causing them to fail, resulting in problems in the power levels and other PLT-related commands. Also reorganized the command functions, moving from wl1271_init.c to wl1271_cmd.c where it fits better. Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_cmd.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 990eb01b4c71..886a9bc39cc1 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -188,6 +188,113 @@ static int wl1271_cmd_cal(struct wl1271 *wl)
188 return ret; 188 return ret;
189} 189}
190 190
191int wl1271_cmd_general_parms(struct wl1271 *wl)
192{
193 struct wl1271_general_parms_cmd *gen_parms;
194 struct conf_general_parms *g = &wl->conf.init.genparam;
195 int ret;
196
197 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
198 if (!gen_parms)
199 return -ENOMEM;
200
201 gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM;
202
203 gen_parms->ref_clk = g->ref_clk;
204 gen_parms->settling_time = g->settling_time;
205 gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup;
206 gen_parms->dc2dcmode = g->dc2dcmode;
207 gen_parms->single_dual_band = g->single_dual_band;
208 gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect;
209 gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer;
210 gen_parms->settings = g->settings;
211
212 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
213 if (ret < 0)
214 wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed");
215
216 kfree(gen_parms);
217 return ret;
218}
219
220int wl1271_cmd_radio_parms(struct wl1271 *wl)
221{
222 struct wl1271_radio_parms_cmd *radio_parms;
223 struct conf_radio_parms *r = &wl->conf.init.radioparam;
224 int i, ret;
225
226 radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL);
227 if (!radio_parms)
228 return -ENOMEM;
229
230 radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
231
232 /* Static radio parameters */
233 radio_parms->rx_trace_loss = r->rx_trace_loss;
234 radio_parms->tx_trace_loss = r->tx_trace_loss;
235 memcpy(radio_parms->rx_rssi_and_proc_compens,
236 r->rx_rssi_and_proc_compens,
237 CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
238
239 memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5,
240 CONF_NUMBER_OF_SUB_BANDS_5);
241 memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5,
242 CONF_NUMBER_OF_SUB_BANDS_5);
243 memcpy(radio_parms->rx_rssi_and_proc_compens_5,
244 r->rx_rssi_and_proc_compens_5,
245 CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
246
247 /* Dynamic radio parameters */
248 radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage);
249 radio_parms->tx_ref_power = r->tx_ref_power;
250 radio_parms->tx_offset_db = r->tx_offset_db;
251
252 memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal,
253 CONF_NUMBER_OF_RATE_GROUPS);
254 memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded,
255 CONF_NUMBER_OF_RATE_GROUPS);
256
257 memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b,
258 CONF_NUMBER_OF_CHANNELS_2_4);
259 memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm,
260 CONF_NUMBER_OF_CHANNELS_2_4);
261 memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets,
262 CONF_NUMBER_OF_RATE_GROUPS);
263 memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS);
264
265 radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss;
266
267 for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++)
268 radio_parms->tx_ref_pd_voltage_5[i] =
269 cpu_to_le16(r->tx_ref_pd_voltage_5[i]);
270 memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5,
271 CONF_NUMBER_OF_SUB_BANDS_5);
272 memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5,
273 CONF_NUMBER_OF_SUB_BANDS_5);
274 memcpy(radio_parms->tx_rate_limits_normal_5,
275 r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS);
276 memcpy(radio_parms->tx_rate_limits_degraded_5,
277 r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS);
278 memcpy(radio_parms->tx_channel_limits_ofdm_5,
279 r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5);
280 memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5,
281 CONF_NUMBER_OF_RATE_GROUPS);
282 memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5,
283 CONF_NUMBER_OF_RATE_GROUPS);
284 memcpy(radio_parms->rx_fem_insertion_loss_5,
285 r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5);
286
287 wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ",
288 radio_parms, sizeof(*radio_parms));
289
290 ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0);
291 if (ret < 0)
292 wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed");
293
294 kfree(radio_parms);
295 return ret;
296}
297
191int wl1271_cmd_join(struct wl1271 *wl) 298int wl1271_cmd_join(struct wl1271 *wl)
192{ 299{
193 static bool do_cal = true; 300 static bool do_cal = true;