diff options
author | Andrzej Pietrasiewicz <andrzej.p@collabora.com> | 2020-06-29 14:29:16 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2020-06-29 20:26:33 +0200 |
commit | 1595d887afe46b0ad721f27df895a61d4879ede2 (patch) | |
tree | 38480aa594e936d8e72bd447a35c645cbee45ee9 /drivers/platform/x86/acerhdf.c | |
parent | acpi: thermal: Fix error handling in the register function (diff) | |
download | linux-1595d887afe46b0ad721f27df895a61d4879ede2.tar.xz linux-1595d887afe46b0ad721f27df895a61d4879ede2.zip |
thermal: Store thermal mode in a dedicated enum
Prepare for storing mode in struct thermal_zone_device.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
[for acerhdf]
Acked-by: Peter Kaestle <peter@piie.net>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200629122925.21729-3-andrzej.p@collabora.com
Diffstat (limited to 'drivers/platform/x86/acerhdf.c')
-rw-r--r-- | drivers/platform/x86/acerhdf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 4df7609b4aa9..9d1030b1a4f4 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -68,6 +68,7 @@ static int kernelmode = 1; #else static int kernelmode; #endif +static enum thermal_device_mode thermal_mode; static unsigned int interval = 10; static unsigned int fanon = 60000; @@ -397,6 +398,7 @@ static inline void acerhdf_revert_to_bios_mode(void) { acerhdf_change_fanstate(ACERHDF_FAN_AUTO); kernelmode = 0; + thermal_mode = THERMAL_DEVICE_DISABLED; if (thz_dev) thz_dev->polling_delay = 0; pr_notice("kernel mode fan control OFF\n"); @@ -404,6 +406,7 @@ static inline void acerhdf_revert_to_bios_mode(void) static inline void acerhdf_enable_kernelmode(void) { kernelmode = 1; + thermal_mode = THERMAL_DEVICE_ENABLED; thz_dev->polling_delay = interval*1000; thermal_zone_device_update(thz_dev, THERMAL_EVENT_UNSPECIFIED); @@ -416,8 +419,7 @@ static int acerhdf_get_mode(struct thermal_zone_device *thermal, if (verbose) pr_notice("kernel mode fan control %d\n", kernelmode); - *mode = (kernelmode) ? THERMAL_DEVICE_ENABLED - : THERMAL_DEVICE_DISABLED; + *mode = thermal_mode; return 0; } @@ -739,6 +741,8 @@ static int __init acerhdf_register_thermal(void) if (IS_ERR(cl_dev)) return -EINVAL; + thermal_mode = kernelmode ? + THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED; thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL, &acerhdf_dev_ops, &acerhdf_zone_params, 0, |