aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/Kconfig13
-rw-r--r--drivers/thermal/thermal_core.c27
-rw-r--r--drivers/thermal/x86_pkg_temp_thermal.c11
3 files changed, 36 insertions, 15 deletions
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 35c066489a19..5f88d767671e 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -136,6 +136,7 @@ config SPEAR_THERMAL
136config RCAR_THERMAL 136config RCAR_THERMAL
137 tristate "Renesas R-Car thermal driver" 137 tristate "Renesas R-Car thermal driver"
138 depends on ARCH_SHMOBILE || COMPILE_TEST 138 depends on ARCH_SHMOBILE || COMPILE_TEST
139 depends on HAS_IOMEM
139 help 140 help
140 Enable this to plug the R-Car thermal sensor driver into the Linux 141 Enable this to plug the R-Car thermal sensor driver into the Linux
141 thermal framework. 142 thermal framework.
@@ -210,8 +211,16 @@ config ACPI_INT3403_THERMAL
210 tristate "ACPI INT3403 thermal driver" 211 tristate "ACPI INT3403 thermal driver"
211 depends on X86 && ACPI 212 depends on X86 && ACPI
212 help 213 help
213 This driver uses ACPI INT3403 device objects. If present, it will 214 Newer laptops and tablets that use ACPI may have thermal sensors
214 register each INT3403 thermal sensor as a thermal zone. 215 outside the core CPU/SOC for thermal safety reasons. These
216 temperature sensors are also exposed for the OS to use via the so
217 called INT3403 ACPI object. This driver will, on devices that have
218 such sensors, expose the temperature information from these sensors
219 to userspace via the normal thermal framework. This means that a wide
220 range of applications and GUI widgets can show this information to
221 the user or use this information for making decisions. For example,
222 the Intel Thermal Daemon can use this information to allow the user
223 to select his laptop to run without turning on the fans.
215 224
216menu "Texas Instruments thermal drivers" 225menu "Texas Instruments thermal drivers"
217source "drivers/thermal/ti-soc-thermal/Kconfig" 226source "drivers/thermal/ti-soc-thermal/Kconfig"
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 338a88bf6662..71b0ec0c370d 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -56,10 +56,15 @@ static LIST_HEAD(thermal_governor_list);
56static DEFINE_MUTEX(thermal_list_lock); 56static DEFINE_MUTEX(thermal_list_lock);
57static DEFINE_MUTEX(thermal_governor_lock); 57static DEFINE_MUTEX(thermal_governor_lock);
58 58
59static struct thermal_governor *def_governor;
60
59static struct thermal_governor *__find_governor(const char *name) 61static struct thermal_governor *__find_governor(const char *name)
60{ 62{
61 struct thermal_governor *pos; 63 struct thermal_governor *pos;
62 64
65 if (!name || !name[0])
66 return def_governor;
67
63 list_for_each_entry(pos, &thermal_governor_list, governor_list) 68 list_for_each_entry(pos, &thermal_governor_list, governor_list)
64 if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH)) 69 if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH))
65 return pos; 70 return pos;
@@ -82,17 +87,23 @@ int thermal_register_governor(struct thermal_governor *governor)
82 if (__find_governor(governor->name) == NULL) { 87 if (__find_governor(governor->name) == NULL) {
83 err = 0; 88 err = 0;
84 list_add(&governor->governor_list, &thermal_governor_list); 89 list_add(&governor->governor_list, &thermal_governor_list);
90 if (!def_governor && !strncmp(governor->name,
91 DEFAULT_THERMAL_GOVERNOR, THERMAL_NAME_LENGTH))
92 def_governor = governor;
85 } 93 }
86 94
87 mutex_lock(&thermal_list_lock); 95 mutex_lock(&thermal_list_lock);
88 96
89 list_for_each_entry(pos, &thermal_tz_list, node) { 97 list_for_each_entry(pos, &thermal_tz_list, node) {
98 /*
99 * only thermal zones with specified tz->tzp->governor_name
100 * may run with tz->govenor unset
101 */
90 if (pos->governor) 102 if (pos->governor)
91 continue; 103 continue;
92 if (pos->tzp) 104
93 name = pos->tzp->governor_name; 105 name = pos->tzp->governor_name;
94 else 106
95 name = DEFAULT_THERMAL_GOVERNOR;
96 if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH)) 107 if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH))
97 pos->governor = governor; 108 pos->governor = governor;
98 } 109 }
@@ -342,8 +353,8 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
342static void handle_non_critical_trips(struct thermal_zone_device *tz, 353static void handle_non_critical_trips(struct thermal_zone_device *tz,
343 int trip, enum thermal_trip_type trip_type) 354 int trip, enum thermal_trip_type trip_type)
344{ 355{
345 if (tz->governor) 356 tz->governor ? tz->governor->throttle(tz, trip) :
346 tz->governor->throttle(tz, trip); 357 def_governor->throttle(tz, trip);
347} 358}
348 359
349static void handle_critical_trips(struct thermal_zone_device *tz, 360static void handle_critical_trips(struct thermal_zone_device *tz,
@@ -1107,7 +1118,7 @@ __thermal_cooling_device_register(struct device_node *np,
1107 INIT_LIST_HEAD(&cdev->thermal_instances); 1118 INIT_LIST_HEAD(&cdev->thermal_instances);
1108 cdev->np = np; 1119 cdev->np = np;
1109 cdev->ops = ops; 1120 cdev->ops = ops;
1110 cdev->updated = true; 1121 cdev->updated = false;
1111 cdev->device.class = &thermal_class; 1122 cdev->device.class = &thermal_class;
1112 cdev->devdata = devdata; 1123 cdev->devdata = devdata;
1113 dev_set_name(&cdev->device, "cooling_device%d", cdev->id); 1124 dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
@@ -1533,7 +1544,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
1533 if (tz->tzp) 1544 if (tz->tzp)
1534 tz->governor = __find_governor(tz->tzp->governor_name); 1545 tz->governor = __find_governor(tz->tzp->governor_name);
1535 else 1546 else
1536 tz->governor = __find_governor(DEFAULT_THERMAL_GOVERNOR); 1547 tz->governor = def_governor;
1537 1548
1538 mutex_unlock(&thermal_governor_lock); 1549 mutex_unlock(&thermal_governor_lock);
1539 1550
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c
index 972e1c73722a..081fd7e6a9f0 100644
--- a/drivers/thermal/x86_pkg_temp_thermal.c
+++ b/drivers/thermal/x86_pkg_temp_thermal.c
@@ -68,6 +68,10 @@ struct phy_dev_entry {
68 struct thermal_zone_device *tzone; 68 struct thermal_zone_device *tzone;
69}; 69};
70 70
71static const struct thermal_zone_params pkg_temp_tz_params = {
72 .no_hwmon = true,
73};
74
71/* List maintaining number of package instances */ 75/* List maintaining number of package instances */
72static LIST_HEAD(phy_dev_list); 76static LIST_HEAD(phy_dev_list);
73static DEFINE_MUTEX(phy_dev_list_mutex); 77static DEFINE_MUTEX(phy_dev_list_mutex);
@@ -394,7 +398,6 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
394 int err; 398 int err;
395 u32 tj_max; 399 u32 tj_max;
396 struct phy_dev_entry *phy_dev_entry; 400 struct phy_dev_entry *phy_dev_entry;
397 char buffer[30];
398 int thres_count; 401 int thres_count;
399 u32 eax, ebx, ecx, edx; 402 u32 eax, ebx, ecx, edx;
400 u8 *temp; 403 u8 *temp;
@@ -440,13 +443,11 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
440 phy_dev_entry->first_cpu = cpu; 443 phy_dev_entry->first_cpu = cpu;
441 phy_dev_entry->tj_max = tj_max; 444 phy_dev_entry->tj_max = tj_max;
442 phy_dev_entry->ref_cnt = 1; 445 phy_dev_entry->ref_cnt = 1;
443 snprintf(buffer, sizeof(buffer), "pkg-temp-%d\n", 446 phy_dev_entry->tzone = thermal_zone_device_register("x86_pkg_temp",
444 phy_dev_entry->phys_proc_id);
445 phy_dev_entry->tzone = thermal_zone_device_register(buffer,
446 thres_count, 447 thres_count,
447 (thres_count == MAX_NUMBER_OF_TRIPS) ? 448 (thres_count == MAX_NUMBER_OF_TRIPS) ?
448 0x03 : 0x01, 449 0x03 : 0x01,
449 phy_dev_entry, &tzone_ops, NULL, 0, 0); 450 phy_dev_entry, &tzone_ops, &pkg_temp_tz_params, 0, 0);
450 if (IS_ERR(phy_dev_entry->tzone)) { 451 if (IS_ERR(phy_dev_entry->tzone)) {
451 err = PTR_ERR(phy_dev_entry->tzone); 452 err = PTR_ERR(phy_dev_entry->tzone);
452 goto err_ret_free; 453 goto err_ret_free;