libertas: misc power saving adjusts
authorHolger Schurig <hs4233@mail.mn-solutions.de>
Wed, 19 Mar 2008 13:25:18 +0000 (14:25 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 25 Mar 2008 20:41:49 +0000 (16:41 -0400)
* 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: Holger Schurig <hs4233@mail.mn-solutions.de>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/cmd.c
drivers/net/wireless/libertas/cmdresp.c
drivers/net/wireless/libertas/decl.h
drivers/net/wireless/libertas/if_cs.c
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/wext.c

index 5e35788946f1c20c49daa0322f6a672a4774435d..733110a03b56815252fbc0d5d72dc8d9e2ecdb89 100644 (file)
@@ -1927,10 +1927,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
        int ret = 0;
 
        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);
 
        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)
                               priv->intcounter);
                }
                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);
@@ -2006,10 +2000,10 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option)
  *  @param psmode      Power Saving mode
  *  @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;
-       u8 allowed = 1;
+       int allowed = 1;
 
        lbs_deb_enter(LBS_DEB_HOST);
 
index 240feeb1b49bf67d9db6171d63dc6ec5df596154..45de4316bdd72a3b0fe999c2d0776bd2b34384c4 100644 (file)
@@ -656,11 +656,9 @@ int lbs_process_event(struct lbs_private *priv)
        eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT;
        spin_unlock_irq(&priv->driver_lock);
 
-       lbs_deb_cmd("event cause %d\n", eventcause);
-
        switch (eventcause) {
        case MACREG_INT_CODE_LINK_SENSED:
-               lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
+               lbs_deb_cmd("EVENT: link sensed\n");
                break;
 
        case MACREG_INT_CODE_DEAUTHENTICATED:
@@ -679,7 +677,7 @@ int lbs_process_event(struct lbs_private *priv)
                break;
 
        case MACREG_INT_CODE_PS_SLEEP:
-               lbs_deb_cmd("EVENT: sleep\n");
+               lbs_deb_cmd("EVENT: ps sleep\n");
 
                /* handle unexpected PS SLEEP event */
                if (priv->psstate == PS_STATE_FULL_POWER) {
@@ -689,17 +687,17 @@ int lbs_process_event(struct lbs_private *priv)
                }
                priv->psstate = PS_STATE_PRE_SLEEP;
 
-               lbs_ps_confirm_sleep(priv, (u16) priv->psmode);
+               lbs_ps_confirm_sleep(priv);
 
                break;
 
        case MACREG_INT_CODE_HOST_AWAKE:
-               lbs_deb_cmd("EVENT: HOST_AWAKE\n");
+               lbs_deb_cmd("EVENT: host awake\n");
                lbs_send_confirmwake(priv);
                break;
 
        case MACREG_INT_CODE_PS_AWAKE:
-               lbs_deb_cmd("EVENT: awake\n");
+               lbs_deb_cmd("EVENT: ps awake\n");
                /* handle unexpected PS AWAKE event */
                if (priv->psstate == PS_STATE_FULL_POWER) {
                        lbs_deb_cmd(
@@ -730,14 +728,16 @@ int lbs_process_event(struct lbs_private *priv)
                lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
                handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
                break;
+
        case MACREG_INT_CODE_MIB_CHANGED:
+               lbs_deb_cmd("EVENT: MIB CHANGED\n");
+               break;
        case MACREG_INT_CODE_INIT_DONE:
+               lbs_deb_cmd("EVENT: INIT DONE\n");
                break;
-
        case MACREG_INT_CODE_ADHOC_BCN_LOST:
                lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
                break;
-
        case MACREG_INT_CODE_RSSI_LOW:
                lbs_pr_alert("EVENT: rssi low\n");
                break;
index 989fb77e66dcaaf37f3629a01828947488d3c777..f0a0de9c6f5a69fd9e5d2e75cb39c28f8c12d8e3 100644 (file)
@@ -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 *);
 
 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);
 
 struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
index 5a9cadb97503fbf6ab8b4ba68a18d7da4a5e2ed6..d17746582160c173692988801f078710166e60d2 100644 (file)
@@ -882,6 +882,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
                goto out3;
        }
 
+       /* The firmware for the CF card supports powersave */
+       priv->ps_supported = 1;
+
        ret = 0;
        goto out;
 
index 37cc05044cd75b3624a33dfd588b05dbf22de4f5..449e84f89ae73e208658a4e2259967cacd5dccdd 100644 (file)
@@ -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",
                                               priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd);
 
-                               lbs_ps_confirm_sleep(priv, (u16) priv->psmode);
+                               lbs_ps_confirm_sleep(priv);
                        } else {
                                /* workaround for firmware sending
                                 * deauth/linkloss event immediately
index 5ccb4e0c8d64aa2c79ec226b95124b418a1c6ad4..c039db648facc00efd760d2a259c3183748922f9 100644 (file)
@@ -656,13 +656,10 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
        range->num_encoding_sizes = 2;
        range->max_encoding_tokens = 4;
 
-       range->min_pmp = 1000000;
-       range->max_pmp = 120000000;
-       range->min_pmt = 1000;
-       range->max_pmt = 1000000;
-       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;
+       /*
+        * Right now we support only "iwconfig ethX power on|off"
+        */
+       range->pm_capa = IW_POWER_ON;
 
        /*
         * Minimum version we recommend
@@ -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 lbs_private *priv = dev->priv;
-       int mode;
 
        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->flags = 0;
+       vwrq->disabled = priv->psmode == LBS802_11POWERMODECAM
+               || priv->connect_status == LBS_DISCONNECTED;
 
-out:
        lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }