* [RFC PATCH 6/12] thermal: introduce active cooling algorithm
@ 2012-06-11 3:20 Zhang Rui
2012-06-11 4:51 ` Amit Kachhap
0 siblings, 1 reply; 5+ messages in thread
From: Zhang Rui @ 2012-06-11 3:20 UTC (permalink / raw)
To: linux-pm, linux-acpi@vger.kernel.org
Introduce thermal_zone_trip_update() to update the cooling state
of all the cooling devices that are binded to an active trip point.
This will be used for passive cooling as well, in the future patches.
as both active and passive cooling can share the same algorithm,
which is
1. if the temperature is higher than a trip point,
a. if the trend is THERMAL_TREND_RAISING, use higher cooling
state for this trip point
b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
state for this trip point
2. if the temperature is lower than a trip point, use lower
cooling state for this trip point.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/acpi/thermal.c | 7 ++-
drivers/thermal/thermal_sys.c | 91 ++++++++++++++++++++++++++++++------------
2 files changed, 71 insertions(+), 27 deletions(-)
Index: rtd3/drivers/thermal/thermal_sys.c
===================================================================
--- rtd3.orig/drivers/thermal/thermal_sys.c
+++ rtd3/drivers/thermal/thermal_sys.c
@@ -1035,6 +1035,70 @@ void thermal_cooling_device_unregister(s
}
EXPORT_SYMBOL(thermal_cooling_device_unregister);
+/*
+ * Cooling algorithm for active trip points
+ *
+ * 1. if the temperature is higher than a trip point,
+ * a. if the trend is THERMAL_TREND_RAISING, use higher cooling
+ * state for this trip point
+ * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
+ * state for this trip point
+ *
+ * 2. if the temperature is lower than a trip point, use lower
+ * cooling state for this trip point
+ *
+ * Note that this behaves the same as the previous passive cooling
+ * algorithm.
+ */
+
+static void thermal_zone_trip_update(struct thermal_zone_device *tz,
+ int trip, long temp)
+{
+ struct thermal_cooling_device_instance *instance;
+ struct thermal_cooling_device *cdev = NULL;
+ unsigned long cur_state, max_state;
+ long trip_temp;
+ enum thermal_trend trend;
+
+ tz->ops->get_trip_temp(tz, trip, &trip_temp);
+
+ if (temp >= trip_temp) {
+ thermal_get_trend(tz, trip, &trend);
+
+ list_for_each_entry(instance, &tz->cooling_devices, node) {
+ if (instance->trip != trip)
+ continue;
+
+ cdev = instance->cdev;
+
+ cdev->ops->get_cur_state(cdev, &cur_state);
+ cdev->ops->get_max_state(cdev, &max_state);
+
+ if (trend == THERMAL_TREND_RAISING) {
+ cur_state = cur_state < instance->upper ?
+ (cur_state + 1) : instance->upper;
+ } else if (trend == THERMAL_TREND_DROPPING) {
+ cur_state = cur_state > instance->lower ?
+ (cur_state - 1) : instance->lower;
+ }
+ cdev->ops->set_cur_state(cdev, cur_state);
+ }
+ } else { /* below trip */
+ list_for_each_entry(instance, &tz->cooling_devices, node) {
+ if (instance->trip != trip)
+ continue;
+
+ cdev = instance->cdev;
+ cdev->ops->get_cur_state(cdev, &cur_state);
+
+ cur_state = cur_state > instance->lower ?
+ (cur_state - 1) : instance->lower;
+ cdev->ops->set_cur_state(cdev, cur_state);
+ }
+ }
+
+ return;
+}
/**
* thermal_zone_device_update - force an update of a thermal zone's state
* @ttz: the thermal zone to update
@@ -1045,9 +1109,6 @@ void thermal_zone_device_update(struct t
int count, ret = 0;
long temp, trip_temp;
enum thermal_trip_type trip_type;
- struct thermal_cooling_device_instance *instance;
- struct thermal_cooling_device *cdev;
- unsigned long cur_state, max_state;
mutex_lock(&tz->lock);
@@ -1083,29 +1144,7 @@ void thermal_zone_device_update(struct t
tz->ops->notify(tz, count, trip_type);
break;
case THERMAL_TRIP_ACTIVE:
- list_for_each_entry(instance, &tz->cooling_devices,
- node) {
- if (instance->trip != count)
- continue;
-
- cdev = instance->cdev;
-
- cdev->ops->get_cur_state(cdev, &cur_state);
- cdev->ops->get_max_state(cdev, &max_state);
-
- if (temp >= trip_temp)
- cur_state =
- cur_state < instance->upper ?
- (cur_state + 1) :
- instance->upper;
- else
- cur_state =
- cur_state > instance->lower ?
- (cur_state - 1) :
- instance->lower;
-
- cdev->ops->set_cur_state(cdev, cur_state);
- }
+ thermal_zone_trip_update(tz, count, temp);
break;
case THERMAL_TRIP_PASSIVE:
if (temp >= trip_temp || tz->passive)
Index: rtd3/drivers/acpi/thermal.c
===================================================================
--- rtd3.orig/drivers/acpi/thermal.c
+++ rtd3/drivers/acpi/thermal.c
@@ -717,7 +717,12 @@ static int thermal_get_trend(struct ther
if (thermal_get_trip_type(thermal, trip, &type))
return -EINVAL;
- /* Only PASSIVE trip points need TREND */
+ if (type == THERMAL_TRIP_ACTIVE) {
+ /* aggressive active cooling */
+ *trend = THERMAL_TREND_RAISING;
+ return 0;
+ }
+
if (type != THERMAL_TRIP_PASSIVE)
return -EINVAL;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFC PATCH 6/12] thermal: introduce active cooling algorithm 2012-06-11 3:20 [RFC PATCH 6/12] thermal: introduce active cooling algorithm Zhang Rui @ 2012-06-11 4:51 ` Amit Kachhap 2012-06-11 6:38 ` Zhang Rui 0 siblings, 1 reply; 5+ messages in thread From: Amit Kachhap @ 2012-06-11 4:51 UTC (permalink / raw) To: Zhang Rui; +Cc: linux-acpi@vger.kernel.org, linux-pm On 11 June 2012 08:50, Zhang Rui <rui.zhang@intel.com> wrote: > > Introduce thermal_zone_trip_update() to update the cooling state > of all the cooling devices that are binded to an active trip point. > > This will be used for passive cooling as well, in the future patches. > as both active and passive cooling can share the same algorithm, > which is > > 1. if the temperature is higher than a trip point, > a. if the trend is THERMAL_TREND_RAISING, use higher cooling > state for this trip point > b. if the trend is THERMAL_TREND_DROPPING, use lower cooling > state for this trip point > > 2. if the temperature is lower than a trip point, use lower > cooling state for this trip point. > > Signed-off-by: Zhang Rui <rui.zhang@intel.com> > --- > drivers/acpi/thermal.c | 7 ++- > drivers/thermal/thermal_sys.c | 91 ++++++++++++++++++++++++++++++------------ > 2 files changed, 71 insertions(+), 27 deletions(-) > > Index: rtd3/drivers/thermal/thermal_sys.c > =================================================================== > --- rtd3.orig/drivers/thermal/thermal_sys.c > +++ rtd3/drivers/thermal/thermal_sys.c > @@ -1035,6 +1035,70 @@ void thermal_cooling_device_unregister(s > } > EXPORT_SYMBOL(thermal_cooling_device_unregister); > > +/* > + * Cooling algorithm for active trip points > + * > + * 1. if the temperature is higher than a trip point, > + * a. if the trend is THERMAL_TREND_RAISING, use higher cooling > + * state for this trip point > + * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling > + * state for this trip point > + * > + * 2. if the temperature is lower than a trip point, use lower > + * cooling state for this trip point > + * > + * Note that this behaves the same as the previous passive cooling > + * algorithm. > + */ > + > +static void thermal_zone_trip_update(struct thermal_zone_device *tz, > + int trip, long temp) > +{ > + struct thermal_cooling_device_instance *instance; > + struct thermal_cooling_device *cdev = NULL; > + unsigned long cur_state, max_state; > + long trip_temp; > + enum thermal_trend trend; > + > + tz->ops->get_trip_temp(tz, trip, &trip_temp); > + > + if (temp >= trip_temp) { > + thermal_get_trend(tz, trip, &trend); > + > + list_for_each_entry(instance, &tz->cooling_devices, node) { > + if (instance->trip != trip) > + continue; > + > + cdev = instance->cdev; > + > + cdev->ops->get_cur_state(cdev, &cur_state); > + cdev->ops->get_max_state(cdev, &max_state); > + > + if (trend == THERMAL_TREND_RAISING) { > + cur_state = cur_state < instance->upper ? > + (cur_state + 1) : instance->upper; > + } else if (trend == THERMAL_TREND_DROPPING) { > + cur_state = cur_state > instance->lower ? > + (cur_state - 1) : instance->lower; > + } > + cdev->ops->set_cur_state(cdev, cur_state); > + } > + } else { /* below trip */ > + list_for_each_entry(instance, &tz->cooling_devices, node) { > + if (instance->trip != trip) > + continue; Can we use the trend callback here even if the current temperature is less than the trip temperature. Basically according to trend it should deactivate the cooling devices as done for activating cooling devices. > + > + cdev = instance->cdev; > + cdev->ops->get_cur_state(cdev, &cur_state); > + > + cur_state = cur_state > instance->lower ? > + (cur_state - 1) : instance->lower; > + cdev->ops->set_cur_state(cdev, cur_state); > + } > + } > + > + return; > +} > /** > * thermal_zone_device_update - force an update of a thermal zone's state > * @ttz: the thermal zone to update > @@ -1045,9 +1109,6 @@ void thermal_zone_device_update(struct t > int count, ret = 0; > long temp, trip_temp; > enum thermal_trip_type trip_type; > - struct thermal_cooling_device_instance *instance; > - struct thermal_cooling_device *cdev; > - unsigned long cur_state, max_state; > > mutex_lock(&tz->lock); > > @@ -1083,29 +1144,7 @@ void thermal_zone_device_update(struct t > tz->ops->notify(tz, count, trip_type); > break; > case THERMAL_TRIP_ACTIVE: > - list_for_each_entry(instance, &tz->cooling_devices, > - node) { > - if (instance->trip != count) > - continue; > - > - cdev = instance->cdev; > - > - cdev->ops->get_cur_state(cdev, &cur_state); > - cdev->ops->get_max_state(cdev, &max_state); > - > - if (temp >= trip_temp) > - cur_state = > - cur_state < instance->upper ? > - (cur_state + 1) : > - instance->upper; > - else > - cur_state = > - cur_state > instance->lower ? > - (cur_state - 1) : > - instance->lower; > - > - cdev->ops->set_cur_state(cdev, cur_state); > - } > + thermal_zone_trip_update(tz, count, temp); > break; > case THERMAL_TRIP_PASSIVE: > if (temp >= trip_temp || tz->passive) > Index: rtd3/drivers/acpi/thermal.c > =================================================================== > --- rtd3.orig/drivers/acpi/thermal.c > +++ rtd3/drivers/acpi/thermal.c > @@ -717,7 +717,12 @@ static int thermal_get_trend(struct ther > if (thermal_get_trip_type(thermal, trip, &type)) > return -EINVAL; > > - /* Only PASSIVE trip points need TREND */ > + if (type == THERMAL_TRIP_ACTIVE) { > + /* aggressive active cooling */ > + *trend = THERMAL_TREND_RAISING; > + return 0; > + } > + > if (type != THERMAL_TRIP_PASSIVE) > return -EINVAL; > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 6/12] thermal: introduce active cooling algorithm 2012-06-11 4:51 ` Amit Kachhap @ 2012-06-11 6:38 ` Zhang Rui 2012-06-11 11:44 ` Eduardo Valentin 0 siblings, 1 reply; 5+ messages in thread From: Zhang Rui @ 2012-06-11 6:38 UTC (permalink / raw) To: Amit Kachhap; +Cc: linux-acpi@vger.kernel.org, linux-pm On 一, 2012-06-11 at 10:21 +0530, Amit Kachhap wrote: > On 11 June 2012 08:50, Zhang Rui <rui.zhang@intel.com> wrote: > > > > Introduce thermal_zone_trip_update() to update the cooling state > > of all the cooling devices that are binded to an active trip point. > > > > This will be used for passive cooling as well, in the future patches. > > as both active and passive cooling can share the same algorithm, > > which is > > > > 1. if the temperature is higher than a trip point, > > a. if the trend is THERMAL_TREND_RAISING, use higher cooling > > state for this trip point > > b. if the trend is THERMAL_TREND_DROPPING, use lower cooling > > state for this trip point > > > > 2. if the temperature is lower than a trip point, use lower > > cooling state for this trip point. > > > > Signed-off-by: Zhang Rui <rui.zhang@intel.com> > > --- > > drivers/acpi/thermal.c | 7 ++- > > drivers/thermal/thermal_sys.c | 91 ++++++++++++++++++++++++++++++------------ > > 2 files changed, 71 insertions(+), 27 deletions(-) > > > > Index: rtd3/drivers/thermal/thermal_sys.c > > =================================================================== > > --- rtd3.orig/drivers/thermal/thermal_sys.c > > +++ rtd3/drivers/thermal/thermal_sys.c > > @@ -1035,6 +1035,70 @@ void thermal_cooling_device_unregister(s > > } > > EXPORT_SYMBOL(thermal_cooling_device_unregister); > > > > +/* > > + * Cooling algorithm for active trip points > > + * > > + * 1. if the temperature is higher than a trip point, > > + * a. if the trend is THERMAL_TREND_RAISING, use higher cooling > > + * state for this trip point > > + * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling > > + * state for this trip point > > + * > > + * 2. if the temperature is lower than a trip point, use lower > > + * cooling state for this trip point > > + * > > + * Note that this behaves the same as the previous passive cooling > > + * algorithm. > > + */ > > + > > +static void thermal_zone_trip_update(struct thermal_zone_device *tz, > > + int trip, long temp) > > +{ > > + struct thermal_cooling_device_instance *instance; > > + struct thermal_cooling_device *cdev = NULL; > > + unsigned long cur_state, max_state; > > + long trip_temp; > > + enum thermal_trend trend; > > + > > + tz->ops->get_trip_temp(tz, trip, &trip_temp); > > + > > + if (temp >= trip_temp) { > > + thermal_get_trend(tz, trip, &trend); > > + > > + list_for_each_entry(instance, &tz->cooling_devices, node) { > > + if (instance->trip != trip) > > + continue; > > + > > + cdev = instance->cdev; > > + > > + cdev->ops->get_cur_state(cdev, &cur_state); > > + cdev->ops->get_max_state(cdev, &max_state); > > + > > + if (trend == THERMAL_TREND_RAISING) { > > + cur_state = cur_state < instance->upper ? > > + (cur_state + 1) : instance->upper; > > + } else if (trend == THERMAL_TREND_DROPPING) { > > + cur_state = cur_state > instance->lower ? > > + (cur_state - 1) : instance->lower; > > + } > > + cdev->ops->set_cur_state(cdev, cur_state); > > + } > > + } else { /* below trip */ > > + list_for_each_entry(instance, &tz->cooling_devices, node) { > > + if (instance->trip != trip) > > + continue; > Can we use the trend callback here even if the current temperature is > less than the trip temperature. Basically according to trend it should > deactivate the cooling devices as done for activating cooling devices. yes, this depends on the cooling algorithm we want to use. When the temperature is lower than the trip point, if we want to stop the fan immediately instead of spinning down step by step, we can do this. Actually, what we are discussing right now should be some cooling governor stuff. which I'm not sure if we should introduce to the generic thermal manager or not, right now. :) thanks, rui > > + > > + cdev = instance->cdev; > > + cdev->ops->get_cur_state(cdev, &cur_state); > > + > > + cur_state = cur_state > instance->lower ? > > + (cur_state - 1) : instance->lower; > > + cdev->ops->set_cur_state(cdev, cur_state); > > + } > > + } > > + > > + return; > > +} > > /** > > * thermal_zone_device_update - force an update of a thermal zone's state > > * @ttz: the thermal zone to update > > @@ -1045,9 +1109,6 @@ void thermal_zone_device_update(struct t > > int count, ret = 0; > > long temp, trip_temp; > > enum thermal_trip_type trip_type; > > - struct thermal_cooling_device_instance *instance; > > - struct thermal_cooling_device *cdev; > > - unsigned long cur_state, max_state; > > > > mutex_lock(&tz->lock); > > > > @@ -1083,29 +1144,7 @@ void thermal_zone_device_update(struct t > > tz->ops->notify(tz, count, trip_type); > > break; > > case THERMAL_TRIP_ACTIVE: > > - list_for_each_entry(instance, &tz->cooling_devices, > > - node) { > > - if (instance->trip != count) > > - continue; > > - > > - cdev = instance->cdev; > > - > > - cdev->ops->get_cur_state(cdev, &cur_state); > > - cdev->ops->get_max_state(cdev, &max_state); > > - > > - if (temp >= trip_temp) > > - cur_state = > > - cur_state < instance->upper ? > > - (cur_state + 1) : > > - instance->upper; > > - else > > - cur_state = > > - cur_state > instance->lower ? > > - (cur_state - 1) : > > - instance->lower; > > - > > - cdev->ops->set_cur_state(cdev, cur_state); > > - } > > + thermal_zone_trip_update(tz, count, temp); > > break; > > case THERMAL_TRIP_PASSIVE: > > if (temp >= trip_temp || tz->passive) > > Index: rtd3/drivers/acpi/thermal.c > > =================================================================== > > --- rtd3.orig/drivers/acpi/thermal.c > > +++ rtd3/drivers/acpi/thermal.c > > @@ -717,7 +717,12 @@ static int thermal_get_trend(struct ther > > if (thermal_get_trip_type(thermal, trip, &type)) > > return -EINVAL; > > > > - /* Only PASSIVE trip points need TREND */ > > + if (type == THERMAL_TRIP_ACTIVE) { > > + /* aggressive active cooling */ > > + *trend = THERMAL_TREND_RAISING; > > + return 0; > > + } > > + > > if (type != THERMAL_TRIP_PASSIVE) > > return -EINVAL; > > > > > > _______________________________________________ linux-pm mailing list linux-pm@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-pm ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 6/12] thermal: introduce active cooling algorithm 2012-06-11 6:38 ` Zhang Rui @ 2012-06-11 11:44 ` Eduardo Valentin 2012-06-11 11:48 ` R, Durgadoss 0 siblings, 1 reply; 5+ messages in thread From: Eduardo Valentin @ 2012-06-11 11:44 UTC (permalink / raw) To: Zhang Rui Cc: Amit Kachhap, linux-pm, linux-acpi@vger.kernel.org, eduardo, R, Durgadoss, Len, Brown, Rafael J. Wysocki, Matthew Garrett Hello, On Mon, Jun 11, 2012 at 02:38:24PM +0800, Zhang Rui wrote: > On 一, 2012-06-11 at 10:21 +0530, Amit Kachhap wrote: > > On 11 June 2012 08:50, Zhang Rui <rui.zhang@intel.com> wrote: > > > > > > Introduce thermal_zone_trip_update() to update the cooling state > > > of all the cooling devices that are binded to an active trip point. > > > > > > This will be used for passive cooling as well, in the future patches. > > > as both active and passive cooling can share the same algorithm, > > > which is > > > > > > 1. if the temperature is higher than a trip point, > > > a. if the trend is THERMAL_TREND_RAISING, use higher cooling > > > state for this trip point > > > b. if the trend is THERMAL_TREND_DROPPING, use lower cooling > > > state for this trip point > > > > > > 2. if the temperature is lower than a trip point, use lower > > > cooling state for this trip point. > > > > > > Signed-off-by: Zhang Rui <rui.zhang@intel.com> > > > --- > > > drivers/acpi/thermal.c | 7 ++- > > > drivers/thermal/thermal_sys.c | 91 ++++++++++++++++++++++++++++++------------ > > > 2 files changed, 71 insertions(+), 27 deletions(-) > > > > > > Index: rtd3/drivers/thermal/thermal_sys.c > > > =================================================================== > > > --- rtd3.orig/drivers/thermal/thermal_sys.c > > > +++ rtd3/drivers/thermal/thermal_sys.c > > > @@ -1035,6 +1035,70 @@ void thermal_cooling_device_unregister(s > > > } > > > EXPORT_SYMBOL(thermal_cooling_device_unregister); > > > > > > +/* > > > + * Cooling algorithm for active trip points > > > + * > > > + * 1. if the temperature is higher than a trip point, > > > + * a. if the trend is THERMAL_TREND_RAISING, use higher cooling > > > + * state for this trip point > > > + * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling > > > + * state for this trip point > > > + * > > > + * 2. if the temperature is lower than a trip point, use lower > > > + * cooling state for this trip point > > > + * > > > + * Note that this behaves the same as the previous passive cooling > > > + * algorithm. > > > + */ > > > + > > > +static void thermal_zone_trip_update(struct thermal_zone_device *tz, > > > + int trip, long temp) > > > +{ > > > + struct thermal_cooling_device_instance *instance; > > > + struct thermal_cooling_device *cdev = NULL; > > > + unsigned long cur_state, max_state; > > > + long trip_temp; > > > + enum thermal_trend trend; > > > + > > > + tz->ops->get_trip_temp(tz, trip, &trip_temp); > > > + > > > + if (temp >= trip_temp) { > > > + thermal_get_trend(tz, trip, &trend); > > > + > > > + list_for_each_entry(instance, &tz->cooling_devices, node) { > > > + if (instance->trip != trip) > > > + continue; > > > + > > > + cdev = instance->cdev; > > > + > > > + cdev->ops->get_cur_state(cdev, &cur_state); > > > + cdev->ops->get_max_state(cdev, &max_state); > > > + > > > + if (trend == THERMAL_TREND_RAISING) { > > > + cur_state = cur_state < instance->upper ? > > > + (cur_state + 1) : instance->upper; > > > + } else if (trend == THERMAL_TREND_DROPPING) { > > > + cur_state = cur_state > instance->lower ? > > > + (cur_state - 1) : instance->lower; > > > + } > > > + cdev->ops->set_cur_state(cdev, cur_state); > > > + } > > > + } else { /* below trip */ > > > + list_for_each_entry(instance, &tz->cooling_devices, node) { > > > + if (instance->trip != trip) > > > + continue; > > Can we use the trend callback here even if the current temperature is > > less than the trip temperature. Basically according to trend it should > > deactivate the cooling devices as done for activating cooling devices. > > yes, this depends on the cooling algorithm we want to use. > When the temperature is lower than the trip point, if we want to stop > the fan immediately instead of spinning down step by step, we can do > this. > > Actually, what we are discussing right now should be some cooling > governor stuff. which I'm not sure if we should introduce to the generic > thermal manager or not, right now. :) Rui, this is an interesting point. Do you have plans to have governor like approach in the generic thermal fw? Or are you sticking to the zone/cooling binding? > > thanks, > rui > > > > + > > > + cdev = instance->cdev; > > > + cdev->ops->get_cur_state(cdev, &cur_state); > > > + > > > + cur_state = cur_state > instance->lower ? > > > + (cur_state - 1) : instance->lower; > > > + cdev->ops->set_cur_state(cdev, cur_state); > > > + } > > > + } > > > + > > > + return; > > > +} > > > /** > > > * thermal_zone_device_update - force an update of a thermal zone's state > > > * @ttz: the thermal zone to update > > > @@ -1045,9 +1109,6 @@ void thermal_zone_device_update(struct t > > > int count, ret = 0; > > > long temp, trip_temp; > > > enum thermal_trip_type trip_type; > > > - struct thermal_cooling_device_instance *instance; > > > - struct thermal_cooling_device *cdev; > > > - unsigned long cur_state, max_state; > > > > > > mutex_lock(&tz->lock); > > > > > > @@ -1083,29 +1144,7 @@ void thermal_zone_device_update(struct t > > > tz->ops->notify(tz, count, trip_type); > > > break; > > > case THERMAL_TRIP_ACTIVE: > > > - list_for_each_entry(instance, &tz->cooling_devices, > > > - node) { > > > - if (instance->trip != count) > > > - continue; > > > - > > > - cdev = instance->cdev; > > > - > > > - cdev->ops->get_cur_state(cdev, &cur_state); > > > - cdev->ops->get_max_state(cdev, &max_state); > > > - > > > - if (temp >= trip_temp) > > > - cur_state = > > > - cur_state < instance->upper ? > > > - (cur_state + 1) : > > > - instance->upper; > > > - else > > > - cur_state = > > > - cur_state > instance->lower ? > > > - (cur_state - 1) : > > > - instance->lower; > > > - > > > - cdev->ops->set_cur_state(cdev, cur_state); > > > - } > > > + thermal_zone_trip_update(tz, count, temp); > > > break; > > > case THERMAL_TRIP_PASSIVE: > > > if (temp >= trip_temp || tz->passive) > > > Index: rtd3/drivers/acpi/thermal.c > > > =================================================================== > > > --- rtd3.orig/drivers/acpi/thermal.c > > > +++ rtd3/drivers/acpi/thermal.c > > > @@ -717,7 +717,12 @@ static int thermal_get_trend(struct ther > > > if (thermal_get_trip_type(thermal, trip, &type)) > > > return -EINVAL; > > > > > > - /* Only PASSIVE trip points need TREND */ > > > + if (type == THERMAL_TRIP_ACTIVE) { > > > + /* aggressive active cooling */ > > > + *trend = THERMAL_TREND_RAISING; > > > + return 0; > > > + } > > > + > > > if (type != THERMAL_TRIP_PASSIVE) > > > return -EINVAL; > > > > > > > > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 6/12] thermal: introduce active cooling algorithm 2012-06-11 11:44 ` Eduardo Valentin @ 2012-06-11 11:48 ` R, Durgadoss 0 siblings, 0 replies; 5+ messages in thread From: R, Durgadoss @ 2012-06-11 11:48 UTC (permalink / raw) To: eduardo.valentin@ti.com, Zhang, Rui; +Cc: linux-acpi@vger.kernel.org, linux-pm Hi Eduardo, > > > Can we use the trend callback here even if the current temperature is > > > less than the trip temperature. Basically according to trend it should > > > deactivate the cooling devices as done for activating cooling devices. > > > > yes, this depends on the cooling algorithm we want to use. > > When the temperature is lower than the trip point, if we want to stop > > the fan immediately instead of spinning down step by step, we can do > > this. > > > > Actually, what we are discussing right now should be some cooling > > governor stuff. which I'm not sure if we should introduce to the generic > > thermal manager or not, right now. :) > > Rui, this is an interesting point. Do you have plans to have governor like approach > in the generic thermal fw? Or are you sticking to the zone/cooling binding? Yes We have. I am almost done. Will submit patches by tomorrow. Unfortunately, I cannot re-base my code now on top of Rui's patches. So, I will submit an RFC version and we can work to resolve the conflicts. Thanks, Durga ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-11 11:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-06-11 3:20 [RFC PATCH 6/12] thermal: introduce active cooling algorithm Zhang Rui 2012-06-11 4:51 ` Amit Kachhap 2012-06-11 6:38 ` Zhang Rui 2012-06-11 11:44 ` Eduardo Valentin 2012-06-11 11:48 ` R, Durgadoss
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox