From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756808AbcBWCQ1 (ORCPT ); Mon, 22 Feb 2016 21:16:27 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:12821 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754795AbcBWCQY convert rfc822-to-8bit (ORCPT ); Mon, 22 Feb 2016 21:16:24 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 22 Feb 2016 18:15:22 -0800 Message-ID: <56CBC105.6080703@nvidia.com> Date: Tue, 23 Feb 2016 10:16:37 +0800 From: Wei Ni User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: , , CC: , , , , , Subject: Re: [PATCH v6 07/12] thermal: of-thermal: allow setting trip_temp on hardware References: <1456128555-29058-1-git-send-email-wni@nvidia.com> In-Reply-To: <1456128555-29058-1-git-send-email-wni@nvidia.com> X-Originating-IP: [10.19.224.146] X-ClientProxiedBy: HKMAIL101.nvidia.com (10.18.16.10) To HKMAIL101.nvidia.com (10.18.16.10) Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add linux-pm@vger.kernel.org in the CC list. On 2016年02月22日 16:09, Wei Ni wrote: > In current of-thermal, the .set_trip_temp only support to > set trip_temp for SW. But some sensors support to set > trip_temp on hardware, so that can trigger interrupt, > shutdown or any other events. > This patch adds .set_trip_temp() callback in > thermal_zone_of_device_ops{}, so that the sensor device can > use it to set trip_temp on hardware. > > Signed-off-by: Wei Ni > --- > drivers/thermal/of-thermal.c | 8 ++++++++ > include/linux/thermal.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c > index be4eedcb839a..fbfc5a52dc27 100644 > --- a/drivers/thermal/of-thermal.c > +++ b/drivers/thermal/of-thermal.c > @@ -331,6 +331,14 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, > if (trip >= data->ntrips || trip < 0) > return -EDOM; > > + if (data->ops->set_trip_temp) { > + int ret; > + > + ret = data->ops->set_trip_temp(data->sensor_data, trip, temp); > + if (ret) > + return ret; > + } > + > /* thermal framework should take care of data->mask & (1 << trip) */ > data->trips[trip].temperature = temp; > > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index e13a1ace50e9..e69296dc583b 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -338,6 +338,7 @@ struct thermal_zone_of_device_ops { > int (*get_temp)(void *, int *); > int (*get_trend)(void *, long *); > int (*set_emul_temp)(void *, int); > + int (*set_trip_temp)(void *, int, int); > }; > > /** >