All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Zhang Rui <rui.zhang@intel.com>, Eduardo Valentin <edubezval@gmail.com>
Cc: Amit kucheria <amit.kucheria@linaro.org>,
	Eric Anholt <eric@anholt.net>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Markus Mayer <mmayer@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com,
	Heiko Stuebner <heiko@sntech.de>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Keerthy <j-keerthy@ti.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Jun Nie <jun.nie@linaro.org>, Baoyou Xie <baoyou.xie@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	b.zolnierkie@samsung.com
Subject: [PATCH v2 04/17] thermal: separate sensor registration and enable+check operations
Date: Wed, 17 Oct 2018 17:52:30 +0200	[thread overview]
Message-ID: <1539791563-5959-5-git-send-email-b.zolnierkie@samsung.com> (raw)
In-Reply-To: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com>

[devm]_thermal_zone_of_sensor_register() is used to register
thermal sensor by thermal drivers using DeviceTree. Besides
registering sensor this function also immediately:

- enables it:

  tzd->ops->set_mode(tzd, THERMAL_DEVICE_ENABLED)
  (->set_mode is set to of_thermal_set_mode() in of-thermal.c)

- checks it (indirectly by using of_thermal_set_mode()):

  thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
  (which in turn ends up using ->get_temp method).

For many DT thermal drivers this causes a problem because:

- [devm]_thermal_zone_of_sensor_register() need to be called in
  order to obtain data about thermal trips which are then used to
  finish hardware sensor setup (only after which ->get_temp can
  be used)

There is also related issue for DT thermal drivers that support
IRQ (i.e. exynos and rockchip ones):

- sensor hardware should be enabled only after IRQ handler is
  requested (because otherwise we might get IRQs that we can't
  handle)

- IRQ handler needs tzd structure which is obtained from
  [devm_]thermal_zone_of_sensor_register()

- after [devm_]thermal_zone_of_sensor_register() call core
  thermal code assumes that sensor is enabled and ready to use
  (i.e. that IRQ handler has been requested and sensor hardware
  has been enabled)

In order to prepare for fixing all abovementioned issues separate
sensor registration and enable+check operations in the core DT
thermal code and update DT thermal drivers accordingly:

* Move thermal_zone_[set_mode,device_check]() calls to the users of
  [devm]_thermal_zone_of_sensor_register().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/ahci_imx.c                             | 10 ++++++++--
 drivers/hwmon/hwmon.c                              |  5 +++++
 drivers/hwmon/ntc_thermistor.c                     |  4 ++++
 drivers/hwmon/scpi-hwmon.c                         |  4 ++++
 drivers/iio/adc/sun4i-gpadc-iio.c                  |  5 +++++
 drivers/input/touchscreen/sun4i-ts.c               |  8 +++++++-
 drivers/regulator/max8973-regulator.c              |  3 +++
 drivers/thermal/armada_thermal.c                   |  3 +++
 drivers/thermal/broadcom/bcm2835_thermal.c         |  3 +++
 drivers/thermal/broadcom/brcmstb_thermal.c         |  3 +++
 drivers/thermal/broadcom/ns-thermal.c              |  3 +++
 drivers/thermal/hisi_thermal.c                     |  3 +++
 drivers/thermal/max77620_thermal.c                 |  3 +++
 drivers/thermal/mtk_thermal.c                      |  3 +++
 drivers/thermal/of-thermal.c                       |  6 ------
 drivers/thermal/qcom-spmi-temp-alarm.c             |  3 +++
 drivers/thermal/qcom/tsens.c                       |  6 ++++++
 drivers/thermal/qoriq_thermal.c                    |  3 +++
 drivers/thermal/rcar_gen3_thermal.c                |  4 ++++
 drivers/thermal/rcar_thermal.c                     |  4 ++++
 drivers/thermal/rockchip_thermal.c                 |  3 +++
 drivers/thermal/samsung/exynos_tmu.c               |  3 +++
 drivers/thermal/tango_thermal.c                    |  5 +++++
 drivers/thermal/tegra/soctherm.c                   |  3 +++
 drivers/thermal/tegra/tegra-bpmp-thermal.c         |  3 +++
 drivers/thermal/thermal-generic-adc.c              |  3 +++
 drivers/thermal/ti-soc-thermal/ti-thermal-common.c |  3 +++
 drivers/thermal/uniphier_thermal.c                 |  3 +++
 drivers/thermal/zx2967_thermal.c                   |  3 +++
 29 files changed, 106 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index b00799d..f1dcc3d 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -1141,6 +1141,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
 	    IS_ENABLED(CONFIG_HWMON)) {
 		/* Add the temperature monitor */
 		struct device *hwmon_dev;
+		struct thermal_zone_device *tzd;
 
 		hwmon_dev =
 			devm_hwmon_device_register_with_groups(dev,
@@ -1151,8 +1152,13 @@ static int imx_ahci_probe(struct platform_device *pdev)
 			ret = PTR_ERR(hwmon_dev);
 			goto disable_clk;
 		}
-		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
-					     &fsl_sata_ahci_of_thermal_ops);
+		tzd = devm_thermal_zone_of_sensor_register(hwmon_dev, 0,
+						hwmon_dev,
+						&fsl_sata_ahci_of_thermal_ops);
+		if (!IS_ERR(tzd)) {
+			thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
+			thermal_zone_device_check(tzd);
+		}
 		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
 	}
 
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index ac1cdf8..486d7a0 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -161,6 +161,11 @@ static int hwmon_thermal_add_sensor(struct device *dev,
 	if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV))
 		return PTR_ERR(tzd);
 
