From: Wei Ni <wni@nvidia.com>
To: thierry.reding@gmail.com, edubezval@gmail.com, rui.zhang@intel.com
Cc: MLongnecker@nvidia.com, swarren@wwwdotorg.org,
mikko.perttunen@kapsi.fi, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v6 07/12] thermal: of-thermal: allow setting trip_temp on hardware
Date: Tue, 23 Feb 2016 10:16:37 +0800 [thread overview]
Message-ID: <56CBC105.6080703@nvidia.com> (raw)
In-Reply-To: <1456128555-29058-1-git-send-email-wni@nvidia.com>
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 <wni@nvidia.com>
> ---
> 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);
> };
>
> /**
>
WARNING: multiple messages have this Message-ID (diff)
From: Wei Ni <wni@nvidia.com>
To: <thierry.reding@gmail.com>, <edubezval@gmail.com>, <rui.zhang@intel.com>
Cc: <MLongnecker@nvidia.com>, <swarren@wwwdotorg.org>,
<mikko.perttunen@kapsi.fi>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v6 07/12] thermal: of-thermal: allow setting trip_temp on hardware
Date: Tue, 23 Feb 2016 10:16:37 +0800 [thread overview]
Message-ID: <56CBC105.6080703@nvidia.com> (raw)
In-Reply-To: <1456128555-29058-1-git-send-email-wni@nvidia.com>
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 <wni@nvidia.com>
> ---
> 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);
> };
>
> /**
>
next prev parent reply other threads:[~2016-02-23 2:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 8:09 [PATCH v6 07/12] thermal: of-thermal: allow setting trip_temp on hardware Wei Ni
2016-02-22 8:09 ` Wei Ni
2016-02-23 2:16 ` Wei Ni [this message]
2016-02-23 2:16 ` Wei Ni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CBC105.6080703@nvidia.com \
--to=wni@nvidia.com \
--cc=MLongnecker@nvidia.com \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mikko.perttunen@kapsi.fi \
--cc=rui.zhang@intel.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.