Skip to content

Commit 79d9984

Browse files
brooniedlezcano
authored andcommitted
thermal/drivers/sun8i: Don't fail probe due to zone registration failure
Currently the sun8i thermal driver will fail to probe if any of the thermal zones it is registering fails to register with the thermal core. Since we currently do not define any trip points for the GPU thermal zones on at least A64 or H5 this means that we have no thermal support on these platforms: [ 1.698703] thermal_sys: Failed to find 'trips' node [ 1.698707] thermal_sys: Failed to find trip points for thermal-sensor id=1 even though the main CPU thermal zone on both SoCs is fully configured. This does not seem ideal, while we may not be able to use all the zones it seems better to have those zones which are usable be operational. Instead just carry on registering zones if we get any non-deferral error, allowing use of those zones which are usable. This means that we also need to update the interrupt handler to not attempt to notify the core for events on zones which we have not registered, I didn't see an ability to mask individual interrupts and I would expect that interrupts would still be indicated in the ISR even if they were masked. Reviewed-by: Vasily Khoruzhick <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 83620b3 commit 79d9984

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/thermal/sun8i_thermal.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data)
195195
int i;
196196

197197
for_each_set_bit(i, &irq_bitmap, tmdev->chip->sensor_num) {
198+
/* We allow some zones to not register. */
199+
if (IS_ERR(tmdev->sensor[i].tzd))
200+
continue;
198201
thermal_zone_device_update(tmdev->sensor[i].tzd,
199202
THERMAL_EVENT_UNSPECIFIED);
200203
}
@@ -531,8 +534,17 @@ static int sun8i_ths_register(struct ths_device *tmdev)
531534
i,
532535
&tmdev->sensor[i],
533536
&ths_ops);
534-
if (IS_ERR(tmdev->sensor[i].tzd))
535-
return PTR_ERR(tmdev->sensor[i].tzd);
537+
538+
/*
539+
* If an individual zone fails to register for reasons
540+
* other than probe deferral (eg, a bad DT) then carry
541+
* on, other zones might register successfully.
542+
*/
543+
if (IS_ERR(tmdev->sensor[i].tzd)) {
544+
if (PTR_ERR(tmdev->sensor[i].tzd) == -EPROBE_DEFER)
545+
return PTR_ERR(tmdev->sensor[i].tzd);
546+
continue;
547+
}
536548

537549
devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd);
538550
}

0 commit comments

Comments
 (0)