[COMMON] thermal: samsung: Added get_trend function
authorHyeonseong Gil <hs.gil@samsung.com>
Wed, 5 Apr 2017 00:37:53 +0000 (09:37 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:09:08 +0000 (17:09 +0900)
Exynos will use sensor ops for get_trend function.

Change-Id: I2da40c030c8ed44f1901b2ebb7d7122d2f243ec6
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/samsung/exynos_tmu.c

index 003ceb7cdc6d210316019968af0acc28ee8cebdc..87e39d04978ccf5a3638ea47c4d3b893149ee669 100644 (file)
@@ -1059,6 +1059,24 @@ static int exynos_get_temp(void *p, int *temp)
        return 0;
 }
 
+static int exynos_get_trend(void *p, int trip, enum thermal_trend *trend)
+{
+       struct exynos_tmu_data *data = p;
+       struct thermal_zone_device *tz = data->tzd;
+       int trip_temp, ret = 0;
+
+       ret = tz->ops->get_trip_temp(tz, trip, &trip_temp);
+       if (ret < 0)
+               return ret;
+
+       if (tz->temperature >= trip_temp)
+               *trend = THERMAL_TREND_RAISE_FULL;
+       else
+               *trend = THERMAL_TREND_DROP_FULL;
+
+       return 0;
+}
+
 #ifdef CONFIG_THERMAL_EMULATION
 static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
                            int temp)
@@ -1458,6 +1476,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
 static const struct thermal_zone_of_device_ops exynos_sensor_ops = {
        .get_temp = exynos_get_temp,
        .set_emul_temp = exynos_tmu_set_emulation,
+       .get_trend = exynos_get_trend,
 };
 
 static int exynos_tmu_probe(struct platform_device *pdev)