From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753289AbbCZPyZ (ORCPT ); Thu, 26 Mar 2015 11:54:25 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:56453 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753172AbbCZPyV (ORCPT ); Thu, 26 Mar 2015 11:54:21 -0400 From: Sascha Hauer To: linux-pm@vger.kernel.org Cc: Zhang Rui , Eduardo Valentin , linux-kernel@vger.kernel.org, Stephen Warren , Mikko Perttunen , kernel@pengutronix.de, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Sascha Hauer Subject: [PATCH 13/13] thermal: of: implement .set_trips for device tree thermal zones Date: Thu, 26 Mar 2015 16:54:00 +0100 Message-Id: <1427385240-6086-14-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427385240-6086-1-git-send-email-s.hauer@pengutronix.de> References: <1427385240-6086-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Sascha Hauer --- drivers/thermal/of-thermal.c | 12 ++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 9b63193..a3de5de 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -97,6 +97,17 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz, return data->ops->get_temp(data->sensor_data, temp); } +static int of_thermal_set_trips(struct thermal_zone_device *tz, + unsigned long low, unsigned long high) +{ + struct __thermal_zone *data = tz->devdata; + + if (!data->ops || !data->ops->set_trips) + return -ENOSYS; + + return data->ops->set_trips(data->sensor_data, low, high); +} + /** * of_thermal_get_ntrips - function to export number of available trip * points. @@ -367,6 +378,7 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, static const struct thermal_zone_device_ops of_thermal_ops = { .get_temp = of_thermal_get_temp, + .set_trips = of_thermal_set_trips, .get_trend = of_thermal_get_trend, .set_emul_temp = of_thermal_set_emul_temp, diff --git a/include/linux/thermal.h b/include/linux/thermal.h index b870702..84a5b5d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -276,6 +276,7 @@ struct thermal_genl_event { */ struct thermal_zone_of_device_ops { int (*get_temp)(void *, unsigned long *); + int (*set_trips)(void *, unsigned long, unsigned long); int (*get_trend)(void *, int trend, enum thermal_trend *); int (*set_emul_temp)(void *, unsigned long); }; -- 2.1.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.hauer@pengutronix.de (Sascha Hauer) Date: Thu, 26 Mar 2015 16:54:00 +0100 Subject: [PATCH 13/13] thermal: of: implement .set_trips for device tree thermal zones In-Reply-To: <1427385240-6086-1-git-send-email-s.hauer@pengutronix.de> References: <1427385240-6086-1-git-send-email-s.hauer@pengutronix.de> Message-ID: <1427385240-6086-14-git-send-email-s.hauer@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Signed-off-by: Sascha Hauer --- drivers/thermal/of-thermal.c | 12 ++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 9b63193..a3de5de 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -97,6 +97,17 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz, return data->ops->get_temp(data->sensor_data, temp); } +static int of_thermal_set_trips(struct thermal_zone_device *tz, + unsigned long low, unsigned long high) +{ + struct __thermal_zone *data = tz->devdata; + + if (!data->ops || !data->ops->set_trips) + return -ENOSYS; + + return data->ops->set_trips(data->sensor_data, low, high); +} + /** * of_thermal_get_ntrips - function to export number of available trip * points. @@ -367,6 +378,7 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, static const struct thermal_zone_device_ops of_thermal_ops = { .get_temp = of_thermal_get_temp, + .set_trips = of_thermal_set_trips, .get_trend = of_thermal_get_trend, .set_emul_temp = of_thermal_set_emul_temp, diff --git a/include/linux/thermal.h b/include/linux/thermal.h index b870702..84a5b5d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -276,6 +276,7 @@ struct thermal_genl_event { */ struct thermal_zone_of_device_ops { int (*get_temp)(void *, unsigned long *); + int (*set_trips)(void *, unsigned long, unsigned long); int (*get_trend)(void *, int trend, enum thermal_trend *); int (*set_emul_temp)(void *, unsigned long); }; -- 2.1.4