+	if (!IS_ERR(tzd)) {
+		thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tzd);
+	}
+
 	return 0;
 }
 #else
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index c52d07c..d423b0f 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -647,6 +647,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
 						  &ntc_of_thermal_ops);
 	if (IS_ERR(tz))
 		dev_dbg(dev, "Failed to register to thermal fw.\n");
+	else {
+		thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tz);
+	}
 
 	return 0;
 }
diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
index 111d521..ad5c5d7 100644
--- a/drivers/hwmon/scpi-hwmon.c
+++ b/drivers/hwmon/scpi-hwmon.c
@@ -288,6 +288,10 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 		 */
 		if (IS_ERR(z))
 			devm_kfree(dev, zone);
+		else {
+			thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED);
+			thermal_zone_device_check(z);
+		}
 	}
 
 	return 0;
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 04d7147..ff67f72 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -659,6 +659,11 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 				PTR_ERR(info->tzd));
 			return PTR_ERR(info->tzd);
 		}
+		if (!IS_ERR(info->tzd)) {
+			thermal_zone_set_mode(info->tzd,
+					      THERMAL_DEVICE_ENABLED);
+			thermal_zone_device_check(info->tzd);
+		}
 	}
 
 	ret = devm_iio_device_register(&pdev->dev, indio_dev);
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index d2e14d9..d38bf69 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -246,6 +246,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device *hwmon;
+	struct thermal_zone_device *tzd;
 	int error;
 	u32 reg;
 	bool ts_attached;
@@ -365,7 +366,12 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	if (IS_ERR(hwmon))
 		return PTR_ERR(hwmon);
 
-	devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops);
+	tzd = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts,
+						   &sun4i_ts_tz_ops);
+	if (!IS_ERR(tzd)) {
+		thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tzd);
+	}
 
 	writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
 
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c
index 9a522ed..65b445e 100644
--- a/drivers/regulator/max8973-regulator.c
+++ b/drivers/regulator/max8973-regulator.c
@@ -523,6 +523,9 @@ static int max8973_thermal_init(struct max8973_chip *mchip)
 		return ret;
 	}
 
+	thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(tzd);
+
 	if (mchip->irq <= 0)
 		return 0;
 
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 2c2f6d9..5a07a8d 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -692,6 +692,9 @@ static int armada_thermal_probe(struct platform_device *pdev)
 			devm_kfree(&pdev->dev, sensor);
 			continue;
 		}
+
+		thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tz);
 	}
 
 	return 0;
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index 23ad4f9..687a00c 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -227,6 +227,9 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
 		goto err_clk;
 	}
 
