iwlwifi: mvm: correctly request DTS-measure for new cards
authorArik Nemtsov <arik@wizery.com>
Tue, 6 Oct 2015 09:22:47 +0000 (12:22 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 25 Oct 2015 11:45:02 +0000 (13:45 +0200)
Since the 8000 series, the DTS measurement request command has been
changed. Use an ucode capability flag to determine which version is
supported and send the extended command when needed.

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

index 72ddd4a163e6847438af8d8d10c72f9b961b3e2f..847d58b4e73aab6a533fe09210749dbcba606e46 100644 (file)
@@ -306,6 +306,7 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t;
  *     is supported.
  * @IWL_UCODE_TLV_CAPA_BT_COEX_RRC: supports BT Coex RRC
  * @IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT: supports gscan
+ * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -330,6 +331,7 @@ enum iwl_ucode_tlv_capa {
        IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC                = (__force iwl_ucode_tlv_capa_t)29,
        IWL_UCODE_TLV_CAPA_BT_COEX_RRC                  = (__force iwl_ucode_tlv_capa_t)30,
        IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT                = (__force iwl_ucode_tlv_capa_t)31,
+       IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE         = (__force iwl_ucode_tlv_capa_t)64,
 
        NUM_IWL_UCODE_TLV_CAPA
 #ifdef __CHECKER__
index 44ff6849b7a59753702113861cb0f21bb61f4a24..181590fbd3b340c712d3f0d1edb70b118a7c9b89 100644 (file)
@@ -1523,6 +1523,69 @@ struct iwl_dts_measurement_cmd {
        __le32 flags;
 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
 
+/**
+* enum iwl_dts_control_measurement_mode - DTS measurement type
+* @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
+*                 back (latest value. Not waiting for new value). Use automatic
+*                 SW DTS configuration.
+* @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
+*                    trigger DTS reading and provide read back temperature read
+*                    when available.
+* @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
+* @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
+*                              without measurement trigger.
+*/
+enum iwl_dts_control_measurement_mode {
+       DTS_AUTOMATIC                   = 0,
+       DTS_REQUEST_READ                = 1,
+       DTS_OVER_WRITE                  = 2,
+       DTS_DIRECT_WITHOUT_MEASURE      = 3,
+};
+
+/**
+* enum iwl_dts_used - DTS to use or used for measurement in the DTS request
+* @DTS_USE_TOP: Top
+* @DTS_USE_CHAIN_A: chain A
+* @DTS_USE_CHAIN_B: chain B
+* @DTS_USE_CHAIN_C: chain C
+* @XTAL_TEMPERATURE - read temperature from xtal
+*/
+enum iwl_dts_used {
+       DTS_USE_TOP             = 0,
+       DTS_USE_CHAIN_A         = 1,
+       DTS_USE_CHAIN_B         = 2,
+       DTS_USE_CHAIN_C         = 3,
+       XTAL_TEMPERATURE        = 4,
+};
+
+/**
+* enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
+* @DTS_BIT6_MODE: bit 6 mode
+* @DTS_BIT8_MODE: bit 8 mode
+*/
+enum iwl_dts_bit_mode {
+       DTS_BIT6_MODE   = 0,
+       DTS_BIT8_MODE   = 1,
+};
+
+/**
+ * iwl_ext_dts_measurement_cmd - request extended DTS temperature measurements
+ * @control_mode: see &enum iwl_dts_control_measurement_mode
+ * @temperature: used when over write DTS mode is selected
+ * @sensor: set temperature sensor to use. See &enum iwl_dts_used
+ * @avg_factor: average factor to DTS in request DTS read mode
+ * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
+ * @step_duration: step duration for the DTS
+ */
+struct iwl_ext_dts_measurement_cmd {
+       __le32 control_mode;
+       __le32 temperature;
+       __le32 sensor;
+       __le32 avg_factor;
+       __le32 bit_mode;
+       __le32 step_duration;
+} __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */
+
 /**
  * iwl_dts_measurement_notif - notification received with the measurements
  *
index 58b762f1e0b54a2cd40a1db7b71580d179d5b765..cadfc046059799065db59d797954ff893a2c580a 100644 (file)
@@ -176,6 +176,9 @@ static int iwl_mvm_get_temp_cmd(struct iwl_mvm *mvm)
        struct iwl_dts_measurement_cmd cmd = {
                .flags = cpu_to_le32(DTS_TRIGGER_CMD_FLAGS_TEMP),
        };
+       struct iwl_ext_dts_measurement_cmd extcmd = {
+               .control_mode = cpu_to_le32(DTS_AUTOMATIC),
+       };
        u32 cmdid;
 
        if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_WIDE_CMD_HDR))
@@ -183,8 +186,12 @@ static int iwl_mvm_get_temp_cmd(struct iwl_mvm *mvm)
                                   PHY_OPS_GROUP, 0);
        else
                cmdid = CMD_DTS_MEASUREMENT_TRIGGER;
-       return iwl_mvm_send_cmd_pdu(mvm, cmdid, 0,
-                                   sizeof(cmd), &cmd);
+
+       if (!fw_has_capa(&mvm->fw->ucode_capa,
+                        IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE))
+               return iwl_mvm_send_cmd_pdu(mvm, cmdid, 0, sizeof(cmd), &cmd);
+
+       return iwl_mvm_send_cmd_pdu(mvm, cmdid, 0, sizeof(extcmd), &extcmd);
 }
 
 int iwl_mvm_get_temp(struct iwl_mvm *mvm)