Skip to content

Commit cdd6076

Browse files
cyndisdlezcano
authored andcommitted
thermal/drivers/tegra-bpmp: Handle offline zones
Thermal zones located in power domains may not be accessible when the domain is powergated. In this situation, reading the temperature will return -BPMP_EFAULT. When evaluating trips, BPMP will internally use -256C as the temperature for offline zones. For smooth operation, for offline zones, return -EAGAIN when reading the temperature and allow registration of zones even if they are offline during probe. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230330094904.2589428-1-cyndis@kapsi.fi
1 parent fee5cae commit cdd6076

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/thermal/tegra/tegra-bpmp-thermal.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *zone,
5252
err = tegra_bpmp_transfer(zone->tegra->bpmp, &msg);
5353
if (err)
5454
return err;
55+
if (msg.rx.ret == -BPMP_EFAULT)
56+
return -EAGAIN;
5557
if (msg.rx.ret)
5658
return -EINVAL;
5759

@@ -209,7 +211,12 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev)
209211
zone->tegra = tegra;
210212

211213
err = __tegra_bpmp_thermal_get_temp(zone, &temp);
212-
if (err < 0) {
214+
215+
/*
216+
* Sensors in powergated domains may temporarily fail to be read
217+
* (-EAGAIN), but will become accessible when the domain is powered on.
218+
*/
219+
if (err < 0 && err != -EAGAIN) {
213220
devm_kfree(&pdev->dev, zone);
214221
continue;
215222
}

0 commit comments

Comments
 (0)