diff mbox

[4/4] thermal: bang-bang governor: act on lower trip boundary

Message ID 1461553367-24744-5-git-send-email-wxt@rock-chips.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Caesar Wang April 25, 2016, 3:02 a.m. UTC
From: Sascha Hauer <s.hauer@pengutronix.de>

With interrupt driven thermal zones we pass the lower and upper
temperature on which shall be acted, so in the governor we have to act on
the exact lower temperature to be consistent. Otherwise an interrupt maybe
generated on the exact lower temperature, but the bang bang governor does
not react.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org

---

 drivers/thermal/gov_bang_bang.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eduardo Valentin April 27, 2016, 9:54 p.m. UTC | #1
On Mon, Apr 25, 2016 at 11:02:47AM +0800, Caesar Wang wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> With interrupt driven thermal zones we pass the lower and upper
> temperature on which shall be acted, so in the governor we have to act on
> the exact lower temperature to be consistent. Otherwise an interrupt maybe
> generated on the exact lower temperature, but the bang bang governor does
> not react.

What is the expected impact on polling driven zones that use bang bang
after this change?

> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Cc: linux-pm@vger.kernel.org
> 
> ---
> 
>  drivers/thermal/gov_bang_bang.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
> index 70836c5..9d1dfea 100644
> --- a/drivers/thermal/gov_bang_bang.c
> +++ b/drivers/thermal/gov_bang_bang.c
> @@ -59,7 +59,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
>  		if (instance->target == 0 && tz->temperature >= trip_temp)
>  			instance->target = 1;
>  		else if (instance->target == 1 &&
> -				tz->temperature < trip_temp - trip_hyst)
> +				tz->temperature <= trip_temp - trip_hyst)
>  			instance->target = 0;
>  
>  		dev_dbg(&instance->cdev->device, "target=%d\n",
> -- 
> 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sascha Hauer April 28, 2016, 6:30 a.m. UTC | #2
On Wed, Apr 27, 2016 at 02:54:26PM -0700, Eduardo Valentin wrote:
> On Mon, Apr 25, 2016 at 11:02:47AM +0800, Caesar Wang wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > With interrupt driven thermal zones we pass the lower and upper
> > temperature on which shall be acted, so in the governor we have to act on
> > the exact lower temperature to be consistent. Otherwise an interrupt maybe
> > generated on the exact lower temperature, but the bang bang governor does
> > not react.
> 
> What is the expected impact on polling driven zones that use bang bang
> after this change?

Polling driven zones may have to be one step cooler before the governor
reacts, otherwise the behaviour should be unaffected.

Sascha
Eduardo Valentin April 28, 2016, 2:50 p.m. UTC | #3
On Thu, Apr 28, 2016 at 08:30:18AM +0200, Sascha Hauer wrote:
> On Wed, Apr 27, 2016 at 02:54:26PM -0700, Eduardo Valentin wrote:
> > On Mon, Apr 25, 2016 at 11:02:47AM +0800, Caesar Wang wrote:
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > 
> > > With interrupt driven thermal zones we pass the lower and upper
> > > temperature on which shall be acted, so in the governor we have to act on
> > > the exact lower temperature to be consistent. Otherwise an interrupt maybe
> > > generated on the exact lower temperature, but the bang bang governor does
> > > not react.
> > 
> > What is the expected impact on polling driven zones that use bang bang
> > after this change?
> 
> Polling driven zones may have to be one step cooler before the governor
> reacts, otherwise the behaviour should be unaffected.

OK. Can we add this description of the expectation of what will happen
to polling driver zones in the next version? An explanation on how this
has bee tested on polling driven zones it is also welcome.

> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
index 70836c5..9d1dfea 100644
--- a/drivers/thermal/gov_bang_bang.c
+++ b/drivers/thermal/gov_bang_bang.c
@@ -59,7 +59,7 @@  static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
 		if (instance->target == 0 && tz->temperature >= trip_temp)
 			instance->target = 1;
 		else if (instance->target == 1 &&
-				tz->temperature < trip_temp - trip_hyst)
+				tz->temperature <= trip_temp - trip_hyst)
 			instance->target = 0;
 
 		dev_dbg(&instance->cdev->device, "target=%d\n",