+	thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(tz);
+
 	/*
 	 * right now the FW does set up the HW-block, so we are not
 	 * touching the configuration registers.
diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 1919f91..3511ce6 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -336,6 +336,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	thermal_zone_set_mode(thermal, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(thermal);
+
 	priv->thermal = thermal;
 
 	irq = platform_get_irq(pdev, 0);
diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadcom/ns-thermal.c
index 322e741..8ace201 100644
--- a/drivers/thermal/broadcom/ns-thermal.c
+++ b/drivers/thermal/broadcom/ns-thermal.c
@@ -71,6 +71,9 @@ static int ns_thermal_probe(struct platform_device *pdev)
 		return PTR_ERR(ns_thermal->tz);
 	}
 
+	thermal_zone_set_mode(ns_thermal->tz, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(ns_thermal->tz);
+
 	platform_set_drvdata(pdev, ns_thermal);
 
 	return 0;
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 6151e55..cc4e2ca 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -488,6 +488,9 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
 		return ret;
 	}
 
+	thermal_zone_set_mode(sensor->tzd, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(sensor->tzd);
+
 	trip = of_thermal_get_trip_points(sensor->tzd);
 
 	for (i = 0; i < of_thermal_get_ntrips(sensor->tzd); i++) {
diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c
index e6bc69f..ffca9a7 100644
--- a/drivers/thermal/max77620_thermal.c
+++ b/drivers/thermal/max77620_thermal.c
@@ -125,6 +125,9 @@ static int max77620_thermal_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	thermal_zone_set_mode(mtherm->tz_device, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(mtherm->tz_device);
+
 	ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL,
 					max77620_thermal_irq,
 					IRQF_ONESHOT | IRQF_SHARED,
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 0691f26..e18cb0e 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -766,6 +766,9 @@ static int mtk_thermal_probe(struct platform_device *pdev)
 		goto err_disable_clk_peri_therm;
 	}
 
+	thermal_zone_set_mode(tzdev, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(tzdev);
+
 	return 0;
 
 err_disable_clk_peri_therm:
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index f1dcb7d..523ac5c 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -494,12 +494,6 @@ struct thermal_zone_device *
 		if (sensor_specs.np == sensor_np && id == sensor_id) {
 			tzd = thermal_zone_of_add_sensor(child, sensor_np,
 							 data, ops);
-			if (!IS_ERR(tzd)) {
-				thermal_zone_set_mode(tzd,
-						      THERMAL_DEVICE_ENABLED);
-				thermal_zone_device_check(tzd);
-			}
-
 			of_node_put(sensor_specs.np);
 			of_node_put(child);
 			goto exit;
diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c
index d3910be..7ba73ca 100644
--- a/drivers/thermal/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom-spmi-temp-alarm.c
@@ -320,6 +320,9 @@ static int qpnp_tm_probe(struct platform_device *pdev)
 		return PTR_ERR(chip->tz_dev);
 	}
 
+	thermal_zone_set_mode(chip->tz_dev, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(chip->tz_dev);
+
 	return 0;
 }
 
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index a2c9bfa..dbd2556 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -98,12 +98,18 @@ static int tsens_register(struct tsens_device *tmdev)
 	for (i = 0;  i < tmdev->num_sensors; i++) {
 		tmdev->sensor[i].tmdev = tmdev;
 		tmdev->sensor[i].id = i;
+
 		tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i,
 							   &tmdev->sensor[i],
 							   &tsens_of_ops);
 		if (IS_ERR(tzd))
 			continue;
+
+		thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tzd);
+
 		tmdev->sensor[i].tzd = tzd;
+
 		if (tmdev->ops->enable)
 			tmdev->ops->enable(tmdev, i);
 	}
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 450ed66..d8a80448 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -233,6 +233,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 		goto err_tmu;
 	}
 
+	thermal_zone_set_mode(data->tz, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(data->tz);
+
 	/* Enable monitoring */
 	site = 0x1 << (15 - data->sensor_id);
 	tmu_write(data, site | TMR_ME | TMR_ALPF, &data->regs->tmr);
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index e0d9424..c72453e 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -420,6 +420,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 			ret = PTR_ERR(zone);
 			goto error_unregister;
 		}
