Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: boards: updates for 6.12

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Some simplifications from Brent Lu for Chromebooks, a new SoundWire codec
support from Bard Liao, new cs42l43 match entries support from
Charles Keepax, Add quirks from some new Dell laptops from Maciej
Strozek, some ACPI match entries from Balamurugan C, and few bug
fixes from Pierre-Louis Bossart.

v2:
- Add "ASoC: SOF: Intel: hda: support BT link mask in mach_params"
commit to fix the build issue in v1.

Balamurugan C (2):
ASoC: Intel: soc-acpi: Add entry for sof_es8336 in ARL match table.
ASoC: Intel: soc-acpi: Add entry for HDMI_In capture support in ARL
match table

Bard Liao (4):
ASoC: Intel: sof_sdw: add rt1320 amp support
ASoC: SOF: Intel: hda: refactoring topology name fixup for HDA mach
ASoC: Intel: sof_sdw: move ignore_internal_dmic check earlier
ASoC: Intel: sof_sdw: overwrite mach_params->dmic_num

Brent Lu (5):
ASoC: SOF: Intel: hda: refactoring topology name fixup for SDW mach
ASoC: SOF: Intel: hda: support BT link mask in mach_params
ASoC: Intel: skl_hda_dsp_generic: support BT audio offload
ASoC: Intel: skl_hda_dsp_generic: remove hdac-hdmi support
ASoC: Intel: skl_hda_dsp_generic: use sof_hdmi_private to init HDMI

Charles Keepax (3):
ASoC: Intel: soc-acpi: arl: Add match entries for new cs42l43 laptops
ASoC: Intel: soc-acpi: adl: Add match entries for new cs42l43 laptops
ASoC: Intel: soc-acpi: lnl: Add match entries for new cs42l43 laptops

Maciej Strozek (1):
ASoC: Intel: sof_sdw: Add quirks from some new Dell laptops

Pierre-Louis Bossart (2):
ASoC: Intel: sof_sdw: make sof_sdw_quirk static
ASoC: Intel: boards: always check the result of
acpi_dev_get_first_match_dev()

include/sound/soc-acpi.h | 2 +
sound/soc/intel/boards/Kconfig | 2 +-
sound/soc/intel/boards/bytcht_cx2072x.c | 4 +
sound/soc/intel/boards/bytcht_da7213.c | 4 +
sound/soc/intel/boards/bytcht_es8316.c | 2 +-
sound/soc/intel/boards/bytcr_rt5640.c | 2 +-
sound/soc/intel/boards/bytcr_rt5651.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 4 +
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +
sound/soc/intel/boards/skl_hda_dsp_common.c | 56 ++--
sound/soc/intel/boards/skl_hda_dsp_common.h | 39 +--
sound/soc/intel/boards/skl_hda_dsp_generic.c | 58 ++--
sound/soc/intel/boards/sof_es8336.c | 12 +-
sound/soc/intel/boards/sof_sdw.c | 85 +++++-
sound/soc/intel/boards/sof_sdw_common.h | 2 -
sound/soc/intel/boards/sof_wm8804.c | 4 +
.../intel/common/soc-acpi-intel-adl-match.c | 105 +++++++
.../intel/common/soc-acpi-intel-arl-match.c | 244 +++++++++++++++
.../intel/common/soc-acpi-intel-hda-match.c | 12 +-
.../intel/common/soc-acpi-intel-lnl-match.c | 104 +++++++
sound/soc/sdw_utils/soc_sdw_rt_amp.c | 11 +-
sound/soc/sdw_utils/soc_sdw_utils.c | 19 ++
sound/soc/sof/intel/hda.c | 281 ++++++++----------
23 files changed, 780 insertions(+), 278 deletions(-)

--
2.43.0

