summaryrefslogtreecommitdiff
path: root/drivers/thermal/intel
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/thermal/intel
parentcbba1d719534b77b857267890b0f54f0f0a90de4 (diff)
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/thermal/intel')
-rw-r--r--drivers/thermal/intel/int340x_thermal/int3400_thermal.c12
-rw-r--r--drivers/thermal/intel/intel_quark_dts_thermal.c16
2 files changed, 10 insertions, 18 deletions
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index e84faaadff87..f65b2fc09198 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -48,7 +48,6 @@ struct int3400_thermal_priv {
struct acpi_device *adev;
struct platform_device *pdev;
struct thermal_zone_device *thermal;
- enum thermal_device_mode mode;
int art_count;
struct art *arts;
int trt_count;
@@ -381,12 +380,7 @@ static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
static int int3400_thermal_get_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode *mode)
{
- struct int3400_thermal_priv *priv = thermal->devdata;
-
- if (!priv)
- return -EINVAL;
-
- *mode = priv->mode;
+ *mode = thermal->mode;
return 0;
}
@@ -404,8 +398,8 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal,
mode != THERMAL_DEVICE_DISABLED)
return -EINVAL;
- if (mode != priv->mode) {
- priv->mode = mode;
+ if (mode != thermal->mode) {
+ thermal->mode = mode;
result = int3400_thermal_run_osc(priv->adev->handle,
priv->current_uuid_index,
mode == THERMAL_DEVICE_ENABLED);
diff --git a/drivers/thermal/intel/intel_quark_dts_thermal.c b/drivers/thermal/intel/intel_quark_dts_thermal.c
index d704fc104cfd..d77cb3df5ade 100644
--- a/drivers/thermal/intel/intel_quark_dts_thermal.c
+++ b/drivers/thermal/intel/intel_quark_dts_thermal.c
@@ -103,7 +103,6 @@ struct soc_sensor_entry {
bool locked;
u32 store_ptps;
u32 store_dts_enable;
- enum thermal_device_mode mode;
struct thermal_zone_device *tzone;
};
@@ -128,7 +127,7 @@ static int soc_dts_enable(struct thermal_zone_device *tzd)
return ret;
if (out & QRK_DTS_ENABLE_BIT) {
- aux_entry->mode = THERMAL_DEVICE_ENABLED;
+ tzd->mode = THERMAL_DEVICE_ENABLED;
return 0;
}
@@ -139,9 +138,9 @@ static int soc_dts_enable(struct thermal_zone_device *tzd)
if (ret)
return ret;
- aux_entry->mode = THERMAL_DEVICE_ENABLED;
+ tzd->mode = THERMAL_DEVICE_ENABLED;
} else {
- aux_entry->mode = THERMAL_DEVICE_DISABLED;
+ tzd->mode = THERMAL_DEVICE_DISABLED;
pr_info("DTS is locked. Cannot enable DTS\n");
ret = -EPERM;
}
@@ -161,7 +160,7 @@ static int soc_dts_disable(struct thermal_zone_device *tzd)
return ret;
if (!(out & QRK_DTS_ENABLE_BIT)) {
- aux_entry->mode = THERMAL_DEVICE_DISABLED;
+ tzd->mode = THERMAL_DEVICE_DISABLED;
return 0;
}
@@ -173,9 +172,9 @@ static int soc_dts_disable(struct thermal_zone_device *tzd)
if (ret)
return ret;
- aux_entry->mode = THERMAL_DEVICE_DISABLED;
+ tzd->mode = THERMAL_DEVICE_DISABLED;
} else {
- aux_entry->mode = THERMAL_DEVICE_ENABLED;
+ tzd->mode = THERMAL_DEVICE_ENABLED;
pr_info("DTS is locked. Cannot disable DTS\n");
ret = -EPERM;
}
@@ -312,8 +311,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd,
static int sys_get_mode(struct thermal_zone_device *tzd,
enum thermal_device_mode *mode)
{
- struct soc_sensor_entry *aux_entry = tzd->devdata;
- *mode = aux_entry->mode;
+ *mode = tzd->mode;
return 0;
}