diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2018-06-26 13:45:28 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 83c6e66b21f548fde75d77e5ee9fe939d260e13d (patch) | |
tree | f7009ddf56c702017834d194a5726d90d6cd427e /drivers/thermal/imx_sc_thermal.c | |
parent | b83bdd38d85ddebf13201d1972368d9a736f62c2 (diff) |
MLK-18687-2 thermal: imx_sc: add status check for thermal zone
Add status check for thermal zones, ignore those thermal
zones with status set to "disabled".
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Diffstat (limited to 'drivers/thermal/imx_sc_thermal.c')
-rw-r--r-- | drivers/thermal/imx_sc_thermal.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index 21f8c2ac214d..8c5049020cd8 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(of, imx_sc_tsens_table); static int imx_sc_tsens_probe(struct platform_device *pdev) { + struct device_node *tz_np, *child_tz_np = NULL; struct device_node *np = pdev->dev.of_node; struct imx_sc_tsens_device *tsens_dev; struct imx_sc_sensor *sensor; @@ -169,7 +170,15 @@ static int imx_sc_tsens_probe(struct platform_device *pdev) tsens_dev->sensor_num = tsens_num; + tz_np = of_find_node_by_name(NULL, "thermal-zones"); + if (!tz_np) + return -ENODEV; + for (sensor_id = 0; sensor_id < tsens_num; sensor_id++) { + child_tz_np = of_get_next_child(tz_np, child_tz_np); + if (!of_device_is_available(child_tz_np)) + continue; + sensor = &tsens_dev->sensor[sensor_id]; sensor->hw_id = sensor_hw_id[sensor_id]; tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, sensor_id, sensor, |