ASoC: Intel: machine driver updates
authorMark Brown <broonie@kernel.org>
Mon, 15 May 2023 15:17:37 +0000 (00:17 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 15 May 2023 15:17:37 +0000 (00:17 +0900)
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Several updates for RPL/MTL/LNL, and one fix for SoundWire TGL device.

include/sound/soc-acpi-intel-match.h
sound/soc/intel/boards/sof_nau8825.c
sound/soc/intel/boards/sof_sdw.c
sound/soc/intel/common/Makefile
sound/soc/intel/common/soc-acpi-intel-lnl-match.c [new file with mode: 0644]
sound/soc/intel/common/soc-acpi-intel-mtl-match.c
sound/soc/intel/common/soc-acpi-intel-rpl-match.c

index 82a7db2..e49b97d 100644 (file)
@@ -31,6 +31,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[];
+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[];
 
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_sdw_machines[];
@@ -40,6 +41,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[];
 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[];
+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[];
 
 /*
  * generic table used for HDA codec-based platforms, possibly with
index 30e7984..4fc6e1c 100644 (file)
@@ -674,6 +674,16 @@ static const struct platform_device_id board_ids[] = {
                                        SOF_BT_OFFLOAD_SSP(2) |
                                        SOF_SSP_BT_OFFLOAD_PRESENT),
        },
+       {
+               .name = "rpl_max98373_8825",
+               .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
+                                       SOF_SPEAKER_AMP_PRESENT |
+                                       SOF_MAX98373_SPEAKER_AMP_PRESENT |
+                                       SOF_NAU8825_SSP_AMP(1) |
+                                       SOF_NAU8825_NUM_HDMIDEV(4) |
+                                       SOF_BT_OFFLOAD_SSP(2) |
+                                       SOF_SSP_BT_OFFLOAD_PRESENT),
+       },
        { }
 };
 MODULE_DEVICE_TABLE(platform, board_ids);
index c845a5c..d16ceef 100644 (file)
@@ -192,6 +192,20 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
                                        RT711_JD1),
        },
        {
+               /*
+                * this entry covers HP Spectre x360 where the DMI information
+                * changed somehow
+                */
+               .callback = sof_sdw_quirk_cb,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+                       DMI_MATCH(DMI_BOARD_NAME, "8709"),
+               },
+               .driver_data = (void *)(SOF_SDW_TGL_HDMI |
+                                       SOF_SDW_PCH_DMIC |
+                                       RT711_JD1),
+       },
+       {
                /* NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
                .callback = sof_sdw_quirk_cb,
                .matches = {
@@ -413,7 +427,24 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
                .matches = {
                        DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_mtlrvp"),
                },
-               .driver_data = (void *)(RT711_JD1 | SOF_SDW_TGL_HDMI),
+               .driver_data = (void *)(RT711_JD1),
+       },
+       {
+               .callback = sof_sdw_quirk_cb,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Meteor Lake Client Platform"),
+               },
+               .driver_data = (void *)(RT711_JD2_100K),
+       },
+       /* LunarLake devices */
+       {
+               .callback = sof_sdw_quirk_cb,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Lunar Lake Client Platform"),
+               },
+               .driver_data = (void *)(RT711_JD2_100K),
        },
        {}
 };
@@ -902,17 +933,20 @@ static int create_codec_dai_name(struct device *dev,
 static int set_codec_init_func(struct snd_soc_card *card,
                               const struct snd_soc_acpi_link_adr *link,
                               struct snd_soc_dai_link *dai_links,
-                              bool playback, int group_id)
+                              bool playback, int group_id, int adr_index)
 {
-       int i;
+       int i = adr_index;
 
        do {
                /*
                 * Initialize the codec. If codec is part of an aggregated
                 * group (group_id>0), initialize all codecs belonging to
                 * same group.
+                * The first link should start with link->adr_d[adr_index]
+                * because that is the device that we want to initialize and
+                * we should end immediately if it is not aggregated (group_id=0)
                 */
-               for (i = 0; i < link->num_adr; i++) {
+               for ( ; i < link->num_adr; i++) {
                        int codec_index;
 
                        codec_index = find_codec_info_part(link->adr_d[i].adr);
@@ -928,9 +962,12 @@ static int set_codec_init_func(struct snd_soc_card *card,
                                                dai_links,
                                                &codec_info_list[codec_index],
                                                playback);
+                       if (!group_id)
+                               return 0;
                }
+               i = 0;
                link++;
-       } while (link->mask && group_id);
+       } while (link->mask);
 
        return 0;
 }
