linux-gbmc: npcm_adc: add reset method to fix get value failed

ADC read failure during the first AC power-on.
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

Tested:
AC power-on stress, and no failures occurred.
mobo_battery_p3v | 3.06 Volts        | ok

Fusion-Link: fusion2/da2ad243-0bf8-3c4f-8ba7-c4a79a25a211 (platform5)
Fusion-Link: fusion2/0e7d01cd-4f12-3482-b76c-5a8c9eab09b8 (platform11)
Fusion-Link: fusion2/a51c227c-1596-3647-957d-8f590fb3d775 (platform15)
Platforms-Affected: Nuvoton 7xx/8xx
Smoke-Bug-Id: 387419591
Google-Bug-Id: 386715774
Change-Id: I8c0581a139da9619a835f7306216ce0500677361
Signed-off-by: Charles Hsu <charles.hsu@quanta.corp-partner.google.com>
(cherry picked from commit bc31e8afa100b51b363df78d6906fa8426cbf35d)
diff --git a/recipes-kernel/linux/5.15/0001-iio-adc-npcm-add-reset-method-to-fix-get-value-faile.patch b/recipes-kernel/linux/5.15/0001-iio-adc-npcm-add-reset-method-to-fix-get-value-faile.patch
new file mode 100644
index 0000000..45f8ca0
--- /dev/null
+++ b/recipes-kernel/linux/5.15/0001-iio-adc-npcm-add-reset-method-to-fix-get-value-faile.patch
@@ -0,0 +1,35 @@
+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
+
diff --git a/recipes-kernel/linux/linux-gbmc_5.15.bb b/recipes-kernel/linux/linux-gbmc_5.15.bb
index 53f3e74..1e4abe8 100644
--- a/recipes-kernel/linux/linux-gbmc_5.15.bb
+++ b/recipes-kernel/linux/linux-gbmc_5.15.bb
@@ -21,6 +21,7 @@
   file://0002-hwmon-max34451-Add-programming-feature.patch \
   file://0001-i2c-npcm-Sync-with-6.1.patch \
   file://0001-hwmon-mp2981-driver.patch \
+  file://0001-iio-adc-npcm-add-reset-method-to-fix-get-value-faile.patch \
   "
 
 SRC_URI:append:aspeed-g6 = " \