* [PATCH] ASoC: imx-rpmsg: Fix ignore-suspend-widgets only applied to codec DAPM
@ 2026-04-11 7:24 Chancel Liu
2026-04-11 10:40 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Chancel Liu @ 2026-04-11 7:24 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
broonie, perex, tiwai, Frank.Li, s.hauer, kernel, linux-sound,
linuxppc-dev, imx, linux-arm-kernel, linux-kernel
Currently the property "ignore-suspend-widgets" are applied only to the
codec's DAPM context. However, some widgets listed in the property
(e.g. "Headphone Jack") belong to card or CPU DAI DAPM context.
Extend the handling so that widgets which are marked ignoring suspend
are looked up across all widgets in the card.
Fixes: 5d9f746ca64c ("ASoC: imx-rpmsg: Force codec power on in low power audio mode")
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
sound/soc/fsl/imx-rpmsg.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
index 40e0043cfe15..4b09b22d413a 100644
--- a/sound/soc/fsl/imx-rpmsg.c
+++ b/sound/soc/fsl/imx-rpmsg.c
@@ -87,10 +87,29 @@ static int imx_rpmsg_late_probe(struct snd_soc_card *card)
int ret;
if (data->lpa) {
- struct snd_soc_component *codec_comp;
+ struct snd_soc_dapm_widget *w;
struct device_node *codec_np;
struct device_driver *codec_drv;
struct device *codec_dev = NULL;
+ int i, num_widgets;
+ const char *widgets;
+
+ num_widgets = of_property_count_strings(data->card.dev->of_node,
+ "ignore-suspend-widgets");
+ for_each_card_widgets(card, w) {
+ for (i = 0; i < num_widgets; i++) {
+ of_property_read_string_index(data->card.dev->of_node,
+ "ignore-suspend-widgets",
+ i, &widgets);
+ if (!strcmp(w->name, widgets)) {
+ ret = snd_soc_dapm_ignore_suspend(w->dapm, widgets);
+ if (ret) {
+ dev_err(dev, "failed to find ignore suspend widgets\n");
+ return ret;
+ }
+ }
+ }
+ }
codec_np = data->dai.codecs->of_node;
if (codec_np) {
@@ -107,22 +126,6 @@ static int imx_rpmsg_late_probe(struct snd_soc_card *card)
}
}
if (codec_dev) {
- codec_comp = snd_soc_lookup_component_nolocked(codec_dev, NULL);
- if (codec_comp) {
- int i, num_widgets;
- const char *widgets;
- struct snd_soc_dapm_context *dapm;
-
- num_widgets = of_property_count_strings(data->card.dev->of_node,
- "ignore-suspend-widgets");
- for (i = 0; i < num_widgets; i++) {
- of_property_read_string_index(data->card.dev->of_node,
- "ignore-suspend-widgets",
- i, &widgets);
- dapm = snd_soc_component_to_dapm(codec_comp);
- snd_soc_dapm_ignore_suspend(dapm, widgets);
- }
- }
codec_drv = codec_dev->driver;
if (codec_drv->pm) {
memcpy(&lpa_pm, codec_drv->pm, sizeof(lpa_pm));
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: imx-rpmsg: Fix ignore-suspend-widgets only applied to codec DAPM
2026-04-11 7:24 [PATCH] ASoC: imx-rpmsg: Fix ignore-suspend-widgets only applied to codec DAPM Chancel Liu
@ 2026-04-11 10:40 ` Mark Brown
2026-04-13 3:13 ` Chancel Liu
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2026-04-11 10:40 UTC (permalink / raw)
To: Chancel Liu
Cc: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
perex, tiwai, Frank.Li, s.hauer, kernel, linux-sound,
linuxppc-dev, imx, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]
On Sat, Apr 11, 2026 at 04:24:39PM +0900, Chancel Liu wrote:
> Currently the property "ignore-suspend-widgets" are applied only to the
> codec's DAPM context. However, some widgets listed in the property
> (e.g. "Headphone Jack") belong to card or CPU DAI DAPM context.
> Extend the handling so that widgets which are marked ignoring suspend
> are looked up across all widgets in the card.
> --- a/sound/soc/fsl/imx-rpmsg.c
> +++ b/sound/soc/fsl/imx-rpmsg.c
> + num_widgets = of_property_count_strings(data->card.dev->of_node,
> + "ignore-suspend-widgets");
Don't we get an error code back if the property doesn't exist at all?
> + for_each_card_widgets(card, w) {
> + for (i = 0; i < num_widgets; i++) {
> + of_property_read_string_index(data->card.dev->of_node,
> + "ignore-suspend-widgets",
> + i, &widgets);
> + if (!strcmp(w->name, widgets)) {
> + ret = snd_soc_dapm_ignore_suspend(w->dapm, widgets);
> + if (ret) {
> + dev_err(dev, "failed to find ignore suspend widgets\n");
> + return ret;
> + }
> + }
> + }
> + }
This seems like the wrong level to implement this search, it should be
in the core. I'm also not seeing any prefix handling, the widget name
might've been prefixed at runtime.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: Re: [PATCH] ASoC: imx-rpmsg: Fix ignore-suspend-widgets only applied to codec DAPM
2026-04-11 10:40 ` Mark Brown
@ 2026-04-13 3:13 ` Chancel Liu
0 siblings, 0 replies; 3+ messages in thread
From: Chancel Liu @ 2026-04-13 3:13 UTC (permalink / raw)
To: Mark Brown
Cc: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com,
nicoleotsuka@gmail.com, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.com, Frank Li, s.hauer@pengutronix.de,
kernel@pengutronix.de, linux-sound@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Hi Mark,
Thank you for the review and feedback.
> > Currently the property "ignore-suspend-widgets" are applied only to the
> > codec's DAPM context. However, some widgets listed in the property
> > (e.g. "Headphone Jack") belong to card or CPU DAI DAPM context.
>
> > Extend the handling so that widgets which are marked ignoring suspend
> > are looked up across all widgets in the card.
>
> > --- a/sound/soc/fsl/imx-rpmsg.c
> > +++ b/sound/soc/fsl/imx-rpmsg.c
>
> > + num_widgets = of_property_count_strings(data->card.dev-
> >of_node,
> > + "ignore-suspend-
> widgets");
>
> Don't we get an error code back if the property doesn't exist at all?
>
It's a mistake here. I will fix it.
> > + for_each_card_widgets(card, w) {
> > + for (i = 0; i < num_widgets; i++) {
> > + of_property_read_string_index(data-
> >card.dev->of_node,
> > + "ignore-suspend-
> widgets",
> > + i, &widgets);
> > + if (!strcmp(w->name, widgets)) {
> > + ret =
> snd_soc_dapm_ignore_suspend(w->dapm, widgets);
> > + if (ret) {
> > + dev_err(dev, "failed to find
> ignore suspend widgets\n");
> > + return ret;
> > + }
> > + }
> > + }
> > + }
>
> This seems like the wrong level to implement this search, it should be
> in the core. I'm also not seeing any prefix handling, the widget name
> might've been prefixed at runtime.
Thanks for pointing this out. I really appreciate your suggestion to
move this functionality into core-level. Several machine drivers could
benefit if there's an unified ignore‑suspend mechanism.
I have an idea to make it support a generic and reusable mechanism in
the core rather than something each machine driver has to re‑implement.
The design follows a simple structure:
1. Parse and store the name of widgets to ignore suspend in
struct snd_soc_card
The name list of widgets to ignore suspend can come either from DT or
from the machine driver. Different boards/machines have different
routing and power requirements. So allowing DT to specify
"ignore-suspend-widgets" is important. It enables each device to define
its own policy rather than forcing hard‑coded rules. To support this, a
helper such as snd_soc_of_parse_ignore_suspend_widgets() can be defined
in core and provided.
2. Apply ignore_suspend flags during snd_soc_bind_card()
After all components have been probed and all DAPM widgets are
registered in snd_soc_bind_card(), perform a unified search through
the card’s widget list and mark matching widgets with
ignore_suspend = 1. Any runtime prefixing applied during widget
creation should be handled well by the lookup.
Please let me know if the approach makes sense or if there are any
concerns I should address before posting the next revision.
Regards,
Chancel Liu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-13 3:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11 7:24 [PATCH] ASoC: imx-rpmsg: Fix ignore-suspend-widgets only applied to codec DAPM Chancel Liu
2026-04-11 10:40 ` Mark Brown
2026-04-13 3:13 ` Chancel Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox