Skip to content

Commit

Permalink
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/rzhang/linux

Pull thermal management update from Zhang Rui:
 "Highlights:

   - Introduction of thermal policy support, together with three new
     thermal governors, including step_wise, user_space, fire_share.

   - Introduction of ST-Ericsson db8500_thermal driver and ST-Ericsson
     db8500_cpufreq_cooling driver.

   - Thermal Kconfig file and Makefile refactor.

   - Fixes for generic thermal layer, generic cpucooling, rcar thermal
     driver and Exynos thermal driver."

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (36 commits)
  Thermal: Fix DEFAULT_THERMAL_GOVERNOR
  Thermal: fix a NULL pointer dereference when generic thermal layer is built as a module
  thermal: rcar: add rcar_zone_to_priv() macro
  thermal: rcar: fixup the unit of temperature
  thermal: cpu cooling: allow module builds
  thermal: cpu cooling: use const parameter while registering
  Thermal: Add ST-Ericsson DB8500 thermal properties and platform data.
  Thermal: Add ST-Ericsson DB8500 thermal driver.
  drivers/thermal/Makefile refactor
  Exynos: Add missing dependency
  Refactor drivers/thermal/Kconfig
  thermal: cpu_cooling: Make 'notify_device' static
  Thermal: Remove the cooling_cpufreq_list.
  Thermal: fix bug of counting cpu frequencies.
  Thermal: add indent for code alignment.
  thermal: rcar_thermal: remove explicitly used devm_kfree/iounap()
  thermal: user_space: Add missing static storage class specifiers
  thermal: fair_share: Add missing static storage class specifiers
  thermal: step_wise: Add missing static storage class specifiers
  Thermal: Fix oops and unlocking in thermal_sys.c
  ...
  • Loading branch information
Linus Torvalds committed Dec 12, 2012
2 parents 99b8f42 + 1f53ef1 commit 50851c6
Show file tree
Hide file tree
Showing 27 changed files with 2,038 additions and 398 deletions.
44 changes: 44 additions & 0 deletions Documentation/devicetree/bindings/thermal/db8500-thermal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
* ST-Ericsson DB8500 Thermal

** Thermal node properties:

- compatible : "stericsson,db8500-thermal";
- reg : address range of the thermal sensor registers;
- interrupts : interrupts generated from PRCMU;
- interrupt-names : "IRQ_HOTMON_LOW" and "IRQ_HOTMON_HIGH";
- num-trips : number of total trip points, this is required, set it 0 if none,
if greater than 0, the following properties must be defined;
- tripN-temp : temperature of trip point N, should be in ascending order;
- tripN-type : type of trip point N, should be one of "active" "passive" "hot"
"critical";
- tripN-cdev-num : number of the cooling devices which can be bound to trip
point N, this is required if trip point N is defined, set it 0 if none,
otherwise the following cooling device names must be defined;
- tripN-cdev-nameM : name of the No. M cooling device of trip point N;

Usually the num-trips and tripN-*** are separated in board related dts files.

Example:
thermal@801573c0 {
compatible = "stericsson,db8500-thermal";
reg = <0x801573c0 0x40>;
interrupts = <21 0x4>, <22 0x4>;
interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";

num-trips = <3>;

trip0-temp = <75000>;
trip0-type = "active";
trip0-cdev-num = <1>;
trip0-cdev-name0 = "thermal-cpufreq-0";

trip1-temp = <80000>;
trip1-type = "active";
trip1-cdev-num = <2>;
trip1-cdev-name0 = "thermal-cpufreq-0";
trip1-cdev-name1 = "thermal-fan";

trip2-temp = <85000>;
trip2-type = "critical";
trip2-cdev-num = <0>;
}
64 changes: 64 additions & 0 deletions Documentation/thermal/sysfs-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ temperature) and throttle appropriate devices.
trip: indicates which trip point the cooling devices is associated with
in this thermal zone.

1.4 Thermal Zone Parameters
1.4.1 struct thermal_bind_params
This structure defines the following parameters that are used to bind
a zone with a cooling device for a particular trip point.
.cdev: The cooling device pointer
.weight: The 'influence' of a particular cooling device on this zone.
This is on a percentage scale. The sum of all these weights
(for a particular zone) cannot exceed 100.
.trip_mask:This is a bit mask that gives the binding relation between
this thermal zone and cdev, for a particular trip point.
If nth bit is set, then the cdev and thermal zone are bound
for trip point n.
.match: This call back returns success(0) if the 'tz and cdev' need to
be bound, as per platform data.
1.4.2 struct thermal_zone_params
This structure defines the platform level parameters for a thermal zone.
This data, for each thermal zone should come from the platform layer.
This is an optional feature where some platforms can choose not to
provide this data.
.governor_name: Name of the thermal governor used for this zone
.num_tbps: Number of thermal_bind_params entries for this zone
.tbp: thermal_bind_params entries

2. sysfs attributes structure

RO read only value
Expand All @@ -126,6 +149,7 @@ Thermal zone device sys I/F, created once it's registered:
|---type: Type of the thermal zone
|---temp: Current temperature
|---mode: Working mode of the thermal zone
|---policy: Thermal governor used for this zone
|---trip_point_[0-*]_temp: Trip point temperature
|---trip_point_[0-*]_type: Trip point type
|---trip_point_[0-*]_hyst: Hysteresis value for this trip point
Expand Down Expand Up @@ -187,6 +211,10 @@ mode
charge of the thermal management.
RW, Optional

policy
One of the various thermal governors used for a particular zone.
RW, Required

trip_point_[0-*]_temp
The temperature above which trip point will be fired.
Unit: millidegree Celsius
Expand Down Expand Up @@ -264,6 +292,7 @@ method, the sys I/F structure will be built like this:
|---type: acpitz
|---temp: 37000
|---mode: enabled
|---policy: step_wise
|---trip_point_0_temp: 100000
|---trip_point_0_type: critical
|---trip_point_1_temp: 80000
Expand Down Expand Up @@ -305,3 +334,38 @@ to a thermal_zone_device when it registers itself with the framework. The
event will be one of:{THERMAL_AUX0, THERMAL_AUX1, THERMAL_CRITICAL,
THERMAL_DEV_FAULT}. Notification can be sent when the current temperature
crosses any of the configured thresholds.

5. Export Symbol APIs:

5.1: get_tz_trend:
This function returns the trend of a thermal zone, i.e the rate of change
of temperature of the thermal zone. Ideally, the thermal sensor drivers
are supposed to implement the callback. If they don't, the thermal
framework calculated the trend by comparing the previous and the current
temperature values.

5.2:get_thermal_instance:
This function returns the thermal_instance corresponding to a given
{thermal_zone, cooling_device, trip_point} combination. Returns NULL
if such an instance does not exist.

5.3:notify_thermal_framework:
This function handles the trip events from sensor drivers. It starts
throttling the cooling devices according to the policy configured.
For CRITICAL and HOT trip points, this notifies the respective drivers,
and does actual throttling for other trip points i.e ACTIVE and PASSIVE.
The throttling policy is based on the configured platform data; if no
platform data is provided, this uses the step_wise throttling policy.

5.4:thermal_cdev_update:
This function serves as an arbitrator to set the state of a cooling
device. It sets the cooling device to the deepest cooling state if
possible.

5.5:thermal_register_governor:
This function lets the various thermal governors to register themselves
with the Thermal framework. At run time, depending on a zone's platform
data, a particular governor is used for throttling.

5.6:thermal_unregister_governor:
This function unregisters a governor from the thermal framework.
14 changes: 14 additions & 0 deletions arch/arm/boot/dts/dbx5x0.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@
reg = <0x80157450 0xC>;
};

thermal@801573c0 {
compatible = "stericsson,db8500-thermal";
reg = <0x801573c0 0x40>;
interrupts = <21 0x4>, <22 0x4>;
interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";
status = "disabled";
};

db8500-prcmu-regulators {
compatible = "stericsson,db8500-prcmu-regulator";

Expand Down Expand Up @@ -660,5 +668,11 @@
ranges = <0 0x50000000 0x4000000>;
status = "disabled";
};

cpufreq-cooling {
compatible = "stericsson,db8500-cpufreq-cooling";
status = "disabled";
};

};
};
31 changes: 31 additions & 0 deletions arch/arm/boot/dts/snowball.dts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,33 @@
status = "okay";
};

prcmu@80157000 {
thermal@801573c0 {
num-trips = <4>;

trip0-temp = <70000>;
trip0-type = "active";
trip0-cdev-num = <1>;
trip0-cdev-name0 = "thermal-cpufreq-0";

trip1-temp = <75000>;
trip1-type = "active";
trip1-cdev-num = <1>;
trip1-cdev-name0 = "thermal-cpufreq-0";

trip2-temp = <80000>;
trip2-type = "active";
trip2-cdev-num = <1>;
trip2-cdev-name0 = "thermal-cpufreq-0";

trip3-temp = <85000>;
trip3-type = "critical";
trip3-cdev-num = <0>;

status = "okay";
};
};

external-bus@50000000 {
status = "okay";

Expand Down Expand Up @@ -183,5 +210,9 @@
reg = <0x33>;
};
};

cpufreq-cooling {
status = "okay";
};
};
};
2 changes: 2 additions & 0 deletions arch/arm/configs/u8500_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ CONFIG_GPIO_TC3589X=y
CONFIG_POWER_SUPPLY=y
CONFIG_AB8500_BM=y
CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_MFD_STMPE=y
CONFIG_MFD_TC3589X=y
CONFIG_AB5500_CORE=y
Expand Down
64 changes: 64 additions & 0 deletions arch/arm/mach-ux500/board-mop500.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/platform_data/i2c-nomadik.h>
#include <linux/platform_data/db8500_thermal.h>
#include <linux/gpio.h>
#include <linux/amba/bus.h>
#include <linux/amba/pl022.h>
Expand Down Expand Up @@ -228,6 +229,67 @@ static struct ab8500_platform_data ab8500_platdata = {
.codec = &ab8500_codec_pdata,
};

