linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Srikar Srimath Tirumala
	<srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	srinivas.pandruvada-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	mlongnecker-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH v3 3/4] thermal: of: enable temperature notifications
Date: Mon, 2 May 2016 20:26:27 -0700	[thread overview]
Message-ID: <20160503032626.GA18752@localhost.localdomain> (raw)
In-Reply-To: <1459298497-29481-4-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

On Tue, Mar 29, 2016 at 05:41:36PM -0700, Srikar Srimath Tirumala wrote:
> * Add a state variable to track if trip point is triggered.
> * Enable trip events only when the state of the tirp point changes.
> * Implement the get\set callbacks for trip state.
> 
> Change-Id: I1bd6a7b0e5e520d8ee678b83111d23cada7a580c
> Signed-off-by: Srikar Srimath Tirumala <srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/thermal/of-thermal.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
> index 49ac23d..f6d9d3d 100644
> --- a/drivers/thermal/of-thermal.c
> +++ b/drivers/thermal/of-thermal.c
> @@ -379,6 +379,43 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
>  	return -EINVAL;
>  }
>  
> +static bool of_thermal_enb_temp_notify(struct thermal_zone_device *tz, int trip)
> +{
> +	bool ret = true;
> +	struct __thermal_zone *data = tz->devdata;
> +
> +	if (trip >= data->ntrips || trip < 0)
> +		ret = false;
> +
> +	return ret;
> +}
> +
> +static int of_thermal_get_trip_state(struct thermal_zone_device *tz, int trip,
> +				     enum thermal_trip_state *state)
> +{
> +	struct __thermal_zone *data = tz->devdata;
> +
> +	if (trip >= data->ntrips || trip < 0)
> +		return -EDOM;
> +
> +	*state = data->trips[trip].state;

For the sake of the current implementation, I believe tracking state is probably
more of a thermal core duty. Not sure this has anything to do with OF
thermal.


Could you please clarify why you think this has to be here?

> +
> +	return 0;
> +}
> +
> +static int of_thermal_set_trip_state(struct thermal_zone_device *tz, int trip,
> +				     enum thermal_trip_state state)
> +{
> +	struct __thermal_zone *data = tz->devdata;
> +
> +	if (trip >= data->ntrips || trip < 0)
> +		return -EDOM;
> +
> +	data->trips[trip].state = state;
> +
> +	return 0;
> +}
> +
>  static struct thermal_zone_device_ops of_thermal_ops = {
>  	.get_mode = of_thermal_get_mode,
>  	.set_mode = of_thermal_set_mode,
> @@ -392,6 +429,10 @@ static struct thermal_zone_device_ops of_thermal_ops = {
>  
>  	.bind = of_thermal_bind,
>  	.unbind = of_thermal_unbind,
> +
> +	.get_trip_state = of_thermal_get_trip_state,
> +	.set_trip_state = of_thermal_set_trip_state,
> +	.enb_temp_notify = of_thermal_enb_temp_notify,
>  };
>  
>  /***   sensor API   ***/
> @@ -782,6 +823,8 @@ static int thermal_of_populate_trip(struct device_node *np,
>  		return ret;
>  	}
>  
> +	trip->state = THERMAL_TRIP_NOT_TRIPPED;
> +
>  	/* Required for cooling map matching */
>  	trip->np = np;
>  	of_node_get(np);
> -- 
> 2.1.4
> 

  parent reply	other threads:[~2016-05-03  3:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30  0:41 [PATCH v3 0/4] add sysfs_notify on some attributes Srikar Srimath Tirumala
     [not found] ` <1459298497-29481-1-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-30  0:41   ` [PATCH v3 1/4] thermal: send notifications for cdev state change Srikar Srimath Tirumala
     [not found]     ` <1459298497-29481-2-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-30 16:45       ` Matt Longnecker
2016-03-30  0:41   ` [PATCH v3 3/4] thermal: of: enable temperature notifications Srikar Srimath Tirumala
2016-03-30 16:54     ` Matt Longnecker
     [not found]     ` <1459298497-29481-4-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-05-03  3:26       ` Eduardo Valentin [this message]
2016-03-30  0:41   ` [PATCH v3 4/4] thermal: update documentation for new device ops Srikar Srimath Tirumala
     [not found]     ` <1459298497-29481-5-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-30 16:54       ` Matt Longnecker
2016-05-03  3:27     ` Eduardo Valentin
2016-03-30  0:41 ` [PATCH v3 2/4] thermal: send notifications for tz temperature Srikar Srimath Tirumala
     [not found]   ` <1459298497-29481-3-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-30 16:43     ` Matt Longnecker
2016-03-30 16:53       ` Matt Longnecker

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=20160503032626.GA18752@localhost.localdomain \
    --to=edubezval-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mlongnecker-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=srinivas.pandruvada-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).