diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-10-05 07:11:56 -0400 |
---|---|---|
committer | Luciano Coelho <luciano.coelho@nokia.com> | 2010-10-05 09:27:48 -0400 |
commit | 644a48607cd40954b6fb095b39a3ccaa0204191e (patch) | |
tree | 86a55ea150c95ff25b30274a66d2a135ed5cc6b1 /drivers | |
parent | d25611da0c75c4b0f72c73d66887d0470aacef40 (diff) |
wl1271: Add extended radio parameter initialization
Currently a command to initialize extended radio parameter tables in the
hardware is missing.
Add the initialization
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.h | 24 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_conf.h | 21 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_init.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 14 |
5 files changed, 90 insertions, 6 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 4a56ab05e736..596e333919ae 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -171,6 +171,39 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
171 | return ret; | 171 | return ret; |
172 | } | 172 | } |
173 | 173 | ||
174 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) | ||
175 | { | ||
176 | struct wl1271_ext_radio_parms_cmd *ext_radio_parms; | ||
177 | struct conf_rf_settings *rf = &wl->conf.rf; | ||
178 | int ret; | ||
179 | |||
180 | if (!wl->nvs) | ||
181 | return -ENODEV; | ||
182 | |||
183 | ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); | ||
184 | if (!ext_radio_parms) | ||
185 | return -ENOMEM; | ||
186 | |||
187 | ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; | ||
188 | |||
189 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_2, | ||
190 | rf->tx_per_channel_power_compensation_2, | ||
191 | CONF_TX_PWR_COMPENSATION_LEN_2); | ||
192 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_5, | ||
193 | rf->tx_per_channel_power_compensation_5, | ||
194 | CONF_TX_PWR_COMPENSATION_LEN_5); | ||
195 | |||
196 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ", | ||
197 | ext_radio_parms, sizeof(*ext_radio_parms)); | ||
198 | |||
199 | ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0); | ||
200 | if (ret < 0) | ||
201 | wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed"); | ||
202 | |||
203 | kfree(ext_radio_parms); | ||
204 | return ret; | ||
205 | } | ||
206 | |||
174 | /* | 207 | /* |
175 | * Poll the mailbox event field until any of the bits in the mask is set or a | 208 | * Poll the mailbox event field until any of the bits in the mask is set or a |
176 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) | 209 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h index 33b946b4cb07..ed80bec1aea4 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h | |||
@@ -33,6 +33,7 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
33 | size_t res_len); | 33 | size_t res_len); |
34 | int wl1271_cmd_general_parms(struct wl1271 *wl); | 34 | int wl1271_cmd_general_parms(struct wl1271 *wl); |
35 | int wl1271_cmd_radio_parms(struct wl1271 *wl); | 35 | int wl1271_cmd_radio_parms(struct wl1271 *wl); |
36 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); | ||
36 | int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type); | 37 | int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type); |
37 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); | 38 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); |
38 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); | 39 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); |
@@ -324,13 +325,14 @@ enum wl1271_channel_tune_bands { | |||
324 | WL1271_CHANNEL_TUNE_BAND_4_9 | 325 | WL1271_CHANNEL_TUNE_BAND_4_9 |
325 | }; | 326 | }; |
326 | 327 | ||
327 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 | 328 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 |
328 | 329 | ||
329 | #define TEST_CMD_P2G_CAL 0x02 | 330 | #define TEST_CMD_P2G_CAL 0x02 |
330 | #define TEST_CMD_CHANNEL_TUNE 0x0d | 331 | #define TEST_CMD_CHANNEL_TUNE 0x0d |
331 | #define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d | 332 | #define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d |
332 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 | 333 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 |
333 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E | 334 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E |
335 | #define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26 | ||
334 | 336 | ||
335 | struct wl1271_general_parms_cmd { | 337 | struct wl1271_general_parms_cmd { |
336 | struct wl1271_cmd_header header; | 338 | struct wl1271_cmd_header header; |
@@ -363,6 +365,16 @@ struct wl1271_radio_parms_cmd { | |||
363 | u8 padding3[2]; | 365 | u8 padding3[2]; |
364 | } __packed; | 366 | } __packed; |
365 | 367 | ||
368 | struct wl1271_ext_radio_parms_cmd { | ||
369 | struct wl1271_cmd_header header; | ||
370 | |||
371 | struct wl1271_cmd_test_header test; | ||
372 | |||
373 | u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; | ||
374 | u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; | ||
375 | u8 padding[3]; | ||
376 | } __packed; | ||
377 | |||
366 | struct wl1271_cmd_cal_channel_tune { | 378 | struct wl1271_cmd_cal_channel_tune { |
367 | struct wl1271_cmd_header header; | 379 | struct wl1271_cmd_header header; |
368 | 380 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h index 60c50d1a9835..5f78a6cb1433 100644 --- a/drivers/net/wireless/wl12xx/wl1271_conf.h +++ b/drivers/net/wireless/wl12xx/wl1271_conf.h | |||
@@ -1070,6 +1070,26 @@ struct conf_scan_settings { | |||
1070 | 1070 | ||
1071 | }; | 1071 | }; |
1072 | 1072 | ||
1073 | /* these are number of channels on the band divided by two, rounded up */ | ||
1074 | #define CONF_TX_PWR_COMPENSATION_LEN_2 7 | ||
1075 | #define CONF_TX_PWR_COMPENSATION_LEN_5 18 | ||
1076 | |||
1077 | struct conf_rf_settings { | ||
1078 | /* | ||
1079 | * Per channel power compensation for 2.4GHz | ||
1080 | * | ||
1081 | * Range: s8 | ||
1082 | */ | ||
1083 | u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; | ||
1084 | |||
1085 | /* | ||
1086 | * Per channel power compensation for 5GHz | ||
1087 | * | ||
1088 | * Range: s8 | ||
1089 | */ | ||
1090 | u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; | ||
1091 | }; | ||
1092 | |||
1073 | struct conf_drv_settings { | 1093 | struct conf_drv_settings { |
1074 | struct conf_sg_settings sg; | 1094 | struct conf_sg_settings sg; |
1075 | struct conf_rx_settings rx; | 1095 | struct conf_rx_settings rx; |
@@ -1079,6 +1099,7 @@ struct conf_drv_settings { | |||
1079 | struct conf_pm_config_settings pm_config; | 1099 | struct conf_pm_config_settings pm_config; |
1080 | struct conf_roam_trigger_settings roam_trigger; | 1100 | struct conf_roam_trigger_settings roam_trigger; |
1081 | struct conf_scan_settings scan; | 1101 | struct conf_scan_settings scan; |
1102 | struct conf_rf_settings rf; | ||
1082 | }; | 1103 | }; |
1083 | 1104 | ||
1084 | #endif | 1105 | #endif |
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c index 349571fe04b3..8044bba70ee7 100644 --- a/drivers/net/wireless/wl12xx/wl1271_init.c +++ b/drivers/net/wireless/wl12xx/wl1271_init.c | |||
@@ -222,6 +222,10 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
222 | if (ret < 0) | 222 | if (ret < 0) |
223 | return ret; | 223 | return ret; |
224 | 224 | ||
225 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
226 | if (ret < 0) | ||
227 | return ret; | ||
228 | |||
225 | /* Template settings */ | 229 | /* Template settings */ |
226 | ret = wl1271_init_templates_config(wl); | 230 | ret = wl1271_init_templates_config(wl); |
227 | if (ret < 0) | 231 | if (ret < 0) |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index d826b6684e39..48a4b9961ae6 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -242,6 +242,16 @@ static struct conf_drv_settings default_conf = { | |||
242 | .max_dwell_time_passive = 60000, | 242 | .max_dwell_time_passive = 60000, |
243 | .num_probe_reqs = 2, | 243 | .num_probe_reqs = 2, |
244 | }, | 244 | }, |
245 | .rf = { | ||
246 | .tx_per_channel_power_compensation_2 = { | ||
247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
248 | }, | ||
249 | .tx_per_channel_power_compensation_5 = { | ||
250 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
252 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
253 | }, | ||
254 | }, | ||
245 | }; | 255 | }; |
246 | 256 | ||
247 | static void __wl1271_op_remove_interface(struct wl1271 *wl); | 257 | static void __wl1271_op_remove_interface(struct wl1271 *wl); |
@@ -357,6 +367,10 @@ static int wl1271_plt_init(struct wl1271 *wl) | |||
357 | if (ret < 0) | 367 | if (ret < 0) |
358 | return ret; | 368 | return ret; |
359 | 369 | ||
370 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
371 | if (ret < 0) | ||
372 | return ret; | ||
373 | |||
360 | ret = wl1271_init_templates_config(wl); | 374 | ret = wl1271_init_templates_config(wl); |
361 | if (ret < 0) | 375 | if (ret < 0) |
362 | return ret; | 376 | return ret; |