aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/ti-soc-thermal
diff options
context:
space:
mode:
authorJ Keerthy <j-keerthy@ti.com>2013-04-01 12:04:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-01 12:27:31 -0700
commit03b7f67bd1a085572539788d07c4630489108a35 (patch)
treea8bdef7a02cb13b85b75ba45754685c1649e134f /drivers/staging/ti-soc-thermal
parent2f440b0622085a130ff723bb037066c9cbfc8cd7 (diff)
downloadlinux-03b7f67bd1a085572539788d07c4630489108a35.tar.gz
staging: ti-soc-thermal: Add get_trend support
Patch adds get_trend functionality for OMAP Bandgap thermal devices. Signed-off-by: J Keerthy <j-keerthy@ti.com> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ti-soc-thermal')
-rw-r--r--drivers/staging/ti-soc-thermal/ti-thermal-common.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/staging/ti-soc-thermal/ti-thermal-common.c b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
index 231c5490d1b..092b39d15d2 100644
--- a/drivers/staging/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
@@ -215,6 +215,31 @@ static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
return 0;
}
+/* Get the temperature trend callback functions for thermal zone */
+static int ti_thermal_get_trend(struct thermal_zone_device *thermal,
+ int trip, enum thermal_trend *trend)
+{
+ struct ti_thermal_data *data = thermal->devdata;
+ struct ti_bandgap *bgp;
+ int id, tr, ret = 0;
+
+ bgp = data->bgp;
+ id = data->sensor_id;
+
+ ret = ti_bandgap_get_trend(bgp, id, &tr);
+ if (ret)
+ return ret;
+
+ if (tr > 0)
+ *trend = THERMAL_TREND_RAISING;
+ else if (tr < 0)
+ *trend = THERMAL_TREND_DROPPING;
+ else
+ *trend = THERMAL_TREND_STABLE;
+
+ return 0;
+}
+
/* Get critical temperature callback functions for thermal zone */
static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
@@ -225,7 +250,7 @@ static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
static struct thermal_zone_device_ops ti_thermal_ops = {
.get_temp = ti_thermal_get_temp,
- /* TODO: add .get_trend */
+ .get_trend = ti_thermal_get_trend,
.bind = ti_thermal_bind,
.unbind = ti_thermal_unbind,
.get_mode = ti_thermal_get_mode,