1 // SPDX-License-Identifier: GPL-2.0-only 2 // Copyright(c) 2019-2020 Intel Corporation. 3 4 /* 5 * Intel SOF Machine Driver with Realtek rt5682 Codec 6 * and speaker codec MAX98357A or RT1015. 7 */ 8 #include <linux/i2c.h> 9 #include <linux/input.h> 10 #include <linux/module.h> 11 #include <linux/platform_device.h> 12 #include <linux/clk.h> 13 #include <linux/dmi.h> 14 #include <sound/core.h> 15 #include <sound/jack.h> 16 #include <sound/pcm.h> 17 #include <sound/pcm_params.h> 18 #include <sound/soc.h> 19 #include <sound/sof.h> 20 #include <sound/rt5682.h> 21 #include <sound/rt5682s.h> 22 #include <sound/soc-acpi.h> 23 #include "../../codecs/rt5682.h" 24 #include "../../codecs/rt5682s.h" 25 #include "../../codecs/hdac_hdmi.h" 26 #include "../common/soc-intel-quirks.h" 27 #include "hda_dsp_common.h" 28 #include "sof_maxim_common.h" 29 #include "sof_realtek_common.h" 30 31 #define NAME_SIZE 32 32 33 #define SOF_RT5682_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0)) 34 #define SOF_RT5682_SSP_CODEC_MASK (GENMASK(2, 0)) 35 #define SOF_RT5682_MCLK_EN BIT(3) 36 #define SOF_RT5682_MCLK_24MHZ BIT(4) 37 #define SOF_SPEAKER_AMP_PRESENT BIT(5) 38 #define SOF_RT5682_SSP_AMP_SHIFT 6 39 #define SOF_RT5682_SSP_AMP_MASK (GENMASK(8, 6)) 40 #define SOF_RT5682_SSP_AMP(quirk) \ 41 (((quirk) << SOF_RT5682_SSP_AMP_SHIFT) & SOF_RT5682_SSP_AMP_MASK) 42 #define SOF_RT5682_MCLK_BYTCHT_EN BIT(9) 43 #define SOF_RT5682_NUM_HDMIDEV_SHIFT 10 44 #define SOF_RT5682_NUM_HDMIDEV_MASK (GENMASK(12, 10)) 45 #define SOF_RT5682_NUM_HDMIDEV(quirk) \ 46 ((quirk << SOF_RT5682_NUM_HDMIDEV_SHIFT) & SOF_RT5682_NUM_HDMIDEV_MASK) 47 #define SOF_RT1011_SPEAKER_AMP_PRESENT BIT(13) 48 #define SOF_RT1015_SPEAKER_AMP_PRESENT BIT(14) 49 #define SOF_RT1015_SPEAKER_AMP_100FS BIT(15) 50 #define SOF_RT1015P_SPEAKER_AMP_PRESENT BIT(16) 51 #define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(17) 52 #define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(18) 53 54 /* BT audio offload: reserve 3 bits for future */ 55 #define SOF_BT_OFFLOAD_SSP_SHIFT 19 56 #define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(21, 19)) 57 #define SOF_BT_OFFLOAD_SSP(quirk) \ 58 (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK) 59 #define SOF_SSP_BT_OFFLOAD_PRESENT BIT(22) 60 #define SOF_RT5682S_HEADPHONE_CODEC_PRESENT BIT(23) 61 #define SOF_MAX98390_SPEAKER_AMP_PRESENT BIT(24) 62 #define SOF_MAX98390_TWEETER_SPEAKER_PRESENT BIT(25) 63 64 65 /* Default: MCLK on, MCLK 19.2M, SSP0 */ 66 static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN | 67 SOF_RT5682_SSP_CODEC(0); 68 69 static int is_legacy_cpu; 70 71 static struct snd_soc_jack sof_hdmi[3]; 72 73 struct sof_hdmi_pcm { 74 struct list_head head; 75 struct snd_soc_dai *codec_dai; 76 int device; 77 }; 78 79 struct sof_card_private { 80 struct clk *mclk; 81 struct snd_soc_jack sof_headset; 82 struct list_head hdmi_pcm_list; 83 bool common_hdmi_codec_drv; 84 bool idisp_codec; 85 }; 86 87 static int sof_rt5682_quirk_cb(const struct dmi_system_id *id) 88 { 89 sof_rt5682_quirk = (unsigned long)id->driver_data; 90 return 1; 91 } 92 93 static const struct dmi_system_id sof_rt5682_quirk_table[] = { 94 { 95 .callback = sof_rt5682_quirk_cb, 96 .matches = { 97 DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"), 98 DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max"), 99 }, 100 .driver_data = (void *)(SOF_RT5682_SSP_CODEC(2)), 101 }, 102 { 103 .callback = sof_rt5682_quirk_cb, 104 .matches = { 105 DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), 106 DMI_MATCH(DMI_PRODUCT_NAME, "UP-CHT01"), 107 }, 108 .driver_data = (void *)(SOF_RT5682_SSP_CODEC(2)), 109 }, 110 { 111 .callback = sof_rt5682_quirk_cb, 112 .matches = { 113 DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), 114 DMI_MATCH(DMI_PRODUCT_NAME, "WhiskeyLake Client"), 115 }, 116 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 117 SOF_RT5682_MCLK_24MHZ | 118 SOF_RT5682_SSP_CODEC(1)), 119 }, 120 { 121 /* 122 * Dooly is hatch family but using rt1015 amp so it 123 * requires a quirk before "Google_Hatch". 124 */ 125 .callback = sof_rt5682_quirk_cb, 126 .matches = { 127 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 128 DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"), 129 }, 130 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 131 SOF_RT5682_MCLK_24MHZ | 132 SOF_RT5682_SSP_CODEC(0) | 133 SOF_SPEAKER_AMP_PRESENT | 134 SOF_RT1015_SPEAKER_AMP_PRESENT | 135 SOF_RT1015_SPEAKER_AMP_100FS | 136 SOF_RT5682_SSP_AMP(1)), 137 }, 138 { 139 .callback = sof_rt5682_quirk_cb, 140 .matches = { 141 DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"), 142 }, 143 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 144 SOF_RT5682_MCLK_24MHZ | 145 SOF_RT5682_SSP_CODEC(0) | 146 SOF_SPEAKER_AMP_PRESENT | 147 SOF_RT5682_SSP_AMP(1)), 148 }, 149 { 150 .callback = sof_rt5682_quirk_cb, 151 .matches = { 152 DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), 153 DMI_MATCH(DMI_PRODUCT_NAME, "Ice Lake Client"), 154 }, 155 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 156 SOF_RT5682_SSP_CODEC(0)), 157 }, 158 { 159 .callback = sof_rt5682_quirk_cb, 160 .matches = { 161 DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"), 162 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98373_ALC5682I_I2S_UP4"), 163 }, 164 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 165 SOF_RT5682_SSP_CODEC(0) | 166 SOF_SPEAKER_AMP_PRESENT | 167 SOF_MAX98373_SPEAKER_AMP_PRESENT | 168 SOF_RT5682_SSP_AMP(2) | 169 SOF_RT5682_NUM_HDMIDEV(4)), 170 }, 171 { 172 .callback = sof_rt5682_quirk_cb, 173 .matches = { 174 DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), 175 DMI_MATCH(DMI_PRODUCT_NAME, "Alder Lake Client Platform"), 176 DMI_MATCH(DMI_OEM_STRING, "AUDIO-ADL_MAX98373_ALC5682I_I2S"), 177 }, 178 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 179 SOF_RT5682_SSP_CODEC(0) | 180 SOF_SPEAKER_AMP_PRESENT | 181 SOF_MAX98373_SPEAKER_AMP_PRESENT | 182 SOF_RT5682_SSP_AMP(2) | 183 SOF_RT5682_NUM_HDMIDEV(4)), 184 }, 185 { 186 .callback = sof_rt5682_quirk_cb, 187 .matches = { 188 DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), 189 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S"), 190 }, 191 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 192 SOF_RT5682_SSP_CODEC(0) | 193 SOF_SPEAKER_AMP_PRESENT | 194 SOF_MAX98390_SPEAKER_AMP_PRESENT | 195 SOF_RT5682_SSP_AMP(2) | 196 SOF_RT5682_NUM_HDMIDEV(4)), 197 }, 198 { 199 .callback = sof_rt5682_quirk_cb, 200 .matches = { 201 DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), 202 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S_4SPK"), 203 }, 204 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 205 SOF_RT5682_SSP_CODEC(0) | 206 SOF_SPEAKER_AMP_PRESENT | 207 SOF_MAX98390_SPEAKER_AMP_PRESENT | 208 SOF_MAX98390_TWEETER_SPEAKER_PRESENT | 209 SOF_RT5682_SSP_AMP(1) | 210 SOF_RT5682_NUM_HDMIDEV(4) | 211 SOF_BT_OFFLOAD_SSP(2) | 212 SOF_SSP_BT_OFFLOAD_PRESENT), 213 214 }, 215 { 216 .callback = sof_rt5682_quirk_cb, 217 .matches = { 218 DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), 219 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98360_ALC5682I_I2S_AMP_SSP2"), 220 }, 221 .driver_data = (void *)(SOF_RT5682_MCLK_EN | 222 SOF_RT5682_SSP_CODEC(0) | 223 SOF_SPEAKER_AMP_PRESENT | 224 SOF_MAX98360A_SPEAKER_AMP_PRESENT | 225 SOF_RT5682_SSP_AMP(2) | 226 SOF_RT5682_NUM_HDMIDEV(4)), 227 }, 228 {} 229 }; 230 231 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd) 232 { 233 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 234 struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0); 235 struct sof_hdmi_pcm *pcm; 236 237 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 238 if (!pcm) 239 return -ENOMEM; 240 241 /* dai_link id is 1:1 mapped to the PCM device */ 242 pcm->device = rtd->dai_link->id; 243 pcm->codec_dai = dai; 244 245 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); 246 247 return 0; 248 } 249 250 static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd) 251 { 252 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 253 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; 254 struct snd_soc_jack *jack; 255 int ret; 256 257 /* need to enable ASRC function for 24MHz mclk rate */ 258 if ((sof_rt5682_quirk & SOF_RT5682_MCLK_EN) && 259 (sof_rt5682_quirk & SOF_RT5682_MCLK_24MHZ)) { 260 if (sof_rt5682_quirk & SOF_RT5682S_HEADPHONE_CODEC_PRESENT) 261 rt5682s_sel_asrc_clk_src(component, 262 RT5682S_DA_STEREO1_FILTER | 263 RT5682S_AD_STEREO1_FILTER, 264 RT5682S_CLK_SEL_I2S1_ASRC); 265 else 266 rt5682_sel_asrc_clk_src(component, 267 RT5682_DA_STEREO1_FILTER | 268 RT5682_AD_STEREO1_FILTER, 269 RT5682_CLK_SEL_I2S1_ASRC); 270 } 271 272 if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) { 273 /* 274 * The firmware might enable the clock at 275 * boot (this information may or may not 276 * be reflected in the enable clock register). 277 * To change the rate we must disable the clock 278 * first to cover these cases. Due to common 279 * clock framework restrictions that do not allow 280 * to disable a clock that has not been enabled, 281 * we need to enable the clock first. 282 */ 283 ret = clk_prepare_enable(ctx->mclk); 284 if (!ret) 285 clk_disable_unprepare(ctx->mclk); 286 287 ret = clk_set_rate(ctx->mclk, 19200000); 288 289 if (ret) 290 dev_err(rtd->dev, "unable to set MCLK rate\n"); 291 } 292 293 /* 294 * Headset buttons map to the google Reference headset. 295 * These can be configured by userspace. 296 */ 297 ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", 298 SND_JACK_HEADSET | SND_JACK_BTN_0 | 299 SND_JACK_BTN_1 | SND_JACK_BTN_2 | 300 SND_JACK_BTN_3, 301 &ctx->sof_headset); 302 if (ret) { 303 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); 304 return ret; 305 } 306 307 jack = &ctx->sof_headset; 308 309 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); 310 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); 311 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); 312 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); 313 ret = snd_soc_component_set_jack(component, jack, NULL); 314 315 if (ret) { 316 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); 317 return ret; 318 } 319 320 return ret; 321 }; 322 323 static void sof_rt5682_codec_exit(struct snd_soc_pcm_runtime *rtd) 324 { 325 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; 326 327 snd_soc_component_set_jack(component, NULL, NULL); 328 } 329 330 static int sof_rt5682_hw_params(struct snd_pcm_substream *substream, 331 struct snd_pcm_hw_params *params) 332 { 333 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 334 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 335 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); 336 int pll_id, pll_source, pll_in, pll_out, clk_id, ret; 337 338 if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN) { 339 if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) { 340 ret = clk_prepare_enable(ctx->mclk); 341 if (ret < 0) { 342 dev_err(rtd->dev, 343 "could not configure MCLK state"); 344 return ret; 345 } 346 } 347 348 if (sof_rt5682_quirk & SOF_RT5682S_HEADPHONE_CODEC_PRESENT) 349 pll_source = RT5682S_PLL_S_MCLK; 350 else 351 pll_source = RT5682_PLL1_S_MCLK; 352 353 /* get the tplg configured mclk. */ 354 pll_in = sof_dai_get_mclk(rtd); 355 356 /* mclk from the quirk is the first choice */ 357 if (sof_rt5682_quirk & SOF_RT5682_MCLK_24MHZ) { 358 if (pll_in != 24000000) 359 dev_warn(rtd->dev, "configure wrong mclk in tplg, please use 24MHz.\n"); 360 pll_in = 24000000; 361 } else if (pll_in == 0) { 362 /* use default mclk if not specified correct in topology */ 363 pll_in = 19200000; 364 } else if (pll_in < 0) { 365 return pll_in; 366 } 367 } else { 368 if (sof_rt5682_quirk & SOF_RT5682S_HEADPHONE_CODEC_PRESENT) 369 pll_source = RT5682S_PLL_S_BCLK1; 370 else 371 pll_source = RT5682_PLL1_S_BCLK1; 372 373 pll_in = params_rate(params) * 50; 374 } 375 376 if (sof_rt5682_quirk & SOF_RT5682S_HEADPHONE_CODEC_PRESENT) { 377 pll_id = RT5682S_PLL2; 378 clk_id = RT5682S_SCLK_S_PLL2; 379 } else { 380 pll_id = RT5682_PLL1; 381 clk_id = RT5682_SCLK_S_PLL1; 382 } 383 384 pll_out = params_rate(params) * 512; 385 386 /* when MCLK is 512FS, no need to set PLL configuration additionally. */ 387 if (pll_in == pll_out) 388 clk_id = RT5682S_SCLK_S_MCLK; 389 else { 390 /* Configure pll for codec */ 391 ret = snd_soc_dai_set_pll(codec_dai, pll_id, pll_source, pll_in, 392 pll_out); 393 if (ret < 0) 394 dev_err(rtd->dev, "snd_soc_dai_set_pll err = %d\n", ret); 395 } 396 397 /* Configure sysclk for codec */ 398 ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, 399 pll_out, SND_SOC_CLOCK_IN); 400 if (ret < 0) 401 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); 402 403 /* 404 * slot_width should equal or large than data length, set them 405 * be the same 406 */ 407 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0, 0x0, 2, 408 params_width(params)); 409 if (ret < 0) { 410 dev_err(rtd->dev, "set TDM slot err:%d\n", ret); 411 return ret; 412 } 413 414 return ret; 415 } 416 417 static struct snd_soc_ops sof_rt5682_ops = { 418 .hw_params = sof_rt5682_hw_params, 419 }; 420 421 static struct snd_soc_dai_link_component platform_component[] = { 422 { 423 /* name might be overridden during probe */ 424 .name = "0000:00:1f.3" 425 } 426 }; 427 428 static int sof_card_late_probe(struct snd_soc_card *card) 429 { 430 struct sof_card_private *ctx = snd_soc_card_get_drvdata(card); 431 struct snd_soc_component *component = NULL; 432 struct snd_soc_dapm_context *dapm = &card->dapm; 433 char jack_name[NAME_SIZE]; 434 struct sof_hdmi_pcm *pcm; 435 int err; 436 int i = 0; 437 438 /* HDMI is not supported by SOF on Baytrail/CherryTrail */ 439 if (is_legacy_cpu || !ctx->idisp_codec) 440 return 0; 441 442 if (list_empty(&ctx->hdmi_pcm_list)) 443 return -EINVAL; 444 445 if (ctx->common_hdmi_codec_drv) { 446 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, 447 head); 448 component = pcm->codec_dai->component; 449 return hda_dsp_hdmi_build_controls(card, component); 450 } 451 452 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 453 component = pcm->codec_dai->component; 454 snprintf(jack_name, sizeof(jack_name), 455 "HDMI/DP, pcm=%d Jack", pcm->device); 456 err = snd_soc_card_jack_new(card, jack_name, 457 SND_JACK_AVOUT, &sof_hdmi[i]); 458 459 if (err) 460 return err; 461 462 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, 463 &sof_hdmi[i]); 464 if (err < 0) 465 return err; 466 467 i++; 468 } 469 470 if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { 471 /* Disable Left and Right Spk pin after boot */ 472 snd_soc_dapm_disable_pin(dapm, "Left Spk"); 473 snd_soc_dapm_disable_pin(dapm, "Right Spk"); 474 err = snd_soc_dapm_sync(dapm); 475 if (err < 0) 476 return err; 477 } 478 479 return hdac_hdmi_jack_port_init(component, &card->dapm); 480 } 481 482 static const struct snd_kcontrol_new sof_controls[] = { 483 SOC_DAPM_PIN_SWITCH("Headphone Jack"), 484 SOC_DAPM_PIN_SWITCH("Headset Mic"), 485 SOC_DAPM_PIN_SWITCH("Left Spk"), 486 SOC_DAPM_PIN_SWITCH("Right Spk"), 487 488 }; 489 490 static const struct snd_soc_dapm_widget sof_widgets[] = { 491 SND_SOC_DAPM_HP("Headphone Jack", NULL), 492 SND_SOC_DAPM_MIC("Headset Mic", NULL), 493 SND_SOC_DAPM_SPK("Left Spk", NULL), 494 SND_SOC_DAPM_SPK("Right Spk", NULL), 495 }; 496 497 static const struct snd_soc_dapm_widget dmic_widgets[] = { 498 SND_SOC_DAPM_MIC("SoC DMIC", NULL), 499 }; 500 501 static const struct snd_soc_dapm_route sof_map[] = { 502 /* HP jack connectors - unknown if we have jack detection */ 503 { "Headphone Jack", NULL, "HPOL" }, 504 { "Headphone Jack", NULL, "HPOR" }, 505 506 /* other jacks */ 507 { "IN1P", NULL, "Headset Mic" }, 508 }; 509 510 static const struct snd_soc_dapm_route dmic_map[] = { 511 /* digital mics */ 512 {"DMic", NULL, "SoC DMIC"}, 513 }; 514 515 static int dmic_init(struct snd_soc_pcm_runtime *rtd) 516 { 517 struct snd_soc_card *card = rtd->card; 518 int ret; 519 520 ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets, 521 ARRAY_SIZE(dmic_widgets)); 522 if (ret) { 523 dev_err(card->dev, "DMic widget addition failed: %d\n", ret); 524 /* Don't need to add routes if widget addition failed */ 525 return ret; 526 } 527 528 ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map, 529 ARRAY_SIZE(dmic_map)); 530 531 if (ret) 532 dev_err(card->dev, "DMic map addition failed: %d\n", ret); 533 534 return ret; 535 } 536 537 /* sof audio machine driver for rt5682 codec */ 538 static struct snd_soc_card sof_audio_card_rt5682 = { 539 .name = "rt5682", /* the sof- prefix is added by the core */ 540 .owner = THIS_MODULE, 541 .controls = sof_controls, 542 .num_controls = ARRAY_SIZE(sof_controls), 543 .dapm_widgets = sof_widgets, 544 .num_dapm_widgets = ARRAY_SIZE(sof_widgets), 545 .dapm_routes = sof_map, 546 .num_dapm_routes = ARRAY_SIZE(sof_map), 547 .fully_routed = true, 548 .late_probe = sof_card_late_probe, 549 }; 550 551 static struct snd_soc_dai_link_component rt5682_component[] = { 552 { 553 .name = "i2c-10EC5682:00", 554 .dai_name = "rt5682-aif1", 555 } 556 }; 557 558 static struct snd_soc_dai_link_component rt5682s_component[] = { 559 { 560 .name = "i2c-RTL5682:00", 561 .dai_name = "rt5682s-aif1", 562 } 563 }; 564 565 static struct snd_soc_dai_link_component dmic_component[] = { 566 { 567 .name = "dmic-codec", 568 .dai_name = "dmic-hifi", 569 } 570 }; 571 572 static struct snd_soc_dai_link_component dummy_component[] = { 573 { 574 .name = "snd-soc-dummy", 575 .dai_name = "snd-soc-dummy-dai", 576 } 577 }; 578 579 #define IDISP_CODEC_MASK 0x4 580 581 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, 582 int ssp_codec, 583 int ssp_amp, 584 int dmic_be_num, 585 int hdmi_num, 586 bool idisp_codec) 587 { 588 struct snd_soc_dai_link_component *idisp_components; 589 struct snd_soc_dai_link_component *cpus; 590 struct snd_soc_dai_link *links; 591 int i, id = 0; 592 593 links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) * 594 sof_audio_card_rt5682.num_links, GFP_KERNEL); 595 cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component) * 596 sof_audio_card_rt5682.num_links, GFP_KERNEL); 597 if (!links || !cpus) 598 goto devm_err; 599 600 /* codec SSP */ 601 links[id].name = devm_kasprintf(dev, GFP_KERNEL, 602 "SSP%d-Codec", ssp_codec); 603 if (!links[id].name) 604 goto devm_err; 605 606 links[id].id = id; 607 if (sof_rt5682_quirk & SOF_RT5682S_HEADPHONE_CODEC_PRESENT) { 608 links[id].codecs = rt5682s_component; 609 links[id].num_codecs = ARRAY_SIZE(rt5682s_component); 610 } else { 611 links[id].codecs = rt5682_component; 612 links[id].num_codecs = ARRAY_SIZE(rt5682_component); 613 } 614 links[id].platforms = platform_component; 615 links[id].num_platforms = ARRAY_SIZE(platform_component); 616 links[id].init = sof_rt5682_codec_init; 617 links[id].exit = sof_rt5682_codec_exit; 618 links[id].ops = &sof_rt5682_ops; 619 links[id].dpcm_playback = 1; 620 links[id].dpcm_capture = 1; 621 links[id].no_pcm = 1; 622 links[id].cpus = &cpus[id]; 623 links[id].num_cpus = 1; 624 if (is_legacy_cpu) { 625 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 626 "ssp%d-port", 627 ssp_codec); 628 if (!links[id].cpus->dai_name) 629 goto devm_err; 630 } else { 631 /* 632 * Currently, On SKL+ platforms MCLK will be turned off in sof 633 * runtime suspended, and it will go into runtime suspended 634 * right after playback is stop. However, rt5682 will output 635 * static noise if sysclk turns off during playback. Set 636 * ignore_pmdown_time to power down rt5682 immediately and 637 * avoid the noise. 638 * It can be removed once we can control MCLK by driver. 639 */ 640 links[id].ignore_pmdown_time = 1; 641 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 642 "SSP%d Pin", 643 ssp_codec); 644 if (!links[id].cpus->dai_name) 645 goto devm_err; 646 } 647 id++; 648 649 /* dmic */ 650 if (dmic_be_num > 0) { 651 /* at least we have dmic01 */ 652 links[id].name = "dmic01"; 653 links[id].cpus = &cpus[id]; 654 links[id].cpus->dai_name = "DMIC01 Pin"; 655 links[id].init = dmic_init; 656 if (dmic_be_num > 1) { 657 /* set up 2 BE links at most */ 658 links[id + 1].name = "dmic16k"; 659 links[id + 1].cpus = &cpus[id + 1]; 660 links[id + 1].cpus->dai_name = "DMIC16k Pin"; 661 dmic_be_num = 2; 662 } 663 } 664 665 for (i = 0; i < dmic_be_num; i++) { 666 links[id].id = id; 667 links[id].num_cpus = 1; 668 links[id].codecs = dmic_component; 669 links[id].num_codecs = ARRAY_SIZE(dmic_component); 670 links[id].platforms = platform_component; 671 links[id].num_platforms = ARRAY_SIZE(platform_component); 672 links[id].ignore_suspend = 1; 673 links[id].dpcm_capture = 1; 674 links[id].no_pcm = 1; 675 id++; 676 } 677 678 /* HDMI */ 679 if (hdmi_num > 0) { 680 idisp_components = devm_kzalloc(dev, 681 sizeof(struct snd_soc_dai_link_component) * 682 hdmi_num, GFP_KERNEL); 683 if (!idisp_components) 684 goto devm_err; 685 } 686 for (i = 1; i <= hdmi_num; i++) { 687 links[id].name = devm_kasprintf(dev, GFP_KERNEL, 688 "iDisp%d", i); 689 if (!links[id].name) 690 goto devm_err; 691 692 links[id].id = id; 693 links[id].cpus = &cpus[id]; 694 links[id].num_cpus = 1; 695 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 696 "iDisp%d Pin", i); 697 if (!links[id].cpus->dai_name) 698 goto devm_err; 699 700 if (idisp_codec) { 701 idisp_components[i - 1].name = "ehdaudio0D2"; 702 idisp_components[i - 1].dai_name = devm_kasprintf(dev, 703 GFP_KERNEL, 704 "intel-hdmi-hifi%d", 705 i); 706 if (!idisp_components[i - 1].dai_name) 707 goto devm_err; 708 } else { 709 idisp_components[i - 1].name = "snd-soc-dummy"; 710 idisp_components[i - 1].dai_name = "snd-soc-dummy-dai"; 711 } 712 713 links[id].codecs = &idisp_components[i - 1]; 714 links[id].num_codecs = 1; 715 links[id].platforms = platform_component; 716 links[id].num_platforms = ARRAY_SIZE(platform_component); 717 links[id].init = sof_hdmi_init; 718 links[id].dpcm_playback = 1; 719 links[id].no_pcm = 1; 720 id++; 721 } 722 723 /* speaker amp */ 724 if (sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) { 725 links[id].name = devm_kasprintf(dev, GFP_KERNEL, 726 "SSP%d-Codec", ssp_amp); 727 if (!links[id].name) 728 goto devm_err; 729 730 links[id].id = id; 731 if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT) { 732 sof_rt1015_dai_link(&links[id], (sof_rt5682_quirk & 733 SOF_RT1015_SPEAKER_AMP_100FS) ? 100 : 64); 734 } else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) { 735 sof_rt1015p_dai_link(&links[id]); 736 } else if (sof_rt5682_quirk & 737 SOF_MAX98373_SPEAKER_AMP_PRESENT) { 738 links[id].codecs = max_98373_components; 739 links[id].num_codecs = ARRAY_SIZE(max_98373_components); 740 links[id].init = max_98373_spk_codec_init; 741 links[id].ops = &max_98373_ops; 742 /* feedback stream */ 743 links[id].dpcm_capture = 1; 744 } else if (sof_rt5682_quirk & 745 SOF_MAX98360A_SPEAKER_AMP_PRESENT) { 746 max_98360a_dai_link(&links[id]); 747 } else if (sof_rt5682_quirk & 748 SOF_RT1011_SPEAKER_AMP_PRESENT) { 749 sof_rt1011_dai_link(&links[id]); 750 } else if (sof_rt5682_quirk & 751 SOF_MAX98390_SPEAKER_AMP_PRESENT) { 752 if (sof_rt5682_quirk & 753 SOF_MAX98390_TWEETER_SPEAKER_PRESENT) { 754 links[id].codecs = max_98390_4spk_components; 755 links[id].num_codecs = ARRAY_SIZE(max_98390_4spk_components); 756 } else { 757 links[id].codecs = max_98390_components; 758 links[id].num_codecs = ARRAY_SIZE(max_98390_components); 759 } 760 links[id].init = max_98390_spk_codec_init; 761 links[id].ops = &max_98390_ops; 762 links[id].dpcm_capture = 1; 763 764 } else { 765 max_98357a_dai_link(&links[id]); 766 } 767 links[id].platforms = platform_component; 768 links[id].num_platforms = ARRAY_SIZE(platform_component); 769 links[id].dpcm_playback = 1; 770 links[id].no_pcm = 1; 771 links[id].cpus = &cpus[id]; 772 links[id].num_cpus = 1; 773 if (is_legacy_cpu) { 774 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 775 "ssp%d-port", 776 ssp_amp); 777 if (!links[id].cpus->dai_name) 778 goto devm_err; 779 780 } else { 781 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 782 "SSP%d Pin", 783 ssp_amp); 784 if (!links[id].cpus->dai_name) 785 goto devm_err; 786 } 787 id++; 788 } 789 790 /* BT audio offload */ 791 if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { 792 int port = (sof_rt5682_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> 793 SOF_BT_OFFLOAD_SSP_SHIFT; 794 795 links[id].id = id; 796 links[id].cpus = &cpus[id]; 797 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 798 "SSP%d Pin", port); 799 if (!links[id].cpus->dai_name) 800 goto devm_err; 801 links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); 802 if (!links[id].name) 803 goto devm_err; 804 links[id].codecs = dummy_component; 805 links[id].num_codecs = ARRAY_SIZE(dummy_component); 806 links[id].platforms = platform_component; 807 links[id].num_platforms = ARRAY_SIZE(platform_component); 808 links[id].dpcm_playback = 1; 809 links[id].dpcm_capture = 1; 810 links[id].no_pcm = 1; 811 links[id].num_cpus = 1; 812 } 813 814 return links; 815 devm_err: 816 return NULL; 817 } 818 819 static int sof_audio_probe(struct platform_device *pdev) 820 { 821 struct snd_soc_dai_link *dai_links; 822 struct snd_soc_acpi_mach *mach; 823 struct sof_card_private *ctx; 824 int dmic_be_num, hdmi_num; 825 int ret, ssp_amp, ssp_codec; 826 827 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 828 if (!ctx) 829 return -ENOMEM; 830 831 if (pdev->id_entry && pdev->id_entry->driver_data) 832 sof_rt5682_quirk = (unsigned long)pdev->id_entry->driver_data; 833 834 dmi_check_system(sof_rt5682_quirk_table); 835 836 mach = pdev->dev.platform_data; 837 838 /* A speaker amp might not be present when the quirk claims one is. 839 * Detect this via whether the machine driver match includes quirk_data. 840 */ 841 if ((sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) && !mach->quirk_data) 842 sof_rt5682_quirk &= ~SOF_SPEAKER_AMP_PRESENT; 843 844 /* Detect the headset codec variant */ 845 if (acpi_dev_present("RTL5682", NULL, -1)) 846 sof_rt5682_quirk |= SOF_RT5682S_HEADPHONE_CODEC_PRESENT; 847 848 /* Detect the headset codec variant to support machines in DMI quirk */ 849 if (acpi_dev_present("RTL5682", NULL, -1)) 850 sof_rt5682_quirk |= SOF_RT5682S_HEADPHONE_CODEC_PRESENT; 851 852 if (soc_intel_is_byt() || soc_intel_is_cht()) { 853 is_legacy_cpu = 1; 854 dmic_be_num = 0; 855 hdmi_num = 0; 856 /* default quirk for legacy cpu */ 857 sof_rt5682_quirk = SOF_RT5682_MCLK_EN | 858 SOF_RT5682_MCLK_BYTCHT_EN | 859 SOF_RT5682_SSP_CODEC(2); 860 } else { 861 dmic_be_num = 2; 862 hdmi_num = (sof_rt5682_quirk & SOF_RT5682_NUM_HDMIDEV_MASK) >> 863 SOF_RT5682_NUM_HDMIDEV_SHIFT; 864 /* default number of HDMI DAI's */ 865 if (!hdmi_num) 866 hdmi_num = 3; 867 868 if (mach->mach_params.codec_mask & IDISP_CODEC_MASK) 869 ctx->idisp_codec = true; 870 } 871 872 /* need to get main clock from pmc */ 873 if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) { 874 ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); 875 if (IS_ERR(ctx->mclk)) { 876 ret = PTR_ERR(ctx->mclk); 877 878 dev_err(&pdev->dev, 879 "Failed to get MCLK from pmc_plt_clk_3: %d\n", 880 ret); 881 return ret; 882 } 883 884 ret = clk_prepare_enable(ctx->mclk); 885 if (ret < 0) { 886 dev_err(&pdev->dev, 887 "could not configure MCLK state"); 888 return ret; 889 } 890 } 891 892 dev_dbg(&pdev->dev, "sof_rt5682_quirk = %lx\n", sof_rt5682_quirk); 893 894 ssp_amp = (sof_rt5682_quirk & SOF_RT5682_SSP_AMP_MASK) >> 895 SOF_RT5682_SSP_AMP_SHIFT; 896 897 ssp_codec = sof_rt5682_quirk & SOF_RT5682_SSP_CODEC_MASK; 898 899 /* compute number of dai links */ 900 sof_audio_card_rt5682.num_links = 1 + dmic_be_num + hdmi_num; 901 902 if (sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) 903 sof_audio_card_rt5682.num_links++; 904 905 if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) 906 max_98373_set_codec_conf(&sof_audio_card_rt5682); 907 else if (sof_rt5682_quirk & SOF_RT1011_SPEAKER_AMP_PRESENT) 908 sof_rt1011_codec_conf(&sof_audio_card_rt5682); 909 else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) 910 sof_rt1015p_codec_conf(&sof_audio_card_rt5682); 911 else if (sof_rt5682_quirk & SOF_MAX98390_SPEAKER_AMP_PRESENT) { 912 if (sof_rt5682_quirk & SOF_MAX98390_TWEETER_SPEAKER_PRESENT) 913 max_98390_set_codec_conf(&sof_audio_card_rt5682, 914 ARRAY_SIZE(max_98390_4spk_components)); 915 else 916 max_98390_set_codec_conf(&sof_audio_card_rt5682, 917 ARRAY_SIZE(max_98390_components)); 918 } 919 920 if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) 921 sof_audio_card_rt5682.num_links++; 922 923 dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp, 924 dmic_be_num, hdmi_num, ctx->idisp_codec); 925 if (!dai_links) 926 return -ENOMEM; 927 928 sof_audio_card_rt5682.dai_link = dai_links; 929 930 if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT) 931 sof_rt1015_codec_conf(&sof_audio_card_rt5682); 932 933 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 934 935 sof_audio_card_rt5682.dev = &pdev->dev; 936 937 /* set platform name for each dailink */ 938 ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_rt5682, 939 mach->mach_params.platform); 940 if (ret) 941 return ret; 942 943 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; 944 945 snd_soc_card_set_drvdata(&sof_audio_card_rt5682, ctx); 946 947 return devm_snd_soc_register_card(&pdev->dev, 948 &sof_audio_card_rt5682); 949 } 950 951 static const struct platform_device_id board_ids[] = { 952 { 953 .name = "sof_rt5682", 954 }, 955 { 956 .name = "tgl_mx98357_rt5682", 957 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 958 SOF_RT5682_SSP_CODEC(0) | 959 SOF_SPEAKER_AMP_PRESENT | 960 SOF_RT5682_SSP_AMP(1) | 961 SOF_RT5682_NUM_HDMIDEV(4) | 962 SOF_BT_OFFLOAD_SSP(2) | 963 SOF_SSP_BT_OFFLOAD_PRESENT), 964 }, 965 { 966 .name = "jsl_rt5682_rt1015", 967 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 968 SOF_RT5682_MCLK_24MHZ | 969 SOF_RT5682_SSP_CODEC(0) | 970 SOF_SPEAKER_AMP_PRESENT | 971 SOF_RT1015_SPEAKER_AMP_PRESENT | 972 SOF_RT5682_SSP_AMP(1)), 973 }, 974 { 975 .name = "tgl_mx98373_rt5682", 976 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 977 SOF_RT5682_SSP_CODEC(0) | 978 SOF_SPEAKER_AMP_PRESENT | 979 SOF_MAX98373_SPEAKER_AMP_PRESENT | 980 SOF_RT5682_SSP_AMP(1) | 981 SOF_RT5682_NUM_HDMIDEV(4) | 982 SOF_BT_OFFLOAD_SSP(2) | 983 SOF_SSP_BT_OFFLOAD_PRESENT), 984 }, 985 { 986 .name = "jsl_rt5682_mx98360", 987 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 988 SOF_RT5682_MCLK_24MHZ | 989 SOF_RT5682_SSP_CODEC(0) | 990 SOF_SPEAKER_AMP_PRESENT | 991 SOF_MAX98360A_SPEAKER_AMP_PRESENT | 992 SOF_RT5682_SSP_AMP(1)), 993 }, 994 { 995 .name = "cml_rt1015_rt5682", 996 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 997 SOF_RT5682_MCLK_24MHZ | 998 SOF_RT5682_SSP_CODEC(0) | 999 SOF_SPEAKER_AMP_PRESENT | 1000 SOF_RT1015_SPEAKER_AMP_PRESENT | 1001 SOF_RT1015_SPEAKER_AMP_100FS | 1002 SOF_RT5682_SSP_AMP(1)), 1003 }, 1004 { 1005 .name = "tgl_rt1011_rt5682", 1006 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1007 SOF_RT5682_SSP_CODEC(0) | 1008 SOF_SPEAKER_AMP_PRESENT | 1009 SOF_RT1011_SPEAKER_AMP_PRESENT | 1010 SOF_RT5682_SSP_AMP(1) | 1011 SOF_RT5682_NUM_HDMIDEV(4) | 1012 SOF_BT_OFFLOAD_SSP(2) | 1013 SOF_SSP_BT_OFFLOAD_PRESENT), 1014 }, 1015 { 1016 .name = "jsl_rt5682_rt1015p", 1017 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1018 SOF_RT5682_MCLK_24MHZ | 1019 SOF_RT5682_SSP_CODEC(0) | 1020 SOF_SPEAKER_AMP_PRESENT | 1021 SOF_RT1015P_SPEAKER_AMP_PRESENT | 1022 SOF_RT5682_SSP_AMP(1)), 1023 }, 1024 { 1025 .name = "adl_mx98373_rt5682", 1026 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1027 SOF_RT5682_SSP_CODEC(0) | 1028 SOF_SPEAKER_AMP_PRESENT | 1029 SOF_MAX98373_SPEAKER_AMP_PRESENT | 1030 SOF_RT5682_SSP_AMP(1) | 1031 SOF_RT5682_NUM_HDMIDEV(4) | 1032 SOF_BT_OFFLOAD_SSP(2) | 1033 SOF_SSP_BT_OFFLOAD_PRESENT), 1034 }, 1035 { 1036 .name = "adl_mx98357_rt5682", 1037 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1038 SOF_RT5682_SSP_CODEC(0) | 1039 SOF_SPEAKER_AMP_PRESENT | 1040 SOF_RT5682_SSP_AMP(2) | 1041 SOF_RT5682_NUM_HDMIDEV(4)), 1042 }, 1043 { 1044 .name = "adl_max98390_rt5682", 1045 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1046 SOF_RT5682_SSP_CODEC(0) | 1047 SOF_SPEAKER_AMP_PRESENT | 1048 SOF_MAX98390_SPEAKER_AMP_PRESENT | 1049 SOF_RT5682_SSP_AMP(1) | 1050 SOF_RT5682_NUM_HDMIDEV(4) | 1051 SOF_BT_OFFLOAD_SSP(2) | 1052 SOF_SSP_BT_OFFLOAD_PRESENT), 1053 }, 1054 { 1055 .name = "adl_mx98360_rt5682", 1056 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1057 SOF_RT5682_SSP_CODEC(0) | 1058 SOF_SPEAKER_AMP_PRESENT | 1059 SOF_MAX98360A_SPEAKER_AMP_PRESENT | 1060 SOF_RT5682_SSP_AMP(1) | 1061 SOF_RT5682_NUM_HDMIDEV(4) | 1062 SOF_BT_OFFLOAD_SSP(2) | 1063 SOF_SSP_BT_OFFLOAD_PRESENT), 1064 }, 1065 { 1066 .name = "adl_rt5682", 1067 .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 1068 SOF_RT5682_SSP_CODEC(0) | 1069 SOF_RT5682_NUM_HDMIDEV(4) | 1070 SOF_BT_OFFLOAD_SSP(2) | 1071 SOF_SSP_BT_OFFLOAD_PRESENT), 1072 }, 1073 { } 1074 }; 1075 MODULE_DEVICE_TABLE(platform, board_ids); 1076 1077 static struct platform_driver sof_audio = { 1078 .probe = sof_audio_probe, 1079 .driver = { 1080 .name = "sof_rt5682", 1081 .pm = &snd_soc_pm_ops, 1082 }, 1083 .id_table = board_ids, 1084 }; 1085 module_platform_driver(sof_audio) 1086 1087 /* Module information */ 1088 MODULE_DESCRIPTION("SOF Audio Machine driver"); 1089 MODULE_AUTHOR("Bard Liao <bard.liao@intel.com>"); 1090 MODULE_AUTHOR("Sathya Prakash M R <sathya.prakash.m.r@intel.com>"); 1091 MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>"); 1092 MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>"); 1093 MODULE_LICENSE("GPL v2"); 1094 MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON); 1095 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON); 1096 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_REALTEK_COMMON); 1097