wl12xx: add config_hangover command
authorEliad Peller <eliad@wizery.com>
Sun, 28 Aug 2011 12:11:56 +0000 (15:11 +0300)
committerLuciano Coelho <coelho@ti.com>
Wed, 14 Sep 2011 08:47:26 +0000 (11:47 +0300)
Add wl12xx_acx_config_hangover() and respective conf values.
This command configures how long the chip will stay awake
after it was configured to enter psm.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/acx.c
drivers/net/wireless/wl12xx/acx.h
drivers/net/wireless/wl12xx/conf.h
drivers/net/wireless/wl12xx/init.c
drivers/net/wireless/wl12xx/main.c

index e047594..9809e41 100644 (file)
@@ -1691,3 +1691,43 @@ out:
        kfree(acx);
        return ret;
 }
+
+int wl12xx_acx_config_hangover(struct wl1271 *wl)
+{
+       struct wl12xx_acx_config_hangover *acx;
+       struct conf_hangover_settings *conf = &wl->conf.hangover;
+       int ret;
+
+       wl1271_debug(DEBUG_ACX, "acx config hangover");
+
+       acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+       if (!acx) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       acx->recover_time = cpu_to_le32(conf->recover_time);
+       acx->hangover_period = conf->hangover_period;
+       acx->dynamic_mode = conf->dynamic_mode;
+       acx->early_termination_mode = conf->early_termination_mode;
+       acx->max_period = conf->max_period;
+       acx->min_period = conf->min_period;
+       acx->increase_delta = conf->increase_delta;
+       acx->decrease_delta = conf->decrease_delta;
+       acx->quiet_time = conf->quiet_time;
+       acx->increase_time = conf->increase_time;
+       acx->window_size = acx->window_size;
+
+       ret = wl1271_cmd_configure(wl, ACX_CONFIG_HANGOVER, acx,
+                                  sizeof(*acx));
+
+       if (ret < 0) {
+               wl1271_warning("acx config hangover failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(acx);
+       return ret;
+
+}
index 758c596..556ee4e 100644 (file)
@@ -1144,6 +1144,23 @@ struct wl12xx_acx_set_rate_mgmt_params {
        u8 padding2[2];
 } __packed;
 
+struct wl12xx_acx_config_hangover {
+       struct acx_header header;
+
+       __le32 recover_time;
+       u8 hangover_period;
+       u8 dynamic_mode;
+       u8 early_termination_mode;
+       u8 max_period;
+       u8 min_period;
+       u8 increase_delta;
+       u8 decrease_delta;
+       u8 quiet_time;
+       u8 increase_time;
+       u8 window_size;
+       u8 padding[2];
+} __packed;
+
 enum {
        ACX_WAKE_UP_CONDITIONS      = 0x0002,
        ACX_MEM_CFG                 = 0x0003,
@@ -1281,5 +1298,6 @@ int wl1271_acx_config_ps(struct wl1271 *wl);
 int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr);
 int wl1271_acx_fm_coex(struct wl1271 *wl);
 int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl);
+int wl12xx_acx_config_hangover(struct wl1271 *wl);
 
 #endif /* __WL1271_ACX_H__ */
index 82f205c..45428a2 100644 (file)
@@ -916,14 +916,6 @@ struct conf_conn_settings {
        u8 psm_entry_nullfunc_retries;
 
        /*
-        * Specifies the time to linger in active mode after successfully
-        * transmitting the PSM entry null-func frame.
-        *
-        * Range 0 - 255 TU's
-        */
-       u8 psm_entry_hangover_period;
-
-       /*
         *
         * Specifies the interval of the connection keep-alive null-func
         * frame in ms.
@@ -1236,6 +1228,20 @@ struct conf_rate_policy_settings {
        u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES];
 };
 
+struct conf_hangover_settings {
+       u32 recover_time;
+       u8 hangover_period;
+       u8 dynamic_mode;
+       u8 early_termination_mode;
+       u8 max_period;
+       u8 min_period;
+       u8 increase_delta;
+       u8 decrease_delta;
+       u8 quiet_time;
+       u8 increase_time;
+       u8 window_size;
+};
+
 struct conf_drv_settings {
        struct conf_sg_settings sg;
        struct conf_rx_settings rx;
@@ -1254,6 +1260,7 @@ struct conf_drv_settings {
        struct conf_rx_streaming_settings rx_streaming;
        struct conf_fwlog fwlog;
        struct conf_rate_policy_settings rate;
+       struct conf_hangover_settings hangover;
        u8 hci_io_ds;
 };
 
index b13bebe..09515f5 100644 (file)
@@ -707,6 +707,11 @@ int wl1271_hw_init(struct wl1271 *wl)
        if (ret < 0)
                goto out_free_memmap;
 
+       /* configure hangover */
+       ret = wl12xx_acx_config_hangover(wl);
+       if (ret < 0)
+               goto out_free_memmap;
+
        return 0;
 
  out_free_memmap:
index 8aff8d4..f1fd991 100644 (file)
@@ -239,7 +239,6 @@ static struct conf_drv_settings default_conf = {
                .psm_entry_retries           = 8,
                .psm_exit_retries            = 16,
                .psm_entry_nullfunc_retries  = 3,
-               .psm_entry_hangover_period   = 1,
                .keep_alive_interval         = 55000,
                .max_listen_interval         = 20,
        },
@@ -359,6 +358,19 @@ static struct conf_drv_settings default_conf = {
                        0x00, 0x00, 0x00,
                },
        },
+       .hangover = {
+               .recover_time               = 0,
+               .hangover_period            = 20,
+               .dynamic_mode               = 1,
+               .early_termination_mode     = 1,
+               .max_period                 = 20,
+               .min_period                 = 1,
+               .increase_delta             = 1,
+               .decrease_delta             = 2,
+               .quiet_time                 = 4,
+               .increase_time              = 1,
+               .window_size                = 16,
+       },
 };
 
 static char *fwlog_param;