/*
* Thermal Sensor
*/

static struct resource db8500_thsens_resources[] = {
{
.name = "IRQ_HOTMON_LOW",
.start = IRQ_PRCMU_HOTMON_LOW,
.end = IRQ_PRCMU_HOTMON_LOW,
.flags = IORESOURCE_IRQ,
},
{
.name = "IRQ_HOTMON_HIGH",
.start = IRQ_PRCMU_HOTMON_HIGH,
.end = IRQ_PRCMU_HOTMON_HIGH,
.flags = IORESOURCE_IRQ,
},
};

static struct db8500_thsens_platform_data db8500_thsens_data = {
.trip_points[0] = {
.temp = 70000,
.type = THERMAL_TRIP_ACTIVE,
.cdev_name = {
[0] = "thermal-cpufreq-0",
},
},
.trip_points[1] = {
.temp = 75000,
.type = THERMAL_TRIP_ACTIVE,
.cdev_name = {
[0] = "thermal-cpufreq-0",
},
},
.trip_points[2] = {
.temp = 80000,
.type = THERMAL_TRIP_ACTIVE,
.cdev_name = {
[0] = "thermal-cpufreq-0",
},
},
.trip_points[3] = {
.temp = 85000,
.type = THERMAL_TRIP_CRITICAL,
},
.num_trips = 4,
};

static struct platform_device u8500_thsens_device = {
.name = "db8500-thermal",
.resource = db8500_thsens_resources,
.num_resources = ARRAY_SIZE(db8500_thsens_resources),
.dev = {
.platform_data = &db8500_thsens_data,
},
};

static struct platform_device u8500_cpufreq_cooling_device = {
.name = "db8500-cpufreq-cooling",
};

/*
* TPS61052
*/
Expand Down Expand Up @@ -583,6 +645,8 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
&snowball_key_dev,
&snowball_sbnet_dev,
&snowball_gpio_en_3v3_regulator_dev,
&u8500_thsens_device,
&u8500_cpufreq_cooling_device,
};

static void __init mop500_init_machine(void)
Expand Down
6 changes: 3 additions & 3 deletions drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,14 +900,14 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
if (tz->trips.passive.flags.valid)
tz->thermal_zone =
thermal_zone_device_register("acpitz", trips, 0, tz,
&acpi_thermal_zone_ops,
&acpi_thermal_zone_ops, NULL,
tz->trips.passive.tsp*100,
tz->polling_frequency*100);
else
tz->thermal_zone =
thermal_zone_device_register("acpitz", trips, 0, tz,
&acpi_thermal_zone_ops, 0,
tz->polling_frequency*100);
&acpi_thermal_zone_ops, NULL,
0, tz->polling_frequency*100);
if (IS_ERR(tz->thermal_zone))
return -ENODEV;

Expand Down
2 changes: 1 addition & 1 deletion drivers/platform/x86/acerhdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ static int acerhdf_register_thermal(void)
return -EINVAL;

thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
&acerhdf_dev_ops, 0,
&acerhdf_dev_ops, NULL, 0,
(kernelmode) ? interval*1000 : 0);
if (IS_ERR(thz_dev))
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/platform/x86/intel_mid_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static int mid_thermal_probe(struct platform_device *pdev)
goto err;
}
pinfo->tzd[i] = thermal_zone_device_register(name[i],
0, 0, td_info, &tzd_ops, 0, 0);
0, 0, td_info, &tzd_ops, NULL, 0, 0);
if (IS_ERR(pinfo->tzd[i])) {
kfree(td_info);
ret = PTR_ERR(pinfo->tzd[i]);
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/power_supply_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static int psy_register_thermal(struct power_supply *psy)
for (i = 0; i < psy->num_properties; i++) {
if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) {
psy->tzd = thermal_zone_device_register(psy->name, 0, 0,
psy, &psy_tzd_ops, 0, 0);
psy, &psy_tzd_ops, NULL, 0, 0);
if (IS_ERR(psy->tzd))
return PTR_ERR(psy->tzd);
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/omap-thermal/omap-thermal-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id,
/* Create thermal zone */
data->omap_thermal = thermal_zone_device_register(domain,
OMAP_TRIP_NUMBER, 0, data, &omap_thermal_ops,
FAST_TEMP_MONITORING_RATE,
NULL, FAST_TEMP_MONITORING_RATE,
FAST_TEMP_MONITORING_RATE);
if (IS_ERR_OR_NULL(data->omap_thermal)) {
dev_err(bg_ptr->dev, "thermal zone device is NULL\n");
Expand Down
Loading

0 comments on commit 50851c6

Please sign in to comment.