* [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* Re: [PATCH] ASoC: SDCA: restore the settings if power is lost during suspend
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 [范書銘]
0 siblings, 1 reply; 5+ messages in thread
From: Charles Keepax @ 2026-04-08 9:21 UTC (permalink / raw)
To: shumingf
Cc: broonie, lgirdwood, linux-sound, lars, flove, oder_chiou, jack.yu,
derek.fang
On Wed, Apr 08, 2026 at 04:56:07PM +0800, shumingf@realtek.com wrote:
> 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.
>
Are you actually hitting this in practice? What is the situation
where the device loses power but it isn't covered by the normal
suspend/resume flow?
Thanks,
Charles
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] ASoC: SDCA: restore the settings if power is lost during suspend
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
0 siblings, 2 replies; 5+ messages in thread
From: Shuming [范書銘] @ 2026-04-08 9:40 UTC (permalink / raw)
To: Charles Keepax
Cc: broonie@kernel.org, lgirdwood@gmail.com,
linux-sound@vger.kernel.org, lars@metafoo.de, Flove(HsinFu),
Oder Chiou, Jack Yu, Derek [方德義]
> On Wed, Apr 08, 2026 at 04:56:07PM +0800, shumingf@realtek.com wrote:
> > 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.
> >
>
> Are you actually hitting this in practice? What is the situation where the device
> loses power but it isn't covered by the normal suspend/resume flow?
This is a scenario where the machine enters hibernation and cuts power to the codec.
I simulated this case and verified that it works as expected.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: SDCA: restore the settings if power is lost during suspend
2026-04-08 9:40 ` Shuming [范書銘]
@ 2026-04-08 9:43 ` Charles Keepax
2026-04-08 9:58 ` Richard Fitzgerald
1 sibling, 0 replies; 5+ messages in thread
From: Charles Keepax @ 2026-04-08 9:43 UTC (permalink / raw)
To: Shuming [范書銘]
Cc: broonie@kernel.org, lgirdwood@gmail.com,
linux-sound@vger.kernel.org, lars@metafoo.de, Flove(HsinFu),
Oder Chiou, Jack Yu, Derek [方德義]
On Wed, Apr 08, 2026 at 09:40:15AM +0000, Shuming [范書銘] wrote:
> > On Wed, Apr 08, 2026 at 04:56:07PM +0800, shumingf@realtek.com wrote:
> > > 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.
> > >
> >
> > Are you actually hitting this in practice? What is the situation where the device
> > loses power but it isn't covered by the normal suspend/resume flow?
>
> This is a scenario where the machine enters hibernation and cuts power to the codec.
> I simulated this case and verified that it works as expected.
>
But in that case the suspend/resume callback should be called and
the cache should be synchronised on that path. Are you not seeing
those run?
Thanks,
Charles
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: SDCA: restore the settings if power is lost during suspend
2026-04-08 9:40 ` Shuming [范書銘]
2026-04-08 9:43 ` Charles Keepax
@ 2026-04-08 9:58 ` Richard Fitzgerald
1 sibling, 0 replies; 5+ messages in thread
From: Richard Fitzgerald @ 2026-04-08 9:58 UTC (permalink / raw)
To: Shuming [范書銘], Charles Keepax
Cc: broonie@kernel.org, lgirdwood@gmail.com,
linux-sound@vger.kernel.org, lars@metafoo.de, Flove(HsinFu),
Oder Chiou, Jack Yu, Derek [方德義]
On 08/04/2026 10:40 am, Shuming [范書銘] wrote:
>> On Wed, Apr 08, 2026 at 04:56:07PM +0800, shumingf@realtek.com wrote:
>>> 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.
>>>
>>
>> Are you actually hitting this in practice? What is the situation where the device
>> loses power but it isn't covered by the normal suspend/resume flow?
>
> This is a scenario where the machine enters hibernation and cuts power to the codec.
> I simulated this case and verified that it works as expected.
>
class_runtime_resume() already does:
regcache_mark_dirty(drv->dev_regmap);
ret = regcache_sync(drv->dev_regmap);
^ permalink raw reply [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