diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2018-06-26 13:45:28 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:32:31 +0800 |
commit | 29dbd3069e0ad9be818f3e66551c79c50854eae2 (patch) | |
tree | f3fb5ebf054c949628534dd473a699f0df548630 /drivers/thermal/imx_sc_thermal.c | |
parent | 00f96cb8f8de1690c2e3b12aa22d18c74cc4548e (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, |