|
@@ -95,29 +95,58 @@ static void iwl_mvm_exit_ctkill(struct iwl_mvm *mvm)
|
|
|
iwl_mvm_set_hw_ctkill_state(mvm, false);
|
|
|
}
|
|
|
|
|
|
-static bool iwl_mvm_temp_notif(struct iwl_notif_wait_data *notif_wait,
|
|
|
- struct iwl_rx_packet *pkt, void *data)
|
|
|
+void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp)
|
|
|
+{
|
|
|
+ /* ignore the notification if we are in test mode */
|
|
|
+ if (mvm->temperature_test)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (mvm->temperature == temp)
|
|
|
+ return;
|
|
|
+
|
|
|
+ mvm->temperature = temp;
|
|
|
+ iwl_mvm_tt_handler(mvm);
|
|
|
+}
|
|
|
+
|
|
|
+static int iwl_mvm_temp_notif_parse(struct iwl_mvm *mvm,
|
|
|
+ struct iwl_rx_packet *pkt)
|
|
|
{
|
|
|
- struct iwl_mvm *mvm =
|
|
|
- container_of(notif_wait, struct iwl_mvm, notif_wait);
|
|
|
- int *temp = data;
|
|
|
struct iwl_dts_measurement_notif *notif;
|
|
|
int len = iwl_rx_packet_payload_len(pkt);
|
|
|
+ int temp;
|
|
|
|
|
|
if (WARN_ON_ONCE(len != sizeof(*notif))) {
|
|
|
IWL_ERR(mvm, "Invalid DTS_MEASUREMENT_NOTIFICATION\n");
|
|
|
- return true;
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
notif = (void *)pkt->data;
|
|
|
|
|
|
- *temp = le32_to_cpu(notif->temp);
|
|
|
+ temp = le32_to_cpu(notif->temp);
|
|
|
|
|
|
/* shouldn't be negative, but since it's s32, make sure it isn't */
|
|
|
- if (WARN_ON_ONCE(*temp < 0))
|
|
|
- *temp = 0;
|
|
|
+ if (WARN_ON_ONCE(temp < 0))
|
|
|
+ temp = 0;
|
|
|
+
|
|
|
+ IWL_DEBUG_TEMP(mvm, "DTS_MEASUREMENT_NOTIFICATION - %d\n", temp);
|
|
|
+
|
|
|
+ return temp;
|
|
|
+}
|
|
|
+
|
|
|
+static bool iwl_mvm_temp_notif_wait(struct iwl_notif_wait_data *notif_wait,
|
|
|
+ struct iwl_rx_packet *pkt, void *data)
|
|
|
+{
|
|
|
+ struct iwl_mvm *mvm =
|
|
|
+ container_of(notif_wait, struct iwl_mvm, notif_wait);
|
|
|
+ int *temp = data;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = iwl_mvm_temp_notif_parse(mvm, pkt);
|
|
|
+ if (ret < 0)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ *temp = ret;
|
|
|
|
|
|
- IWL_DEBUG_TEMP(mvm, "DTS_MEASUREMENT_NOTIFICATION - %d\n", *temp);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -141,7 +170,7 @@ int iwl_mvm_get_temp(struct iwl_mvm *mvm)
|
|
|
|
|
|
iwl_init_notification_wait(&mvm->notif_wait, &wait_temp_notif,
|
|
|
temp_notif, ARRAY_SIZE(temp_notif),
|
|
|
- iwl_mvm_temp_notif, &temp);
|
|
|
+ iwl_mvm_temp_notif_wait, &temp);
|
|
|
|
|
|
ret = iwl_mvm_get_temp_cmd(mvm);
|
|
|
if (ret) {
|