+
+		thermal_zone_set_mode(zone, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(zone);
+
 		tsc->zone = zone;
 
 		ret = of_thermal_get_ntrips(tsc->zone);
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 6619a48..f2f7ad3 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -566,6 +566,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		}
 
 		if (chip->use_of_thermal) {
+			thermal_zone_set_mode(priv->zone,
+					      THERMAL_DEVICE_ENABLED);
+			thermal_zone_device_check(priv->zone);
+
 			/*
 			 * thermal_zone doesn't enable hwmon as default,
 			 * but, enable it here to keep compatible
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 715f4cd..90d8175 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1161,6 +1161,9 @@ static int rockchip_configure_from_dt(struct device *dev,
 		return error;
 	}
 
+	thermal_zone_set_mode(sensor->tzd, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(sensor->tzd);
+
 	return 0;
 }
 
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 9e98b12..8ec74a62 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1109,6 +1109,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 		goto err_sclk;
 	}
 
+	thermal_zone_set_mode(data->tzd, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(data->tzd);
+
 	ret = exynos_tmu_initialize(pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to initialize TMU\n");
diff --git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c
index 4e67795..caa4036 100644
--- a/drivers/thermal/tango_thermal.c
+++ b/drivers/thermal/tango_thermal.c
@@ -90,6 +90,11 @@ static int tango_thermal_probe(struct platform_device *pdev)
 	tango_thermal_init(priv);
 
 	tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &ops);
+	if (!IS_ERR(tzdev)) {
+		thermal_zone_set_mode(tzdev, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tzdev);
+	}
+
 	return PTR_ERR_OR_ZERO(tzdev);
 }
 
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index ed28110..2ac9f81 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -1375,6 +1375,9 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
 			goto disable_clocks;
 		}
 
+		thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(z);
+
 		zone->tz = z;
 		tegra->thermctl_tzs[soc->ttgs[i]->id] = z;
 
diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c
index b0980db..3181110 100644
--- a/drivers/thermal/tegra/tegra-bpmp-thermal.c
+++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c
@@ -213,6 +213,9 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev)
 			continue;
 		}
 
+		thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
+		thermal_zone_device_check(tzd);
+
 		zone->tzd = tzd;
 		INIT_WORK(&zone->tz_device_update_work,
 			  tz_device_update_work_fn);
diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c
index bf1c628..c1c3746 100644
--- a/drivers/thermal/thermal-generic-adc.c
+++ b/drivers/thermal/thermal-generic-adc.c
@@ -143,6 +143,9 @@ static int gadc_thermal_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	thermal_zone_set_mode(gti->tz_dev, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(gti->tz_dev);
+
 	return 0;
 }
 
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
index b80b6e2..aa15719 100644
--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
@@ -197,6 +197,9 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
 		return PTR_ERR(data->ti_thermal);
 	}
 
+	thermal_zone_set_mode(data->ti_thermal, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(data->ti_thermal);
+
 	ti_bandgap_set_sensor_data(bgp, id, data);
 	ti_bandgap_write_update_interval(bgp, data->sensor_id,
 					data->ti_thermal->polling_delay);
diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
index bb95983..ed3a920 100644
--- a/drivers/thermal/uniphier_thermal.c
+++ b/drivers/thermal/uniphier_thermal.c
@@ -307,6 +307,9 @@ static int uniphier_tm_probe(struct platform_device *pdev)
 		return PTR_ERR(tdev->tz_dev);
 	}
 
+	thermal_zone_set_mode(tdev->tz_dev, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(tdev->tz_dev);
+
 	/* get trip points */
 	trips = of_thermal_get_trip_points(tdev->tz_dev);
 	ntrips = of_thermal_get_ntrips(tdev->tz_dev);
diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c
index 6acce0b..3c08e1d 100644
--- a/drivers/thermal/zx2967_thermal.c
+++ b/drivers/thermal/zx2967_thermal.c
@@ -168,6 +168,9 @@ static int zx2967_thermal_probe(struct platform_device *pdev)
 		goto disable_clk_all;
 	}
 
