1 // SPDX-License-Identifier: GPL-2.0-only 2 // Copyright(c) 2021 Intel Corporation. 3 // Copyright(c) 2021 Nuvoton Corporation. 4 5 /* 6 * Intel SOF Machine Driver with Nuvoton headphone codec NAU8825 7 * and speaker codec RT1019P MAX98360a or MAX98373 8 */ 9 #include <linux/i2c.h> 10 #include <linux/input.h> 11 #include <linux/module.h> 12 #include <linux/platform_device.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/soc-acpi.h> 21 #include "../../codecs/nau8825.h" 22 #include "../common/soc-intel-quirks.h" 23 #include "hda_dsp_common.h" 24 #include "sof_realtek_common.h" 25 #include "sof_maxim_common.h" 26 #include "sof_nuvoton_common.h" 27 #include "sof_ssp_common.h" 28 29 #define NAME_SIZE 32 30 31 #define SOF_NAU8825_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0)) 32 #define SOF_NAU8825_SSP_CODEC_MASK (GENMASK(2, 0)) 33 #define SOF_NAU8825_SSP_AMP_SHIFT 4 34 #define SOF_NAU8825_SSP_AMP_MASK (GENMASK(6, 4)) 35 #define SOF_NAU8825_SSP_AMP(quirk) \ 36 (((quirk) << SOF_NAU8825_SSP_AMP_SHIFT) & SOF_NAU8825_SSP_AMP_MASK) 37 #define SOF_NAU8825_NUM_HDMIDEV_SHIFT 7 38 #define SOF_NAU8825_NUM_HDMIDEV_MASK (GENMASK(9, 7)) 39 #define SOF_NAU8825_NUM_HDMIDEV(quirk) \ 40 (((quirk) << SOF_NAU8825_NUM_HDMIDEV_SHIFT) & SOF_NAU8825_NUM_HDMIDEV_MASK) 41 42 /* BT audio offload: reserve 3 bits for future */ 43 #define SOF_BT_OFFLOAD_SSP_SHIFT 10 44 #define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(12, 10)) 45 #define SOF_BT_OFFLOAD_SSP(quirk) \ 46 (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK) 47 #define SOF_SSP_BT_OFFLOAD_PRESENT BIT(13) 48 49 static unsigned long sof_nau8825_quirk = SOF_NAU8825_SSP_CODEC(0); 50 51 struct sof_hdmi_pcm { 52 struct list_head head; 53 struct snd_soc_dai *codec_dai; 54 int device; 55 }; 56 57 struct sof_card_private { 58 struct clk *mclk; 59 struct snd_soc_jack sof_headset; 60 struct list_head hdmi_pcm_list; 61 enum sof_ssp_codec codec_type; 62 enum sof_ssp_codec amp_type; 63 }; 64 65 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd) 66 { 67 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 68 struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0); 69 struct sof_hdmi_pcm *pcm; 70 71 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 72 if (!pcm) 73 return -ENOMEM; 74 75 /* dai_link id is 1:1 mapped to the PCM device */ 76 pcm->device = rtd->dai_link->id; 77 pcm->codec_dai = dai; 78 79 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); 80 81 return 0; 82 } 83 84 static struct snd_soc_jack_pin jack_pins[] = { 85 { 86 .pin = "Headphone Jack", 87 .mask = SND_JACK_HEADPHONE, 88 }, 89 { 90 .pin = "Headset Mic", 91 .mask = SND_JACK_MICROPHONE, 92 }, 93 }; 94 95 static int sof_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) 96 { 97 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 98 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; 99 100 struct snd_soc_jack *jack; 101 int ret; 102 103 /* 104 * Headset buttons map to the google Reference headset. 105 * These can be configured by userspace. 106 */ 107 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", 108 SND_JACK_HEADSET | SND_JACK_BTN_0 | 109 SND_JACK_BTN_1 | SND_JACK_BTN_2 | 110 SND_JACK_BTN_3, 111 &ctx->sof_headset, 112 jack_pins, 113 ARRAY_SIZE(jack_pins)); 114 if (ret) { 115 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); 116 return ret; 117 } 118 119 jack = &ctx->sof_headset; 120 121 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); 122 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); 123 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); 124 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); 125 ret = snd_soc_component_set_jack(component, jack, NULL); 126 127 if (ret) { 128 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); 129 return ret; 130 } 131 132 return ret; 133 }; 134 135 static void sof_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd) 136 { 137 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; 138 139 snd_soc_component_set_jack(component, NULL, NULL); 140 } 141 142 static int sof_nau8825_hw_params(struct snd_pcm_substream *substream, 143 struct snd_pcm_hw_params *params) 144 { 145 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 146 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); 147 int clk_freq, ret; 148 149 clk_freq = sof_dai_get_bclk(rtd); /* BCLK freq */ 150 151 if (clk_freq <= 0) { 152 dev_err(rtd->dev, "get bclk freq failed: %d\n", clk_freq); 153 return -EINVAL; 154 } 155 156 /* Configure clock for codec */ 157 ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_BLK, 0, 158 SND_SOC_CLOCK_IN); 159 if (ret < 0) { 160 dev_err(codec_dai->dev, "can't set BCLK clock %d\n", ret); 161 return ret; 162 } 163 164 /* Configure pll for codec */ 165 ret = snd_soc_dai_set_pll(codec_dai, 0, 0, clk_freq, 166 params_rate(params) * 256); 167 if (ret < 0) { 168 dev_err(codec_dai->dev, "can't set BCLK: %d\n", ret); 169 return ret; 170 } 171 172 return ret; 173 } 174 175 static struct snd_soc_ops sof_nau8825_ops = { 176 .hw_params = sof_nau8825_hw_params, 177 }; 178 179 static struct snd_soc_dai_link_component platform_component[] = { 180 { 181 /* name might be overridden during probe */ 182 .name = "0000:00:1f.3" 183 } 184 }; 185 186 static int sof_card_late_probe(struct snd_soc_card *card) 187 { 188 struct sof_card_private *ctx = snd_soc_card_get_drvdata(card); 189 struct snd_soc_dapm_context *dapm = &card->dapm; 190 struct sof_hdmi_pcm *pcm; 191 int err; 192 193 if (ctx->amp_type == CODEC_MAX98373) { 194 /* Disable Left and Right Spk pin after boot */ 195 snd_soc_dapm_disable_pin(dapm, "Left Spk"); 196 snd_soc_dapm_disable_pin(dapm, "Right Spk"); 197 err = snd_soc_dapm_sync(dapm); 198 if (err < 0) 199 return err; 200 } 201 202 if (list_empty(&ctx->hdmi_pcm_list)) 203 return -EINVAL; 204 205 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head); 206 207 return hda_dsp_hdmi_build_controls(card, pcm->codec_dai->component); 208 } 209 210 static const struct snd_kcontrol_new sof_controls[] = { 211 SOC_DAPM_PIN_SWITCH("Headphone Jack"), 212 SOC_DAPM_PIN_SWITCH("Headset Mic"), 213 SOC_DAPM_PIN_SWITCH("Left Spk"), 214 SOC_DAPM_PIN_SWITCH("Right Spk"), 215 }; 216 217 static const struct snd_soc_dapm_widget sof_widgets[] = { 218 SND_SOC_DAPM_HP("Headphone Jack", NULL), 219 SND_SOC_DAPM_MIC("Headset Mic", NULL), 220 SND_SOC_DAPM_SPK("Left Spk", NULL), 221 SND_SOC_DAPM_SPK("Right Spk", NULL), 222 }; 223 224 static const struct snd_soc_dapm_widget dmic_widgets[] = { 225 SND_SOC_DAPM_MIC("SoC DMIC", NULL), 226 }; 227 228 static const struct snd_soc_dapm_route sof_map[] = { 229 /* HP jack connectors - unknown if we have jack detection */ 230 { "Headphone Jack", NULL, "HPOL" }, 231 { "Headphone Jack", NULL, "HPOR" }, 232 233 /* other jacks */ 234 { "MIC", NULL, "Headset Mic" }, 235 }; 236 237 static const struct snd_soc_dapm_route dmic_map[] = { 238 /* digital mics */ 239 {"DMic", NULL, "SoC DMIC"}, 240 }; 241 242 static int dmic_init(struct snd_soc_pcm_runtime *rtd) 243 { 244 struct snd_soc_card *card = rtd->card; 245 int ret; 246 247 ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets, 248 ARRAY_SIZE(dmic_widgets)); 249 if (ret) { 250 dev_err(card->dev, "DMic widget addition failed: %d\n", ret); 251 /* Don't need to add routes if widget addition failed */ 252 return ret; 253 } 254 255 ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map, 256 ARRAY_SIZE(dmic_map)); 257 258 if (ret) 259 dev_err(card->dev, "DMic map addition failed: %d\n", ret); 260 261 return ret; 262 } 263 264 /* sof audio machine driver for nau8825 codec */ 265 static struct snd_soc_card sof_audio_card_nau8825 = { 266 .name = "nau8825", /* the sof- prefix is added by the core */ 267 .owner = THIS_MODULE, 268 .controls = sof_controls, 269 .num_controls = ARRAY_SIZE(sof_controls), 270 .dapm_widgets = sof_widgets, 271 .num_dapm_widgets = ARRAY_SIZE(sof_widgets), 272 .dapm_routes = sof_map, 273 .num_dapm_routes = ARRAY_SIZE(sof_map), 274 .fully_routed = true, 275 .late_probe = sof_card_late_probe, 276 }; 277 278 static struct snd_soc_dai_link_component nau8825_component[] = { 279 { 280 .name = "i2c-10508825:00", 281 .dai_name = "nau8825-hifi", 282 } 283 }; 284 285 static struct snd_soc_dai_link_component dmic_component[] = { 286 { 287 .name = "dmic-codec", 288 .dai_name = "dmic-hifi", 289 } 290 }; 291 292 static struct snd_soc_dai_link * 293 sof_card_dai_links_create(struct device *dev, enum sof_ssp_codec amp_type, 294 int ssp_codec, int ssp_amp, int dmic_be_num, 295 int hdmi_num) 296 { 297 struct snd_soc_dai_link_component *idisp_components; 298 struct snd_soc_dai_link_component *cpus; 299 struct snd_soc_dai_link *links; 300 int i, id = 0; 301 302 links = devm_kcalloc(dev, sof_audio_card_nau8825.num_links, 303 sizeof(struct snd_soc_dai_link), GFP_KERNEL); 304 cpus = devm_kcalloc(dev, sof_audio_card_nau8825.num_links, 305 sizeof(struct snd_soc_dai_link_component), GFP_KERNEL); 306 if (!links || !cpus) 307 goto devm_err; 308 309 /* codec SSP */ 310 links[id].name = devm_kasprintf(dev, GFP_KERNEL, 311 "SSP%d-Codec", ssp_codec); 312 if (!links[id].name) 313 goto devm_err; 314 315 links[id].id = id; 316 links[id].codecs = nau8825_component; 317 links[id].num_codecs = ARRAY_SIZE(nau8825_component); 318 links[id].platforms = platform_component; 319 links[id].num_platforms = ARRAY_SIZE(platform_component); 320 links[id].init = sof_nau8825_codec_init; 321 links[id].exit = sof_nau8825_codec_exit; 322 links[id].ops = &sof_nau8825_ops; 323 links[id].dpcm_playback = 1; 324 links[id].dpcm_capture = 1; 325 links[id].no_pcm = 1; 326 links[id].cpus = &cpus[id]; 327 links[id].num_cpus = 1; 328 329 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 330 "SSP%d Pin", 331 ssp_codec); 332 if (!links[id].cpus->dai_name) 333 goto devm_err; 334 335 id++; 336 337 /* dmic */ 338 if (dmic_be_num > 0) { 339 /* at least we have dmic01 */ 340 links[id].name = "dmic01"; 341 links[id].cpus = &cpus[id]; 342 links[id].cpus->dai_name = "DMIC01 Pin"; 343 links[id].init = dmic_init; 344 if (dmic_be_num > 1) { 345 /* set up 2 BE links at most */ 346 links[id + 1].name = "dmic16k"; 347 links[id + 1].cpus = &cpus[id + 1]; 348 links[id + 1].cpus->dai_name = "DMIC16k Pin"; 349 dmic_be_num = 2; 350 } 351 } 352 353 for (i = 0; i < dmic_be_num; i++) { 354 links[id].id = id; 355 links[id].num_cpus = 1; 356 links[id].codecs = dmic_component; 357 links[id].num_codecs = ARRAY_SIZE(dmic_component); 358 links[id].platforms = platform_component; 359 links[id].num_platforms = ARRAY_SIZE(platform_component); 360 links[id].ignore_suspend = 1; 361 links[id].dpcm_capture = 1; 362 links[id].no_pcm = 1; 363 id++; 364 } 365 366 /* HDMI */ 367 if (hdmi_num > 0) { 368 idisp_components = devm_kcalloc(dev, 369 hdmi_num, 370 sizeof(struct snd_soc_dai_link_component), 371 GFP_KERNEL); 372 if (!idisp_components) 373 goto devm_err; 374 } 375 for (i = 1; i <= hdmi_num; i++) { 376 links[id].name = devm_kasprintf(dev, GFP_KERNEL, 377 "iDisp%d", i); 378 if (!links[id].name) 379 goto devm_err; 380 381 links[id].id = id; 382 links[id].cpus = &cpus[id]; 383 links[id].num_cpus = 1; 384 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 385 "iDisp%d Pin", i); 386 if (!links[id].cpus->dai_name) 387 goto devm_err; 388 389 idisp_components[i - 1].name = "ehdaudio0D2"; 390 idisp_components[i - 1].dai_name = devm_kasprintf(dev, 391 GFP_KERNEL, 392 "intel-hdmi-hifi%d", 393 i); 394 if (!idisp_components[i - 1].dai_name) 395 goto devm_err; 396 397 links[id].codecs = &idisp_components[i - 1]; 398 links[id].num_codecs = 1; 399 links[id].platforms = platform_component; 400 links[id].num_platforms = ARRAY_SIZE(platform_component); 401 links[id].init = sof_hdmi_init; 402 links[id].dpcm_playback = 1; 403 links[id].no_pcm = 1; 404 id++; 405 } 406 407 /* speaker amp */ 408 if (amp_type != CODEC_NONE) { 409 links[id].name = devm_kasprintf(dev, GFP_KERNEL, 410 "SSP%d-Codec", ssp_amp); 411 if (!links[id].name) 412 goto devm_err; 413 414 links[id].id = id; 415 416 switch (amp_type) { 417 case CODEC_MAX98360A: 418 max_98360a_dai_link(&links[id]); 419 break; 420 case CODEC_MAX98373: 421 links[id].codecs = max_98373_components; 422 links[id].num_codecs = ARRAY_SIZE(max_98373_components); 423 links[id].init = max_98373_spk_codec_init; 424 links[id].ops = &max_98373_ops; 425 break; 426 case CODEC_NAU8318: 427 nau8318_set_dai_link(&links[id]); 428 break; 429 case CODEC_RT1015P: 430 sof_rt1015p_dai_link(&links[id]); 431 break; 432 case CODEC_RT1019P: 433 sof_rt1019p_dai_link(&links[id]); 434 break; 435 default: 436 dev_err(dev, "invalid amp type %d\n", amp_type); 437 return NULL; 438 } 439 440 links[id].platforms = platform_component; 441 links[id].num_platforms = ARRAY_SIZE(platform_component); 442 links[id].dpcm_playback = 1; 443 /* feedback stream or firmware-generated echo reference */ 444 links[id].dpcm_capture = 1; 445 446 links[id].no_pcm = 1; 447 links[id].cpus = &cpus[id]; 448 links[id].num_cpus = 1; 449 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 450 "SSP%d Pin", 451 ssp_amp); 452 if (!links[id].cpus->dai_name) 453 goto devm_err; 454 id++; 455 } 456 457 /* BT audio offload */ 458 if (sof_nau8825_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { 459 int port = (sof_nau8825_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> 460 SOF_BT_OFFLOAD_SSP_SHIFT; 461 462 links[id].id = id; 463 links[id].cpus = &cpus[id]; 464 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 465 "SSP%d Pin", port); 466 if (!links[id].cpus->dai_name) 467 goto devm_err; 468 links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); 469 if (!links[id].name) 470 goto devm_err; 471 links[id].codecs = &asoc_dummy_dlc; 472 links[id].num_codecs = 1; 473 links[id].platforms = platform_component; 474 links[id].num_platforms = ARRAY_SIZE(platform_component); 475 links[id].dpcm_playback = 1; 476 links[id].dpcm_capture = 1; 477 links[id].no_pcm = 1; 478 links[id].num_cpus = 1; 479 } 480 481 return links; 482 devm_err: 483 return NULL; 484 } 485 486 static int sof_audio_probe(struct platform_device *pdev) 487 { 488 struct snd_soc_dai_link *dai_links; 489 struct snd_soc_acpi_mach *mach; 490 struct sof_card_private *ctx; 491 int dmic_be_num, hdmi_num; 492 int ret, ssp_amp, ssp_codec; 493 494 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 495 if (!ctx) 496 return -ENOMEM; 497 498 if (pdev->id_entry && pdev->id_entry->driver_data) 499 sof_nau8825_quirk = (unsigned long)pdev->id_entry->driver_data; 500 501 mach = pdev->dev.platform_data; 502 503 ctx->codec_type = sof_ssp_detect_codec_type(&pdev->dev); 504 ctx->amp_type = sof_ssp_detect_amp_type(&pdev->dev); 505 506 dev_dbg(&pdev->dev, "sof_nau8825_quirk = %lx\n", sof_nau8825_quirk); 507 508 /* default number of DMIC DAI's */ 509 dmic_be_num = 2; 510 hdmi_num = (sof_nau8825_quirk & SOF_NAU8825_NUM_HDMIDEV_MASK) >> 511 SOF_NAU8825_NUM_HDMIDEV_SHIFT; 512 /* default number of HDMI DAI's */ 513 if (!hdmi_num) 514 hdmi_num = 3; 515 516 ssp_amp = (sof_nau8825_quirk & SOF_NAU8825_SSP_AMP_MASK) >> 517 SOF_NAU8825_SSP_AMP_SHIFT; 518 519 ssp_codec = sof_nau8825_quirk & SOF_NAU8825_SSP_CODEC_MASK; 520 521 /* compute number of dai links */ 522 sof_audio_card_nau8825.num_links = 1 + dmic_be_num + hdmi_num; 523 524 if (ctx->amp_type != CODEC_NONE) 525 sof_audio_card_nau8825.num_links++; 526 527 if (sof_nau8825_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) 528 sof_audio_card_nau8825.num_links++; 529 530 dai_links = sof_card_dai_links_create(&pdev->dev, ctx->amp_type, 531 ssp_codec, ssp_amp, dmic_be_num, 532 hdmi_num); 533 if (!dai_links) 534 return -ENOMEM; 535 536 sof_audio_card_nau8825.dai_link = dai_links; 537 538 /* update codec_conf */ 539 switch (ctx->amp_type) { 540 case CODEC_MAX98373: 541 max_98373_set_codec_conf(&sof_audio_card_nau8825); 542 break; 543 case CODEC_RT1015P: 544 sof_rt1015p_codec_conf(&sof_audio_card_nau8825); 545 break; 546 case CODEC_NONE: 547 case CODEC_MAX98360A: 548 case CODEC_NAU8318: 549 case CODEC_RT1019P: 550 /* no codec conf required */ 551 break; 552 default: 553 dev_err(&pdev->dev, "invalid amp type %d\n", ctx->amp_type); 554 return -EINVAL; 555 } 556 557 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 558 559 sof_audio_card_nau8825.dev = &pdev->dev; 560 561 /* set platform name for each dailink */ 562 ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_nau8825, 563 mach->mach_params.platform); 564 if (ret) 565 return ret; 566 567 snd_soc_card_set_drvdata(&sof_audio_card_nau8825, ctx); 568 569 return devm_snd_soc_register_card(&pdev->dev, 570 &sof_audio_card_nau8825); 571 } 572 573 static const struct platform_device_id board_ids[] = { 574 { 575 .name = "sof_nau8825", 576 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 577 SOF_NAU8825_NUM_HDMIDEV(4) | 578 SOF_BT_OFFLOAD_SSP(2) | 579 SOF_SSP_BT_OFFLOAD_PRESENT), 580 581 }, 582 { 583 .name = "adl_rt1019p_8825", 584 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 585 SOF_NAU8825_SSP_AMP(2) | 586 SOF_NAU8825_NUM_HDMIDEV(4)), 587 }, 588 { 589 .name = "adl_max98373_8825", 590 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 591 SOF_NAU8825_SSP_AMP(1) | 592 SOF_NAU8825_NUM_HDMIDEV(4) | 593 SOF_BT_OFFLOAD_SSP(2) | 594 SOF_SSP_BT_OFFLOAD_PRESENT), 595 }, 596 { 597 /* The limitation of length of char array, shorten the name */ 598 .name = "adl_mx98360a_8825", 599 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 600 SOF_NAU8825_SSP_AMP(1) | 601 SOF_NAU8825_NUM_HDMIDEV(4) | 602 SOF_BT_OFFLOAD_SSP(2) | 603 SOF_SSP_BT_OFFLOAD_PRESENT), 604 605 }, 606 { 607 .name = "adl_rt1015p_8825", 608 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 609 SOF_NAU8825_SSP_AMP(1) | 610 SOF_NAU8825_NUM_HDMIDEV(4) | 611 SOF_BT_OFFLOAD_SSP(2) | 612 SOF_SSP_BT_OFFLOAD_PRESENT), 613 }, 614 { 615 .name = "adl_nau8318_8825", 616 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 617 SOF_NAU8825_SSP_AMP(1) | 618 SOF_NAU8825_NUM_HDMIDEV(4) | 619 SOF_BT_OFFLOAD_SSP(2) | 620 SOF_SSP_BT_OFFLOAD_PRESENT), 621 }, 622 { 623 .name = "rpl_max98373_8825", 624 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 625 SOF_NAU8825_SSP_AMP(1) | 626 SOF_NAU8825_NUM_HDMIDEV(4) | 627 SOF_BT_OFFLOAD_SSP(2) | 628 SOF_SSP_BT_OFFLOAD_PRESENT), 629 }, 630 { 631 .name = "rpl_nau8318_8825", 632 .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | 633 SOF_NAU8825_SSP_AMP(1) | 634 SOF_NAU8825_NUM_HDMIDEV(4) | 635 SOF_BT_OFFLOAD_SSP(2) | 636 SOF_SSP_BT_OFFLOAD_PRESENT), 637 }, 638 { } 639 }; 640 MODULE_DEVICE_TABLE(platform, board_ids); 641 642 static struct platform_driver sof_audio = { 643 .probe = sof_audio_probe, 644 .driver = { 645 .name = "sof_nau8825", 646 .pm = &snd_soc_pm_ops, 647 }, 648 .id_table = board_ids, 649 }; 650 module_platform_driver(sof_audio) 651 652 /* Module information */ 653 MODULE_DESCRIPTION("SOF Audio Machine driver for NAU8825"); 654 MODULE_AUTHOR("David Lin <ctlin0@nuvoton.com>"); 655 MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>"); 656 MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>"); 657 MODULE_LICENSE("GPL"); 658 MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON); 659 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON); 660 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_NUVOTON_COMMON); 661 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_REALTEK_COMMON); 662 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_SSP_COMMON); 663