@@ -1180,7 +1217,7 @@ static int create_sdw_dailink(struct snd_soc_card *card,
                dai_links[*link_index].nonatomic = true;
 
                ret = set_codec_init_func(card, link, dai_links + (*link_index)++,
-                                         playback, group_id);
+                                         playback, group_id, adr_index);
                if (ret < 0) {
                        dev_err(dev, "failed to init codec %d", codec_index);
                        return ret;
index 41054cf..07aa37d 100644 (file)
@@ -10,6 +10,7 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m
        soc-acpi-intel-tgl-match.o soc-acpi-intel-ehl-match.o \
        soc-acpi-intel-jsl-match.o soc-acpi-intel-adl-match.o \
        soc-acpi-intel-rpl-match.o soc-acpi-intel-mtl-match.o \
+       soc-acpi-intel-lnl-match.o \
        soc-acpi-intel-hda-match.o \
        soc-acpi-intel-sdw-mockup-match.o
 
diff --git a/sound/soc/intel/common/soc-acpi-intel-lnl-match.c b/sound/soc/intel/common/soc-acpi-intel-lnl-match.c
new file mode 100644 (file)
index 0000000..9f35b77
--- /dev/null
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * soc-acpi-intel-lnl-match.c - tables and support for LNL ACPI enumeration.
+ *
+ * Copyright (c) 2023, Intel Corporation. All rights reserved.
+ *
+ */
+
+#include <sound/soc-acpi.h>
+#include <sound/soc-acpi-intel-match.h>
+#include "soc-acpi-intel-sdw-mockup-match.h"
+
+struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[] = {
+       {},
+};
+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_machines);
+
+static const struct snd_soc_acpi_endpoint single_endpoint = {
+       .num = 0,
+       .aggregated = 0,
+       .group_position = 0,
+       .group_id = 0,
+};
+
+static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
+       {
+               .adr = 0x000030025D071101ull,
+               .num_endpoints = 1,
+               .endpoints = &single_endpoint,
+               .name_prefix = "rt711"
+       }
+};
+
+static const struct snd_soc_acpi_link_adr lnl_rvp[] = {
+       {
+               .mask = BIT(0),
+               .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
+               .adr_d = rt711_sdca_0_adr,
+       },
+       {}
+};
+
+/* this table is used when there is no I2S codec present */
+struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = {
+       /* mockup tests need to be first */
+       {
+               .link_mask = GENMASK(3, 0),
+               .links = sdw_mockup_headset_2amps_mic,
+               .drv_name = "sof_sdw",
+               .sof_tplg_filename = "sof-lnl-rt711-rt1308-rt715.tplg",
+       },
+       {
+               .link_mask = BIT(0) | BIT(1) | BIT(3),
+               .links = sdw_mockup_headset_1amp_mic,
+               .drv_name = "sof_sdw",
+               .sof_tplg_filename = "sof-lnl-rt711-rt1308-mono-rt715.tplg",
+       },
+       {
+               .link_mask = GENMASK(2, 0),
+               .links = sdw_mockup_mic_headset_1amp,
+               .drv_name = "sof_sdw",
+               .sof_tplg_filename = "sof-lnl-rt715-rt711-rt1308-mono.tplg",
+       },
+       {
+               .link_mask = BIT(0),
+               .links = lnl_rvp,
+               .drv_name = "sof_sdw",
+               .sof_tplg_filename = "sof-lnl-rt711.tplg",
+       },
+       {},
+};
+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_sdw_machines);
index 7911c3a..8fd4d0d 100644 (file)
@@ -98,6 +98,33 @@ static const struct snd_soc_acpi_adr_device rt5682_2_adr[] = {
        }
 };
 
+static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
+       {
+               .adr = 0x000230025D131601ull,
+               .num_endpoints = 1,
+               .endpoints = &spk_l_endpoint,
+               .name_prefix = "rt1316-1"
+       }
+};
+
+static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
+       {
+               .adr = 0x000331025D131601ull,
+               .num_endpoints = 1,
+               .endpoints = &spk_r_endpoint,
+               .name_prefix = "rt1316-2"
+       }
+};
+
+static const struct snd_soc_acpi_adr_device rt714_1_adr[] = {
+       {
+               .adr = 0x000130025D071401ull,
+               .num_endpoints = 1,
+               .endpoints = &single_endpoint,
+               .name_prefix = "rt714"
+       }
+};
+
 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = {
        /* Expected order: jack -> amp */
        {
@@ -122,6 +149,30 @@ static const struct snd_soc_acpi_link_adr mtl_rvp[] = {
        {}
 };
 
+static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = {
+       {
+               .mask = BIT(0),
+               .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
+               .adr_d = rt711_sdca_0_adr,
+       },
+       {
+               .mask = BIT(2),
+               .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
+               .adr_d = rt1316_2_group1_adr,
+       },
+       {
+               .mask = BIT(3),
+               .num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
+               .adr_d = rt1316_3_group1_adr,
+       },
+       {
+               .mask = BIT(1),
+               .num_adr = ARRAY_SIZE(rt714_1_adr),
+               .adr_d = rt714_1_adr,
+       },
+       {}
+};
+
 /* this table is used when there is no I2S codec present */
 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
        /* mockup tests need to be first */
@@ -144,6 +195,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
                .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg",
        },
        {
+               .link_mask = GENMASK(3, 0),
+               .links = mtl_3_in_1_sdca,
+               .drv_name = "sof_sdw",
+               .sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg",
+       },
+       {
                .link_mask = BIT(0),
                .links = mtl_rvp,
                .drv_name = "sof_sdw",
index 749d371..c61d654 100644 (file)
@@ -303,6 +303,11 @@ static const struct snd_soc_acpi_codecs rpl_max98360a_amp = {
        .codecs = {"MX98360A"},
 };
 
+static const struct snd_soc_acpi_codecs rpl_max98373_amp = {
+       .num_codecs = 1,
+       .codecs = {"MX98373"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
        {
                .comp_ids = &rpl_rt5682_hp,
@@ -311,6 +316,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
                .quirk_data = &rpl_max98360a_amp,
                .sof_tplg_filename = "sof-rpl-max98360a-rt5682.tplg",
        },
+       {
+               .id = "10508825",
+               .drv_name = "rpl_max98373_8825",
+               .machine_quirk = snd_soc_acpi_codec_list,
+               .quirk_data = &rpl_max98373_amp,
+               .sof_tplg_filename = "sof-rpl-max98373-nau8825.tplg",
+       },
        {},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_machines);