public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SDCA: restore the settings if power is lost during suspend
@ 2026-04-08  8:56 shumingf
  2026-04-08  9:21 ` Charles Keepax
  0 siblings, 1 reply; 5+ messages in thread
From: shumingf @ 2026-04-08  8:56 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: linux-sound, lars, flove, oder_chiou, jack.yu, derek.fang,
	ckeepax, Shuming Fan

From: Shuming Fan <shumingf@realtek.com>

We should restore the MIPI-defined registers when the device is attached.
If a function status interrupt occurs, the device will trigger an interrupt to reload the settings.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/sdca/sdca_class.c      |  4 ++++
 sound/soc/sdca/sdca_interrupts.c | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c
index 7af4e5d1b347..d1feaa57eae7 100644
--- a/sound/soc/sdca/sdca_class.c
+++ b/sound/soc/sdca/sdca_class.c
@@ -49,6 +49,10 @@ static int class_sdw_update_status(struct sdw_slave *sdw, enum sdw_slave_status
 		drv->attached = true;
 
 		complete(&drv->device_attach);
+
+		/* resync the MIPI-defined registers if the device loses power */
+		regcache_mark_dirty(drv->dev_regmap);
+		regcache_sync(drv->dev_regmap);
 		break;
 	case SDW_SLAVE_UNATTACHED:
 		dev_dbg(drv->dev, "device detach\n");
diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c
index 1838dabcdf60..ee69486e6b68 100644
--- a/sound/soc/sdca/sdca_interrupts.c
+++ b/sound/soc/sdca/sdca_interrupts.c
@@ -24,6 +24,7 @@
 #include <sound/sdca_interrupts.h>
 #include <sound/sdca_jack.h>
 #include <sound/sdca_ump.h>
+#include <sound/sdca_regmap.h>
 #include <sound/soc-component.h>
 #include <sound/soc.h>
 
@@ -121,7 +122,14 @@ static irqreturn_t function_status_handler(int irq, void *data)
 
 		switch (mask) {
 		case SDCA_CTL_ENTITY_0_FUNCTION_NEEDS_INITIALIZATION:
-			//FIXME: Add init writes
+			dev_info(dev, "%s function needs initialisation\n", interrupt->function->desc->name);
+			ret = sdca_regmap_write_init(dev, interrupt->device_regmap,
+					     interrupt->function);
+			if (ret)
+				return ret;
+			/* resync the function registers */
+			regcache_mark_dirty(interrupt->function_regmap);
+			regcache_sync(interrupt->function_regmap);
 			break;
 		case SDCA_CTL_ENTITY_0_FUNCTION_FAULT:
 			dev_err(dev, "function fault\n");
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-08  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08  8:56 [PATCH] ASoC: SDCA: restore the settings if power is lost during suspend shumingf
2026-04-08  9:21 ` Charles Keepax
2026-04-08  9:40   ` Shuming [范書銘]
2026-04-08  9:43     ` Charles Keepax
2026-04-08  9:58     ` Richard Fitzgerald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox