[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1372927830-2949-6-git-send-email-l.majewski@samsung.com>
Date: Thu, 04 Jul 2013 10:50:28 +0200
From: Lukasz Majewski <l.majewski@...sung.com>
To: Viresh Kumar <viresh.kumar@...aro.org>,
"Rafael J. Wysocki" <rjw@...k.pl>, Zhang Rui <rui.zhang@...el.com>,
Eduardo Valentin <eduardo.valentin@...com>
Cc: "cpufreq@...r.kernel.org" <cpufreq@...r.kernel.org>,
Linux PM list <linux-pm@...r.kernel.org>,
Jonghwa Lee <jonghwa3.lee@...sung.com>,
Lukasz Majewski <l.majewski@...sung.com>, l.majewski@...ess.pl,
linux-kernel <linux-kernel@...r.kernel.org>,
Andre Przywara <andre.przywara@...aro.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Kukjin Kim <kgene.kim@...sung.com>,
Myungjoo Ham <myungjoo.ham@...sung.com>
Subject: [PATCH v5 5/7] thermal:boost: Automatic enable/disable of BOOST feature
This patch provides auto disable/enable operation for boost. When any
defined trip point is passed, the boost is disabled.
In that moment thermal monitor workqueue is woken up and it monitors
if the device temperature drops below 75% of the smallest trip point.
When device cools down, the boost is enabled again.
Signed-off-by: Lukasz Majewski <l.majewski@...sung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@...sung.com>
---
Changes for v5:
- Move boost disable code from cpu_cooling.c to thermal_core.c
(to handle_non_critical_trips)
- Extent struct thermal_zone_device by adding overheated bool flag
- Implement auto enable of boost after device cools down
- Introduce boost_polling flag, which indicates if thermal uses it's predefined
pool delay or has woken up thermal workqueue only to wait until device
cools down.
Changes for v4:
- New patch
drivers/thermal/thermal_core.c | 31 +++++++++++++++++++++++++++++++
include/linux/thermal.h | 2 ++
2 files changed, 33 insertions(+)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d755440..12adbad 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -33,6 +33,7 @@
#include <linux/idr.h>
#include <linux/thermal.h>
#include <linux/reboot.h>
+#include <linux/cpufreq.h>
#include <net/netlink.h>
#include <net/genetlink.h>
@@ -326,6 +327,15 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
static void handle_non_critical_trips(struct thermal_zone_device *tz,
int trip, enum thermal_trip_type trip_type)
{
+ if (cpufreq_boost_supported()) {
+ tz->overheated = true;
+ cpufreq_boost_trigger_state(0);
+ if (!tz->polling_delay) {
+ tz->boost_polling = true;
+ tz->polling_delay = 1000;
+ }
+ }
+
if (tz->governor)
tz->governor->throttle(tz, trip);
}
@@ -453,6 +463,27 @@ static void thermal_zone_device_check(struct work_struct *work)
struct thermal_zone_device *tz = container_of(work, struct
thermal_zone_device,
poll_queue.work);
+ long trip_temp;
+
+ if (cpufreq_boost_supported() && tz->overheated) {
+ tz->ops->get_trip_temp(tz, 0, &trip_temp);
+ /*
+ * Enable boost again only when current temperature is less
+ * than 75% of trip_temp[0]
+ */
+ if ((tz->temperature + (trip_temp >> 2)) < trip_temp) {
+ tz->overheated = false;
+ if (tz->boost_polling) {
+ tz->boost_polling = false;
+ tz->polling_delay = 0;
+ monitor_thermal_zone(tz);
+ }
+
+ cpufreq_boost_trigger_state(1);
+ return;
+ }
+ }
+
thermal_zone_device_update(tz);
}
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index a386a1c..f1aa3c2 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -172,6 +172,8 @@ struct thermal_zone_device {
int emul_temperature;
int passive;
unsigned int forced_passive;
+ bool overheated;
+ bool boost_polling;
const struct thermal_zone_device_ops *ops;
const struct thermal_zone_params *tzp;
struct thermal_governor *governor;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists