Skip to content

Commit 29b19e2

Browse files
committed
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux into thermal
Conflicts: drivers/staging/omap-thermal/omap-thermal-common. OMAP supplied dummy TC1 and TC2, at the same time that the thermal tree removed them from thermal_zone_device_register() drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c propogate the upstream MAX_IDR_LEVEL re-name to prevent a build failure Previously-fixed-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Len Brown <len.brown@intel.com>
2 parents 125c4c7 + c072fed commit 29b19e2

21 files changed

Lines changed: 2177 additions & 728 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CPU cooling APIs How To
2+
===================================
3+
4+
Written by Amit Daniel Kachhap <amit.kachhap@linaro.org>
5+
6+
Updated: 12 May 2012
7+
8+
Copyright (c) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
9+
10+
0. Introduction
11+
12+
The generic cpu cooling(freq clipping) provides registration/unregistration APIs
13+
to the caller. The binding of the cooling devices to the trip point is left for
14+
the user. The registration APIs returns the cooling device pointer.
15+
16+
1. cpu cooling APIs
17+
18+
1.1 cpufreq registration/unregistration APIs
19+
1.1.1 struct thermal_cooling_device *cpufreq_cooling_register(
20+
struct cpumask *clip_cpus)
21+
22+
This interface function registers the cpufreq cooling device with the name
23+
"thermal-cpufreq-%x". This api can support multiple instances of cpufreq
24+
cooling devices.
25+
26+
clip_cpus: cpumask of cpus where the frequency constraints will happen.
27+
28+
1.1.2 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
29+
30+
This interface function unregisters the "thermal-cpufreq-%x" cooling device.
31+
32+
cdev: Cooling device pointer which has to be unregistered.
Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,36 +46,7 @@ The threshold levels are defined as follows:
4646
The threshold and each trigger_level are set
4747
through the corresponding registers.
4848

49-
When an interrupt occurs, this driver notify user space of
50-
one of four threshold levels for the interrupt
51-
through kobject_uevent_env and sysfs_notify functions.
49+
When an interrupt occurs, this driver notify kernel thermal framework
50+
with the function exynos4_report_trigger.
5251
Although an interrupt condition for level_0 can be set,
53-
it is not notified to user space through sysfs_notify function.
54-
55-
Sysfs Interface
56-
---------------
57-
name name of the temperature sensor
58-
RO
59-
60-
temp1_input temperature
61-
RO
62-
63-
temp1_max temperature for level_1 interrupt
64-
RO
65-
66-
temp1_crit temperature for level_2 interrupt
67-
RO
68-
69-
temp1_emergency temperature for level_3 interrupt
70-
RO
71-
72-
temp1_max_alarm alarm for level_1 interrupt
73-
RO
74-
75-
temp1_crit_alarm
76-
alarm for level_2 interrupt
77-
RO
78-
79-
temp1_emergency_alarm
80-
alarm for level_3 interrupt
81-
RO
52+
it can be used to synchronize the cooling action.

Documentation/thermal/sysfs-api.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ temperature) and throttle appropriate devices.
8484

8585
1.3 interface for binding a thermal zone device with a thermal cooling device
8686
1.3.1 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
87-
int trip, struct thermal_cooling_device *cdev);
87+
int trip, struct thermal_cooling_device *cdev,
88+
unsigned long upper, unsigned long lower);
8889

8990
This interface function bind a thermal cooling device to the certain trip
9091
point of a thermal zone device.
@@ -93,6 +94,12 @@ temperature) and throttle appropriate devices.
9394
cdev: thermal cooling device
9495
trip: indicates which trip point the cooling devices is associated with
9596
in this thermal zone.
97+
upper:the Maximum cooling state for this trip point.
98+
THERMAL_NO_LIMIT means no upper limit,
99+
and the cooling device can be in max_state.
100+
lower:the Minimum cooling state can be used for this trip point.
101+
THERMAL_NO_LIMIT means no lower limit,
102+
and the cooling device can be in cooling state 0.
96103

97104
1.3.2 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
98105
int trip, struct thermal_cooling_device *cdev);

drivers/acpi/thermal.c

Lines changed: 71 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,40 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
708708
return -EINVAL;
709709
}
710710

711+
static int thermal_get_trend(struct thermal_zone_device *thermal,
712+
int trip, enum thermal_trend *trend)
713+
{
714+
struct acpi_thermal *tz = thermal->devdata;
715+
enum thermal_trip_type type;
716+
int i;
717+
718+
if (thermal_get_trip_type(thermal, trip, &type))
719+
return -EINVAL;
720+
721+
if (type == THERMAL_TRIP_ACTIVE) {
722+
/* aggressive active cooling */
723+
*trend = THERMAL_TREND_RAISING;
724+
return 0;
725+
}
726+
727+
/*
728+
* tz->temperature has already been updated by generic thermal layer,
729+
* before this callback being invoked
730+
*/
731+
i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature))
732+
+ (tz->trips.passive.tc2
733+
* (tz->temperature - tz->trips.passive.temperature));
734+
735+
if (i > 0)
736+
*trend = THERMAL_TREND_RAISING;
737+
else if (i < 0)
738+
*trend = THERMAL_TREND_DROPPING;
739+
else
740+
*trend = THERMAL_TREND_STABLE;
741+
return 0;
742+
}
743+
744+
711745
static int thermal_notify(struct thermal_zone_device *thermal, int trip,
712746
enum thermal_trip_type trip_type)
713747
{
@@ -731,11 +765,9 @@ static int thermal_notify(struct thermal_zone_device *thermal, int trip,
731765
return 0;
732766
}
733767

734-
typedef int (*cb)(struct thermal_zone_device *, int,
735-
struct thermal_cooling_device *);
736768
static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
737769
struct thermal_cooling_device *cdev,
738-
cb action)
770+
bool bind)
739771
{
740772
struct acpi_device *device = cdev->devdata;
741773
struct acpi_thermal *tz = thermal->devdata;
@@ -759,11 +791,19 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
759791
i++) {
760792
handle = tz->trips.passive.devices.handles[i];
761793
status = acpi_bus_get_device(handle, &dev);
762-
if (ACPI_SUCCESS(status) && (dev == device)) {
763-
result = action(thermal, trip, cdev);
764-
if (result)
765-
goto failed;
766-
}
794+
if (ACPI_FAILURE(status) || dev != device)
795+
continue;
796+
if (bind)
797+
result =
798+
thermal_zone_bind_cooling_device
799+
(thermal, trip, cdev,
800+
THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
801+
else
802+
result =
803+
thermal_zone_unbind_cooling_device
804+
(thermal, trip, cdev);
805+
if (result)
806+
goto failed;
767807
}
768808
}
769809

