summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorBai Ping <b51503@freescale.com>2015-09-08 01:58:22 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:23:09 +0800
commit4361432e11599749da5d82ca7a9aeef9e9805067 (patch)
tree5a1aaecc469f7f35fef19ce1f4de514cb5a65e5e /drivers/thermal
parent7ea96f96b09b88a116cefcf9e3bb52fb46fad91b (diff)
MLK-11518-02 thermal: imx: add .get_trend callback fn in thermal driver
add .get_trend callback to determine the thermal raise/fall trend, when the temp great than a threshold, drop to the lowest trend (THERMAL_TREND_DROP_FULL). Signed-off-by: Bai Ping <b51503@freescale.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/imx_thermal.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 3a733310e6e1..c83b7776c63b 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -91,6 +91,8 @@ enum imx_thermal_trip {
IMX_TRIP_NUM,
};
+#define IMX_TEMP_PASSIVE_COOL_DELTA 10000
+
#define IMX_POLLING_DELAY 2000 /* millisecond */
#define IMX_PASSIVE_DELAY 1000
@@ -494,6 +496,23 @@ static int imx_unbind(struct thermal_zone_device *tz,
return 0;
}
+static int imx_get_trend(struct thermal_zone_device *tz,
+ int trip, enum thermal_trend *trend)
+{
+ int ret;
+ int trip_temp;
+
+ ret = imx_get_trip_temp(tz, trip, &trip_temp);
+ if (ret < 0)
+ return ret;
+
+ if (tz->temperature >= (trip_temp - IMX_TEMP_PASSIVE_COOL_DELTA))
+ *trend = THERMAL_TREND_RAISE_FULL;
+ else
+ *trend = THERMAL_TREND_DROP_FULL;
+
+ return 0;
+}
static struct thermal_zone_device_ops imx_tz_ops = {
.bind = imx_bind,
.unbind = imx_unbind,
@@ -504,6 +523,7 @@ static struct thermal_zone_device_ops imx_tz_ops = {
.get_trip_temp = imx_get_trip_temp,
.get_crit_temp = imx_get_crit_temp,
.set_trip_temp = imx_set_trip_temp,
+ .get_trend = imx_get_trend,
};
static inline void imx6_calibrate_data(struct imx_thermal_data *data, u32 val)