Unverified Commit be82e888 authored by Naveen Manohar's avatar Naveen Manohar Committed by Mark Brown
Browse files

ASoC: Intel: sof_sdw: Add MAX98373 support



Add max98373-sdw helper function, which configures 2x MAX98373 codecs to
Link1. This patch shares code between the I2S and SoundWire modes of
MAX98373 and adds the trigger already added for I2S.

Signed-off-by: default avatarRander Wang <rander.wang@linux.intel.com>
Signed-off-by: default avatarNaveen Manohar <naveen.m@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200625192620.4312-1-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f6de798e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -564,6 +564,7 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
	depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST
	depends on SOUNDWIRE
	depends on SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC
	select SND_SOC_MAX98373_SDW
	select SND_SOC_RT700_SDW
	select SND_SOC_RT711_SDW
	select SND_SOC_RT1308_SDW
@@ -573,7 +574,7 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
	select SND_SOC_DMIC
        help
	  Add support for Intel SoundWire-based platforms connected to
	  RT700, RT711, RT1308 and RT715
	  MAX98373, RT700, RT711, RT1308 and RT715
	  If unsure select "N".

endif
+2 −0
Original line number Diff line number Diff line
@@ -34,9 +34,11 @@ snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
snd-soc-sof_da7219_max98373-objs := sof_da7219_max98373.o hda_dsp_common.o
snd-soc-ehl-rt5660-objs := ehl_rt5660.o hda_dsp_common.o
snd-soc-sof-sdw-objs += sof_sdw.o				\
			sof_sdw_max98373.o			\
			sof_sdw_rt711.o sof_sdw_rt700.o		\
			sof_sdw_rt1308.o sof_sdw_rt715.o	\
			sof_sdw_rt5682.o			\
			sof_maxim_common.o                      \
			sof_sdw_dmic.o sof_sdw_hdmi.o hda_dsp_common.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o
obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@

#define MAX_98373_PIN_NAME 16

static const struct snd_soc_dapm_route max_98373_dapm_routes[] = {
const struct snd_soc_dapm_route max_98373_dapm_routes[] = {
	/* speaker */
	{ "Left Spk", NULL, "Left BE_OUT" },
	{ "Right Spk", NULL, "Right BE_OUT" },
@@ -59,7 +59,7 @@ static int max98373_hw_params(struct snd_pcm_substream *substream,
	return 0;
}

static int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *codec_dai;
+3 −0
Original line number Diff line number Diff line
@@ -18,7 +18,10 @@

extern struct snd_soc_dai_link_component max_98373_components[2];
extern struct snd_soc_ops max_98373_ops;
extern const struct snd_soc_dapm_route max_98373_dapm_routes[];

int max98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd);
void sof_max98373_codec_conf(struct snd_soc_card *card);
int max98373_trigger(struct snd_pcm_substream *substream, int cmd);

#endif /* __SOF_MAXIM_COMMON_H */
+19 −3
Original line number Diff line number Diff line
@@ -120,7 +120,8 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
			DMI_MATCH(DMI_SYS_VENDOR, "Google"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Volteer"),
		},
		.driver_data = (void *)(SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC),
		.driver_data = (void *)(SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC |
					SOF_SDW_FOUR_SPK),
	},

	{}
@@ -159,6 +160,15 @@ static struct snd_soc_codec_conf codec_conf[] = {
		.dlc = COMP_CODEC_CONF("sdw:3:25d:715:0"),
		.name_prefix = "rt715",
	},
	/* two MAX98373s on link1 with different unique id */
	{
		.dlc = COMP_CODEC_CONF("sdw:1:19f:8373:0:3"),
		.name_prefix = "Right",
	},
	{
		.dlc = COMP_CODEC_CONF("sdw:1:19f:8373:0:7"),
		.name_prefix = "Left",
	},
	{
		.dlc = COMP_CODEC_CONF("sdw:0:25d:5682:0"),
		.name_prefix = "rt5682",
@@ -180,12 +190,12 @@ static struct snd_soc_dai_link_component platform_component[] = {
};

/* these wrappers are only needed to avoid typecast compilation errors */
static int sdw_startup(struct snd_pcm_substream *substream)
int sdw_startup(struct snd_pcm_substream *substream)
{
	return sdw_startup_stream(substream);
}

static void sdw_shutdown(struct snd_pcm_substream *substream)
void sdw_shutdown(struct snd_pcm_substream *substream)
{
	sdw_shutdown_stream(substream);
}
@@ -222,6 +232,12 @@ static struct sof_sdw_codec_info codec_info_list[] = {
		.dai_name = "rt715-aif2",
		.init = sof_sdw_rt715_init,
	},
	{
		.id = 0x8373,
		.direction = {true, true},
		.dai_name = "max98373-aif1",
		.init = sof_sdw_mx8373_init,
	},
	{
		.id = 0x5682,
		.direction = {true, true},
Loading