Commit 773597ae authored by Patrik Dahlström's avatar Patrik Dahlström Committed by Jonathan Cameron

iio: adc: palmas: always reset events on unload

This prevents leaving the adc in freerunning mode when removing the
driver.
Signed-off-by: default avatarPatrik Dahlström <risca@dalakolonin.se>
Link: https://lore.kernel.org/r/20230408114825.824505-8-risca@dalakolonin.seSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2d48dbdf
...@@ -498,6 +498,13 @@ static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev, ...@@ -498,6 +498,13 @@ static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev,
return 0; return 0;
} }
static void palmas_gpadc_reset(void *data)
{
struct palmas_gpadc *adc = data;
if (adc->event0.enabled || adc->event1.enabled)
palmas_adc_reset_events(adc);
}
static int palmas_gpadc_probe(struct platform_device *pdev) static int palmas_gpadc_probe(struct platform_device *pdev)
{ {
struct palmas_gpadc *adc; struct palmas_gpadc *adc;
...@@ -587,6 +594,10 @@ static int palmas_gpadc_probe(struct platform_device *pdev) ...@@ -587,6 +594,10 @@ static int palmas_gpadc_probe(struct platform_device *pdev)
palmas_gpadc_calibrate(adc, i); palmas_gpadc_calibrate(adc, i);
} }
ret = devm_add_action(&pdev->dev, palmas_gpadc_reset, adc);
if (ret)
return ret;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment