deep sleep mode on compact flash interface wifi card

Cyril HAENEL chaenel at free.fr
Mon Sep 6 06:29:49 EDT 2010


Hi all,

We try to have the deep sleep command directly managed by the libertas 
driver for the compact flash interface, but we have a problem.

We copied the 3 functions if_sdio_enter_deep_sleep, 
if_sdio_exit_deep_sleep, if_sdio_reset_deep_sleep_wakeup from if_sdio.c 
to if_cs.c and named them if_cs_enter_deep_sleep, if_cs_exit_deep_sleep 
and if_cs_reset_deep_sleep.

We modified these, they look like this :

static int if_cs_enter_deep_sleep(struct lbs_private *priv)
{
     int ret = -1;
     struct cmd_header cmd;

     memset(&cmd, 0, sizeof(cmd));

     lbs_deb_cs("send DEEP_SLEEP command\n");
     ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd),
             lbs_cmd_copyback, (unsigned long) &cmd);
     if (ret)
         lbs_pr_err("DEEP_SLEEP cmd failed\n");

     mdelay(200);
     return ret;
}

static int if_cs_exit_deep_sleep(struct lbs_private *priv)
{
     struct if_cs_card *card = priv->card;
     int ret = 0;

     lbs_deb_enter(LBS_DEB_SDIO);

     if_cs_write8 (card, CONFIGURATION_REG, HOST_POWER_UP);

     lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);

     return ret;
}

static int if_cs_reset_deep_sleep_wakeup(struct lbs_private *priv)
{
     struct if_cs_card *card = priv->card;
     int ret = 0;

     lbs_deb_enter(LBS_DEB_CS);

     if_cs_write8 (card, CONFIGURATION_REG, 0);

     lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);

     return ret;
}

We also configured the pointers in if_cs_probe :

     priv->enter_deep_sleep = if_cs_enter_deep_sleep;
     priv->exit_deep_sleep = if_cs_exit_deep_sleep;
     priv->reset_deep_sleep_wakeup = if_cs_reset_deep_sleep_wakeup;

When we do iwconfig wlan0 power 0, the if_cs_enter_deep_sleep function 
is correctly called, the wifi module correctly enters deep sleep (the 
board consumption decrease), and iwconfig exits correctly.

When we do iwconfig wlan0 power -1, the if_cs_exit_deep_sleep function 
is correctly called, and the wifi module correctly exits deep sleep, 
because the board consumption increase, and 1 second later we receive 
the MACREG_INT_CODE_DEEP_SLEEP_AWAKE event from the wifi module, and the 
if_cs_reset_deep_sleep_wakeup function is correctly called.
Also, this iwconfig command returns without error.

But the next iwconfig command fails, even without any parameter : 
iwconfig wlan0 never finish

Any idea concerning this problem ? Is someone successfully used the deep 
sleep command on a CF interface ?

Regards,
Cyril HAENEL






-- 

Cyril Haenel
Registered Linux User #332632




More information about the libertas-dev mailing list