+	thermal_zone_set_mode(priv->tzd, THERMAL_DEVICE_ENABLED);
+	thermal_zone_device_check(priv->tzd);
+
 	if (priv->tzd->tzp->slope == 0) {
 		thermal_zone_of_sensor_unregister(&pdev->dev, priv->tzd);
 		dev_err(&pdev->dev, "coefficients of sensor is invalid\n");
-- 
1.9.1


  parent reply	other threads:[~2018-10-17 15:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181017155314epcas2p4a5aa24978b36354a2ccb2f9b0fb6f0f6@epcas2p4.samsung.com>
2018-10-17 15:52 ` [PATCH v2 00/17] thermal: enable+check sensor after its setup is finished Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155320epcas2p439b713149d94aa485b3c2ffba063ea03@epcas2p4.samsung.com>
2018-10-17 15:52     ` [PATCH v2 01/17] thermal: add thermal_zone_set_mode() helper Bartlomiej Zolnierkiewicz
2018-11-06  8:11       ` Zhang Rui
2018-11-06 16:11         ` Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155326epcas2p21d8b703f27fe54561a0f741fa7920dce@epcas2p2.samsung.com>
2018-10-17 15:52     ` [PATCH v2 02/17] thermal: add thermal_zone_device_check() helper Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155332epcas2p499ac9d53678d82a9984b3533e723a0dd@epcas2p4.samsung.com>
2018-10-17 15:52     ` [PATCH v2 03/17] thermal: separate sensor enable and check operations Bartlomiej Zolnierkiewicz
2018-10-26 12:11       ` Amit Kucheria
     [not found]   ` <CGME20181017155338epcas1p3a22cd0b22e757c3e51eb72ccee545478@epcas1p3.samsung.com>
2018-10-17 15:52     ` Bartlomiej Zolnierkiewicz [this message]
2018-10-31 12:40       ` [PATCH v2 04/17] thermal: separate sensor registration and enable+check operations Amit Kucheria
     [not found]   ` <CGME20181017155345epcas1p18dee37b9a46f2bf0b68aa3ded43f2717@epcas1p1.samsung.com>
2018-10-17 15:52     ` [PATCH v2 05/17] thermal: bcm2835: enable+check sensor after its setup is finished Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155351epcas1p171637911ef29cdec96dda648cfac51a5@epcas1p1.samsung.com>
2018-10-17 15:52     ` [PATCH v2 06/17] thermal: brcmstb: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155357epcas1p3900b1d3522c636fdee27ab9928c076e1@epcas1p3.samsung.com>
2018-10-17 15:52     ` [PATCH v2 07/17] thermal: hisi_thermal: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155403epcas2p1ed9777e96c6b2c77c2c5b67466be9843@epcas2p1.samsung.com>
2018-10-17 15:52     ` [PATCH v2 08/17] thermal: qcom: tsens: " Bartlomiej Zolnierkiewicz
2018-10-26 12:11       ` Amit Kucheria
2018-10-26 12:39         ` Amit Kucheria
     [not found]   ` <CGME20181017155409epcas2p41b5770668abdb4af99646841a3dd24ec@epcas2p4.samsung.com>
2018-10-17 15:52     ` [PATCH v2 09/17] thermal: qoriq: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155416epcas2p32f63571e9c06cd1aba2b40bcf23de8e1@epcas2p3.samsung.com>
2018-10-17 15:52     ` [PATCH v2 10/17] thermal: rcar_gen3_thermal: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155422epcas1p1644d897c62ceb36b57d33ecd4e3bc81c@epcas1p1.samsung.com>
2018-10-17 15:52     ` [PATCH v2 11/17] thermal: rockchip_thermal: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155428epcas2p1aca0b5e7b30b89db7be7026dfa740fc6@epcas2p1.samsung.com>
2018-10-17 15:52     ` [PATCH v2 12/17] thermal: exynos: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155434epcas1p33a6de1fda3c69cc966f954796a95a935@epcas1p3.samsung.com>
2018-10-17 15:52     ` [PATCH v2 13/17] thermal: tegra: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155440epcas1p12c33048a8c1c083496d1a8996591d884@epcas1p1.samsung.com>
2018-10-17 15:52     ` [PATCH v2 14/17] thermal: ti-soc-thermal: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155447epcas2p2db761f6575de357b65eb5e39b709fead@epcas2p2.samsung.com>
2018-10-17 15:52     ` [PATCH v2 15/17] thermal: uniphier: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155453epcas1p3be6976375c18583bcbebc7ff7853ae50@epcas1p3.samsung.com>
2018-10-17 15:52     ` [PATCH v2 16/17] thermal: zx2967: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181017155459epcas1p470bd73f433cdbb0f7a11aa8d46212e4e@epcas1p4.samsung.com>
2018-10-17 15:52     ` [PATCH v2 17/17] thermal: warn on attempts to read temperature on disabled sensors Bartlomiej Zolnierkiewicz
     [not found]   ` <1541387097.2124.9.camel@intel.com>
2018-11-05 16:35     ` [PATCH v2 00/17] thermal: enable+check sensor after its setup is finished Bartlomiej Zolnierkiewicz
2018-11-06  0:46       ` Eduardo Valentin
2018-11-06  7:34       ` Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1539791563-5959-5-git-send-email-b.zolnierkie@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=amit.kucheria@linaro.org \
    --cc=baoyou.xie@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=edubezval@gmail.com \
    --cc=eric@anholt.net \
    --cc=heiko@sntech.de \
    --cc=j-keerthy@ti.com \
    --cc=jonathanh@nvidia.com \
    --cc=jun.nie@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mmayer@broadcom.com \
    --cc=rui.zhang@intel.com \
    --cc=shawnguo@kernel.org \
    --cc=stefan.wahren@i2se.com \
    --cc=thierry.reding@gmail.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.