aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2014-07-25 06:01:58 -0400
committerEduardo Valentin <edubezval@gmail.com>2014-07-29 09:45:39 -0400
commita020279ee611c31ac163c00b21b975e7ecbb2e9c (patch)
tree27aba45b8a8d30732c69572fda32e85145b438b7 /drivers/thermal
parent208cd822a19e683bc890f6708786f2420e172d76 (diff)
thermal: add support to disable thermal zone from DTS
Add support to check status of the thermal zone before registering the zone. This will help on disabling some non-existing thermal zone from the top level DTS file out of common dtsi thermalzone file. For example, we have 3 platforms almost same but thermal zones on this platform are little bit different. Platform 1 and 2 have three thermal zones and platform 3 has two thermal zones. To avoid duplication of the thermal zones entries on each DTS file of platforms,we created one common dtsi file for thermal zone and included this dtsi file from these 3 platform's top level dts file. On common thermal zone com dtsi file, all thermal zone are enabled and need to disable one of thermal zone on platform 3 dts file. For this, we just added entry status = "disabled" for that thermal zone on platform 3 dts file and along with this change to make it work. This way, we reuse the common file and control the enable/disable of the thermal zone from top level dts file. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/of-thermal.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 4b2b999b7611..f8eb625b8400 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -401,6 +401,10 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
401 struct of_phandle_args sensor_specs; 401 struct of_phandle_args sensor_specs;
402 int ret, id; 402 int ret, id;
403 403
404 /* Check whether child is enabled or not */
405 if (!of_device_is_available(child))
406 continue;
407
404 /* For now, thermal framework supports only 1 sensor per zone */ 408 /* For now, thermal framework supports only 1 sensor per zone */
405 ret = of_parse_phandle_with_args(child, "thermal-sensors", 409 ret = of_parse_phandle_with_args(child, "thermal-sensors",
406 "#thermal-sensor-cells", 410 "#thermal-sensor-cells",
@@ -771,6 +775,10 @@ int __init of_parse_thermal_zones(void)
771 struct thermal_zone_device *zone; 775 struct thermal_zone_device *zone;
772 struct thermal_zone_params *tzp; 776 struct thermal_zone_params *tzp;
773 777
778 /* Check whether child is enabled or not */
779 if (!of_device_is_available(child))
780 continue;
781
774 tz = thermal_of_build_thermal_zone(child); 782 tz = thermal_of_build_thermal_zone(child);
775 if (IS_ERR(tz)) { 783 if (IS_ERR(tz)) {
776 pr_err("failed to build thermal zone %s: %ld\n", 784 pr_err("failed to build thermal zone %s: %ld\n",
@@ -838,6 +846,10 @@ void of_thermal_destroy_zones(void)
838 for_each_child_of_node(np, child) { 846 for_each_child_of_node(np, child) {
839 struct thermal_zone_device *zone; 847 struct thermal_zone_device *zone;
840 848
849 /* Check whether child is enabled or not */
850 if (!of_device_is_available(child))
851 continue;
852
841 zone = thermal_zone_get_zone_by_name(child->name); 853 zone = thermal_zone_get_zone_by_name(child->name);
842 if (IS_ERR(zone)) 854 if (IS_ERR(zone))
843 continue; 855 continue;