Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Thermal/int340x/int3402: Provide notification support

This driver supports programmable trips, but didn't register
notification handler to receive threshold violation notification.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>

authored by

Srinivas Pandruvada and committed by
Zhang Rui
acebf7ee 1c55be02

+33
+33
drivers/thermal/int340x_thermal/int3402_thermal.c
··· 16 16 #include <linux/thermal.h> 17 17 #include "int340x_thermal_zone.h" 18 18 19 + #define INT3402_PERF_CHANGED_EVENT 0x80 20 + #define INT3402_THERMAL_EVENT 0x90 21 + 19 22 struct int3402_thermal_data { 20 23 acpi_handle *handle; 21 24 struct int34x_thermal_zone *int340x_zone; 22 25 }; 23 26 27 + static void int3402_notify(acpi_handle handle, u32 event, void *data) 28 + { 29 + struct int3402_thermal_data *priv = data; 30 + 31 + if (!priv) 32 + return; 33 + 34 + switch (event) { 35 + case INT3402_PERF_CHANGED_EVENT: 36 + break; 37 + case INT3402_THERMAL_EVENT: 38 + int340x_thermal_zone_device_update(priv->int340x_zone); 39 + break; 40 + default: 41 + break; 42 + } 43 + } 44 + 24 45 static int int3402_thermal_probe(struct platform_device *pdev) 25 46 { 26 47 struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); 27 48 struct int3402_thermal_data *d; 49 + int ret; 28 50 29 51 if (!acpi_has_method(adev->handle, "_TMP")) 30 52 return -ENODEV; ··· 59 37 if (IS_ERR(d->int340x_zone)) 60 38 return PTR_ERR(d->int340x_zone); 61 39 40 + ret = acpi_install_notify_handler(adev->handle, 41 + ACPI_DEVICE_NOTIFY, 42 + int3402_notify, 43 + d); 44 + if (ret) { 45 + int340x_thermal_zone_remove(d->int340x_zone); 46 + return ret; 47 + } 48 + 62 49 d->handle = adev->handle; 63 50 platform_set_drvdata(pdev, d); 64 51 ··· 78 47 { 79 48 struct int3402_thermal_data *d = platform_get_drvdata(pdev); 80 49 50 + acpi_remove_notify_handler(d->handle, 51 + ACPI_DEVICE_NOTIFY, int3402_notify); 81 52 int340x_thermal_zone_remove(d->int340x_zone); 82 53 83 54 return 0;