ASoC: Intel: boards: sof_sdw: add SoundWire mockup codecs for tests
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Wed, 14 Jul 2021 03:22:03 +0000 (11:22 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 14 Jul 2021 17:02:07 +0000 (18:02 +0100)
Add support for SoundWire mockup devices. The configurations assume the
same topology as the CML SoundWire devices and can be used to test the
SOF firmware on a development board (RVP, UpExtreme) without any
hardware connected.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20210714032209.11284-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/Kconfig
sound/soc/intel/boards/sof_sdw.c

index 7e29b0d..046955b 100644 (file)
@@ -602,6 +602,7 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
        select SND_SOC_DMIC
        select SND_SOC_INTEL_HDA_DSP_COMMON
        select SND_SOC_INTEL_SOF_MAXIM_COMMON
+       select SND_SOC_SDW_MOCKUP
        help
          Add support for Intel SoundWire-based platforms connected to
          MAX98373, RT700, RT711, RT1308 and RT715
index 1a867c7..82d909e 100644 (file)
@@ -328,6 +328,19 @@ static const struct snd_soc_ops sdw_ops = {
        .shutdown = sdw_shutdown,
 };
 
+static int sof_sdw_mic_codec_mockup_init(const struct snd_soc_acpi_link_adr *link,
+                                        struct snd_soc_dai_link *dai_links,
+                                        struct sof_sdw_codec_info *info,
+                                        bool playback)
+{
+       /*
+        * force DAI link to use same ID as RT715 and DMIC
+        * to reuse topologies
+        */
+       dai_links->id = SDW_DMIC_DAI_ID;
+       return 0;
+}
+
 static struct sof_sdw_codec_info codec_info_list[] = {
        {
                .part_id = 0x700,
@@ -410,6 +423,34 @@ static struct sof_sdw_codec_info codec_info_list[] = {
                .dai_name = "rt5682-sdw",
                .init = sof_sdw_rt5682_init,
        },
+       {
+               .part_id = 0xaaaa, /* generic codec mockup */
+               .version_id = 0,
+               .direction = {true, true},
+               .dai_name = "sdw-mockup-aif1",
+               .init = NULL,
+       },
+       {
+               .part_id = 0xaa55, /* headset codec mockup */
+               .version_id = 0,
+               .direction = {true, true},
+               .dai_name = "sdw-mockup-aif1",
+               .init = NULL,
+       },
+       {
+               .part_id = 0x55aa, /* amplifier mockup */
+               .version_id = 0,
+               .direction = {true, false},
+               .dai_name = "sdw-mockup-aif1",
+               .init = NULL,
+       },
+       {
+               .part_id = 0x5555,
+               .version_id = 0,
+               .direction = {false, true},
+               .dai_name = "sdw-mockup-aif1",
+               .init = sof_sdw_mic_codec_mockup_init,
+       },
 };
 
 static inline int find_codec_info_part(u64 adr)