iwlwifi: mvm: add support for new LTR command
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 13 Jan 2015 08:16:30 +0000 (10:16 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 22 Jan 2015 15:55:16 +0000 (17:55 +0200)
This new command will give finer granularity to configure
the platform.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-fw-file.h
drivers/net/wireless/iwlwifi/mvm/fw-api-power.h
drivers/net/wireless/iwlwifi/mvm/fw.c

index 4aa26b2e2e231043ae2b8a68020b79e77a0857bd..b998aaf5efd1a6b9fa60d2d46bc1a6a1909d2bb4 100644 (file)
@@ -241,6 +241,7 @@ enum iwl_ucode_tlv_flag {
  * @IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF: ucode supports disabling dummy notif.
  * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
  *     longer than the passive one, which is essential for fragmented scan.
+ * IWL_UCODE_TLV_API_HDC_PHASE_0: ucode supports finer configuration of LTR
  * @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command,
  *     regardless of the band or the number of the probes. FW will calculate
  *     the actual dwell time.
@@ -255,6 +256,7 @@ enum iwl_ucode_tlv_api {
        IWL_UCODE_TLV_API_LMAC_SCAN             = BIT(6),
        IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF     = BIT(7),
        IWL_UCODE_TLV_API_FRAGMENTED_SCAN       = BIT(8),
+       IWL_UCODE_TLV_API_HDC_PHASE_0           = BIT(10),
        IWL_UCODE_TLV_API_BASIC_DWELL           = BIT(13),
        IWL_UCODE_TLV_API_SCD_CFG               = BIT(15),
        IWL_UCODE_TLV_API_SINGLE_SCAN_EBS       = BIT(16),
index 430020047b777e5ff830d2ca0485cff86b64278e..4fc0938b3fb6d6c92464f63b3f206cbc798f92b7 100644 (file)
@@ -91,15 +91,33 @@ enum iwl_ltr_config_flags {
        LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
 };
 
+/**
+ * struct iwl_ltr_config_cmd_v1 - configures the LTR
+ * @flags: See %enum iwl_ltr_config_flags
+ */
+struct iwl_ltr_config_cmd_v1 {
+       __le32 flags;
+       __le32 static_long;
+       __le32 static_short;
+} __packed; /* LTR_CAPABLE_API_S_VER_1 */
+
+#define LTR_VALID_STATES_NUM 4
+
 /**
  * struct iwl_ltr_config_cmd - configures the LTR
  * @flags: See %enum iwl_ltr_config_flags
+ * @static_long:
+ * @static_short:
+ * @ltr_cfg_values:
+ * @ltr_short_idle_timeout:
  */
 struct iwl_ltr_config_cmd {
        __le32 flags;
        __le32 static_long;
        __le32 static_short;
-} __packed;
+       __le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
+       __le32 ltr_short_idle_timeout;
+} __packed; /* LTR_CAPABLE_API_S_VER_2 */
 
 /* Radio LP RX Energy Threshold measured in dBm */
 #define POWER_LPRX_RSSI_THRESHOLD      75
index 2e12f41dd65b392bb00d7e269618fced44a55936..a322a5e3d31b8e5e4323f98fc6c24d16074dfb97 100644 (file)
@@ -499,6 +499,35 @@ int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, enum iwl_fw_dbg_conf conf_id)
        return ret;
 }
 
+static int iwl_mvm_config_ltr_v1(struct iwl_mvm *mvm)
+{
+       struct iwl_ltr_config_cmd_v1 cmd_v1 = {
+               .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
+       };
+
+       if (!mvm->trans->ltr_enabled)
+               return 0;
+
+       return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
+                                   sizeof(cmd_v1), &cmd_v1);
+}
+
+static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
+{
+       struct iwl_ltr_config_cmd cmd = {
+               .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
+       };
+
+       if (!mvm->trans->ltr_enabled)
+               return 0;
+
+       if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_HDC_PHASE_0))
+               return iwl_mvm_config_ltr_v1(mvm);
+
+       return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
+                                   sizeof(cmd), &cmd);
+}
+
 int iwl_mvm_up(struct iwl_mvm *mvm)
 {
        int ret, i;
@@ -604,14 +633,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        /* Initialize tx backoffs to the minimal possible */
        iwl_mvm_tt_tx_backoff(mvm, 0);
 
-       if (mvm->trans->ltr_enabled) {
-               struct iwl_ltr_config_cmd cmd = {
-                       .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
-               };
-
-               WARN_ON(iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
-                                            sizeof(cmd), &cmd));
-       }
+       WARN_ON(iwl_mvm_config_ltr(mvm));
 
        ret = iwl_mvm_power_update_device(mvm);
        if (ret)