@@ -776,19 +816,32 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
776816
j++) {
777817
handle = tz->trips.active[i].devices.handles[j];
778818
status = acpi_bus_get_device(handle, &dev);
779-
if (ACPI_SUCCESS(status) && (dev == device)) {
780-
result = action(thermal, trip, cdev);
781-
if (result)
782-
goto failed;
783-
}
819+
if (ACPI_FAILURE(status) || dev != device)
820+
continue;
821+
if (bind)
822+
result = thermal_zone_bind_cooling_device
823+
(thermal, trip, cdev,
824+
THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
825+
else
826+
result = thermal_zone_unbind_cooling_device
827+
(thermal, trip, cdev);
828+
if (result)
829+
goto failed;
784830
}
785831
}
786832

787833
for (i = 0; i < tz->devices.count; i++) {
788834
handle = tz->devices.handles[i];
789835
status = acpi_bus_get_device(handle, &dev);
790836
if (ACPI_SUCCESS(status) && (dev == device)) {
791-
result = action(thermal, -1, cdev);
837+
if (bind)
838+
result = thermal_zone_bind_cooling_device
839+
(thermal, -1, cdev,
840+
THERMAL_NO_LIMIT,
841+
THERMAL_NO_LIMIT);
842+
else
843+
result = thermal_zone_unbind_cooling_device
844+
(thermal, -1, cdev);
792845
if (result)
793846
goto failed;
794847
}
@@ -802,16 +855,14 @@ static int
802855
acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal,
803856
struct thermal_cooling_device *cdev)
804857
{
805-
return acpi_thermal_cooling_device_cb(thermal, cdev,
806-
thermal_zone_bind_cooling_device);
858+
return acpi_thermal_cooling_device_cb(thermal, cdev, true);
807859
}
808860

809861
static int
810862
acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
811863
struct thermal_cooling_device *cdev)
812864
{
813-
return acpi_thermal_cooling_device_cb(thermal, cdev,
814-
thermal_zone_unbind_cooling_device);
865+
return acpi_thermal_cooling_device_cb(thermal, cdev, false);
815866
}
816867

817868
static const struct thermal_zone_device_ops acpi_thermal_zone_ops = {
@@ -823,6 +874,7 @@ static const struct thermal_zone_device_ops acpi_thermal_zone_ops = {
823874
.get_trip_type = thermal_get_trip_type,
824875
.get_trip_temp = thermal_get_trip_temp,
825876
.get_crit_temp = thermal_get_crit_temp,
877+
.get_trend = thermal_get_trend,
826878
.notify = thermal_notify,
827879
};
828880

@@ -849,15 +901,12 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
849901
tz->thermal_zone =
850902
thermal_zone_device_register("acpitz", trips, 0, tz,
851903
&acpi_thermal_zone_ops,
852-
tz->trips.passive.tc1,
853-
tz->trips.passive.tc2,
854904
tz->trips.passive.tsp*100,
855905
tz->polling_frequency*100);
856906
else
857907
tz->thermal_zone =
858908
thermal_zone_device_register("acpitz", trips, 0, tz,
859-
&acpi_thermal_zone_ops,
860-
0, 0, 0,
909+
&acpi_thermal_zone_ops, 0,
861910
tz->polling_frequency*100);
862911
if (IS_ERR(tz->thermal_zone))
863912
return -ENODEV;

drivers/hwmon/Kconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,6 @@ config SENSORS_DA9052_ADC
334334
This driver can also be built as module. If so, the module
335335
will be called da9052-hwmon.
336336

337-
config SENSORS_EXYNOS4_TMU
338-
tristate "Temperature sensor on Samsung EXYNOS4"
339-
depends on ARCH_EXYNOS4
340-
help
341-
If you say yes here you get support for TMU (Thermal Management
342-
Unit) on SAMSUNG EXYNOS4 series of SoC.
343-
344-
This driver can also be built as a module. If so, the module
345-
will be called exynos4-tmu.
346-
347337
config SENSORS_I5K_AMB
348338
tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets"
349339
depends on PCI

drivers/hwmon/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
5050
obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o
5151
obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o
5252
obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o
53-
obj-$(CONFIG_SENSORS_EXYNOS4_TMU) += exynos4_tmu.o
5453
obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
5554
obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o
5655
obj-$(CONFIG_SENSORS_F75375S) += f75375s.o

0 commit comments

Comments
 (0)