ASoC: Intel: sof_sdw: Move get_codec_dai_by_name() into sof_sdw itself
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 26 Mar 2024 16:04:01 +0000 (11:04 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 26 Mar 2024 16:13:24 +0000 (16:13 +0000)
Currently sof_sdw relies on sof_board_helpers to provide
get_codec_dai_by_name(), but that is the only function from
sof_board_helpers it uses and no other machine driver requires
that function. There is no reason for sof_sdw to select SSP_COMMON
but more and more functions in sof_board_helpers are gaining
dependencies on functions that would require stubs for sof_sdw to
build without it.  Firstly it was sof_ssp_get_codec_name(), as was
fixed in commit c1469c3a8a30 ("ASoC: Intel: ssp-common: Add stub for
sof_ssp_get_codec_name"), now it is:

ERROR: modpost: "sof_ssp_detect_amp_type"
[sound/soc/intel/boards/snd-soc-intel-sof-board-helpers.ko] undefined!
ERROR: modpost: "sof_ssp_detect_codec_type"
[sound/soc/intel/boards/snd-soc-intel-sof-board-helpers.ko] undefined!

Rather than adding more stubs, simply move the affected function
to the sof_sdw machine driver itself and no longer select
SND_SOC_INTEL_SOF_BOARD_HELPERS at all. This should allow work on
SSP_COMMON to progress without affecting sof_sdw.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240326160429.13560-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 files changed:
sound/soc/intel/boards/Kconfig
sound/soc/intel/boards/sof_board_helpers.c
sound/soc/intel/boards/sof_board_helpers.h
sound/soc/intel/boards/sof_sdw.c
sound/soc/intel/boards/sof_sdw_common.h
sound/soc/intel/boards/sof_sdw_cs42l42.c
sound/soc/intel/boards/sof_sdw_rt5682.c
sound/soc/intel/boards/sof_sdw_rt700.c
sound/soc/intel/boards/sof_sdw_rt711.c
sound/soc/intel/boards/sof_sdw_rt712_sdca.c
sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c
sound/soc/intel/boards/sof_ssp_common.h

index e5df64fec3199dbc937fcfd4086680ca6925b88b..b7a6ac4b6c0ca6b3457ff49e69eb574e8eac4dcd 100644 (file)
@@ -678,7 +678,6 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
        depends on MFD_INTEL_LPSS || COMPILE_TEST
        depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST
        depends on SOUNDWIRE
-       select SND_SOC_INTEL_SOF_BOARD_HELPERS
        select SND_SOC_MAX98363
        select SND_SOC_MAX98373_I2C
        select SND_SOC_MAX98373_SDW
index a5135be94f32a31567a593595c9781498ed1e28d..586600680e84c4e33efba2df0f82f0df9e488295 100644 (file)
@@ -630,24 +630,6 @@ sof_intel_board_get_ctx(struct device *dev, unsigned long board_quirk)
 }
 EXPORT_SYMBOL_NS(sof_intel_board_get_ctx, SND_SOC_INTEL_SOF_BOARD_HELPERS);
 
-struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd,
-                                         const char * const dai_name[], int num_dais)
-{
-       struct snd_soc_dai *dai;
-       int index;
-       int i;
-
-       for (index = 0; index < num_dais; index++)
-               for_each_rtd_codec_dais(rtd, i, dai)
-                       if (strstr(dai->name, dai_name[index])) {
-                               dev_dbg(rtd->card->dev, "get dai %s\n", dai->name);
-                               return dai;
-                       }
-
-       return NULL;
-}
-EXPORT_SYMBOL_NS(get_codec_dai_by_name, SND_SOC_INTEL_SOF_BOARD_HELPERS);
-
 MODULE_DESCRIPTION("ASoC Intel SOF Machine Driver Board Helpers");
 MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
 MODULE_LICENSE("GPL");
index 2f27ad8726f8b2a7e41aba5db31f42b7776cc633..b6a83ca14fa82aeaf9a02ef16c03c5e35048c415 100644 (file)
@@ -167,7 +167,4 @@ int sof_intel_board_set_dai_link(struct device *dev, struct snd_soc_card *card,
 struct sof_card_private *
 sof_intel_board_get_ctx(struct device *dev, unsigned long board_quirk);
 
-struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd,
-                                         const char * const dai_name[], int num_dais);
-
 #endif /* __SOF_INTEL_BOARD_HELPERS_H */
index e2c1822b185fede2138e91cbb5ca10bc78356fb2..45732884e310631572bd92c34f8215d1264fcba6 100644 (file)
@@ -514,6 +514,24 @@ static struct snd_soc_dai_link_component platform_component[] = {
        }
 };
 
+struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd,
+                                         const char * const dai_name[],
+                                         int num_dais)
+{
+       struct snd_soc_dai *dai;
+       int index;
+       int i;
+
+       for (index = 0; index < num_dais; index++)
+               for_each_rtd_codec_dais(rtd, i, dai)
+                       if (strstr(dai->name, dai_name[index])) {
+                               dev_dbg(rtd->card->dev, "get dai %s\n", dai->name);
+                               return dai;
+                       }
+
+       return NULL;
+}
+
 /* these wrappers are only needed to avoid typecast compilation errors */
 int sdw_startup(struct snd_pcm_substream *substream)
 {
index b1d57034361c443aba0d8a77c6a9d459a5e99976..a04cbab9bc70dd4059b94f553b0389dd080603d9 100644 (file)
@@ -107,6 +107,10 @@ struct mc_private {
 
 extern unsigned long sof_sdw_quirk;
 
+struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd,
+                                         const char * const dai_name[],
+                                         int num_dais);
+
 int sdw_startup(struct snd_pcm_substream *substream);
 int sdw_prepare(struct snd_pcm_substream *substream);
 int sdw_trigger(struct snd_pcm_substream *substream, int cmd);
index 0dc297f7de0112f0ef0e659a62dcc429d2f5ce55..b999f4e7901a5d67a203819fec8f9a78898a530f 100644 (file)
@@ -15,7 +15,6 @@
 #include <sound/soc-acpi.h>
 #include <sound/soc-dapm.h>
 #include <sound/jack.h>
-#include "sof_board_helpers.h"
 #include "sof_sdw_common.h"
 
 static const struct snd_soc_dapm_widget cs42l42_widgets[] = {
index 6b008a5a343bcd9288683f287a048e7a07ca53cf..f812aea64322d8549c1e3b9663312db7fad0241e 100644 (file)
@@ -15,7 +15,6 @@
 #include <sound/soc-acpi.h>
 #include <sound/soc-dapm.h>
 #include <sound/jack.h>
-#include "sof_board_helpers.h"
 #include "sof_sdw_common.h"
 
 static const struct snd_soc_dapm_widget rt5682_widgets[] = {
index 88e785a54b16fb73376294d070294a7c41a03e4c..a2648c900e747a631c2e96e4e16f14e07ef6a06d 100644 (file)
@@ -13,7 +13,6 @@
 #include <sound/soc-acpi.h>
 #include <sound/soc-dapm.h>
 #include <sound/jack.h>
-#include "sof_board_helpers.h"
 #include "sof_sdw_common.h"
 
 static const struct snd_soc_dapm_widget rt700_widgets[] = {
index cdd1587b246c87aeb91585b7112f08518a61e99c..9762c48ba7a920dfbeae86c316ca0e036c1c9fd5 100644 (file)
@@ -15,7 +15,6 @@
 #include <sound/soc-acpi.h>
 #include <sound/soc-dapm.h>
 #include <sound/jack.h>
-#include "sof_board_helpers.h"
 #include "sof_sdw_common.h"
 
 /*
index ebb4b58c198b9572f3339e04078c0e2c9f4e8fbe..9c898c7286af98ad97179070b136d798fc7f6208 100644 (file)
@@ -13,7 +13,6 @@
 #include <sound/soc.h>
 #include <sound/soc-acpi.h>
 #include <sound/soc-dapm.h>
-#include "sof_board_helpers.h"
 #include "sof_sdw_common.h"
 
 static const struct snd_soc_dapm_widget rt712_spk_widgets[] = {
index 5253d8332780f78bb977e1ec1379d3aa4daa3275..fe59a144efeffdaf0f1abb068196ddc94c4bce48 100644 (file)
@@ -15,7 +15,6 @@
 #include <sound/soc-acpi.h>
 #include <sound/soc-dapm.h>
 #include <sound/jack.h>
-#include "sof_board_helpers.h"
 #include "sof_sdw_common.h"
 
 /*
index d24888bc99fde97808fc441dc74a59b620f05fe2..ff84154ce60a6011e17fddf63ba8346e84deeb04 100644 (file)
@@ -68,13 +68,6 @@ enum sof_ssp_codec {
 enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev);
 enum sof_ssp_codec sof_ssp_detect_amp_type(struct device *dev);
 
-#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SOF_SSP_COMMON)
 const char *sof_ssp_get_codec_name(enum sof_ssp_codec codec_type);
-#else
-static inline const char *sof_ssp_get_codec_name(enum sof_ssp_codec codec_type)
-{
-       return NULL;
-}
-#endif
 
 #endif /* __SOF_SSP_COMMON_H */