| From 9c67871856a2de634061cd4e67ab227425429087 Mon Sep 17 00:00:00 2001 |
| From: Jim Liu <JJLIU0@nuvoton.com> |
| Date: Tue, 17 Dec 2024 17:30:31 +0800 |
| Subject: [PATCH] iio: adc: npcm: add reset method to fix get value failed |
| |
| Add a reset method to handle the issue |
| of not being able to obtain ADC values at some marginal timings. |
| ref: https://github.com/Nuvoton-Israel/linux/commit/2a6f126926b0952a19481de99d8b08f2f90c676b |
| |
| Signed-off-by: Jim Liu <JJLIU0@nuvoton.com> |
| --- |
| drivers/iio/adc/npcm_adc.c | 7 +++++++ |
| 1 file changed, 7 insertions(+) |
| |
| diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c |
| index de0f6462dbc1..1a6b591770dd 100644 |
| --- a/drivers/iio/adc/npcm_adc.c |
| +++ b/drivers/iio/adc/npcm_adc.c |
| @@ -445,6 +445,13 @@ static int npcm_adc_probe(struct platform_device *pdev) |
| goto err_disable_clk; |
| } |
| |
| + reg_con = ioread32(info->regs + NPCM_ADCCON); |
| + iowrite32(reg_con | NPCM_ADCCON_ADC_EN, info->regs + NPCM_ADCCON); |
| + reset_control_assert(info->reset); |
| + udelay(1); |
| + reset_control_deassert(info->reset); |
| + udelay(1); |
| + |
| ret = devm_request_irq(&pdev->dev, irq, npcm_adc_isr, 0, |
| "NPCM_ADC", indio_dev); |
| if (ret < 0) { |
| -- |
| 2.34.1 |
| |