1 From 525f68bb9d9f6334dbcd2b5ec99f9d797ff53618 Mon Sep 17 00:00:00 2001
2 From: Sascha Hauer <s.hauer@pengutronix.de>
3 Date: Wed, 13 May 2015 10:52:40 +0200
4 Subject: [PATCH 21/76] thermal: of: implement .set_trips for device tree
7 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
9 drivers/thermal/of-thermal.c | 12 ++++++++++++
10 include/linux/thermal.h | 3 +++
11 2 files changed, 15 insertions(+)
13 --- a/drivers/thermal/of-thermal.c
14 +++ b/drivers/thermal/of-thermal.c
15 @@ -97,6 +97,17 @@ static int of_thermal_get_temp(struct th
16 return data->ops->get_temp(data->sensor_data, temp);
19 +static int of_thermal_set_trips(struct thermal_zone_device *tz,
22 + struct __thermal_zone *data = tz->devdata;
24 + if (!data->ops || !data->ops->set_trips)
27 + return data->ops->set_trips(data->sensor_data, low, high);
31 * of_thermal_get_ntrips - function to export number of available trip
33 @@ -367,6 +378,7 @@ static int of_thermal_get_crit_temp(stru
35 static const struct thermal_zone_device_ops of_thermal_ops = {
36 .get_temp = of_thermal_get_temp,
37 + .set_trips = of_thermal_set_trips,
38 .get_trend = of_thermal_get_trend,
39 .set_emul_temp = of_thermal_set_emul_temp,
41 --- a/include/linux/thermal.h
42 +++ b/include/linux/thermal.h
43 @@ -272,12 +272,15 @@ struct thermal_genl_event {
46 * @get_trend: a pointer to a function that reads the sensor temperature trend.
47 + * @set_trips: a pointer to a function that sets a temperature window which shall
48 + * trigger an interrupt when it is left.
49 * @set_emul_temp: a pointer to a function that sets sensor emulated
52 struct thermal_zone_of_device_ops {
53 int (*get_temp)(void *, int *);
54 int (*get_trend)(void *, int, enum thermal_trend *);
55 + int (*set_trips)(void *, int, int);
56 int (*set_emul_temp)(void *, int);