diff options
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index cdb9b9650d73..0fa6b0e59ea5 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -70,6 +70,8 @@ static u8 is_command_allowed_in_ps(u16 cmd) | |||
70 | switch (cmd) { | 70 | switch (cmd) { |
71 | case CMD_802_11_RSSI: | 71 | case CMD_802_11_RSSI: |
72 | return 1; | 72 | return 1; |
73 | case CMD_802_11_HOST_SLEEP_CFG: | ||
74 | return 1; | ||
73 | default: | 75 | default: |
74 | break; | 76 | break; |
75 | } | 77 | } |
@@ -185,6 +187,23 @@ out: | |||
185 | return ret; | 187 | return ret; |
186 | } | 188 | } |
187 | 189 | ||
190 | static int lbs_ret_host_sleep_cfg(struct lbs_private *priv, unsigned long dummy, | ||
191 | struct cmd_header *resp) | ||
192 | { | ||
193 | lbs_deb_enter(LBS_DEB_CMD); | ||
194 | if (priv->wol_criteria == EHS_REMOVE_WAKEUP) { | ||
195 | priv->is_host_sleep_configured = 0; | ||
196 | if (priv->psstate == PS_STATE_FULL_POWER) { | ||
197 | priv->is_host_sleep_activated = 0; | ||
198 | wake_up_interruptible(&priv->host_sleep_q); | ||
199 | } | ||
200 | } else { | ||
201 | priv->is_host_sleep_configured = 1; | ||
202 | } | ||
203 | lbs_deb_leave(LBS_DEB_CMD); | ||
204 | return 0; | ||
205 | } | ||
206 | |||
188 | int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, | 207 | int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, |
189 | struct wol_config *p_wol_config) | 208 | struct wol_config *p_wol_config) |
190 | { | 209 | { |
@@ -202,12 +221,11 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, | |||
202 | else | 221 | else |
203 | cmd_config.wol_conf.action = CMD_ACT_ACTION_NONE; | 222 | cmd_config.wol_conf.action = CMD_ACT_ACTION_NONE; |
204 | 223 | ||
205 | ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config); | 224 | ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config.hdr, |
225 | le16_to_cpu(cmd_config.hdr.size), | ||
226 | lbs_ret_host_sleep_cfg, 0); | ||
206 | if (!ret) { | 227 | if (!ret) { |
207 | if (criteria) { | 228 | if (p_wol_config) |
208 | lbs_deb_cmd("Set WOL criteria to %x\n", criteria); | ||
209 | priv->wol_criteria = criteria; | ||
210 | } else | ||
211 | memcpy((uint8_t *) p_wol_config, | 229 | memcpy((uint8_t *) p_wol_config, |
212 | (uint8_t *)&cmd_config.wol_conf, | 230 | (uint8_t *)&cmd_config.wol_conf, |
213 | sizeof(struct wol_config)); | 231 | sizeof(struct wol_config)); |
@@ -712,6 +730,10 @@ static void lbs_queue_cmd(struct lbs_private *priv, | |||
712 | } | 730 | } |
713 | } | 731 | } |
714 | 732 | ||
733 | if (le16_to_cpu(cmdnode->cmdbuf->command) == | ||
734 | CMD_802_11_WAKEUP_CONFIRM) | ||
735 | addtail = 0; | ||
736 | |||
715 | spin_lock_irqsave(&priv->driver_lock, flags); | 737 | spin_lock_irqsave(&priv->driver_lock, flags); |
716 | 738 | ||
717 | if (addtail) | 739 | if (addtail) |
@@ -1353,6 +1375,11 @@ static void lbs_send_confirmsleep(struct lbs_private *priv) | |||
1353 | /* We don't get a response on the sleep-confirmation */ | 1375 | /* We don't get a response on the sleep-confirmation */ |
1354 | priv->dnld_sent = DNLD_RES_RECEIVED; | 1376 | priv->dnld_sent = DNLD_RES_RECEIVED; |
1355 | 1377 | ||
1378 | if (priv->is_host_sleep_configured) { | ||
1379 | priv->is_host_sleep_activated = 1; | ||
1380 | wake_up_interruptible(&priv->host_sleep_q); | ||
1381 | } | ||
1382 | |||
1356 | /* If nothing to do, go back to sleep (?) */ | 1383 | /* If nothing to do, go back to sleep (?) */ |
1357 | if (!kfifo_len(&priv->event_fifo) && !priv->resp_len[priv->resp_idx]) | 1384 | if (!kfifo_len(&priv->event_fifo) && !priv->resp_len[priv->resp_idx]) |
1358 | priv->psstate = PS_STATE_SLEEP; | 1385 | priv->psstate = PS_STATE_SLEEP; |