aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 8364a2f71b51..f3073a5a954a 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1289,41 +1289,47 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
1289 priv->cur_cmd = NULL; 1289 priv->cur_cmd = NULL;
1290} 1290}
1291 1291
1292int lbs_set_radio_control(struct lbs_private *priv) 1292int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on)
1293{ 1293{
1294 int ret = 0;
1295 struct cmd_ds_802_11_radio_control cmd; 1294 struct cmd_ds_802_11_radio_control cmd;
1295 int ret = -EINVAL;
1296 1296
1297 lbs_deb_enter(LBS_DEB_CMD); 1297 lbs_deb_enter(LBS_DEB_CMD);
1298 1298
1299 cmd.hdr.size = cpu_to_le16(sizeof(cmd)); 1299 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
1300 cmd.action = cpu_to_le16(CMD_ACT_SET); 1300 cmd.action = cpu_to_le16(CMD_ACT_SET);
1301 1301
1302 switch (priv->preamble) { 1302 /* Only v8 and below support setting the preamble */
1303 case CMD_TYPE_SHORT_PREAMBLE: 1303 if (priv->fwrelease < 0x09000000) {
1304 cmd.control = cpu_to_le16(SET_SHORT_PREAMBLE); 1304 switch (preamble) {
1305 break; 1305 case RADIO_PREAMBLE_SHORT:
1306 1306 if (!(priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE))
1307 case CMD_TYPE_LONG_PREAMBLE: 1307 goto out;
1308 cmd.control = cpu_to_le16(SET_LONG_PREAMBLE); 1308 /* Fall through */
1309 break; 1309 case RADIO_PREAMBLE_AUTO:
1310 case RADIO_PREAMBLE_LONG:
1311 cmd.control = cpu_to_le16(preamble);
1312 break;
1313 default:
1314 goto out;
1315 }
1316 }
1310 1317
1311 case CMD_TYPE_AUTO_PREAMBLE: 1318 if (radio_on)
1312 default: 1319 cmd.control |= cpu_to_le16(0x1);
1313 cmd.control = cpu_to_le16(SET_AUTO_PREAMBLE); 1320 else {
1314 break; 1321 cmd.control &= cpu_to_le16(~0x1);
1322 priv->txpower_cur = 0;
1315 } 1323 }
1316 1324
1317 if (priv->radioon) 1325 lbs_deb_cmd("RADIO_CONTROL: radio %s, preamble %d\n",
1318 cmd.control |= cpu_to_le16(TURN_ON_RF); 1326 radio_on ? "ON" : "OFF", preamble);
1319 else
1320 cmd.control &= cpu_to_le16(~TURN_ON_RF);
1321 1327
1322 lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n", priv->radioon, 1328 priv->radio_on = radio_on;
1323 priv->preamble);
1324 1329
1325 ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); 1330 ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd);
1326 1331
1332out:
1327 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1333 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1328 return ret; 1334 return ret;
1329} 1335}