summaryrefslogtreecommitdiff
path: root/drivers/scsi/ufs/ufs-hwmon.c
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@wdc.com>2021-09-15 09:04:07 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2021-09-22 00:07:42 -0400
commit322c4b29ee1f19ce153f027bfb21d272b029f2d7 (patch)
treef74222d3b5fadcd89922ae10f0c2233b39d79b6b /drivers/scsi/ufs/ufs-hwmon.c
parente88e2d32200a1734cb4a2ca292c5c7b338257bb6 (diff)
scsi: ufs: core: Add temperature notification exception handling
The device may notify the host of an extreme temperature by using the exception event mechanism. The exception can be raised when the device’s Tcase temperature is either too high or too low. It is essentially up to the platform to decide what further actions need to be taken. leave a placeholder for a designated vop for that. Link: https://lore.kernel.org/r/20210915060407.40-3-avri.altman@wdc.com Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Daejun Park <daejun7.park@samsung.com> Signed-off-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/ufs/ufs-hwmon.c')
-rw-r--r--drivers/scsi/ufs/ufs-hwmon.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufs-hwmon.c b/drivers/scsi/ufs/ufs-hwmon.c
index 33b66736aaa4..74855491dc8f 100644
--- a/drivers/scsi/ufs/ufs-hwmon.c
+++ b/drivers/scsi/ufs/ufs-hwmon.c
@@ -196,3 +196,15 @@ void ufs_hwmon_remove(struct ufs_hba *hba)
hba->hwmon_device = NULL;
kfree(data);
}
+
+void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask)
+{
+ if (!hba->hwmon_device)
+ return;
+
+ if (ee_mask & MASK_EE_TOO_HIGH_TEMP)
+ hwmon_notify_event(hba->hwmon_device, hwmon_temp, hwmon_temp_max_alarm, 0);
+
+ if (ee_mask & MASK_EE_TOO_LOW_TEMP)
+ hwmon_notify_event(hba->hwmon_device, hwmon_temp, hwmon_temp_min_alarm, 0);
+}