Commit 1dc3217dad3e771f2bd12703d6daed6cb818fdd8

Authored by Linus Torvalds

Merge branch 'for-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux

Pull thermal fixes from Zhang Rui:
 "Specifics:

   - Update the help text of INT3403 Thermal driver, which was not
     friendly to users.  From Zhang Rui.

   - The "type" sysfs attribute of x86_pkg_temp_thermal registered
     thermal zones includes an instance number, which makes the
     thermal-to-hwmon bridge fails to group them all in a single hwmon
     device.  Fixed by Jean Delvare.

   - The hwmon device registered by x86_pkg_temp_thermal driver is
     redundant because the temperature value reported by
     x86_pkg_temp_thermal is already reported by the coretemp driver.
     Fixed by Jean Delvare.

   - Fix a problem that the cooling device can not be updated properly
     if it is initialized at max cooling state.  From Ni Wade.

   - Fix a problem that OF registered thermal zones are running without
     thermal governors.  From Zhang Rui.

   - Commit beeb5a1e0ef7 ("thermal: rcar-thermal: Enable driver
     compilation with COMPILE_TEST") broke build on archs wihout io
     memory.  Thus make it depend on HAS_IOMEM to bypass build failures.
     Fixed by Richard Weinberger"

* 'for-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  Thermal: thermal zone governor fix
  Thermal: Allow first update of cooling device state
  thermal,rcar_thermal: Add dependency on HAS_IOMEM
  x86_pkg_temp_thermal: Fix the thermal zone type
  x86_pkg_temp_thermal: Do not expose as a hwmon device
  Thermal: update INT3404 thermal driver help text

Showing 3 changed files Side-by-side Diff

drivers/thermal/Kconfig
... ... @@ -136,6 +136,7 @@
136 136 config RCAR_THERMAL
137 137 tristate "Renesas R-Car thermal driver"
138 138 depends on ARCH_SHMOBILE || COMPILE_TEST
  139 + depends on HAS_IOMEM
139 140 help
140 141 Enable this to plug the R-Car thermal sensor driver into the Linux
141 142 thermal framework.
... ... @@ -210,8 +211,16 @@
210 211 tristate "ACPI INT3403 thermal driver"
211 212 depends on X86 && ACPI
212 213 help
213   - This driver uses ACPI INT3403 device objects. If present, it will
214   - register each INT3403 thermal sensor as a thermal zone.
  214 + Newer laptops and tablets that use ACPI may have thermal sensors
  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  
216 225 menu "Texas Instruments thermal drivers"
217 226 source "drivers/thermal/ti-soc-thermal/Kconfig"
drivers/thermal/thermal_core.c
... ... @@ -56,10 +56,15 @@
56 56 static DEFINE_MUTEX(thermal_list_lock);
57 57 static DEFINE_MUTEX(thermal_governor_lock);
58 58  
  59 +static struct thermal_governor *def_governor;
  60 +
59 61 static struct thermal_governor *__find_governor(const char *name)
60 62 {
61 63 struct thermal_governor *pos;
62 64  
  65 + if (!name || !name[0])
  66 + return def_governor;
  67 +
63 68 list_for_each_entry(pos, &thermal_governor_list, governor_list)
64 69 if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH))
65 70 return pos;
66 71  
67 72  
... ... @@ -82,17 +87,23 @@
82 87 if (__find_governor(governor->name) == NULL) {
83 88 err = 0;
84 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 95 mutex_lock(&thermal_list_lock);
88 96  
89 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 102 if (pos->governor)
91 103 continue;
92   - if (pos->tzp)
93   - name = pos->tzp->governor_name;
94   - else
95   - name = DEFAULT_THERMAL_GOVERNOR;
  104 +
  105 + name = pos->tzp->governor_name;
  106 +
96 107 if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH))
97 108 pos->governor = governor;
98 109 }
... ... @@ -342,8 +353,8 @@
342 353 static void handle_non_critical_trips(struct thermal_zone_device *tz,
343 354 int trip, enum thermal_trip_type trip_type)
344 355 {
345   - if (tz->governor)
346   - tz->governor->throttle(tz, trip);
  356 + tz->governor ? tz->governor->throttle(tz, trip) :
  357 + def_governor->throttle(tz, trip);
347 358 }
348 359  
349 360 static void handle_critical_trips(struct thermal_zone_device *tz,
... ... @@ -1107,7 +1118,7 @@
1107 1118 INIT_LIST_HEAD(&cdev->thermal_instances);
1108 1119 cdev->np = np;
1109 1120 cdev->ops = ops;
1110   - cdev->updated = true;
  1121 + cdev->updated = false;
1111 1122 cdev->device.class = &thermal_class;
1112 1123 cdev->devdata = devdata;
1113 1124 dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
... ... @@ -1533,7 +1544,7 @@
1533 1544 if (tz->tzp)
1534 1545 tz->governor = __find_governor(tz->tzp->governor_name);
1535 1546 else
1536   - tz->governor = __find_governor(DEFAULT_THERMAL_GOVERNOR);
  1547 + tz->governor = def_governor;
1537 1548  
1538 1549 mutex_unlock(&thermal_governor_lock);
1539 1550  
drivers/thermal/x86_pkg_temp_thermal.c
... ... @@ -68,6 +68,10 @@
68 68 struct thermal_zone_device *tzone;
69 69 };
70 70  
  71 +static const struct thermal_zone_params pkg_temp_tz_params = {
  72 + .no_hwmon = true,
  73 +};
  74 +
71 75 /* List maintaining number of package instances */
72 76 static LIST_HEAD(phy_dev_list);
73 77 static DEFINE_MUTEX(phy_dev_list_mutex);
... ... @@ -394,7 +398,6 @@
394 398 int err;
395 399 u32 tj_max;
396 400 struct phy_dev_entry *phy_dev_entry;
397   - char buffer[30];
398 401 int thres_count;
399 402 u32 eax, ebx, ecx, edx;
400 403 u8 *temp;
401 404  
... ... @@ -440,13 +443,11 @@
440 443 phy_dev_entry->first_cpu = cpu;
441 444 phy_dev_entry->tj_max = tj_max;
442 445 phy_dev_entry->ref_cnt = 1;
443   - snprintf(buffer, sizeof(buffer), "pkg-temp-%d\n",
444   - phy_dev_entry->phys_proc_id);
445   - phy_dev_entry->tzone = thermal_zone_device_register(buffer,
  446 + phy_dev_entry->tzone = thermal_zone_device_register("x86_pkg_temp",
446 447 thres_count,
447 448 (thres_count == MAX_NUMBER_OF_TRIPS) ?
448 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 451 if (IS_ERR(phy_dev_entry->tzone)) {
451 452 err = PTR_ERR(phy_dev_entry->tzone);
452 453 goto err_ret_free;