]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: fsl: imx-rpmsg: Switch to core ignore-suspend-widgets support
authorChancel Liu <chancel.liu@nxp.com>
Thu, 7 May 2026 01:36:54 +0000 (10:36 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 25 May 2026 12:37:16 +0000 (13:37 +0100)
The imx-rpmsg machine driver currently implements its own logic to
parse ignore-suspend-widgets from Device Tree and manually traverse
DAPM widgets to mark them as ignore_suspend.

It also has a potential issue that some widgets listed in the property
(e.g. "Headphone Jack") belong to card or CPU DAI DAPM context.

Switch to use snd_soc_of_parse_ignore_suspend_widgets() with the
introduction of a generic ignore-suspend-widgets mechanism in the ASoC
core.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Link: https://patch.msgid.link/20260507013654.2945915-4-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/imx-rpmsg.c

index 40e0043cfe15eeb387f26f4fac36bde0c1b79a42..fd4624786b627e0c24fd64d563ae2afbf0174845 100644 (file)
@@ -87,7 +87,6 @@ static int imx_rpmsg_late_probe(struct snd_soc_card *card)
        int ret;
 
        if (data->lpa) {
-               struct snd_soc_component *codec_comp;
                struct device_node *codec_np;
                struct device_driver *codec_drv;
                struct device *codec_dev = NULL;
@@ -107,22 +106,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));
@@ -274,6 +257,15 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
                }
        }
 
+       if (data->lpa && of_property_present(np, "ignore-suspend-widgets")) {
+               ret = snd_soc_of_parse_ignore_suspend_widgets(&data->card,
+                                                             "ignore-suspend-widgets");
+               if (ret) {
+                       dev_err(&pdev->dev, "failed to parse ignore-suspend-widgets: %d\n", ret);
+                       goto fail;
+               }
+       }
+
        platform_set_drvdata(pdev, &data->card);
        snd_soc_card_set_drvdata(&data->card, data);
        ret = devm_snd_soc_register_card(&pdev->dev, &data->card);