summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>2020-06-29 14:29:18 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-06-29 20:26:34 +0200
commit5a3506657f71d7ca124c040aff98639673c5dc97 (patch)
tree7cae0f77b9bb04ff0281c62b85b1506e467a572f /drivers/platform
parentthermal: Add current mode to thermal zone device (diff)
downloadlinux-5a3506657f71d7ca124c040aff98639673c5dc97.tar.xz
linux-5a3506657f71d7ca124c040aff98639673c5dc97.zip
thermal: Store device mode in struct thermal_zone_device
Prepare for eliminating get_mode(). Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> [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-5-andrzej.p@collabora.com
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/acerhdf.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 9d1030b1a4f4..6f21015e5fd9 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -68,7 +68,6 @@ 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;
@@ -398,15 +397,16 @@ 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)
+ if (thz_dev) {
+ thz_dev->mode = THERMAL_DEVICE_DISABLED;
thz_dev->polling_delay = 0;
+ }
pr_notice("kernel mode fan control OFF\n");
}
static inline void acerhdf_enable_kernelmode(void)
{
kernelmode = 1;
- thermal_mode = THERMAL_DEVICE_ENABLED;
+ thz_dev->mode = THERMAL_DEVICE_ENABLED;
thz_dev->polling_delay = interval*1000;
thermal_zone_device_update(thz_dev, THERMAL_EVENT_UNSPECIFIED);
@@ -419,7 +419,7 @@ static int acerhdf_get_mode(struct thermal_zone_device *thermal,
if (verbose)
pr_notice("kernel mode fan control %d\n", kernelmode);
- *mode = thermal_mode;
+ *mode = thermal->mode;
return 0;
}
@@ -741,8 +741,6 @@ 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,
@@ -750,6 +748,9 @@ static int __init acerhdf_register_thermal(void)
if (IS_ERR(thz_dev))
return -EINVAL;
+ thz_dev->mode = kernelmode ?
+ THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED;
+
if (strcmp(thz_dev->governor->name,
acerhdf_zone_params.governor_name)) {
pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",