public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [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; 2+ 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] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2026-04-11 10:40 UTC | newest]

Thread overview: 2+ 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

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