1 // SPDX-License-Identifier: GPL-2.0-only 2 // Copyright(c) 2019 Intel Corporation. 3 4 /* 5 * Intel Cometlake I2S Machine driver for RT1011 + RT5682 codec 6 */ 7 8 #include <linux/input.h> 9 #include <linux/module.h> 10 #include <linux/platform_device.h> 11 #include <linux/clk.h> 12 #include <linux/dmi.h> 13 #include <linux/slab.h> 14 #include <linux/acpi.h> 15 #include <sound/core.h> 16 #include <sound/jack.h> 17 #include <sound/pcm.h> 18 #include <sound/pcm_params.h> 19 #include <sound/soc.h> 20 #include <sound/rt5682.h> 21 #include <sound/soc-acpi.h> 22 #include "../../codecs/rt1011.h" 23 #include "../../codecs/rt5682.h" 24 #include "../../codecs/hdac_hdmi.h" 25 #include "hda_dsp_common.h" 26 27 /* The platform clock outputs 24Mhz clock to codec as I2S MCLK */ 28 #define CML_PLAT_CLK 24000000 29 #define CML_RT1011_CODEC_DAI "rt1011-aif" 30 #define CML_RT5682_CODEC_DAI "rt5682-aif1" 31 #define NAME_SIZE 32 32 33 #define SOF_RT1011_SPEAKER_WL BIT(0) 34 #define SOF_RT1011_SPEAKER_WR BIT(1) 35 #define SOF_RT1011_SPEAKER_TL BIT(2) 36 #define SOF_RT1011_SPEAKER_TR BIT(3) 37 #define SPK_CH 4 38 39 /* Default: Woofer speakers */ 40 static unsigned long sof_rt1011_quirk = SOF_RT1011_SPEAKER_WL | 41 SOF_RT1011_SPEAKER_WR; 42 43 static int sof_rt1011_quirk_cb(const struct dmi_system_id *id) 44 { 45 sof_rt1011_quirk = (unsigned long)id->driver_data; 46 return 1; 47 } 48 49 static const struct dmi_system_id sof_rt1011_quirk_table[] = { 50 { 51 .callback = sof_rt1011_quirk_cb, 52 .matches = { 53 DMI_MATCH(DMI_SYS_VENDOR, "Google"), 54 DMI_MATCH(DMI_PRODUCT_NAME, "Helios"), 55 }, 56 .driver_data = (void *)(SOF_RT1011_SPEAKER_WL | SOF_RT1011_SPEAKER_WR | 57 SOF_RT1011_SPEAKER_TL | SOF_RT1011_SPEAKER_TR), 58 }, 59 { 60 } 61 }; 62 63 static struct snd_soc_jack hdmi_jack[3]; 64 65 struct hdmi_pcm { 66 struct list_head head; 67 struct snd_soc_dai *codec_dai; 68 int device; 69 }; 70 71 struct card_private { 72 char codec_name[SND_ACPI_I2C_ID_LEN]; 73 struct snd_soc_jack headset; 74 struct list_head hdmi_pcm_list; 75 bool common_hdmi_codec_drv; 76 }; 77 78 static const struct snd_kcontrol_new cml_controls[] = { 79 SOC_DAPM_PIN_SWITCH("Headphone Jack"), 80 SOC_DAPM_PIN_SWITCH("Headset Mic"), 81 SOC_DAPM_PIN_SWITCH("WL Ext Spk"), 82 SOC_DAPM_PIN_SWITCH("WR Ext Spk"), 83 }; 84 85 static const struct snd_kcontrol_new cml_rt1011_tt_controls[] = { 86 SOC_DAPM_PIN_SWITCH("TL Ext Spk"), 87 SOC_DAPM_PIN_SWITCH("TR Ext Spk"), 88 }; 89 90 static const struct snd_soc_dapm_widget cml_rt1011_rt5682_widgets[] = { 91 SND_SOC_DAPM_SPK("WL Ext Spk", NULL), 92 SND_SOC_DAPM_SPK("WR Ext Spk", NULL), 93 SND_SOC_DAPM_HP("Headphone Jack", NULL), 94 SND_SOC_DAPM_MIC("Headset Mic", NULL), 95 SND_SOC_DAPM_MIC("SoC DMIC", NULL), 96 }; 97 98 static const struct snd_soc_dapm_widget cml_rt1011_tt_widgets[] = { 99 SND_SOC_DAPM_SPK("TL Ext Spk", NULL), 100 SND_SOC_DAPM_SPK("TR Ext Spk", NULL), 101 }; 102 103 static const struct snd_soc_dapm_route cml_rt1011_rt5682_map[] = { 104 /*WL/WR speaker*/ 105 {"WL Ext Spk", NULL, "WL SPO"}, 106 {"WR Ext Spk", NULL, "WR SPO"}, 107 108 /* HP jack connectors - unknown if we have jack detection */ 109 { "Headphone Jack", NULL, "HPOL" }, 110 { "Headphone Jack", NULL, "HPOR" }, 111 112 /* other jacks */ 113 { "IN1P", NULL, "Headset Mic" }, 114 115 /* DMIC */ 116 {"DMic", NULL, "SoC DMIC"}, 117 }; 118 119 static const struct snd_soc_dapm_route cml_rt1011_tt_map[] = { 120 /*TL/TR speaker*/ 121 {"TL Ext Spk", NULL, "TL SPO" }, 122 {"TR Ext Spk", NULL, "TR SPO" }, 123 }; 124 125 static int cml_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd) 126 { 127 struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 128 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; 129 struct snd_soc_jack *jack; 130 int ret; 131 132 /* need to enable ASRC function for 24MHz mclk rate */ 133 rt5682_sel_asrc_clk_src(component, RT5682_DA_STEREO1_FILTER | 134 RT5682_AD_STEREO1_FILTER, 135 RT5682_CLK_SEL_I2S1_ASRC); 136 137 /* 138 * Headset buttons map to the google Reference headset. 139 * These can be configured by userspace. 140 */ 141 ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", 142 SND_JACK_HEADSET | SND_JACK_BTN_0 | 143 SND_JACK_BTN_1 | SND_JACK_BTN_2 | 144 SND_JACK_BTN_3, 145 &ctx->headset, NULL, 0); 146 if (ret) { 147 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); 148 return ret; 149 } 150 151 jack = &ctx->headset; 152 153 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); 154 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); 155 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); 156 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); 157 ret = snd_soc_component_set_jack(component, jack, NULL); 158 if (ret) 159 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); 160 161 return ret; 162 }; 163 164 static int cml_rt1011_spk_init(struct snd_soc_pcm_runtime *rtd) 165 { 166 int ret = 0; 167 struct snd_soc_card *card = rtd->card; 168 169 if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_TL | 170 SOF_RT1011_SPEAKER_TR)) { 171 172 ret = snd_soc_add_card_controls(card, cml_rt1011_tt_controls, 173 ARRAY_SIZE(cml_rt1011_tt_controls)); 174 if (ret) 175 return ret; 176 177 ret = snd_soc_dapm_new_controls(&card->dapm, 178 cml_rt1011_tt_widgets, 179 ARRAY_SIZE(cml_rt1011_tt_widgets)); 180 if (ret) 181 return ret; 182 183 ret = snd_soc_dapm_add_routes(&card->dapm, cml_rt1011_tt_map, 184 ARRAY_SIZE(cml_rt1011_tt_map)); 185 186 if (ret) 187 return ret; 188 } 189 190 return ret; 191 } 192 193 static int cml_rt5682_hw_params(struct snd_pcm_substream *substream, 194 struct snd_pcm_hw_params *params) 195 { 196 struct snd_soc_pcm_runtime *rtd = substream->private_data; 197 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); 198 int clk_id, clk_freq, pll_out, ret; 199 200 clk_id = RT5682_PLL1_S_MCLK; 201 clk_freq = CML_PLAT_CLK; 202 203 pll_out = params_rate(params) * 512; 204 205 ret = snd_soc_dai_set_pll(codec_dai, 0, clk_id, clk_freq, pll_out); 206 if (ret < 0) 207 dev_warn(rtd->dev, "snd_soc_dai_set_pll err = %d\n", ret); 208 209 /* Configure sysclk for codec */ 210 ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1, 211 pll_out, SND_SOC_CLOCK_IN); 212 if (ret < 0) 213 dev_warn(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); 214 215 /* 216 * slot_width should be equal or large than data length, set them 217 * be the same 218 */ 219 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0, 0x0, 2, 220 params_width(params)); 221 if (ret < 0) 222 dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); 223 return ret; 224 } 225 226 static int cml_rt1011_hw_params(struct snd_pcm_substream *substream, 227 struct snd_pcm_hw_params *params) 228 { 229 struct snd_soc_pcm_runtime *rtd = substream->private_data; 230 struct snd_soc_dai *codec_dai; 231 struct snd_soc_card *card = rtd->card; 232 int srate, i, ret = 0; 233 234 srate = params_rate(params); 235 236 for_each_rtd_codec_dais(rtd, i, codec_dai) { 237 238 /* 100 Fs to drive 24 bit data */ 239 ret = snd_soc_dai_set_pll(codec_dai, 0, RT1011_PLL1_S_BCLK, 240 100 * srate, 256 * srate); 241 if (ret < 0) { 242 dev_err(card->dev, "codec_dai clock not set\n"); 243 return ret; 244 } 245 246 ret = snd_soc_dai_set_sysclk(codec_dai, 247 RT1011_FS_SYS_PRE_S_PLL1, 248 256 * srate, SND_SOC_CLOCK_IN); 249 if (ret < 0) { 250 dev_err(card->dev, "codec_dai clock not set\n"); 251 return ret; 252 } 253 254 /* 255 * Codec TDM is configured as 24 bit capture/ playback. 256 * 2 CH PB is done over 4 codecs - 2 Woofers and 2 Tweeters. 257 * The Left woofer and tweeter plays the Left playback data 258 * and similar by the Right. 259 * Hence 2 codecs (1 T and 1 W pair) share same Rx slot. 260 * The feedback is captured for each codec individually. 261 * Hence all 4 codecs use 1 Tx slot each for feedback. 262 */ 263 if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_WL | 264 SOF_RT1011_SPEAKER_WR)) { 265 if (!strcmp(codec_dai->component->name, "i2c-10EC1011:00")) { 266 ret = snd_soc_dai_set_tdm_slot(codec_dai, 267 0x4, 0x1, 4, 24); 268 if (ret < 0) 269 break; 270 } 271 272 if (!strcmp(codec_dai->component->name, "i2c-10EC1011:01")) { 273 ret = snd_soc_dai_set_tdm_slot(codec_dai, 274 0x8, 0x2, 4, 24); 275 if (ret < 0) 276 break; 277 } 278 } 279 280 if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_TL | 281 SOF_RT1011_SPEAKER_TR)) { 282 if (!strcmp(codec_dai->component->name, "i2c-10EC1011:02")) { 283 ret = snd_soc_dai_set_tdm_slot(codec_dai, 284 0x1, 0x1, 4, 24); 285 if (ret < 0) 286 break; 287 } 288 289 if (!strcmp(codec_dai->component->name, "i2c-10EC1011:03")) { 290 ret = snd_soc_dai_set_tdm_slot(codec_dai, 291 0x2, 0x2, 4, 24); 292 if (ret < 0) 293 break; 294 } 295 } 296 } 297 if (ret < 0) 298 dev_err(rtd->dev, 299 "set codec TDM slot for %s failed with error %d\n", 300 codec_dai->component->name, ret); 301 return ret; 302 } 303 304 static struct snd_soc_ops cml_rt5682_ops = { 305 .hw_params = cml_rt5682_hw_params, 306 }; 307 308 static const struct snd_soc_ops cml_rt1011_ops = { 309 .hw_params = cml_rt1011_hw_params, 310 }; 311 312 static int sof_card_late_probe(struct snd_soc_card *card) 313 { 314 struct card_private *ctx = snd_soc_card_get_drvdata(card); 315 struct snd_soc_component *component = NULL; 316 char jack_name[NAME_SIZE]; 317 struct hdmi_pcm *pcm; 318 int ret, i = 0; 319 320 if (list_empty(&ctx->hdmi_pcm_list)) 321 return -EINVAL; 322 323 if (ctx->common_hdmi_codec_drv) { 324 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, 325 head); 326 component = pcm->codec_dai->component; 327 return hda_dsp_hdmi_build_controls(card, component); 328 } 329 330 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 331 component = pcm->codec_dai->component; 332 snprintf(jack_name, sizeof(jack_name), 333 "HDMI/DP, pcm=%d Jack", pcm->device); 334 ret = snd_soc_card_jack_new(card, jack_name, 335 SND_JACK_AVOUT, &hdmi_jack[i], 336 NULL, 0); 337 if (ret) 338 return ret; 339 340 ret = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, 341 &hdmi_jack[i]); 342 if (ret < 0) 343 return ret; 344 345 i++; 346 } 347 348 return hdac_hdmi_jack_port_init(component, &card->dapm); 349 } 350 351 static int hdmi_init(struct snd_soc_pcm_runtime *rtd) 352 { 353 struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 354 struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0); 355 struct hdmi_pcm *pcm; 356 357 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 358 if (!pcm) 359 return -ENOMEM; 360 361 pcm->device = dai->id; 362 pcm->codec_dai = dai; 363 364 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); 365 366 return 0; 367 } 368 369 /* Cometlake digital audio interface glue - connects codec <--> CPU */ 370 371 SND_SOC_DAILINK_DEF(ssp0_pin, 372 DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin"))); 373 SND_SOC_DAILINK_DEF(ssp0_codec, 374 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", 375 CML_RT5682_CODEC_DAI))); 376 377 SND_SOC_DAILINK_DEF(ssp1_pin, 378 DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin"))); 379 SND_SOC_DAILINK_DEF(ssp1_codec, 380 DAILINK_COMP_ARRAY( 381 /* WL */ COMP_CODEC("i2c-10EC1011:00", CML_RT1011_CODEC_DAI), 382 /* WR */ COMP_CODEC("i2c-10EC1011:01", CML_RT1011_CODEC_DAI))); 383 384 SND_SOC_DAILINK_DEF(dmic_pin, 385 DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin"))); 386 387 SND_SOC_DAILINK_DEF(dmic16k_pin, 388 DAILINK_COMP_ARRAY(COMP_CPU("DMIC16k Pin"))); 389 390 SND_SOC_DAILINK_DEF(dmic_codec, 391 DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi"))); 392 393 SND_SOC_DAILINK_DEF(idisp1_pin, 394 DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin"))); 395 SND_SOC_DAILINK_DEF(idisp1_codec, 396 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1"))); 397 398 SND_SOC_DAILINK_DEF(idisp2_pin, 399 DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin"))); 400 SND_SOC_DAILINK_DEF(idisp2_codec, 401 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2"))); 402 403 SND_SOC_DAILINK_DEF(idisp3_pin, 404 DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin"))); 405 SND_SOC_DAILINK_DEF(idisp3_codec, 406 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3"))); 407 408 SND_SOC_DAILINK_DEF(platform, 409 DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3"))); 410 411 static struct snd_soc_dai_link cml_rt1011_rt5682_dailink[] = { 412 /* Back End DAI links */ 413 { 414 /* SSP0 - Codec */ 415 .name = "SSP0-Codec", 416 .id = 0, 417 .init = cml_rt5682_codec_init, 418 .ignore_pmdown_time = 1, 419 .ops = &cml_rt5682_ops, 420 .dpcm_playback = 1, 421 .dpcm_capture = 1, 422 .no_pcm = 1, 423 SND_SOC_DAILINK_REG(ssp0_pin, ssp0_codec, platform), 424 }, 425 { 426 .name = "dmic01", 427 .id = 1, 428 .ignore_suspend = 1, 429 .dpcm_capture = 1, 430 .no_pcm = 1, 431 SND_SOC_DAILINK_REG(dmic_pin, dmic_codec, platform), 432 }, 433 { 434 .name = "dmic16k", 435 .id = 2, 436 .ignore_suspend = 1, 437 .dpcm_capture = 1, 438 .no_pcm = 1, 439 SND_SOC_DAILINK_REG(dmic16k_pin, dmic_codec, platform), 440 }, 441 { 442 .name = "iDisp1", 443 .id = 3, 444 .init = hdmi_init, 445 .dpcm_playback = 1, 446 .no_pcm = 1, 447 SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform), 448 }, 449 { 450 .name = "iDisp2", 451 .id = 4, 452 .init = hdmi_init, 453 .dpcm_playback = 1, 454 .no_pcm = 1, 455 SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform), 456 }, 457 { 458 .name = "iDisp3", 459 .id = 5, 460 .init = hdmi_init, 461 .dpcm_playback = 1, 462 .no_pcm = 1, 463 SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform), 464 }, 465 { 466 /* 467 * SSP1 - Codec : added to end of list ensuring 468 * reuse of common topologies for other end points 469 * and changing only SSP1's codec 470 */ 471 .name = "SSP1-Codec", 472 .id = 6, 473 .dpcm_playback = 1, 474 .dpcm_capture = 1, /* Capture stream provides Feedback */ 475 .no_pcm = 1, 476 .init = cml_rt1011_spk_init, 477 .ops = &cml_rt1011_ops, 478 SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform), 479 }, 480 }; 481 482 static struct snd_soc_codec_conf rt1011_conf[] = { 483 { 484 .dlc = COMP_CODEC_CONF("i2c-10EC1011:00"), 485 .name_prefix = "WL", 486 }, 487 { 488 .dlc = COMP_CODEC_CONF("i2c-10EC1011:01"), 489 .name_prefix = "WR", 490 }, 491 }; 492 493 /* Cometlake audio machine driver for RT1011 and RT5682 */ 494 static struct snd_soc_card snd_soc_card_cml = { 495 .name = "cml_rt1011_rt5682", 496 .dai_link = cml_rt1011_rt5682_dailink, 497 .num_links = ARRAY_SIZE(cml_rt1011_rt5682_dailink), 498 .codec_conf = rt1011_conf, 499 .num_configs = ARRAY_SIZE(rt1011_conf), 500 .dapm_widgets = cml_rt1011_rt5682_widgets, 501 .num_dapm_widgets = ARRAY_SIZE(cml_rt1011_rt5682_widgets), 502 .dapm_routes = cml_rt1011_rt5682_map, 503 .num_dapm_routes = ARRAY_SIZE(cml_rt1011_rt5682_map), 504 .controls = cml_controls, 505 .num_controls = ARRAY_SIZE(cml_controls), 506 .fully_routed = true, 507 .late_probe = sof_card_late_probe, 508 }; 509 510 static int snd_cml_rt1011_probe(struct platform_device *pdev) 511 { 512 struct snd_soc_dai_link_component *rt1011_dais_components; 513 struct snd_soc_codec_conf *rt1011_dais_confs; 514 struct card_private *ctx; 515 struct snd_soc_acpi_mach *mach; 516 const char *platform_name; 517 int ret, i; 518 519 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 520 if (!ctx) 521 return -ENOMEM; 522 523 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 524 mach = pdev->dev.platform_data; 525 snd_soc_card_cml.dev = &pdev->dev; 526 platform_name = mach->mach_params.platform; 527 528 dmi_check_system(sof_rt1011_quirk_table); 529 530 dev_info(&pdev->dev, "sof_rt1011_quirk = %lx\n", sof_rt1011_quirk); 531 532 if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_TL | 533 SOF_RT1011_SPEAKER_TR)) { 534 rt1011_dais_confs = devm_kzalloc(&pdev->dev, 535 sizeof(struct snd_soc_codec_conf) * 536 SPK_CH, GFP_KERNEL); 537 538 if (!rt1011_dais_confs) 539 return -ENOMEM; 540 541 rt1011_dais_components = devm_kzalloc(&pdev->dev, 542 sizeof(struct snd_soc_dai_link_component) * 543 SPK_CH, GFP_KERNEL); 544 545 if (!rt1011_dais_components) 546 return -ENOMEM; 547 548 for (i = 0; i < SPK_CH; i++) { 549 rt1011_dais_confs[i].dlc.name = devm_kasprintf(&pdev->dev, 550 GFP_KERNEL, 551 "i2c-10EC1011:0%d", 552 i); 553 554 if (!rt1011_dais_confs[i].dlc.name) 555 return -ENOMEM; 556 557 switch (i) { 558 case 0: 559 rt1011_dais_confs[i].name_prefix = "WL"; 560 break; 561 case 1: 562 rt1011_dais_confs[i].name_prefix = "WR"; 563 break; 564 case 2: 565 rt1011_dais_confs[i].name_prefix = "TL"; 566 break; 567 case 3: 568 rt1011_dais_confs[i].name_prefix = "TR"; 569 break; 570 default: 571 return -EINVAL; 572 } 573 rt1011_dais_components[i].name = devm_kasprintf(&pdev->dev, 574 GFP_KERNEL, 575 "i2c-10EC1011:0%d", 576 i); 577 if (!rt1011_dais_components[i].name) 578 return -ENOMEM; 579 580 rt1011_dais_components[i].dai_name = CML_RT1011_CODEC_DAI; 581 } 582 583 snd_soc_card_cml.codec_conf = rt1011_dais_confs; 584 snd_soc_card_cml.num_configs = SPK_CH; 585 586 for (i = 0; i < ARRAY_SIZE(cml_rt1011_rt5682_dailink); i++) { 587 if (!strcmp(cml_rt1011_rt5682_dailink[i].codecs->dai_name, 588 CML_RT1011_CODEC_DAI)) { 589 cml_rt1011_rt5682_dailink[i].codecs = rt1011_dais_components; 590 cml_rt1011_rt5682_dailink[i].num_codecs = SPK_CH; 591 } 592 } 593 } 594 595 /* set platform name for each dailink */ 596 ret = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cml, 597 platform_name); 598 if (ret) 599 return ret; 600 601 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; 602 603 snd_soc_card_set_drvdata(&snd_soc_card_cml, ctx); 604 605 return devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cml); 606 } 607 608 static struct platform_driver snd_cml_rt1011_rt5682_driver = { 609 .probe = snd_cml_rt1011_probe, 610 .driver = { 611 .name = "cml_rt1011_rt5682", 612 .pm = &snd_soc_pm_ops, 613 }, 614 }; 615 module_platform_driver(snd_cml_rt1011_rt5682_driver); 616 617 /* Module information */ 618 MODULE_DESCRIPTION("Cometlake Audio Machine driver - RT1011 and RT5682 in I2S mode"); 619 MODULE_AUTHOR("Naveen Manohar <naveen.m@intel.com>"); 620 MODULE_AUTHOR("Sathya Prakash M R <sathya.prakash.m.r@intel.com>"); 621 MODULE_AUTHOR("Shuming Fan <shumingf@realtek.com>"); 622 MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>"); 623 MODULE_LICENSE("GPL v2"); 624 MODULE_ALIAS("platform:cml_rt1011_rt5682"); 625