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 0ea1a48..0b34348 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 b6a473f..1bb63af 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 5d1b5b6..1993d63 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 3b4ed07..c9848ee 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 90a60c1..7e6b500 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
        }
 };