thermal: Default OF created trip points to writable
authorPunit Agrawal <punit.agrawal@arm.com>
Tue, 3 Mar 2015 10:43:04 +0000 (10:43 +0000)
committerEduardo Valentin <edubezval@gmail.com>
Tue, 5 May 2015 04:27:53 +0000 (21:27 -0700)
When registering a thermal zone from device tree, default the trip
points to writable. By default, only the root user can change these.

This allows the trip points to be tweaked after the system has
booted.

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

index 705b21d01f1c4c720d5ee469f2d6a29358a508e2..9e8c614103ef4cfb4a55b5608d361476a24d7ed5 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;
+               int i, mask = 0;
                u32 prop;
 
                /* Check whether child is enabled or not */
@@ -896,8 +897,11 @@ int __init of_parse_thermal_zones(void)
                if (!of_property_read_u32(child, "sustainable-power", &prop))
                        tzp->sustainable_power = prop;
 
+               for (i = 0; i < tz->ntrips; i++)
+                       mask |= 1 << i;
+
                zone = thermal_zone_device_register(child->name, tz->ntrips,
-                                                   0, tz,
+                                                   mask, tz,
                                                    ops, tzp,
                                                    tz->passive_delay,
                                                    tz->polling_delay);