Commit d4ff0ef6 authored by Holger Schurig's avatar Holger Schurig Committed by John W. Linville

libertas: misc power saving adjusts

* firmware for the CF card supports power saving
* the driver currenly only accept "iwconfig ethX power on|off", so
  I fixed what the range wext ioctl reports.
* initialize value/flags in lbs_get_power()
* get rid of unused parameter psmode in lbs_ps_confirm_sleep()
* some minor debug output tweaks
Signed-off-by: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Acked-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c49c3b77
...@@ -1927,10 +1927,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) ...@@ -1927,10 +1927,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
int ret = 0; int ret = 0;
lbs_deb_enter(LBS_DEB_HOST); lbs_deb_enter(LBS_DEB_HOST);
lbs_deb_host("SEND_SLEEPC_CMD: before download, cmd size %d\n",
size);
lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size); lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size);
ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size); ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
...@@ -1953,8 +1949,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) ...@@ -1953,8 +1949,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
priv->intcounter); priv->intcounter);
} }
spin_unlock_irqrestore(&priv->driver_lock, flags); spin_unlock_irqrestore(&priv->driver_lock, flags);
lbs_deb_host("SEND_SLEEPC_CMD: sent confirm sleep\n");
} }
lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
...@@ -2006,10 +2000,10 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option) ...@@ -2006,10 +2000,10 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option)
* @param psmode Power Saving mode * @param psmode Power Saving mode
* @return n/a * @return n/a
*/ */
void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) void lbs_ps_confirm_sleep(struct lbs_private *priv)
{ {
unsigned long flags =0; unsigned long flags =0;
u8 allowed = 1; int allowed = 1;
lbs_deb_enter(LBS_DEB_HOST); lbs_deb_enter(LBS_DEB_HOST);
......
...@@ -656,11 +656,9 @@ int lbs_process_event(struct lbs_private *priv) ...@@ -656,11 +656,9 @@ int lbs_process_event(struct lbs_private *priv)
eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT; eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT;
spin_unlock_irq(&priv->driver_lock); spin_unlock_irq(&priv->driver_lock);
lbs_deb_cmd("event cause %d\n", eventcause);
switch (eventcause) { switch (eventcause) {
case MACREG_INT_CODE_LINK_SENSED: case MACREG_INT_CODE_LINK_SENSED:
lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n"); lbs_deb_cmd("EVENT: link sensed\n");
break; break;
case MACREG_INT_CODE_DEAUTHENTICATED: case MACREG_INT_CODE_DEAUTHENTICATED:
...@@ -679,7 +677,7 @@ int lbs_process_event(struct lbs_private *priv) ...@@ -679,7 +677,7 @@ int lbs_process_event(struct lbs_private *priv)
break; break;
case MACREG_INT_CODE_PS_SLEEP: case MACREG_INT_CODE_PS_SLEEP:
lbs_deb_cmd("EVENT: sleep\n"); lbs_deb_cmd("EVENT: ps sleep\n");
/* handle unexpected PS SLEEP event */ /* handle unexpected PS SLEEP event */
if (priv->psstate == PS_STATE_FULL_POWER) { if (priv->psstate == PS_STATE_FULL_POWER) {
...@@ -689,17 +687,17 @@ int lbs_process_event(struct lbs_private *priv) ...@@ -689,17 +687,17 @@ int lbs_process_event(struct lbs_private *priv)
} }
priv->psstate = PS_STATE_PRE_SLEEP; priv->psstate = PS_STATE_PRE_SLEEP;
lbs_ps_confirm_sleep(priv, (u16) priv->psmode); lbs_ps_confirm_sleep(priv);
break; break;
case MACREG_INT_CODE_HOST_AWAKE: case MACREG_INT_CODE_HOST_AWAKE:
lbs_deb_cmd("EVENT: HOST_AWAKE\n"); lbs_deb_cmd("EVENT: host awake\n");
lbs_send_confirmwake(priv); lbs_send_confirmwake(priv);
break; break;
case MACREG_INT_CODE_PS_AWAKE: case MACREG_INT_CODE_PS_AWAKE:
lbs_deb_cmd("EVENT: awake\n"); lbs_deb_cmd("EVENT: ps awake\n");
/* handle unexpected PS AWAKE event */ /* handle unexpected PS AWAKE event */
if (priv->psstate == PS_STATE_FULL_POWER) { if (priv->psstate == PS_STATE_FULL_POWER) {
lbs_deb_cmd( lbs_deb_cmd(
...@@ -730,14 +728,16 @@ int lbs_process_event(struct lbs_private *priv) ...@@ -730,14 +728,16 @@ int lbs_process_event(struct lbs_private *priv)
lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n"); lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
break; break;
case MACREG_INT_CODE_MIB_CHANGED: case MACREG_INT_CODE_MIB_CHANGED:
lbs_deb_cmd("EVENT: MIB CHANGED\n");
break;
case MACREG_INT_CODE_INIT_DONE: case MACREG_INT_CODE_INIT_DONE:
lbs_deb_cmd("EVENT: INIT DONE\n");
break; break;
case MACREG_INT_CODE_ADHOC_BCN_LOST: case MACREG_INT_CODE_ADHOC_BCN_LOST:
lbs_deb_cmd("EVENT: ADHOC beacon lost\n"); lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
break; break;
case MACREG_INT_CODE_RSSI_LOW: case MACREG_INT_CODE_RSSI_LOW:
lbs_pr_alert("EVENT: rssi low\n"); lbs_pr_alert("EVENT: rssi low\n");
break; break;
......
...@@ -49,7 +49,7 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); ...@@ -49,7 +49,7 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *);
void lbs_ps_sleep(struct lbs_private *priv, int wait_option); void lbs_ps_sleep(struct lbs_private *priv, int wait_option);
void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode); void lbs_ps_confirm_sleep(struct lbs_private *priv);
void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); void lbs_ps_wakeup(struct lbs_private *priv, int wait_option);
struct chan_freq_power *lbs_find_cfp_by_band_and_channel( struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
......
...@@ -882,6 +882,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev) ...@@ -882,6 +882,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
goto out3; goto out3;
} }
/* The firmware for the CF card supports powersave */
priv->ps_supported = 1;
ret = 0; ret = 0;
goto out; goto out;
......
...@@ -803,7 +803,7 @@ static int lbs_thread(void *data) ...@@ -803,7 +803,7 @@ static int lbs_thread(void *data)
lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n", lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n",
priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd); priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd);
lbs_ps_confirm_sleep(priv, (u16) priv->psmode); lbs_ps_confirm_sleep(priv);
} else { } else {
/* workaround for firmware sending /* workaround for firmware sending
* deauth/linkloss event immediately * deauth/linkloss event immediately
......
...@@ -656,13 +656,10 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, ...@@ -656,13 +656,10 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
range->num_encoding_sizes = 2; range->num_encoding_sizes = 2;
range->max_encoding_tokens = 4; range->max_encoding_tokens = 4;
range->min_pmp = 1000000; /*
range->max_pmp = 120000000; * Right now we support only "iwconfig ethX power on|off"
range->min_pmt = 1000; */
range->max_pmt = 1000000; range->pm_capa = IW_POWER_ON;
range->pmp_flags = IW_POWER_PERIOD;
range->pmt_flags = IW_POWER_TIMEOUT;
range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
/* /*
* Minimum version we recommend * Minimum version we recommend
...@@ -784,21 +781,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, ...@@ -784,21 +781,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra) struct iw_param *vwrq, char *extra)
{ {
struct lbs_private *priv = dev->priv; struct lbs_private *priv = dev->priv;
int mode;
lbs_deb_enter(LBS_DEB_WEXT); lbs_deb_enter(LBS_DEB_WEXT);
mode = priv->psmode;
if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM))
|| priv->connect_status == LBS_DISCONNECTED)
{
goto out;
}
vwrq->value = 0; vwrq->value = 0;
vwrq->flags = 0;
vwrq->disabled = priv->psmode == LBS802_11POWERMODECAM
|| priv->connect_status == LBS_DISCONNECTED;
out:
lbs_deb_leave(LBS_DEB_WEXT); lbs_deb_leave(LBS_DEB_WEXT);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment