]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: sdw_utils: refactor sof_sdw_card_late_probe function
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>
Thu, 1 Aug 2024 11:18:11 +0000 (16:48 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 1 Aug 2024 11:44:14 +0000 (12:44 +0100)
Refactor sof_sdw_card_late_probe() function and derive a generic
function soc_sdw_card_late_probe() function which can be used by
SoundWire generic machine driver.

Link: https://github.com/thesofproject/linux/pull/5068
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://patch.msgid.link/20240801111821.18076-5-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc_sdw_utils.h
sound/soc/intel/boards/sof_sdw.c
sound/soc/sdw_utils/soc_sdw_utils.c

index b3b6d6b7ce2f2a6884b0d40022c7cc0f40db4324..14e21a992f566de58b116f078440695abb998d16 100644 (file)
@@ -122,6 +122,8 @@ struct snd_soc_dai_link *asoc_sdw_mc_find_codec_dai_used(struct snd_soc_card *ca
 
 void asoc_sdw_mc_dailink_exit_loop(struct snd_soc_card *card);
 
+int asoc_sdw_card_late_probe(struct snd_soc_card *card);
+
 int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd);
 
 /* DMIC support */
index 07b1d6994304fa17c725f00d00f48b8073e35ea9..65b15f594aeddbb1a115bf7620403ee0a7dc14a9 100644 (file)
@@ -1221,16 +1221,10 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card)
        struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
        struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
        int ret = 0;
-       int i;
-
-       for (i = 0; i < ctx->codec_info_list_count; i++) {
-               if (codec_info_list[i].codec_card_late_probe) {
-                       ret = codec_info_list[i].codec_card_late_probe(card);
 
-                       if (ret < 0)
-                               return ret;
-               }
-       }
+       ret = asoc_sdw_card_late_probe(card);
+       if (ret < 0)
+               return ret;
 
        if (intel_ctx->hdmi.idisp_codec)
                ret = sof_sdw_hdmi_card_late_probe(card);
index 409a5014734951ff7e4969ebed5162e9ea04552d..613ecc3bed92cd6bf5e61fa5ec398edab40e064b 100644 (file)
@@ -916,5 +916,21 @@ void asoc_sdw_mc_dailink_exit_loop(struct snd_soc_card *card)
 }
 EXPORT_SYMBOL_NS(asoc_sdw_mc_dailink_exit_loop, SND_SOC_SDW_UTILS);
 
+int asoc_sdw_card_late_probe(struct snd_soc_card *card)
+{
+       int ret = 0;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) {
+               if (codec_info_list[i].codec_card_late_probe) {
+                       ret = codec_info_list[i].codec_card_late_probe(card);
+                       if (ret < 0)
+                               return ret;
+               }
+       }
+       return ret;
+}
+EXPORT_SYMBOL_NS(asoc_sdw_card_late_probe, SND_SOC_SDW_UTILS);
+
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("SoundWire ASoC helpers");