Linux Power Management development
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Simon <horms@verge.net.au>, Magnus <magnus.damm@gmail.com>,
	linux-pm@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>
Subject: Re: [PATCH 3/3] thermal: rcar: add .get_trip_type/temp and .notify support
Date: Mon, 03 Dec 2012 09:09:31 +0800	[thread overview]
Message-ID: <1354496971.1936.12.camel@rzhang1-mobl4> (raw)
In-Reply-To: <87obicq9c6.wl%kuninori.morimoto.gx@renesas.com>

Hi, Kuninori,

On Sun, 2012-12-02 at 16:15 -0800, Kuninori Morimoto wrote:
> Hi Zhang
> 
> I couldn't find this patch on v3.8 list.
> Is this patch not good ?
> 
No, the patch looks okay.
This patch set is sent too late for 3.8. Usually patches need to stay in
linux-next for at least two weeks before they are pushing upstream,
especially when there are some big changes made in the patch.
so I just picked up the first two, and leave this one for 3.9.

thanks,
rui

> > This patch adds .get_trip_type(), .get_trip_temp(), and .notify()
> > on rcar_thermal_zone_ops.
> > Driver will try platform power OFF if it reached to
> > critical temperature.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/thermal/rcar_thermal.c |   68 ++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 65 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> > index 90db951..e1aedcc 100644
> > --- a/drivers/thermal/rcar_thermal.c
> > +++ b/drivers/thermal/rcar_thermal.c
> > @@ -22,10 +22,13 @@
> >  #include <linux/io.h>
> >  #include <linux/module.h>
> >  #include <linux/platform_device.h>
> > +#include <linux/reboot.h>
> >  #include <linux/slab.h>
> >  #include <linux/spinlock.h>
> >  #include <linux/thermal.h>
> >  
> > +#define IDLE_INTERVAL	5000
> > +
> >  #define THSCR	0x2c
> >  #define THSSR	0x30
> >  
> > @@ -176,8 +179,66 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
> >  	return 0;
> >  }
> >  
> > +static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone,
> > +				      int trip, enum thermal_trip_type *type)
> > +{
> > +	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> > +
> > +	/* see rcar_thermal_get_temp() */
> > +	switch (trip) {
> > +	case 0: /* +90 <= temp < +135 */
> > +		*type = THERMAL_TRIP_CRITICAL;
> > +		break;
> > +	default:
> > +		dev_err(priv->dev, "rcar driver trip error\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone,
> > +				      int trip, unsigned long *temp)
> > +{
> > +	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> > +
> > +	/* see rcar_thermal_get_temp() */
> > +	switch (trip) {
> > +	case 0: /* +90 <= temp < +135 */
> > +		*temp = MCELSIUS(90 - 1);
> > +		break;
> > +	default:
> > +		dev_err(priv->dev, "rcar driver trip error\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int rcar_thermal_notify(struct thermal_zone_device *zone,
> > +			       int trip, enum thermal_trip_type type)
> > +{
> > +	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> > +
> > +	switch (type) {
> > +	case THERMAL_TRIP_CRITICAL:
> > +		/* FIXME */
> > +		dev_warn(priv->dev,
> > +			 "Thermal reached to critical temperature\n");
> > +		machine_power_off();
> > +		break;
> > +	default:
> > +		break;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >  static struct thermal_zone_device_ops rcar_thermal_zone_ops = {
> > -	.get_temp = rcar_thermal_get_temp,
> > +	.get_temp	= rcar_thermal_get_temp,
> > +	.get_trip_type	= rcar_thermal_get_trip_type,
> > +	.get_trip_temp	= rcar_thermal_get_trip_temp,
> > +	.notify		= rcar_thermal_notify,
> >  };
> >  
> >  /*
> > @@ -211,8 +272,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> >  		return -ENOMEM;
> >  	}
> >  
> > -	zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv,
> > -				    &rcar_thermal_zone_ops, NULL, 0, 0);
> > +	zone = thermal_zone_device_register("rcar_thermal", 1, 0, priv,
> > +					    &rcar_thermal_zone_ops, NULL, 0,
> > +					    IDLE_INTERVAL);
> >  	if (IS_ERR(zone)) {
> >  		dev_err(&pdev->dev, "thermal zone device is NULL\n");
> >  		return PTR_ERR(zone);
> > -- 
> > 1.7.9.5
> > 
> 
> 
> Best regards
> ---
> Kuninori Morimoto



  reply	other threads:[~2012-12-03  1:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22  6:49 [PATCH 0/2] thermal: rcar: add emergency power down Kuninori Morimoto
2012-11-22  6:50 ` [PATCH 1/2] thermal: rcar: add rcar_zone_to_priv() macro Kuninori Morimoto
2012-11-25  9:24   ` Zhang Rui
2012-11-22  6:50 ` [PATCH 2/2] thermal: rcar: add .get_trip_type/temp and .notify support Kuninori Morimoto
2012-11-22  7:05   ` Magnus Damm
2012-11-23  6:29   ` Zhang Rui
2012-11-26  1:40     ` Kuninori Morimoto
2012-11-26  1:52       ` Zhang Rui
2012-11-26  2:30         ` [PATCH 0/3 v2] thermal: rcar: add critical shutdown support Kuninori Morimoto
2012-11-26  2:32           ` [PATCH 1/3] thermal: rcar: fixup the unit of temperature Kuninori Morimoto, Kuninori Morimoto
2012-11-26  2:59             ` Zhang Rui
2012-11-26  2:32           ` [PATCH 2/3] thermal: rcar: add rcar_zone_to_priv() macro Kuninori Morimoto, Kuninori Morimoto
2012-11-26  2:59             ` Zhang Rui
2012-11-26  2:32           ` [PATCH 3/3] thermal: rcar: add .get_trip_type/temp and .notify support Kuninori Morimoto, Kuninori Morimoto
2012-12-03  0:15             ` Kuninori Morimoto
2012-12-03  1:09               ` Zhang Rui [this message]
2012-12-03  2:11                 ` Kuninori Morimoto
2012-12-03  1:02             ` Zhang Rui
2012-12-03  2:20               ` Kuninori Morimoto
2012-12-03  2:22                 ` Zhang Rui
2012-12-03  2:25                 ` Zhang Rui
2012-12-03  2:39                   ` Kuninori Morimoto
2012-12-03  2:48                     ` [PATCH v2] " Kuninori Morimoto, Kuninori Morimoto
2013-01-04  7:23                       ` Zhang Rui

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=1354496971.1936.12.camel@rzhang1-mobl4 \
    --to=rui.zhang@intel.com \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@gmail.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=magnus.damm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox