wl1271: Add support for acx_pm_config
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Fri, 11 Dec 2009 13:41:08 +0000 (15:41 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 28 Dec 2009 21:31:36 +0000 (16:31 -0500)
This acx configures host clock parameters in correspondence with the clock
request line - the settling time of the clock, and whether fast wake-up is
supported.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl12xx/wl1271_acx.c
drivers/net/wireless/wl12xx/wl1271_acx.h
drivers/net/wireless/wl12xx/wl1271_conf.h
drivers/net/wireless/wl12xx/wl1271_init.c
drivers/net/wireless/wl12xx/wl1271_main.c

index 0ea1a48c45fa607841a509b56abf8af7446da19b..0b34348434766db6eaa86c6555ae2a8704b376f1 100644 (file)
@@ -1118,3 +1118,31 @@ out:
        kfree(acx);
        return ret;
 }
+
+int wl1271_acx_pm_config(struct wl1271 *wl)
+{
+       struct wl1271_acx_pm_config *acx = NULL;
+       struct  conf_pm_config_settings *c = &wl->conf.pm_config;
+       int ret = 0;
+
+       wl1271_debug(DEBUG_ACX, "acx pm config");
+
+       acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+       if (!acx) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       acx->host_clk_settling_time = cpu_to_le32(c->host_clk_settling_time);
+       acx->host_fast_wakeup_support = c->host_fast_wakeup_support;
+
+       ret = wl1271_cmd_configure(wl, ACX_PM_CONFIG, acx, sizeof(*acx));
+       if (ret < 0) {
+               wl1271_warning("acx pm config failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(acx);
+       return ret;
+}
index b6a473f60658bee03aa5122c38e2c969ca325f90..1bb63af64f0e5616bfe02013055249336f10b14b 100644 (file)
@@ -961,6 +961,13 @@ struct wl1271_acx_arp_filter {
                               used. */
 } __attribute__((packed));
 
+struct wl1271_acx_pm_config {
+       struct acx_header header;
+
+       __le32 host_clk_settling_time;
+       u8 host_fast_wakeup_support;
+       u8 padding[3];
+} __attribute__ ((packed));
 
 enum {
        ACX_WAKE_UP_CONDITIONS      = 0x0002,
@@ -1025,6 +1032,7 @@ enum {
        DOT11_RX_DOT11_MODE         = 0x1012,
        DOT11_RTS_THRESHOLD         = 0x1013,
        DOT11_GROUP_ADDRESS_TBL     = 0x1014,
+       ACX_PM_CONFIG               = 0x1016,
 
        MAX_DOT11_IE = DOT11_GROUP_ADDRESS_TBL,
 
@@ -1073,5 +1081,6 @@ int wl1271_acx_smart_reflex(struct wl1271 *wl);
 int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable);
 int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, u8 *address,
                             u8 version);
+int wl1271_acx_pm_config(struct wl1271 *wl);
 
 #endif /* __WL1271_ACX_H__ */
index 5d1b5b6493e9bc900f8017cf68d40eeb18e77ba7..1993d63c214ed3a0a2613c83d5f95a7ccc03fded 100644 (file)
@@ -904,6 +904,22 @@ struct conf_itrim_settings {
        u32 timeout;
 };
 
+struct conf_pm_config_settings {
+       /*
+        * Host clock settling time
+        *
+        * Range: 0 - 30000 us
+        */
+       u32 host_clk_settling_time;
+
+       /*
+        * Host fast wakeup support
+        *
+        * Range: true, false
+        */
+       bool host_fast_wakeup_support;
+};
+
 struct conf_drv_settings {
        struct conf_sg_settings sg;
        struct conf_rx_settings rx;
@@ -911,6 +927,7 @@ struct conf_drv_settings {
        struct conf_conn_settings conn;
        struct conf_init_settings init;
        struct conf_itrim_settings itrim;
+       struct conf_pm_config_settings pm_config;
 };
 
 #endif
index 3b4ed070f439d643d5130ecb4560d9393c6651fa..c9848eecb767f45648233a84e0ed79b7131ba9be 100644 (file)
@@ -303,6 +303,11 @@ int wl1271_hw_init(struct wl1271 *wl)
        if (ret < 0)
                goto out_free_memmap;
 
+       /* configure PM */
+       ret = wl1271_acx_pm_config(wl);
+       if (ret < 0)
+               goto out_free_memmap;
+
        return 0;
 
  out_free_memmap:
index 90a60c1147a8f60a4953fe684f2c4b69fa4849ac..7e6b500dfb6f74b3f04c52b4a90c70820dbc9b29 100644 (file)
@@ -321,6 +321,10 @@ static struct conf_drv_settings default_conf = {
        .itrim = {
                .enable = false,
                .timeout = 50000,
+       },
+       .pm_config = {
+               .host_clk_settling_time = 5000,
+               .host_fast_wakeup_support = false
        }
 };