aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/of-thermal.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index e062bf59ab6c..e145b66df444 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -161,6 +161,28 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz)
161} 161}
162EXPORT_SYMBOL_GPL(of_thermal_get_trip_points); 162EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);
163 163
164/**
165 * of_thermal_set_emul_temp - function to set emulated temperature
166 *
167 * @tz: pointer to a thermal zone
168 * @temp: temperature to set
169 *
170 * This function gives the ability to set emulated value of temperature,
171 * which is handy for debugging
172 *
173 * Return: zero on success, error code otherwise
174 */
175static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
176 unsigned long temp)
177{
178 struct __thermal_zone *data = tz->devdata;
179
180 if (!data->ops || !data->ops->set_emul_temp)
181 return -EINVAL;
182
183 return data->ops->set_emul_temp(data->sensor_data, temp);
184}
185
164static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, 186static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip,
165 enum thermal_trend *trend) 187 enum thermal_trend *trend)
166{ 188{
@@ -392,6 +414,7 @@ thermal_zone_of_add_sensor(struct device_node *zone,
392 414
393 tzd->ops->get_temp = of_thermal_get_temp; 415 tzd->ops->get_temp = of_thermal_get_temp;
394 tzd->ops->get_trend = of_thermal_get_trend; 416 tzd->ops->get_trend = of_thermal_get_trend;
417 tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
395 mutex_unlock(&tzd->lock); 418 mutex_unlock(&tzd->lock);
396 419
397 return tzd; 420 return tzd;
@@ -520,6 +543,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
520 mutex_lock(&tzd->lock); 543 mutex_lock(&tzd->lock);
521 tzd->ops->get_temp = NULL; 544 tzd->ops->get_temp = NULL;
522 tzd->ops->get_trend = NULL; 545 tzd->ops->get_trend = NULL;
546 tzd->ops->set_emul_temp = NULL;
523 547
524 tz->ops = NULL; 548 tz->ops = NULL;
525 tz->sensor_data = NULL; 549 tz->sensor_data = NULL;