Messages in this thread Patch in this message | | | From | Fabio Estevam <> | Date | Tue, 3 Dec 2019 09:04:58 -0300 | Subject | Re: Issue with imx_get_temp() |
| |
Hi Marco,
On Tue, Dec 3, 2019 at 7:15 AM Marco Felsch <m.felsch@pengutronix.de> wrote:
> Mh.. it seems that the irq gets enabled before a irq-handler is > registered. As your backlog shows the thermal_zone_device_register() > triggers a imx_get_temp() and during boot the irq_enabled is false and > it seems that your temperature is below the alarm_temp. So in such a > case the enable_irq() is executed. I don't know what happens if we > enable a irq without a irq-handler.
I think your analysis makes sense.
Should we move the ' data->irq_enabled = true' just prior to calling thermal_zone_device_register()?
--- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -803,6 +803,7 @@ static int imx_thermal_probe(struct platform_device *pdev) goto legacy_cleanup; }
+ data->irq_enabled = true; data->tz = thermal_zone_device_register("imx_thermal_zone", IMX_TRIP_NUM, BIT(IMX_TRIP_PASSIVE), data, @@ -837,7 +838,6 @@ static int imx_thermal_probe(struct platform_device *pdev) regmap_write(map, data->socdata->sensor_ctrl + REG_SET, data->socdata->measure_temp_mask);
- data->irq_enabled = true; data->mode = THERMAL_DEVICE_ENABLED;
ret = devm_request_threaded_irq(&pdev->dev, data->irq,
| |