wil6210: set platform features based on FW capabilities
authorMaya Erez <qca_merez@qca.qualcomm.com>
Thu, 14 Dec 2017 16:53:08 +0000 (18:53 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 9 Jan 2018 08:03:21 +0000 (10:03 +0200)
In some cases the platform should be aware of the FW capabilities
to decide which feature to enable.
For example, FW can control the external REF clock for power saving.
Driver should notify the platform about that, to allow platform
power management optimization.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/wil_platform.h
drivers/net/wireless/ath/wil6210/wmi.h

index bafd8d515618db993d01af85f1aebc2dae0b3188..7a8f8c209af8b7ccc17f672afa34e47f61241bcc 100644 (file)
@@ -771,6 +771,7 @@ static void wil_collect_fw_info(struct wil6210_priv *wil)
 void wil_refresh_fw_capabilities(struct wil6210_priv *wil)
 {
        struct wiphy *wiphy = wil_to_wiphy(wil);
+       int features;
 
        wil->keep_radio_on_during_sleep =
                test_bit(WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND,
@@ -792,6 +793,16 @@ void wil_refresh_fw_capabilities(struct wil6210_priv *wil)
                wiphy->max_sched_scan_ie_len = WMI_MAX_IE_LEN;
                wiphy->max_sched_scan_plans = WMI_MAX_PLANS_NUM;
        }
+
+       if (wil->platform_ops.set_features) {
+               features = (test_bit(WMI_FW_CAPABILITY_REF_CLOCK_CONTROL,
+                                    wil->fw_capabilities) &&
+                           test_bit(WIL_PLATFORM_CAPA_EXT_CLK,
+                                    wil->platform_capa)) ?
+                       BIT(WIL_PLATFORM_FEATURE_FW_EXT_CLK_CONTROL) : 0;
+
+               wil->platform_ops.set_features(wil->platform_handle, features);
+       }
 }
 
 void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r)
index 5cfb946caff7f2f0e2e26eb7114b6dd4924b7fdb..177026e5323be420d176aa3aa97895fdf9242b26 100644 (file)
@@ -27,6 +27,11 @@ enum wil_platform_event {
        WIL_PLATFORM_EVT_POST_SUSPEND = 4,
 };
 
+enum wil_platform_features {
+       WIL_PLATFORM_FEATURE_FW_EXT_CLK_CONTROL = 0,
+       WIL_PLATFORM_FEATURE_MAX,
+};
+
 enum wil_platform_capa {
        WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND = 0,
        WIL_PLATFORM_CAPA_T_PWR_ON_0 = 1,
@@ -45,6 +50,7 @@ struct wil_platform_ops {
        void (*uninit)(void *handle);
        int (*notify)(void *handle, enum wil_platform_event evt);
        int (*get_capa)(void *handle);
+       void (*set_features)(void *handle, int features);
 };
 
 /**
index c7b84d16a582956f025603a471883e6231a22c06..d3e75f0ff24550a703d9546f4db676cd4fb6602d 100644 (file)
@@ -72,6 +72,7 @@ enum wmi_fw_capability {
        WMI_FW_CAPABILITY_SET_SILENT_RSSI_TABLE         = 13,
        WMI_FW_CAPABILITY_LO_POWER_CALIB_FROM_OTP       = 14,
        WMI_FW_CAPABILITY_PNO                           = 15,
+       WMI_FW_CAPABILITY_REF_CLOCK_CONTROL             = 18,
        WMI_FW_CAPABILITY_MAX,
 };