Unverified Commit 07033296 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

ASoC: Intel: sof_sdw: Move get_codec_dai_by_name() into sof_sdw itself



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 c1469c3a ("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: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarPierre-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: default avatarMark Brown <broonie@kernel.org>
parent 634ffef9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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
+0 −18
Original line number Diff line number Diff line
@@ -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");
+0 −3
Original line number Diff line number Diff line
@@ -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 */
+18 −0
Original line number Diff line number Diff line
@@ -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)
{
+4 −0
Original line number Diff line number Diff line
@@ -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);
Loading