of: thermal: Introduce sustainable power for a thermal zone
authorPunit Agrawal <punit.agrawal@arm.com>
Thu, 26 Feb 2015 19:00:32 +0000 (19:00 +0000)
committerEduardo Valentin <edubezval@gmail.com>
Tue, 5 May 2015 04:27:52 +0000 (21:27 -0700)
Introduce an optional property called, sustainable-power, which
represents the power (in mW) which the thermal zone can safely
dissipate.

If provided the property is parsed and associated with the thermal
zone via the thermal zone parameters.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Documentation/devicetree/bindings/thermal/thermal.txt
drivers/thermal/of-thermal.c

index 29fe0bfae38e454975dddf145d20d6acbde8bef6..8a49362dea6e81c377d8762e401696c97555cd74 100644 (file)
@@ -167,6 +167,13 @@ Optional property:
                        by means of sensor ID. Additional coefficients are
                        interpreted as constant offset.
 
+- sustainable-power:   An estimate of the sustainable power (in mW) that the
+  Type: unsigned       thermal zone can dissipate at the desired
+  Size: one cell       control temperature.  For reference, the
+                       sustainable power of a 4'' phone is typically
+                       2000mW, while on a 10'' tablet is around
+                       4500mW.
+
 Note: The delay properties are bound to the maximum dT/dt (temperature
 derivative over time) in two situations for a thermal zone:
 (i)  - when passive cooling is activated (polling-delay-passive); and
@@ -546,6 +553,8 @@ thermal-zones {
                 */
                coefficients =          <1200   -345    890>;
 
+               sustainable-power = <2500>;
+
                trips {
                        /* Trips are based on resulting linear equation */
                        cpu_trip: cpu-trip {
index c606b85ea9f47bf08370db605625049f6750c8e1..705b21d01f1c4c720d5ee469f2d6a29358a508e2 100644 (file)
@@ -866,6 +866,7 @@ int __init of_parse_thermal_zones(void)
        for_each_child_of_node(np, child) {
                struct thermal_zone_device *zone;
                struct thermal_zone_params *tzp;
+               u32 prop;
 
                /* Check whether child is enabled or not */
                if (!of_device_is_available(child))
@@ -892,6 +893,9 @@ int __init of_parse_thermal_zones(void)
                /* No hwmon because there might be hwmon drivers registering */
                tzp->no_hwmon = true;
 
+               if (!of_property_read_u32(child, "sustainable-power", &prop))
+                       tzp->sustainable_power = prop;
+
                zone = thermal_zone_device_register(child->name, tz->ntrips,
                                                    0, tz,
                                                    ops, tzp,