+780 -278
+2
include/sound/soc-acpi.h
··· 73 73 * @subsystem_rev: optional PCI SSID revision value 74 74 * @subsystem_id_set: true if a value has been written to 75 75 * subsystem_vendor and subsystem_device. 76 + * @bt_link_mask: BT offload link enabled on the board 76 77 */ 77 78 struct snd_soc_acpi_mach_params { 78 79 u32 acpi_ipc_irq_index; ··· 90 89 unsigned short subsystem_device; 91 90 unsigned short subsystem_rev; 92 91 bool subsystem_id_set; 92 + u32 bt_link_mask; 93 93 }; 94 94 95 95 /**
+1 -1
sound/soc/intel/boards/Kconfig
··· 305 305 config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH 306 306 tristate "Skylake+ with HDA Codecs" 307 307 depends on SND_HDA_CODEC_HDMI 308 - select SND_SOC_HDAC_HDMI 309 308 select SND_SOC_INTEL_HDA_DSP_COMMON 310 309 select SND_SOC_DMIC 311 310 # SND_SOC_HDAC_HDA is already selected ··· 523 524 select SND_SOC_RT1308 524 525 select SND_SOC_RT1316_SDW 525 526 select SND_SOC_RT1318_SDW 527 + select SND_SOC_RT1320_SDW 526 528 select SND_SOC_RT5682_SDW 527 529 select SND_SOC_CS42L42_SDW 528 530 select SND_SOC_CS42L43
+4
sound/soc/intel/boards/bytcht_cx2072x.c
··· 255 255 snprintf(codec_name, sizeof(codec_name), "i2c-%s", 256 256 acpi_dev_name(adev)); 257 257 byt_cht_cx2072x_dais[dai_index].codecs->name = codec_name; 258 + } else { 259 + dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); 260 + return -ENOENT; 258 261 } 262 + 259 263 acpi_dev_put(adev); 260 264 261 265 /* override platform name, if required */
+4
sound/soc/intel/boards/bytcht_da7213.c
··· 258 258 snprintf(codec_name, sizeof(codec_name), 259 259 "i2c-%s", acpi_dev_name(adev)); 260 260 dailink[dai_index].codecs->name = codec_name; 261 + } else { 262 + dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); 263 + return -ENOENT; 261 264 } 265 + 262 266 acpi_dev_put(adev); 263 267 264 268 /* override platform name, if required */
+1 -1
sound/soc/intel/boards/bytcht_es8316.c
··· 562 562 byt_cht_es8316_dais[dai_index].codecs->name = codec_name; 563 563 } else { 564 564 dev_err(dev, "Error cannot find '%s' dev\n", mach->id); 565 - return -ENXIO; 565 + return -ENOENT; 566 566 } 567 567 568 568 codec_dev = acpi_get_first_physical_node(adev);
+1 -1
sound/soc/intel/boards/bytcr_rt5640.c
··· 1693 1693 byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name; 1694 1694 } else { 1695 1695 dev_err(dev, "Error cannot find '%s' dev\n", mach->id); 1696 - return -ENXIO; 1696 + return -ENOENT; 1697 1697 } 1698 1698 1699 1699 codec_dev = acpi_get_first_physical_node(adev);
+1 -1
sound/soc/intel/boards/bytcr_rt5651.c
··· 926 926 byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name; 927 927 } else { 928 928 dev_err(dev, "Error cannot find '%s' dev\n", mach->id); 929 - return -ENXIO; 929 + return -ENOENT; 930 930 } 931 931 932 932 codec_dev = acpi_get_first_physical_node(adev);
+4
sound/soc/intel/boards/cht_bsw_rt5645.c
··· 582 582 snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name), 583 583 "i2c-%s", acpi_dev_name(adev)); 584 584 cht_dailink[dai_index].codecs->name = cht_rt5645_codec_name; 585 + } else { 586 + dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); 587 + return -ENOENT; 585 588 } 589 + 586 590 /* acpi_get_first_physical_node() returns a borrowed ref, no need to deref */ 587 591 codec_dev = acpi_get_first_physical_node(adev); 588 592 acpi_dev_put(adev);
+4
sound/soc/intel/boards/cht_bsw_rt5672.c
··· 479 479 snprintf(drv->codec_name, sizeof(drv->codec_name), 480 480 "i2c-%s", acpi_dev_name(adev)); 481 481 cht_dailink[dai_index].codecs->name = drv->codec_name; 482 + } else { 483 + dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); 484 + return -ENOENT; 482 485 } 486 + 483 487 acpi_dev_put(adev); 484 488 485 489 /* Use SSP0 on Bay Trail CR devices */
+22 -34
sound/soc/intel/boards/skl_hda_dsp_common.c
··· 11 11 #include <sound/pcm.h> 12 12 #include <sound/pcm_params.h> 13 13 #include <sound/soc.h> 14 - #include "../../codecs/hdac_hdmi.h" 15 14 #include "skl_hda_dsp_common.h" 16 15 17 16 #include <sound/hda_codec.h> ··· 21 22 int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device) 22 23 { 23 24 struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); 24 - struct skl_hda_hdmi_pcm *pcm; 25 + struct snd_soc_dai *dai; 25 26 char dai_name[NAME_SIZE]; 26 - 27 - pcm = devm_kzalloc(card->dev, sizeof(*pcm), GFP_KERNEL); 28 - if (!pcm) 29 - return -ENOMEM; 30 27 31 28 snprintf(dai_name, sizeof(dai_name), "intel-hdmi-hifi%d", 32 29 ctx->dai_index); 33 - pcm->codec_dai = snd_soc_card_get_codec_dai(card, dai_name); 34 - if (!pcm->codec_dai) 30 + dai = snd_soc_card_get_codec_dai(card, dai_name); 31 + if (!dai) 35 32 return -EINVAL; 36 33 37 - pcm->device = device; 38 - list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); 34 + ctx->hdmi.hdmi_comp = dai->component; 39 35 40 36 return 0; 41 37 } ··· 68 74 69 75 SND_SOC_DAILINK_DEF(dmic16k, 70 76 DAILINK_COMP_ARRAY(COMP_CPU("DMIC16k Pin"))); 77 + 78 + SND_SOC_DAILINK_DEF(bt_offload_pin, 79 + DAILINK_COMP_ARRAY(COMP_CPU(""))); /* initialized in driver probe function */ 80 + SND_SOC_DAILINK_DEF(dummy, 81 + DAILINK_COMP_ARRAY(COMP_DUMMY())); 71 82 72 83 SND_SOC_DAILINK_DEF(platform, 73 84 DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3"))); ··· 131 132 .no_pcm = 1, 132 133 SND_SOC_DAILINK_REG(dmic16k, dmic_codec, platform), 133 134 }, 135 + { 136 + .name = NULL, /* initialized in driver probe function */ 137 + .id = 8, 138 + .dpcm_playback = 1, 139 + .dpcm_capture = 1, 140 + .no_pcm = 1, 141 + SND_SOC_DAILINK_REG(bt_offload_pin, dummy, platform), 142 + }, 134 143 }; 135 144 136 145 int skl_hda_hdmi_jack_init(struct snd_soc_card *card) 137 146 { 138 147 struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); 139 - struct snd_soc_component *component = NULL; 140 - struct skl_hda_hdmi_pcm *pcm; 141 - char jack_name[NAME_SIZE]; 142 - int err; 143 148 144 - if (ctx->common_hdmi_codec_drv) 145 - return skl_hda_hdmi_build_controls(card); 149 + /* HDMI disabled, do not create controls */ 150 + if (!ctx->hdmi.idisp_codec) 151 + return 0; 146 152 147 - list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 148 - component = pcm->codec_dai->component; 149 - snprintf(jack_name, sizeof(jack_name), 150 - "HDMI/DP, pcm=%d Jack", pcm->device); 151 - err = snd_soc_card_jack_new(card, jack_name, 152 - SND_JACK_AVOUT, &pcm->hdmi_jack); 153 - 154 - if (err) 155 - return err; 156 - 157 - err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, 158 - &pcm->hdmi_jack); 159 - if (err < 0) 160 - return err; 161 - } 162 - 163 - if (!component) 153 + if (!ctx->hdmi.hdmi_comp) 164 154 return -EINVAL; 165 155 166 - return hdac_hdmi_jack_port_init(component, &card->dapm); 156 + return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp); 167 157 }
+5 -34
sound/soc/intel/boards/skl_hda_dsp_common.h
··· 17 17 #include <sound/hda_codec.h> 18 18 #include "../../codecs/hdac_hda.h" 19 19 #include "hda_dsp_common.h" 20 + #include "sof_hdmi_common.h" 20 21 21 - #define HDA_DSP_MAX_BE_DAI_LINKS 7 22 - 23 - struct skl_hda_hdmi_pcm { 24 - struct list_head head; 25 - struct snd_soc_dai *codec_dai; 26 - struct snd_soc_jack hdmi_jack; 27 - int device; 28 - }; 22 + #define HDA_DSP_MAX_BE_DAI_LINKS 8 29 23 30 24 struct skl_hda_private { 31 25 struct snd_soc_card card; 32 - struct list_head hdmi_pcm_list; 26 + struct sof_hdmi_private hdmi; 33 27 int pcm_count; 34 28 int dai_index; 35 29 const char *platform_name; 36 - bool common_hdmi_codec_drv; 37 - bool idisp_codec; 30 + bool bt_offload_present; 31 + int ssp_bt; 38 32 }; 39 33 40 34 extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS]; 41 35 int skl_hda_hdmi_jack_init(struct snd_soc_card *card); 42 36 int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device); 43 - 44 - /* 45 - * Search card topology and register HDMI PCM related controls 46 - * to codec driver. 47 - */ 48 - static inline int skl_hda_hdmi_build_controls(struct snd_soc_card *card) 49 - { 50 - struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); 51 - struct snd_soc_component *component; 52 - struct skl_hda_hdmi_pcm *pcm; 53 - 54 - /* HDMI disabled, do not create controls */ 55 - if (list_empty(&ctx->hdmi_pcm_list)) 56 - return 0; 57 - 58 - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm, 59 - head); 60 - component = pcm->codec_dai->component; 61 - if (!component) 62 - return -EINVAL; 63 - 64 - return hda_dsp_hdmi_build_controls(card, component); 65 - } 66 37 67 38 #endif /* __SOUND_SOC_HDA_DSP_COMMON_H */
+40 -18
sound/soc/intel/boards/skl_hda_dsp_generic.c
··· 13 13 #include <sound/pcm_params.h> 14 14 #include <sound/soc.h> 15 15 #include <sound/soc-acpi.h> 16 - #include "../../codecs/hdac_hdmi.h" 17 16 #include "skl_hda_dsp_common.h" 18 17 19 18 static const struct snd_soc_dapm_widget skl_hda_widgets[] = { ··· 75 76 link->platforms->name = ctx->platform_name; 76 77 link->nonatomic = 1; 77 78 78 - if (!ctx->idisp_codec) 79 + if (!ctx->hdmi.idisp_codec) 79 80 return 0; 80 81 81 82 if (strstr(link->name, "HDMI")) { ··· 94 95 #define IDISP_DAI_COUNT 3 95 96 #define HDAC_DAI_COUNT 2 96 97 #define DMIC_DAI_COUNT 2 98 + #define BT_DAI_COUNT 1 97 99 98 100 /* there are two routes per iDisp output */ 99 101 #define IDISP_ROUTE_COUNT (IDISP_DAI_COUNT * 2) 100 - #define IDISP_CODEC_MASK 0x4 101 102 102 103 #define HDA_CODEC_AUTOSUSPEND_DELAY_MS 1000 103 104 104 - static int skl_hda_fill_card_info(struct snd_soc_card *card, 105 + static int skl_hda_fill_card_info(struct device *dev, struct snd_soc_card *card, 105 106 struct snd_soc_acpi_mach_params *mach_params) 106 107 { 107 108 struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); 108 109 struct snd_soc_dai_link *dai_link; 110 + struct snd_soc_dai_link *bt_link; 109 111 u32 codec_count, codec_mask; 110 112 int i, num_links, num_route; 111 113 112 114 codec_mask = mach_params->codec_mask; 113 115 codec_count = hweight_long(codec_mask); 114 - ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK); 115 116 116 117 if (!codec_count || codec_count > 2 || 117 - (codec_count == 2 && !ctx->idisp_codec)) 118 + (codec_count == 2 && !ctx->hdmi.idisp_codec)) 118 119 return -EINVAL; 119 120 120 121 if (codec_mask == IDISP_CODEC_MASK) { 121 122 /* topology with iDisp as the only HDA codec */ 122 - num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT; 123 + num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT + BT_DAI_COUNT; 123 124 num_route = IDISP_ROUTE_COUNT; 124 125 125 126 /* ··· 128 129 * num_links of dai links need to be registered 129 130 * to ASoC. 130 131 */ 131 - for (i = 0; i < DMIC_DAI_COUNT; i++) { 132 + for (i = 0; i < (DMIC_DAI_COUNT + BT_DAI_COUNT); i++) { 132 133 skl_hda_be_dai_links[IDISP_DAI_COUNT + i] = 133 134 skl_hda_be_dai_links[IDISP_DAI_COUNT + 134 135 HDAC_DAI_COUNT + i]; ··· 139 140 num_route = ARRAY_SIZE(skl_hda_map); 140 141 card->dapm_widgets = skl_hda_widgets; 141 142 card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets); 142 - if (!ctx->idisp_codec) { 143 + if (!ctx->hdmi.idisp_codec) { 143 144 card->dapm_routes = &skl_hda_map[IDISP_ROUTE_COUNT]; 144 145 num_route -= IDISP_ROUTE_COUNT; 145 146 for (i = 0; i < IDISP_DAI_COUNT; i++) { ··· 147 148 skl_hda_be_dai_links[i].num_codecs = 1; 148 149 } 149 150 } 151 + } 152 + 153 + if (!ctx->bt_offload_present) { 154 + /* remove last link since bt audio offload is not supported */ 155 + num_links -= BT_DAI_COUNT; 156 + } else { 157 + if (codec_mask == IDISP_CODEC_MASK) 158 + bt_link = &skl_hda_be_dai_links[IDISP_DAI_COUNT + DMIC_DAI_COUNT]; 159 + else 160 + bt_link = &skl_hda_be_dai_links[IDISP_DAI_COUNT + HDAC_DAI_COUNT + DMIC_DAI_COUNT]; 161 + 162 + /* complete the link name and dai name with SSP port number */ 163 + bt_link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", 164 + ctx->ssp_bt); 165 + if (!bt_link->name) 166 + return -ENOMEM; 167 + 168 + bt_link->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 169 + "SSP%d Pin", 170 + ctx->ssp_bt); 171 + if (!bt_link->cpus->dai_name) 172 + return -ENOMEM; 150 173 } 151 174 152 175 card->num_links = num_links; ··· 205 184 206 185 static int skl_hda_audio_probe(struct platform_device *pdev) 207 186 { 208 - struct snd_soc_acpi_mach *mach; 187 + struct snd_soc_acpi_mach *mach = pdev->dev.platform_data; 209 188 struct skl_hda_private *ctx; 210 189 struct snd_soc_card *card; 211 190 int ret; ··· 215 194 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 216 195 if (!ctx) 217 196 return -ENOMEM; 218 - 219 - INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 220 - 221 - mach = pdev->dev.platform_data; 222 - if (!mach) 223 - return -EINVAL; 224 197 225 198 card = &ctx->card; 226 199 card->name = "hda-dsp", ··· 228 213 229 214 snd_soc_card_set_drvdata(card, ctx); 230 215 231 - ret = skl_hda_fill_card_info(card, &mach->mach_params); 216 + if (mach->mach_params.codec_mask & IDISP_CODEC_MASK) 217 + ctx->hdmi.idisp_codec = true; 218 + 219 + if (hweight_long(mach->mach_params.bt_link_mask) == 1) { 220 + ctx->bt_offload_present = true; 221 + ctx->ssp_bt = fls(mach->mach_params.bt_link_mask) - 1; 222 + } 223 + 224 + ret = skl_hda_fill_card_info(&pdev->dev, card, &mach->mach_params); 232 225 if (ret < 0) { 233 226 dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n"); 234 227 return ret; ··· 245 222 ctx->pcm_count = card->num_links; 246 223 ctx->dai_index = 1; /* hdmi codec dai name starts from index 1 */ 247 224 ctx->platform_name = mach->mach_params.platform; 248 - ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; 249 225 250 226 card->dev = &pdev->dev; 251 227 if (!snd_soc_acpi_sof_parent(&pdev->dev))
+11 -1
sound/soc/intel/boards/sof_es8336.c
··· 681 681 dai_links[0].codecs->dai_name = "ES8326 HiFi"; 682 682 } else { 683 683 dev_err(dev, "Error cannot find '%s' dev\n", mach->id); 684 - return -ENXIO; 684 + return -ENOENT; 685 685 } 686 686 687 687 codec_dev = acpi_get_first_physical_node(adev); ··· 810 810 }, 811 811 { 812 812 .name = "mtl_es83x6_c1_h02", 813 + .driver_data = (kernel_ulong_t)(SOF_ES8336_SSP_CODEC(1) | 814 + SOF_NO_OF_HDMI_CAPTURE_SSP(2) | 815 + SOF_HDMI_CAPTURE_1_SSP(0) | 816 + SOF_HDMI_CAPTURE_2_SSP(2) | 817 + SOF_SSP_HDMI_CAPTURE_PRESENT | 818 + SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK | 819 + SOF_ES8336_JD_INVERTED), 820 + }, 821 + { 822 + .name = "arl_es83x6_c1_h02", 813 823 .driver_data = (kernel_ulong_t)(SOF_ES8336_SSP_CODEC(1) | 814 824 SOF_NO_OF_HDMI_CAPTURE_SSP(2) | 815 825 SOF_HDMI_CAPTURE_1_SSP(0) |
+74 -11
sound/soc/intel/boards/sof_sdw.c
··· 17 17 #include "sof_sdw_common.h" 18 18 #include "../../codecs/rt711.h" 19 19 20 - unsigned long sof_sdw_quirk = RT711_JD1; 20 + static unsigned long sof_sdw_quirk = RT711_JD1; 21 21 static int quirk_override = -1; 22 22 module_param_named(quirk, quirk_override, int, 0444); 23 23 MODULE_PARM_DESC(quirk, "Board-specific quirk override"); ··· 480 480 .driver_data = (void *)(SOF_SDW_TGL_HDMI | 481 481 RT711_JD2), 482 482 }, 483 + { 484 + .callback = sof_sdw_quirk_cb, 485 + .matches = { 486 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 487 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CF9") 488 + }, 489 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 490 + }, 483 491 /* MeteorLake devices */ 484 492 { 485 493 .callback = sof_sdw_quirk_cb, ··· 547 539 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CE4") 548 540 }, 549 541 .driver_data = (void *)(SOC_SDW_SIDECAR_AMPS), 542 + }, 543 + { 544 + .callback = sof_sdw_quirk_cb, 545 + .matches = { 546 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 547 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CDB") 548 + }, 549 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 550 + }, 551 + { 552 + .callback = sof_sdw_quirk_cb, 553 + .matches = { 554 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 555 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CDC") 556 + }, 557 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 558 + }, 559 + { 560 + .callback = sof_sdw_quirk_cb, 561 + .matches = { 562 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 563 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CDD") 564 + }, 565 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 566 + }, 567 + { 568 + .callback = sof_sdw_quirk_cb, 569 + .matches = { 570 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 571 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CF8") 572 + }, 573 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 574 + }, 575 + 576 + /* ArrowLake devices */ 577 + { 578 + .callback = sof_sdw_quirk_cb, 579 + .matches = { 580 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 581 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CE8") 582 + }, 583 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 584 + }, 585 + { 586 + .callback = sof_sdw_quirk_cb, 587 + .matches = { 588 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 589 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CF7") 590 + }, 591 + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), 550 592 }, 551 593 {} 552 594 }; ··· 1160 1102 hdmi_num = SOF_PRE_TGL_HDMI_COUNT; 1161 1103 1162 1104 /* enable dmic01 & dmic16k */ 1163 - if (sof_sdw_quirk & SOC_SDW_PCH_DMIC || mach_params->dmic_num) 1164 - dmic_num = 2; 1105 + if (sof_sdw_quirk & SOC_SDW_PCH_DMIC || mach_params->dmic_num) { 1106 + if (ctx->ignore_internal_dmic) 1107 + dev_warn(dev, "Ignoring PCH DMIC\n"); 1108 + else 1109 + dmic_num = 2; 1110 + } 1111 + /* 1112 + * mach_params->dmic_num will be used to set the cfg-mics value of card->components 1113 + * string. Overwrite it to the actual number of PCH DMICs used in the device. 1114 + */ 1115 + mach_params->dmic_num = dmic_num; 1165 1116 1166 1117 if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) 1167 1118 bt_num = 1; ··· 1215 1148 } 1216 1149 1217 1150 /* dmic */ 1218 - if (dmic_num > 0) { 1219 - if (ctx->ignore_internal_dmic) { 1220 - dev_warn(dev, "Ignoring PCH DMIC\n"); 1221 - } else { 1222 - ret = create_dmic_dailinks(card, &dai_links, &be_id); 1223 - if (ret) 1224 - goto err_end; 1225 - } 1151 + if (dmic_num) { 1152 + ret = create_dmic_dailinks(card, &dai_links, &be_id); 1153 + if (ret) 1154 + goto err_end; 1226 1155 } 1227 1156 1228 1157 /* HDMI */
-2
sound/soc/intel/boards/sof_sdw_common.h
··· 58 58 unsigned int sdw_pin_index[SDW_INTEL_MAX_LINKS]; 59 59 }; 60 60 61 - extern unsigned long sof_sdw_quirk; 62 - 63 61 /* generic HDMI support */ 64 62 int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd); 65 63
+4
sound/soc/intel/boards/sof_wm8804.c
··· 270 270 snprintf(codec_name, sizeof(codec_name), 271 271 "%s%s", "i2c-", acpi_dev_name(adev)); 272 272 dailink[dai_index].codecs->name = codec_name; 273 + } else { 274 + dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); 275 + return -ENOENT; 273 276 } 277 + 274 278 acpi_dev_put(adev); 275 279 276 280 snd_soc_card_set_drvdata(card, ctx);
+105
sound/soc/intel/common/soc-acpi-intel-adl-match.c
··· 35 35 .group_id = 1, 36 36 }; 37 37 38 + static const struct snd_soc_acpi_endpoint spk_2_endpoint = { 39 + .num = 0, 40 + .aggregated = 1, 41 + .group_position = 2, 42 + .group_id = 1, 43 + }; 44 + 45 + static const struct snd_soc_acpi_endpoint spk_3_endpoint = { 46 + .num = 0, 47 + .aggregated = 1, 48 + .group_position = 3, 49 + .group_id = 1, 50 + }; 51 + 52 + static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = { 53 + { 54 + .adr = 0x00023201FA355601ull, 55 + .num_endpoints = 1, 56 + .endpoints = &spk_r_endpoint, 57 + .name_prefix = "AMP3" 58 + }, 59 + { 60 + .adr = 0x00023301FA355601ull, 61 + .num_endpoints = 1, 62 + .endpoints = &spk_3_endpoint, 63 + .name_prefix = "AMP4" 64 + } 65 + }; 66 + 67 + static const struct snd_soc_acpi_adr_device cs35l56_3_l_adr[] = { 68 + { 69 + .adr = 0x00033001fa355601ull, 70 + .num_endpoints = 1, 71 + .endpoints = &spk_l_endpoint, 72 + .name_prefix = "AMP1" 73 + }, 74 + { 75 + .adr = 0x00033101fa355601ull, 76 + .num_endpoints = 1, 77 + .endpoints = &spk_2_endpoint, 78 + .name_prefix = "AMP2" 79 + } 80 + }; 81 + 82 + static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 83 + { /* Jack Playback Endpoint */ 84 + .num = 0, 85 + .aggregated = 0, 86 + .group_position = 0, 87 + .group_id = 0, 88 + }, 89 + { /* DMIC Capture Endpoint */ 90 + .num = 1, 91 + .aggregated = 0, 92 + .group_position = 0, 93 + .group_id = 0, 94 + }, 95 + { /* Jack Capture Endpoint */ 96 + .num = 2, 97 + .aggregated = 0, 98 + .group_position = 0, 99 + .group_id = 0, 100 + }, 101 + { /* Speaker Playback Endpoint */ 102 + .num = 3, 103 + .aggregated = 0, 104 + .group_position = 0, 105 + .group_id = 0, 106 + }, 107 + }; 108 + 109 + static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { 110 + { 111 + .adr = 0x00003001FA424301ull, 112 + .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 113 + .endpoints = cs42l43_endpoints, 114 + .name_prefix = "cs42l43" 115 + } 116 + }; 117 + 38 118 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 39 119 { 40 120 .adr = 0x000020025D071100ull, ··· 496 416 } 497 417 }; 498 418 419 + static const struct snd_soc_acpi_link_adr adl_cs42l43_l0_cs35l56_l23[] = { 420 + { 421 + .mask = BIT(0), 422 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 423 + .adr_d = cs42l43_0_adr, 424 + }, 425 + { 426 + .mask = BIT(2), 427 + .num_adr = ARRAY_SIZE(cs35l56_2_r_adr), 428 + .adr_d = cs35l56_2_r_adr, 429 + }, 430 + { 431 + .mask = BIT(3), 432 + .num_adr = ARRAY_SIZE(cs35l56_3_l_adr), 433 + .adr_d = cs35l56_3_l_adr, 434 + }, 435 + {} 436 + }; 437 + 499 438 static const struct snd_soc_acpi_link_adr adl_rvp[] = { 500 439 { 501 440 .mask = BIT(0), ··· 659 560 660 561 /* this table is used when there is no I2S codec present */ 661 562 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = { 563 + { 564 + .link_mask = BIT(0) | BIT(2) | BIT(3), 565 + .links = adl_cs42l43_l0_cs35l56_l23, 566 + .drv_name = "sof_sdw", 567 + .sof_tplg_filename = "sof-adl-cs42l43-l0-cs35l56-l23.tplg", 568 + }, 662 569 { 663 570 .link_mask = 0xF, /* 4 active links required */ 664 571 .links = adl_default,
+244
sound/soc/intel/common/soc-acpi-intel-arl-match.c
··· 15 15 .group_id = 0, 16 16 }; 17 17 18 + static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 19 + .num = 0, 20 + .aggregated = 1, 21 + .group_position = 0, 22 + .group_id = 1, 23 + }; 24 + 25 + static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 26 + .num = 0, 27 + .aggregated = 1, 28 + .group_position = 1, 29 + .group_id = 1, 30 + }; 31 + 32 + static const struct snd_soc_acpi_endpoint spk_2_endpoint = { 33 + .num = 0, 34 + .aggregated = 1, 35 + .group_position = 2, 36 + .group_id = 1, 37 + }; 38 + 39 + static const struct snd_soc_acpi_endpoint spk_3_endpoint = { 40 + .num = 0, 41 + .aggregated = 1, 42 + .group_position = 3, 43 + .group_id = 1, 44 + }; 45 + 46 + static const struct snd_soc_acpi_adr_device cs35l56_2_lr_adr[] = { 47 + { 48 + .adr = 0x00023001FA355601ull, 49 + .num_endpoints = 1, 50 + .endpoints = &spk_l_endpoint, 51 + .name_prefix = "AMP1" 52 + }, 53 + { 54 + .adr = 0x00023101FA355601ull, 55 + .num_endpoints = 1, 56 + .endpoints = &spk_r_endpoint, 57 + .name_prefix = "AMP2" 58 + } 59 + }; 60 + 61 + static const struct snd_soc_acpi_adr_device cs35l56_3_lr_adr[] = { 62 + { 63 + .adr = 0x00033001FA355601ull, 64 + .num_endpoints = 1, 65 + .endpoints = &spk_l_endpoint, 66 + .name_prefix = "AMP1" 67 + }, 68 + { 69 + .adr = 0x00033401FA355601ull, 70 + .num_endpoints = 1, 71 + .endpoints = &spk_r_endpoint, 72 + .name_prefix = "AMP2" 73 + } 74 + }; 75 + 76 + static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = { 77 + { 78 + .adr = 0x00023201FA355601ull, 79 + .num_endpoints = 1, 80 + .endpoints = &spk_r_endpoint, 81 + .name_prefix = "AMP3" 82 + }, 83 + { 84 + .adr = 0x00023301FA355601ull, 85 + .num_endpoints = 1, 86 + .endpoints = &spk_3_endpoint, 87 + .name_prefix = "AMP4" 88 + } 89 + }; 90 + 91 + static const struct snd_soc_acpi_adr_device cs35l56_3_l_adr[] = { 92 + { 93 + .adr = 0x00033001fa355601ull, 94 + .num_endpoints = 1, 95 + .endpoints = &spk_l_endpoint, 96 + .name_prefix = "AMP1" 97 + }, 98 + { 99 + .adr = 0x00033101fa355601ull, 100 + .num_endpoints = 1, 101 + .endpoints = &spk_2_endpoint, 102 + .name_prefix = "AMP2" 103 + } 104 + }; 105 + 106 + static const struct snd_soc_acpi_adr_device cs35l56_2_r1_adr[] = { 107 + { 108 + .adr = 0x00023101FA355601ull, 109 + .num_endpoints = 1, 110 + .endpoints = &spk_r_endpoint, 111 + .name_prefix = "AMP2" 112 + }, 113 + }; 114 + 115 + static const struct snd_soc_acpi_adr_device cs35l56_3_l1_adr[] = { 116 + { 117 + .adr = 0x00033301fa355601ull, 118 + .num_endpoints = 1, 119 + .endpoints = &spk_l_endpoint, 120 + .name_prefix = "AMP1" 121 + }, 122 + }; 123 + 18 124 static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 19 125 { /* Jack Playback Endpoint */ 20 126 .num = 0, ··· 157 51 } 158 52 }; 159 53 54 + static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = { 55 + { 56 + .adr = 0x00023001FA424301ull, 57 + .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 58 + .endpoints = cs42l43_endpoints, 59 + .name_prefix = "cs42l43" 60 + } 61 + }; 62 + 160 63 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 161 64 { 162 65 .adr = 0x000020025D071100ull, ··· 192 77 }, 193 78 }; 194 79 80 + static const struct snd_soc_acpi_link_adr arl_cs42l43_l2[] = { 81 + { 82 + .mask = BIT(2), 83 + .num_adr = ARRAY_SIZE(cs42l43_2_adr), 84 + .adr_d = cs42l43_2_adr, 85 + }, 86 + }; 87 + 88 + static const struct snd_soc_acpi_link_adr arl_cs42l43_l2_cs35l56_l3[] = { 89 + { 90 + .mask = BIT(2), 91 + .num_adr = ARRAY_SIZE(cs42l43_2_adr), 92 + .adr_d = cs42l43_2_adr, 93 + }, 94 + { 95 + .mask = BIT(3), 96 + .num_adr = ARRAY_SIZE(cs35l56_3_lr_adr), 97 + .adr_d = cs35l56_3_lr_adr, 98 + }, 99 + {} 100 + }; 101 + 102 + static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_l2[] = { 103 + { 104 + .mask = BIT(0), 105 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 106 + .adr_d = cs42l43_0_adr, 107 + }, 108 + { 109 + .mask = BIT(2), 110 + .num_adr = ARRAY_SIZE(cs35l56_2_lr_adr), 111 + .adr_d = cs35l56_2_lr_adr, 112 + }, 113 + {} 114 + }; 115 + 116 + static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_l23[] = { 117 + { 118 + .mask = BIT(0), 119 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 120 + .adr_d = cs42l43_0_adr, 121 + }, 122 + { 123 + .mask = BIT(2), 124 + .num_adr = ARRAY_SIZE(cs35l56_2_r_adr), 125 + .adr_d = cs35l56_2_r_adr, 126 + }, 127 + { 128 + .mask = BIT(3), 129 + .num_adr = ARRAY_SIZE(cs35l56_3_l_adr), 130 + .adr_d = cs35l56_3_l_adr, 131 + }, 132 + {} 133 + }; 134 + 135 + static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_2_l23[] = { 136 + { 137 + .mask = BIT(0), 138 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 139 + .adr_d = cs42l43_0_adr, 140 + }, 141 + { 142 + .mask = BIT(2), 143 + .num_adr = ARRAY_SIZE(cs35l56_2_r1_adr), 144 + .adr_d = cs35l56_2_r1_adr, 145 + }, 146 + { 147 + .mask = BIT(3), 148 + .num_adr = ARRAY_SIZE(cs35l56_3_l1_adr), 149 + .adr_d = cs35l56_3_l1_adr, 150 + }, 151 + {} 152 + }; 153 + 195 154 static const struct snd_soc_acpi_link_adr arl_rvp[] = { 196 155 { 197 156 .mask = BIT(0), ··· 284 95 {} 285 96 }; 286 97 98 + static const struct snd_soc_acpi_codecs arl_essx_83x6 = { 99 + .num_codecs = 3, 100 + .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, 101 + }; 102 + 103 + static const struct snd_soc_acpi_codecs arl_lt6911_hdmi = { 104 + .num_codecs = 1, 105 + .codecs = {"INTC10B0"} 106 + }; 107 + 287 108 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[] = { 109 + { 110 + .comp_ids = &arl_essx_83x6, 111 + .drv_name = "arl_es83x6_c1_h02", 112 + .machine_quirk = snd_soc_acpi_codec_list, 113 + .quirk_data = &arl_lt6911_hdmi, 114 + .sof_tplg_filename = "sof-arl-es83x6-ssp1-hdmi-ssp02.tplg", 115 + }, 116 + { 117 + .comp_ids = &arl_essx_83x6, 118 + .drv_name = "sof-essx8336", 119 + .sof_tplg_filename = "sof-arl-es8336", /* the tplg suffix is added at run time */ 120 + .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | 121 + SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | 122 + SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 123 + }, 288 124 {}, 289 125 }; 290 126 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_machines); ··· 317 103 /* this table is used when there is no I2S codec present */ 318 104 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { 319 105 { 106 + .link_mask = BIT(0) | BIT(2) | BIT(3), 107 + .links = arl_cs42l43_l0_cs35l56_l23, 108 + .drv_name = "sof_sdw", 109 + .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", 110 + }, 111 + { 112 + .link_mask = BIT(0) | BIT(2) | BIT(3), 113 + .links = arl_cs42l43_l0_cs35l56_2_l23, 114 + .drv_name = "sof_sdw", 115 + .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", 116 + }, 117 + { 118 + .link_mask = BIT(0) | BIT(2), 119 + .links = arl_cs42l43_l0_cs35l56_l2, 120 + .drv_name = "sof_sdw", 121 + .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l2.tplg", 122 + }, 123 + { 320 124 .link_mask = BIT(0), 321 125 .links = arl_cs42l43_l0, 322 126 .drv_name = "sof_sdw", 323 127 .sof_tplg_filename = "sof-arl-cs42l43-l0.tplg", 128 + }, 129 + { 130 + .link_mask = BIT(2), 131 + .links = arl_cs42l43_l2, 132 + .drv_name = "sof_sdw", 133 + .sof_tplg_filename = "sof-arl-cs42l43-l2.tplg", 134 + }, 135 + { 136 + .link_mask = BIT(2) | BIT(3), 137 + .links = arl_cs42l43_l2_cs35l56_l3, 138 + .drv_name = "sof_sdw", 139 + .sof_tplg_filename = "sof-arl-cs42l43-l2-cs35l56-l3.tplg", 324 140 }, 325 141 { 326 142 .link_mask = 0x1, /* link0 required */
+2 -10
sound/soc/intel/common/soc-acpi-intel-hda-match.c
··· 13 13 { 14 14 /* .id is not used in this file */ 15 15 .drv_name = "skl_hda_dsp_generic", 16 - 17 - /* .fw_filename is dynamically set in skylake driver */ 18 - 19 - .sof_tplg_filename = "sof-hda-generic.tplg", 20 - 21 - /* 22 - * .machine_quirk and .quirk_data are not used here but 23 - * can be used if we need a more complicated machine driver 24 - * combining HDA+other device (e.g. DMIC). 25 - */ 16 + .sof_tplg_filename = "sof-hda-generic", /* the tplg suffix is added at run time */ 17 + .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 26 18 }, 27 19 {}, 28 20 };
+104
sound/soc/intel/common/soc-acpi-intel-lnl-match.c
··· 36 36 .group_id = 1, 37 37 }; 38 38 39 + static const struct snd_soc_acpi_endpoint spk_2_endpoint = { 40 + .num = 0, 41 + .aggregated = 1, 42 + .group_position = 2, 43 + .group_id = 1, 44 + }; 45 + 46 + static const struct snd_soc_acpi_endpoint spk_3_endpoint = { 47 + .num = 0, 48 + .aggregated = 1, 49 + .group_position = 3, 50 + .group_id = 1, 51 + }; 52 + 39 53 static const struct snd_soc_acpi_endpoint rt712_endpoints[] = { 40 54 { 41 55 .num = 0, ··· 115 101 .group_position = 0, 116 102 .group_id = 0, 117 103 }, 104 + }; 105 + 106 + static const struct snd_soc_acpi_adr_device cs35l56_2_l_adr[] = { 107 + { 108 + .adr = 0x00023001FA355601ull, 109 + .num_endpoints = 1, 110 + .endpoints = &spk_l_endpoint, 111 + .name_prefix = "AMP1" 112 + }, 113 + { 114 + .adr = 0x00023101FA355601ull, 115 + .num_endpoints = 1, 116 + .endpoints = &spk_2_endpoint, 117 + .name_prefix = "AMP2" 118 + } 119 + }; 120 + 121 + static const struct snd_soc_acpi_adr_device cs35l56_3_r_adr[] = { 122 + { 123 + .adr = 0x00033201fa355601ull, 124 + .num_endpoints = 1, 125 + .endpoints = &spk_r_endpoint, 126 + .name_prefix = "AMP3" 127 + }, 128 + { 129 + .adr = 0x00033301fa355601ull, 130 + .num_endpoints = 1, 131 + .endpoints = &spk_3_endpoint, 132 + .name_prefix = "AMP4" 133 + } 134 + }; 135 + 136 + static const struct snd_soc_acpi_adr_device cs35l56_3_lr_adr[] = { 137 + { 138 + .adr = 0x00033001fa355601ull, 139 + .num_endpoints = 1, 140 + .endpoints = &spk_l_endpoint, 141 + .name_prefix = "AMP1" 142 + }, 143 + { 144 + .adr = 0x00033101fa355601ull, 145 + .num_endpoints = 1, 146 + .endpoints = &spk_r_endpoint, 147 + .name_prefix = "AMP2" 148 + } 118 149 }; 119 150 120 151 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { ··· 269 210 }, 270 211 }; 271 212 213 + static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0_cs35l56_l3[] = { 214 + { 215 + .mask = BIT(0), 216 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 217 + .adr_d = cs42l43_0_adr, 218 + }, 219 + { 220 + .mask = BIT(3), 221 + .num_adr = ARRAY_SIZE(cs35l56_3_lr_adr), 222 + .adr_d = cs35l56_3_lr_adr, 223 + }, 224 + {} 225 + }; 226 + 227 + static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0_cs35l56_l23[] = { 228 + { 229 + .mask = BIT(0), 230 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 231 + .adr_d = cs42l43_0_adr, 232 + }, 233 + { 234 + .mask = BIT(2), 235 + .num_adr = ARRAY_SIZE(cs35l56_2_l_adr), 236 + .adr_d = cs35l56_2_l_adr, 237 + }, 238 + { 239 + .mask = BIT(3), 240 + .num_adr = ARRAY_SIZE(cs35l56_3_r_adr), 241 + .adr_d = cs35l56_3_r_adr, 242 + }, 243 + {} 244 + }; 245 + 272 246 static const struct snd_soc_acpi_link_adr lnl_rvp[] = { 273 247 { 274 248 .mask = BIT(0), ··· 403 311 .links = lnl_3_in_1_sdca, 404 312 .drv_name = "sof_sdw", 405 313 .sof_tplg_filename = "sof-lnl-rt711-l0-rt1316-l23-rt714-l1.tplg", 314 + }, 315 + { 316 + .link_mask = BIT(0) | BIT(2) | BIT(3), 317 + .links = lnl_cs42l43_l0_cs35l56_l23, 318 + .drv_name = "sof_sdw", 319 + .sof_tplg_filename = "sof-lnl-cs42l43-l0-cs35l56-l23.tplg", 320 + }, 321 + { 322 + .link_mask = BIT(0) | BIT(3), 323 + .links = lnl_cs42l43_l0_cs35l56_l3, 324 + .drv_name = "sof_sdw", 325 + .sof_tplg_filename = "sof-lnl-cs42l43-l0-cs35l56-l3.tplg", 406 326 }, 407 327 { 408 328 .link_mask = BIT(0),
+10 -1
sound/soc/sdw_utils/soc_sdw_rt_amp.c
··· 160 160 { "Speaker", NULL, "rt1318-2 SPOR" }, 161 161 }; 162 162 163 + static const struct snd_soc_dapm_route rt1320_map[] = { 164 + { "Speaker", NULL, "rt1320-1 SPOL" }, 165 + { "Speaker", NULL, "rt1320-1 SPOR" }, 166 + { "Speaker", NULL, "rt1320-2 SPOL" }, 167 + { "Speaker", NULL, "rt1320-2 SPOR" }, 168 + }; 169 + 163 170 static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_dai *dai, 164 171 char *codec_name) 165 172 { ··· 178 171 return rt1308_map; 179 172 else if (strcmp(codec_name, "rt1316") == 0) 180 173 return rt1316_map; 181 - else 174 + else if (strcmp(codec_name, "rt1318") == 0) 182 175 return rt1318_map; 176 + else 177 + return rt1320_map; 183 178 } 184 179 185 180 int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
+19
sound/soc/sdw_utils/soc_sdw_utils.c
··· 255 255 .dai_num = 1, 256 256 }, 257 257 { 258 + .part_id = 0x1320, 259 + .dais = { 260 + { 261 + .direction = {true, false}, 262 + .dai_name = "rt1320-aif1", 263 + .dai_type = SOC_SDW_DAI_TYPE_AMP, 264 + .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID}, 265 + .init = asoc_sdw_rt_amp_init, 266 + .exit = asoc_sdw_rt_amp_exit, 267 + .rtd_init = asoc_sdw_rt_amp_spk_rtd_init, 268 + .controls = generic_spk_controls, 269 + .num_controls = ARRAY_SIZE(generic_spk_controls), 270 + .widgets = generic_spk_widgets, 271 + .num_widgets = ARRAY_SIZE(generic_spk_widgets), 272 + }, 273 + }, 274 + .dai_num = 1, 275 + }, 276 + { 258 277 .part_id = 0x714, 259 278 .version_id = 3, 260 279 .ignore_internal_dmic = true,
+118 -163
sound/soc/sof/intel/hda.c
··· 444 444 module_param_named(mclk_id, mclk_id_override, int, 0444); 445 445 MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); 446 446 447 + static int bt_link_mask_override; 448 + module_param_named(bt_link_mask, bt_link_mask_override, int, 0444); 449 + MODULE_PARM_DESC(bt_link_mask, "SOF BT offload link mask"); 450 + 447 451 static int hda_init(struct snd_sof_dev *sdev) 448 452 { 449 453 struct hda_bus *hbus; ··· 515 511 if (nhlt) 516 512 dmic_num = intel_nhlt_get_dmic_geo(sdev->dev, nhlt); 517 513 514 + dev_info(sdev->dev, "DMICs detected in NHLT tables: %d\n", dmic_num); 515 + 518 516 /* allow for module parameter override */ 519 517 if (dmic_num_override != -1) { 520 518 dev_dbg(sdev->dev, ··· 533 527 return dmic_num; 534 528 } 535 529 536 - static int check_nhlt_ssp_mask(struct snd_sof_dev *sdev) 530 + static int check_nhlt_ssp_mask(struct snd_sof_dev *sdev, u8 device_type) 537 531 { 538 532 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; 539 533 struct nhlt_acpi_table *nhlt; ··· 544 538 return ssp_mask; 545 539 546 540 if (intel_nhlt_has_endpoint_type(nhlt, NHLT_LINK_SSP)) { 547 - ssp_mask = intel_nhlt_ssp_endpoint_mask(nhlt, NHLT_DEVICE_I2S); 541 + ssp_mask = intel_nhlt_ssp_endpoint_mask(nhlt, device_type); 548 542 if (ssp_mask) 549 - dev_info(sdev->dev, "NHLT_DEVICE_I2S detected, ssp_mask %#x\n", ssp_mask); 543 + dev_info(sdev->dev, "NHLT device %s(%d) detected, ssp_mask %#x\n", 544 + device_type == NHLT_DEVICE_BT ? "BT" : "I2S", 545 + device_type, ssp_mask); 550 546 } 551 547 552 548 return ssp_mask; ··· 565 557 566 558 return intel_nhlt_ssp_mclk_mask(nhlt, ssp_num); 567 559 } 568 - 569 - #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) || IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) 570 - 571 - static const char *fixup_tplg_name(struct snd_sof_dev *sdev, 572 - const char *sof_tplg_filename, 573 - const char *idisp_str, 574 - const char *dmic_str) 575 - { 576 - const char *tplg_filename = NULL; 577 - char *filename, *tmp; 578 - const char *split_ext; 579 - 580 - filename = kstrdup(sof_tplg_filename, GFP_KERNEL); 581 - if (!filename) 582 - return NULL; 583 - 584 - /* this assumes a .tplg extension */ 585 - tmp = filename; 586 - split_ext = strsep(&tmp, "."); 587 - if (split_ext) 588 - tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, 589 - "%s%s%s.tplg", 590 - split_ext, idisp_str, dmic_str); 591 - kfree(filename); 592 - 593 - return tplg_filename; 594 - } 595 - 596 - static int dmic_detect_topology_fixup(struct snd_sof_dev *sdev, 597 - const char **tplg_filename, 598 - const char *idisp_str, 599 - int *dmic_found, 600 - bool tplg_fixup) 601 - { 602 - const char *dmic_str; 603 - int dmic_num; 604 - 605 - /* first check for DMICs (using NHLT or module parameter) */ 606 - dmic_num = check_dmic_num(sdev); 607 - 608 - switch (dmic_num) { 609 - case 1: 610 - dmic_str = "-1ch"; 611 - break; 612 - case 2: 613 - dmic_str = "-2ch"; 614 - break; 615 - case 3: 616 - dmic_str = "-3ch"; 617 - break; 618 - case 4: 619 - dmic_str = "-4ch"; 620 - break; 621 - default: 622 - dmic_num = 0; 623 - dmic_str = ""; 624 - break; 625 - } 626 - 627 - if (tplg_fixup) { 628 - const char *default_tplg_filename = *tplg_filename; 629 - const char *fixed_tplg_filename; 630 - 631 - fixed_tplg_filename = fixup_tplg_name(sdev, default_tplg_filename, 632 - idisp_str, dmic_str); 633 - if (!fixed_tplg_filename) 634 - return -ENOMEM; 635 - *tplg_filename = fixed_tplg_filename; 636 - } 637 - 638 - dev_info(sdev->dev, "DMICs detected in NHLT tables: %d\n", dmic_num); 639 - *dmic_found = dmic_num; 640 - 641 - return 0; 642 - } 643 - #endif 644 560 645 561 static int hda_init_caps(struct snd_sof_dev *sdev) 646 562 { ··· 977 1045 struct snd_soc_acpi_mach *hda_mach; 978 1046 struct snd_sof_pdata *pdata = sdev->pdata; 979 1047 const char *tplg_filename; 980 - const char *idisp_str; 981 - int dmic_num = 0; 982 1048 int codec_num = 0; 983 - int ret; 984 1049 int i; 985 1050 986 1051 /* codec detection */ ··· 1000 1071 * - one external HDAudio codec 1001 1072 */ 1002 1073 if (!*mach && codec_num <= 2) { 1003 - bool tplg_fixup; 1074 + bool tplg_fixup = false; 1004 1075 1005 1076 hda_mach = snd_soc_acpi_intel_hda_machines; 1006 1077 1007 1078 dev_info(bus->dev, "using HDA machine driver %s now\n", 1008 1079 hda_mach->drv_name); 1009 1080 1010 - if (codec_num == 1 && HDA_IDISP_CODEC(bus->codec_mask)) 1011 - idisp_str = "-idisp"; 1012 - else 1013 - idisp_str = ""; 1014 - 1015 - /* topology: use the info from hda_machines */ 1016 - if (pdata->tplg_filename) { 1017 - tplg_fixup = false; 1018 - tplg_filename = pdata->tplg_filename; 1019 - } else { 1081 + /* 1082 + * topology: use the info from hda_machines since tplg file name 1083 + * is not overwritten 1084 + */ 1085 + if (!pdata->tplg_filename) 1020 1086 tplg_fixup = true; 1021 - tplg_filename = hda_mach->sof_tplg_filename; 1022 - } 1023 - ret = dmic_detect_topology_fixup(sdev, &tplg_filename, idisp_str, &dmic_num, 1024 - tplg_fixup); 1025 - if (ret < 0) 1026 - return; 1027 1087 1028 - hda_mach->mach_params.dmic_num = dmic_num; 1029 - pdata->tplg_filename = tplg_filename; 1088 + if (tplg_fixup && 1089 + codec_num == 1 && HDA_IDISP_CODEC(bus->codec_mask)) { 1090 + tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, 1091 + "%s-idisp", 1092 + hda_mach->sof_tplg_filename); 1093 + if (!tplg_filename) 1094 + return; 1095 + 1096 + hda_mach->sof_tplg_filename = tplg_filename; 1097 + } 1030 1098 1031 1099 if (codec_num == 2 || 1032 1100 (codec_num == 1 && !HDA_IDISP_CODEC(bus->codec_mask))) { ··· 1131 1205 break; 1132 1206 } 1133 1207 if (mach && mach->link_mask) { 1134 - int dmic_num = 0; 1135 - bool tplg_fixup; 1136 - const char *tplg_filename; 1137 - 1138 1208 mach->mach_params.links = mach->links; 1139 1209 mach->mach_params.link_mask = mach->link_mask; 1140 1210 mach->mach_params.platform = dev_name(sdev->dev); 1141 - 1142 - if (pdata->tplg_filename) { 1143 - tplg_fixup = false; 1144 - } else { 1145 - tplg_fixup = true; 1146 - tplg_filename = mach->sof_tplg_filename; 1147 - } 1148 - 1149 - /* 1150 - * DMICs use up to 4 pins and are typically pin-muxed with SoundWire 1151 - * link 2 and 3, or link 1 and 2, thus we only try to enable dmics 1152 - * if all conditions are true: 1153 - * a) 2 or fewer links are used by SoundWire 1154 - * b) the NHLT table reports the presence of microphones 1155 - */ 1156 - if (hweight_long(mach->link_mask) <= 2) { 1157 - int ret; 1158 - 1159 - ret = dmic_detect_topology_fixup(sdev, &tplg_filename, "", 1160 - &dmic_num, tplg_fixup); 1161 - if (ret < 0) 1162 - return NULL; 1163 - } 1164 - if (tplg_fixup) 1165 - pdata->tplg_filename = tplg_filename; 1166 - mach->mach_params.dmic_num = dmic_num; 1167 - 1168 - dev_dbg(sdev->dev, 1169 - "SoundWire machine driver %s topology %s\n", 1170 - mach->drv_name, 1171 - pdata->tplg_filename); 1172 1211 1173 1212 return mach; 1174 1213 } ··· 1191 1300 return 0; 1192 1301 } 1193 1302 1303 + static char *remove_file_ext(const char *tplg_filename) 1304 + { 1305 + char *filename, *tmp; 1306 + 1307 + filename = kstrdup(tplg_filename, GFP_KERNEL); 1308 + if (!filename) 1309 + return NULL; 1310 + 1311 + /* remove file extension if exist */ 1312 + tmp = filename; 1313 + return strsep(&tmp, "."); 1314 + } 1315 + 1194 1316 struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) 1195 1317 { 1196 1318 u32 interface_mask = hda_get_interface_mask(sdev); ··· 1215 1311 const char *tplg_filename; 1216 1312 const char *tplg_suffix; 1217 1313 bool amp_name_valid; 1314 + bool i2s_mach_found = false; 1315 + bool sdw_mach_found = false; 1218 1316 1219 1317 /* Try I2S or DMIC if it is supported */ 1220 - if (interface_mask & (BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC))) 1318 + if (interface_mask & (BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC))) { 1221 1319 mach = snd_soc_acpi_find_machine(desc->machines); 1320 + if (mach) 1321 + i2s_mach_found = true; 1322 + } 1222 1323 1324 + /* 1325 + * If I2S fails and no external HDaudio codec is detected, 1326 + * try SoundWire if it is supported 1327 + */ 1328 + if (!mach && !HDA_EXT_CODEC(bus->codec_mask) && 1329 + (interface_mask & BIT(SOF_DAI_INTEL_ALH))) { 1330 + mach = hda_sdw_machine_select(sdev); 1331 + if (mach) 1332 + sdw_mach_found = true; 1333 + } 1334 + 1335 + /* 1336 + * Choose HDA generic machine driver if mach is NULL. 1337 + * Otherwise, set certain mach params. 1338 + */ 1339 + hda_generic_machine_select(sdev, &mach); 1340 + if (!mach) { 1341 + dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); 1342 + return NULL; 1343 + } 1344 + 1345 + /* report BT offload link mask to machine driver */ 1346 + mach->mach_params.bt_link_mask = check_nhlt_ssp_mask(sdev, NHLT_DEVICE_BT); 1347 + 1348 + dev_info(sdev->dev, "BT link detected in NHLT tables: %#x\n", 1349 + mach->mach_params.bt_link_mask); 1350 + 1351 + /* allow for module parameter override */ 1352 + if (bt_link_mask_override) { 1353 + dev_dbg(sdev->dev, "overriding BT link detected in NHLT tables %#x by kernel param %#x\n", 1354 + mach->mach_params.bt_link_mask, bt_link_mask_override); 1355 + mach->mach_params.bt_link_mask = bt_link_mask_override; 1356 + } 1357 + 1358 + if (hweight_long(mach->mach_params.bt_link_mask) > 1) { 1359 + dev_warn(sdev->dev, "invalid BT link mask %#x found, reset the mask\n", 1360 + mach->mach_params.bt_link_mask); 1361 + mach->mach_params.bt_link_mask = 0; 1362 + } 1363 + 1364 + /* 1365 + * Fixup tplg file name by appending dmic num, ssp num, codec/amplifier 1366 + * name string if quirk flag is set. 1367 + */ 1223 1368 if (mach) { 1224 - bool add_extension = false; 1225 1369 bool tplg_fixup = false; 1370 + bool dmic_fixup = false; 1226 1371 1227 1372 /* 1228 1373 * If tplg file name is overridden, use it instead of 1229 1374 * the one set in mach table 1230 1375 */ 1231 1376 if (!sof_pdata->tplg_filename) { 1232 - sof_pdata->tplg_filename = mach->sof_tplg_filename; 1377 + /* remove file extension if it exists */ 1378 + tplg_filename = remove_file_ext(mach->sof_tplg_filename); 1379 + if (!tplg_filename) 1380 + return NULL; 1381 + 1382 + sof_pdata->tplg_filename = tplg_filename; 1233 1383 tplg_fixup = true; 1234 1384 } 1235 1385 ··· 1301 1343 /* report to machine driver if any DMICs are found */ 1302 1344 mach->mach_params.dmic_num = check_dmic_num(sdev); 1303 1345 1346 + if (sdw_mach_found) { 1347 + /* 1348 + * DMICs use up to 4 pins and are typically pin-muxed with SoundWire 1349 + * link 2 and 3, or link 1 and 2, thus we only try to enable dmics 1350 + * if all conditions are true: 1351 + * a) 2 or fewer links are used by SoundWire 1352 + * b) the NHLT table reports the presence of microphones 1353 + */ 1354 + if (hweight_long(mach->link_mask) <= 2) 1355 + dmic_fixup = true; 1356 + else 1357 + mach->mach_params.dmic_num = 0; 1358 + } else { 1359 + if (mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER) 1360 + dmic_fixup = true; 1361 + } 1362 + 1304 1363 if (tplg_fixup && 1305 - mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER && 1364 + dmic_fixup && 1306 1365 mach->mach_params.dmic_num) { 1307 1366 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, 1308 1367 "%s%s%d%s", 1309 1368 sof_pdata->tplg_filename, 1310 - "-dmic", 1369 + i2s_mach_found ? "-dmic" : "-", 1311 1370 mach->mach_params.dmic_num, 1312 1371 "ch"); 1313 1372 if (!tplg_filename) 1314 1373 return NULL; 1315 1374 1316 1375 sof_pdata->tplg_filename = tplg_filename; 1317 - add_extension = true; 1318 1376 } 1319 1377 1320 1378 if (mach->link_mask) { ··· 1339 1365 } 1340 1366 1341 1367 /* report SSP link mask to machine driver */ 1342 - mach->mach_params.i2s_link_mask = check_nhlt_ssp_mask(sdev); 1368 + mach->mach_params.i2s_link_mask = check_nhlt_ssp_mask(sdev, NHLT_DEVICE_I2S); 1343 1369 1344 1370 if (tplg_fixup && 1345 1371 mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER && ··· 1370 1396 return NULL; 1371 1397 1372 1398 sof_pdata->tplg_filename = tplg_filename; 1373 - add_extension = true; 1374 1399 1375 1400 mclk_mask = check_nhlt_ssp_mclk_mask(sdev, ssp_num); 1376 1401 ··· 1408 1435 return NULL; 1409 1436 1410 1437 sof_pdata->tplg_filename = tplg_filename; 1411 - add_extension = true; 1412 1438 } 1413 1439 1414 1440 ··· 1429 1457 return NULL; 1430 1458 1431 1459 sof_pdata->tplg_filename = tplg_filename; 1432 - add_extension = true; 1433 1460 } 1434 1461 1435 - if (tplg_fixup && add_extension) { 1462 + if (tplg_fixup) { 1436 1463 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, 1437 1464 "%s%s", 1438 1465 sof_pdata->tplg_filename, ··· 1449 1478 sdev->mclk_id_quirk = mclk_id_override; 1450 1479 } 1451 1480 } 1452 - 1453 - /* 1454 - * If I2S fails and no external HDaudio codec is detected, 1455 - * try SoundWire if it is supported 1456 - */ 1457 - if (!mach && !HDA_EXT_CODEC(bus->codec_mask) && 1458 - (interface_mask & BIT(SOF_DAI_INTEL_ALH))) 1459 - mach = hda_sdw_machine_select(sdev); 1460 - 1461 - /* 1462 - * Choose HDA generic machine driver if mach is NULL. 1463 - * Otherwise, set certain mach params. 1464 - */ 1465 - hda_generic_machine_select(sdev, &mach); 1466 - if (!mach) 1467 - dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); 1468 1481 1469 1482 return mach; 1470 1483 }