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

Merge series "ASoC: Intel: machine driver updates for 5.7" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Fix HDaudio/HDMI Kconfig dependencies, cleanup code, and add support
for 2 new configs (DA7219+Maxim 98360A and RT5692+RT1015)

Note that the last patch is the first case where we added the
Reviewed-by tags automagically from the list of GitHub
approvers. Feedback/comments welcome on the format, and thanks to
Ranjani for the nice script!

Changes since v1:
Change base to broonie/for-5.7
Rebase and fix for_each_codec_dais() macro in Patch 9.
Add new patch to remove GFP_ATOMIC

Guennadi Liakhovetski (3):
ASoC: codecs: hdac_hdmi: (cosmetic) remove redundant variable
initialisations
ASoC: Intel: skylake: (cosmetic) remove redundant variable
initialisations
ASoC: Intel: (cosmetic) simplify structure member access

Kai Vehmanen (4):
ASoC: Intel: boards: drop reverse deps for SND_HDA_CODEC_HDMI
ASoC: Intel: sof_pcm512x: drop reverse deps for SND_HDA_CODEC_HDMI
ASoC: Intel: sof_pcm512x: make HDMI optional for all platforms
ASoC: SOF: Intel: hda: remove SND_SOC_SOF_HDA_COMMON_HDMI_CODEC

Pierre-Louis Bossart (1):
ASoC: Intel: don't use GFP_ATOMIC for machine driver contexts

Yong Zhi (2):
ASoC: Intel: sof_da7219_max98373: Add support for max98360a speaker
amp
ASoC: Intel: sof_rt5682: Add rt1015 speaker amp support

sound/soc/codecs/hdac_hdmi.c | 6 +-
sound/soc/intel/boards/Kconfig | 20 ++--
sound/soc/intel/boards/bdw-rt5650.c | 2 +-
sound/soc/intel/boards/bdw-rt5677.c | 2 +-
sound/soc/intel/boards/broadwell.c | 2 +-
sound/soc/intel/boards/bxt_da7219_max98357a.c | 2 +-
sound/soc/intel/boards/bxt_rt298.c | 2 +-
sound/soc/intel/boards/bytcht_da7213.c | 2 +-
sound/soc/intel/boards/cht_bsw_max98090_ti.c | 2 +-
sound/soc/intel/boards/cht_bsw_nau8824.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 2 +-
sound/soc/intel/boards/cml_rt1011_rt5682.c | 4 +-
sound/soc/intel/boards/glk_rt5682_max98357a.c | 2 +-
sound/soc/intel/boards/haswell.c | 2 +-
sound/soc/intel/boards/kbl_rt5663_max98927.c | 2 +-
.../intel/boards/kbl_rt5663_rt5514_max98927.c | 2 +-
sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 +-
.../soc/intel/boards/skl_nau88l25_max98357a.c | 2 +-
sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 2 +-
sound/soc/intel/boards/sof_da7219_max98373.c | 78 +++++++++++--
sound/soc/intel/boards/sof_pcm512x.c | 38 ++++--
sound/soc/intel/boards/sof_rt5682.c | 110 +++++++++++++++++-
.../intel/common/soc-acpi-intel-jsl-match.c | 34 +++++-
sound/soc/intel/skylake/skl.c | 4 +-
sound/soc/sof/intel/Kconfig | 11 --
sound/soc/sof/intel/hda.c | 3 +-
26 files changed, 269 insertions(+), 71 deletions(-)

base-commit: 101247a3b86e1cc0e382b7e887a56176290fc957
--
2.20.1

+269 -71
+3 -3
sound/soc/codecs/hdac_hdmi.c
··· 1998 1998 1999 1999 static int hdac_hdmi_dev_probe(struct hdac_device *hdev) 2000 2000 { 2001 - struct hdac_hdmi_priv *hdmi_priv = NULL; 2001 + struct hdac_hdmi_priv *hdmi_priv; 2002 2002 struct snd_soc_dai_driver *hdmi_dais = NULL; 2003 - struct hdac_ext_link *hlink = NULL; 2003 + struct hdac_ext_link *hlink; 2004 2004 int num_dais = 0; 2005 - int ret = 0; 2005 + int ret; 2006 2006 struct hdac_driver *hdrv = drv_to_hdac_driver(hdev->dev.driver); 2007 2007 const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv); 2008 2008
+11 -9
sound/soc/intel/boards/Kconfig
··· 289 289 select SND_SOC_DA7219 290 290 select SND_SOC_MAX98357A 291 291 select SND_SOC_DMIC 292 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 293 292 select SND_SOC_HDAC_HDMI 294 293 295 294 config SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON ··· 301 302 tristate "Broxton with DA7219 and MAX98357A in I2S Mode" 302 303 depends on I2C && ACPI 303 304 depends on MFD_INTEL_LPSS || COMPILE_TEST 305 + depends on SND_HDA_CODEC_HDMI 304 306 select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON 305 307 help 306 308 This adds support for ASoC machine driver for Broxton-P platforms ··· 402 402 tristate "GLK with DA7219 and MAX98357A in I2S Mode" 403 403 depends on I2C && ACPI 404 404 depends on MFD_INTEL_LPSS || COMPILE_TEST 405 + depends on SND_HDA_CODEC_HDMI 405 406 select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON 406 407 help 407 408 This adds support for ASoC machine driver for Geminilake platforms ··· 414 413 tristate "GLK with RT5682 and MAX98357A in I2S Mode" 415 414 depends on I2C && ACPI 416 415 depends on MFD_INTEL_LPSS || COMPILE_TEST 416 + depends on SND_HDA_CODEC_HDMI 417 417 select SND_SOC_RT5682 418 418 select SND_SOC_MAX98357A 419 419 select SND_SOC_DMIC 420 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 421 420 select SND_SOC_HDAC_HDMI 422 421 help 423 422 This adds support for ASoC machine driver for Geminilake platforms ··· 431 430 432 431 config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH 433 432 tristate "SKL/KBL/BXT/APL with HDA Codecs" 434 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 433 + depends on SND_HDA_CODEC_HDMI 435 434 select SND_SOC_HDAC_HDMI 436 435 select SND_SOC_DMIC 437 436 # SND_SOC_HDAC_HDA is already selected ··· 449 448 depends on I2C && ACPI 450 449 depends on (SND_SOC_SOF_HDA_LINK && (MFD_INTEL_LPSS || COMPILE_TEST)) ||\ 451 450 (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST)) 451 + depends on SND_HDA_CODEC_HDMI 452 + select SND_SOC_RT1015 452 453 select SND_SOC_RT5682 453 454 select SND_SOC_DMIC 454 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 455 455 select SND_SOC_HDAC_HDMI 456 456 help 457 457 This adds support for ASoC machine driver for SOF platforms ··· 465 463 depends on I2C && ACPI 466 464 depends on (SND_SOC_SOF_HDA_AUDIO_CODEC && (MFD_INTEL_LPSS || COMPILE_TEST)) ||\ 467 465 (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST)) 466 + depends on SND_HDA_CODEC_HDMI 468 467 select SND_SOC_PCM512x_I2C 469 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 470 468 help 471 469 This adds support for ASoC machine driver for SOF platforms 472 470 with TI PCM512x I2S audio codec. ··· 492 490 tristate "CML with RT1011 and RT5682 in I2S Mode" 493 491 depends on I2C && ACPI 494 492 depends on MFD_INTEL_LPSS || COMPILE_TEST 493 + depends on SND_HDA_CODEC_HDMI 495 494 select SND_SOC_RT1011 496 495 select SND_SOC_RT5682 497 496 select SND_SOC_DMIC 498 497 select SND_SOC_HDAC_HDMI 499 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 500 498 help 501 499 This adds support for ASoC machine driver for SOF platform with 502 500 RT1011 + RT5682 I2S codec. ··· 508 506 if SND_SOC_SOF_JASPERLAKE 509 507 510 508 config SND_SOC_INTEL_SOF_DA7219_MAX98373_MACH 511 - tristate "SOF with DA7219 and MAX98373 in I2S Mode" 509 + tristate "SOF with DA7219 and MAX98373/MAX98360A in I2S Mode" 512 510 depends on I2C && ACPI 513 511 depends on MFD_INTEL_LPSS || COMPILE_TEST 512 + depends on SND_HDA_CODEC_HDMI 514 513 select SND_SOC_DA7219 515 514 select SND_SOC_MAX98373 516 515 select SND_SOC_DMIC 517 - select SND_HDA_CODEC_HDMI if SND_SOC_SOF_HDA_AUDIO_CODEC 518 516 help 519 517 This adds support for ASoC machine driver for SOF platforms 520 - with DA7219 + MAX98373 I2S audio codec. 518 + with DA7219 + MAX98373/MAX98360A I2S audio codec. 521 519 Say Y if you have such a device. 522 520 If unsure select "N". 523 521
+1 -1
sound/soc/intel/boards/bdw-rt5650.c
··· 298 298 return -ENOMEM; 299 299 300 300 /* override plaform name, if required */ 301 - mach = (&pdev->dev)->platform_data; 301 + mach = pdev->dev.platform_data; 302 302 ret = snd_soc_fixup_dai_links_platform_name(&bdw_rt5650_card, 303 303 mach->mach_params.platform); 304 304
+1 -1
sound/soc/intel/boards/bdw-rt5677.c
··· 412 412 } 413 413 414 414 /* override plaform name, if required */ 415 - mach = (&pdev->dev)->platform_data; 415 + mach = pdev->dev.platform_data; 416 416 ret = snd_soc_fixup_dai_links_platform_name(&bdw_rt5677_card, 417 417 mach->mach_params.platform); 418 418 if (ret)
+1 -1
sound/soc/intel/boards/broadwell.c
··· 283 283 broadwell_rt286.dev = &pdev->dev; 284 284 285 285 /* override plaform name, if required */ 286 - mach = (&pdev->dev)->platform_data; 286 + mach = pdev->dev.platform_data; 287 287 ret = snd_soc_fixup_dai_links_platform_name(&broadwell_rt286, 288 288 mach->mach_params.platform); 289 289 if (ret)
+1 -1
sound/soc/intel/boards/bxt_da7219_max98357a.c
··· 721 721 } 722 722 723 723 /* override plaform name, if required */ 724 - mach = (&pdev->dev)->platform_data; 724 + mach = pdev->dev.platform_data; 725 725 platform_name = mach->mach_params.platform; 726 726 727 727 ret = snd_soc_fixup_dai_links_platform_name(&broxton_audio_card,
+1 -1
sound/soc/intel/boards/bxt_rt298.c
··· 627 627 snd_soc_card_set_drvdata(card, ctx); 628 628 629 629 /* override plaform name, if required */ 630 - mach = (&pdev->dev)->platform_data; 630 + mach = pdev->dev.platform_data; 631 631 platform_name = mach->mach_params.platform; 632 632 633 633 ret = snd_soc_fixup_dai_links_platform_name(card,
+1 -1
sound/soc/intel/boards/bytcht_da7213.c
··· 231 231 int ret_val = 0; 232 232 int i; 233 233 234 - mach = (&pdev->dev)->platform_data; 234 + mach = pdev->dev.platform_data; 235 235 card = &bytcht_da7213_card; 236 236 card->dev = &pdev->dev; 237 237
+1 -1
sound/soc/intel/boards/cht_bsw_max98090_ti.c
··· 553 553 554 554 /* override plaform name, if required */ 555 555 snd_soc_card_cht.dev = &pdev->dev; 556 - mach = (&pdev->dev)->platform_data; 556 + mach = pdev->dev.platform_data; 557 557 platform_name = mach->mach_params.platform; 558 558 559 559 ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
+1 -1
sound/soc/intel/boards/cht_bsw_nau8824.c
··· 259 259 260 260 /* override plaform name, if required */ 261 261 snd_soc_card_cht.dev = &pdev->dev; 262 - mach = (&pdev->dev)->platform_data; 262 + mach = pdev->dev.platform_data; 263 263 platform_name = mach->mach_params.platform; 264 264 265 265 ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
+1 -1
sound/soc/intel/boards/cht_bsw_rt5645.c
··· 539 539 if (!drv) 540 540 return -ENOMEM; 541 541 542 - mach = (&pdev->dev)->platform_data; 542 + mach = pdev->dev.platform_data; 543 543 544 544 for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) { 545 545 if (acpi_dev_found(snd_soc_cards[i].codec_id) &&
+2 -2
sound/soc/intel/boards/cml_rt1011_rt5682.c
··· 446 446 const char *platform_name; 447 447 int ret; 448 448 449 - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC); 449 + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 450 450 if (!ctx) 451 451 return -ENOMEM; 452 452 453 453 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 454 - mach = (&pdev->dev)->platform_data; 454 + mach = pdev->dev.platform_data; 455 455 snd_soc_card_cml.dev = &pdev->dev; 456 456 platform_name = mach->mach_params.platform; 457 457
+1 -1
sound/soc/intel/boards/glk_rt5682_max98357a.c
··· 604 604 snd_soc_card_set_drvdata(card, ctx); 605 605 606 606 /* override plaform name, if required */ 607 - mach = (&pdev->dev)->platform_data; 607 + mach = pdev->dev.platform_data; 608 608 platform_name = mach->mach_params.platform; 609 609 610 610 ret = snd_soc_fixup_dai_links_platform_name(card, platform_name);
+1 -1
sound/soc/intel/boards/haswell.c
··· 193 193 haswell_rt5640.dev = &pdev->dev; 194 194 195 195 /* override plaform name, if required */ 196 - mach = (&pdev->dev)->platform_data; 196 + mach = pdev->dev.platform_data; 197 197 ret = snd_soc_fixup_dai_links_platform_name(&haswell_rt5640, 198 198 mach->mach_params.platform); 199 199 if (ret)
+1 -1
sound/soc/intel/boards/kbl_rt5663_max98927.c
··· 962 962 kabylake_audio_card->dev = &pdev->dev; 963 963 snd_soc_card_set_drvdata(kabylake_audio_card, ctx); 964 964 965 - mach = (&pdev->dev)->platform_data; 965 + mach = pdev->dev.platform_data; 966 966 if (mach) 967 967 dmic_constraints = mach->mach_params.dmic_num == 2 ? 968 968 &constraints_dmic_2ch : &constraints_dmic_channels;
+1 -1
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
··· 772 772 kabylake_audio_card.dev = &pdev->dev; 773 773 snd_soc_card_set_drvdata(&kabylake_audio_card, ctx); 774 774 775 - mach = (&pdev->dev)->platform_data; 775 + mach = pdev->dev.platform_data; 776 776 if (mach) 777 777 dmic_constraints = mach->mach_params.dmic_num == 2 ? 778 778 &constraints_dmic_2ch : &constraints_dmic_channels;
+1 -1
sound/soc/intel/boards/skl_hda_dsp_generic.c
··· 182 182 183 183 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 184 184 185 - mach = (&pdev->dev)->platform_data; 185 + mach = pdev->dev.platform_data; 186 186 if (!mach) 187 187 return -EINVAL; 188 188
+1 -1
sound/soc/intel/boards/skl_nau88l25_max98357a.c
··· 660 660 skylake_audio_card.dev = &pdev->dev; 661 661 snd_soc_card_set_drvdata(&skylake_audio_card, ctx); 662 662 663 - mach = (&pdev->dev)->platform_data; 663 + mach = pdev->dev.platform_data; 664 664 if (mach) 665 665 dmic_constraints = mach->mach_params.dmic_num == 2 ? 666 666 &constraints_dmic_2ch : &constraints_dmic_channels;
+1 -1
sound/soc/intel/boards/skl_nau88l25_ssm4567.c
··· 703 703 skylake_audio_card.dev = &pdev->dev; 704 704 snd_soc_card_set_drvdata(&skylake_audio_card, ctx); 705 705 706 - mach = (&pdev->dev)->platform_data; 706 + mach = pdev->dev.platform_data; 707 707 if (mach) 708 708 dmic_constraints = mach->mach_params.dmic_num == 2 ? 709 709 &constraints_dmic_2ch : &constraints_dmic_channels;
+69 -9
sound/soc/intel/boards/sof_da7219_max98373.c
··· 2 2 // Copyright(c) 2019 Intel Corporation. 3 3 4 4 /* 5 - * Intel SOF Machine driver for DA7219 + MAX98373 codec 5 + * Intel SOF Machine driver for DA7219 + MAX98373/MAX98360A codec 6 6 */ 7 7 8 8 #include <linux/input.h> ··· 69 69 SOC_DAPM_PIN_SWITCH("Right Spk"), 70 70 }; 71 71 72 + static const struct snd_kcontrol_new m98360a_controls[] = { 73 + SOC_DAPM_PIN_SWITCH("Headphone Jack"), 74 + SOC_DAPM_PIN_SWITCH("Headset Mic"), 75 + }; 76 + 72 77 static const struct snd_soc_dapm_widget widgets[] = { 73 78 SND_SOC_DAPM_HP("Headphone Jack", NULL), 74 79 SND_SOC_DAPM_MIC("Headset Mic", NULL), 75 - SND_SOC_DAPM_SPK("Left Spk", NULL), 76 - SND_SOC_DAPM_SPK("Right Spk", NULL), 77 80 SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, 78 81 platform_clock_control, SND_SOC_DAPM_POST_PMD | 79 82 SND_SOC_DAPM_PRE_PMU), ··· 86 83 { "Headphone Jack", NULL, "HPL" }, 87 84 { "Headphone Jack", NULL, "HPR" }, 88 85 89 - { "Left Spk", NULL, "Left BE_OUT" }, 90 - { "Right Spk", NULL, "Right BE_OUT" }, 91 - 92 86 { "MIC", NULL, "Headset Mic" }, 93 87 94 88 { "Headphone Jack", NULL, "Platform Clock" }, 95 89 { "Headset Mic", NULL, "Platform Clock" }, 90 + }; 91 + 92 + /* For MAX98373 amp */ 93 + static const struct snd_soc_dapm_widget max98373_widgets[] = { 94 + SND_SOC_DAPM_SPK("Left Spk", NULL), 95 + SND_SOC_DAPM_SPK("Right Spk", NULL), 96 + }; 97 + 98 + static const struct snd_soc_dapm_route max98373_map[] = { 99 + { "Left Spk", NULL, "Left BE_OUT" }, 100 + { "Right Spk", NULL, "Right BE_OUT" }, 96 101 }; 97 102 98 103 static struct snd_soc_jack headset; ··· 142 131 da7219_aad_jack_det(component, jack); 143 132 144 133 return ret; 134 + } 135 + 136 + static int speaker_amp_init(struct snd_soc_pcm_runtime *rtd) 137 + { 138 + int ret; 139 + 140 + /* Add widgets */ 141 + ret = snd_soc_dapm_new_controls(&rtd->card->dapm, max98373_widgets, 142 + ARRAY_SIZE(max98373_widgets)); 143 + if (ret) 144 + return ret; 145 + 146 + /* Add routes */ 147 + return snd_soc_dapm_add_routes(&rtd->card->dapm, max98373_map, 148 + ARRAY_SIZE(max98373_map)); 145 149 } 146 150 147 151 static int ssp1_hw_params(struct snd_pcm_substream *substream, ··· 249 223 DAILINK_COMP_ARRAY( 250 224 /* Left */ COMP_CODEC(MAXIM_DEV0_NAME, MAX98373_CODEC_DAI), 251 225 /* Right */ COMP_CODEC(MAXIM_DEV1_NAME, MAX98373_CODEC_DAI))); 226 + /* For the driver-less spk amp */ 227 + SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY())); 252 228 253 229 SND_SOC_DAILINK_DEF(dmic_pin, 254 230 DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin"))); ··· 282 254 .id = 0, 283 255 .ignore_pmdown_time = 1, 284 256 .no_pcm = 1, 257 + .init = speaker_amp_init, 285 258 .dpcm_playback = 1, 286 259 .dpcm_capture = 1, /* IV feedback */ 287 260 .ops = &ssp1_ops, ··· 349 320 .late_probe = card_late_probe, 350 321 }; 351 322 323 + static struct snd_soc_card card_da7219_m98360a = { 324 + .name = "da7219max98360a", 325 + .owner = THIS_MODULE, 326 + .dai_link = dais, 327 + .num_links = ARRAY_SIZE(dais), 328 + .controls = m98360a_controls, 329 + .num_controls = ARRAY_SIZE(m98360a_controls), 330 + .dapm_widgets = widgets, 331 + .num_dapm_widgets = ARRAY_SIZE(widgets), 332 + .dapm_routes = audio_map, 333 + .num_dapm_routes = ARRAY_SIZE(audio_map), 334 + .fully_routed = true, 335 + .late_probe = card_late_probe, 336 + }; 337 + 352 338 static int audio_probe(struct platform_device *pdev) 353 339 { 354 340 static struct snd_soc_card *card; ··· 371 327 struct card_private *ctx; 372 328 int ret; 373 329 374 - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC); 330 + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 375 331 if (!ctx) 376 332 return -ENOMEM; 333 + 334 + /* By default dais[0] is configured for max98373 */ 335 + if (!strcmp(pdev->name, "sof_da7219_max98360a")) { 336 + dais[0] = (struct snd_soc_dai_link) { 337 + .name = "SSP1-Codec", 338 + .id = 0, 339 + .no_pcm = 1, 340 + .dpcm_playback = 1, 341 + .ignore_pmdown_time = 1, 342 + SND_SOC_DAILINK_REG(ssp1_pin, dummy, platform) }; 343 + } 377 344 378 345 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 379 346 card = (struct snd_soc_card *)pdev->id_entry->driver_data; 380 347 card->dev = &pdev->dev; 381 348 382 - mach = (&pdev->dev)->platform_data; 349 + mach = pdev->dev.platform_data; 383 350 ret = snd_soc_fixup_dai_links_platform_name(card, 384 351 mach->mach_params.platform); 385 352 if (ret) ··· 406 351 .name = "sof_da7219_max98373", 407 352 .driver_data = (kernel_ulong_t)&card_da7219_m98373, 408 353 }, 354 + { 355 + .name = "sof_da7219_max98360a", 356 + .driver_data = (kernel_ulong_t)&card_da7219_m98360a, 357 + }, 409 358 { } 410 359 }; 411 360 412 361 static struct platform_driver audio = { 413 362 .probe = audio_probe, 414 363 .driver = { 415 - .name = "sof_da7219_max98373", 364 + .name = "sof_da7219_max98_360a_373", 416 365 .pm = &snd_soc_pm_ops, 417 366 }, 418 367 .id_table = board_ids, ··· 427 368 MODULE_DESCRIPTION("ASoC Intel(R) SOF Machine driver"); 428 369 MODULE_AUTHOR("Yong Zhi <yong.zhi@intel.com>"); 429 370 MODULE_LICENSE("GPL v2"); 371 + MODULE_ALIAS("platform:sof_da7219_max98360a"); 430 372 MODULE_ALIAS("platform:sof_da7219_max98373");
+29 -9
sound/soc/intel/boards/sof_pcm512x.c
··· 27 27 #define SOF_PCM512X_SSP_CODEC(quirk) ((quirk) & GENMASK(3, 0)) 28 28 #define SOF_PCM512X_SSP_CODEC_MASK (GENMASK(3, 0)) 29 29 30 + #define IDISP_CODEC_MASK 0x4 31 + 30 32 /* Default: SSP5 */ 31 33 static unsigned long sof_pcm512x_quirk = SOF_PCM512X_SSP_CODEC(5); 32 34 ··· 42 40 43 41 struct sof_card_private { 44 42 struct list_head hdmi_pcm_list; 43 + bool idisp_codec; 45 44 }; 46 45 47 46 static int sof_pcm512x_quirk_cb(const struct dmi_system_id *id) ··· 139 136 if (list_empty(&ctx->hdmi_pcm_list)) 140 137 return -EINVAL; 141 138 139 + if (!ctx->idisp_codec) 140 + return 0; 141 + 142 142 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head); 143 143 144 144 return hda_dsp_hdmi_build_controls(card, pcm->codec_dai->component); ··· 220 214 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, 221 215 int ssp_codec, 222 216 int dmic_be_num, 223 - int hdmi_num) 217 + int hdmi_num, 218 + bool idisp_codec) 224 219 { 225 220 struct snd_soc_dai_link_component *idisp_components; 226 221 struct snd_soc_dai_link_component *cpus; ··· 323 316 if (!links[id].cpus->dai_name) 324 317 goto devm_err; 325 318 326 - idisp_components[i - 1].name = "ehdaudio0D2"; 327 - idisp_components[i - 1].dai_name = devm_kasprintf(dev, 328 - GFP_KERNEL, 329 - "intel-hdmi-hifi%d", 330 - i); 319 + /* 320 + * topology cannot be loaded if codec is missing, so 321 + * use the dummy codec if needed 322 + */ 323 + if (idisp_codec) { 324 + idisp_components[i - 1].name = "ehdaudio0D2"; 325 + idisp_components[i - 1].dai_name = 326 + devm_kasprintf(dev, GFP_KERNEL, 327 + "intel-hdmi-hifi%d", i); 328 + } else { 329 + idisp_components[i - 1].name = "snd-soc-dummy"; 330 + idisp_components[i - 1].dai_name = "snd-soc-dummy-dai"; 331 + } 331 332 if (!idisp_components[i - 1].dai_name) 332 333 goto devm_err; 333 334 ··· 356 341 357 342 static int sof_audio_probe(struct platform_device *pdev) 358 343 { 344 + struct snd_soc_acpi_mach *mach = pdev->dev.platform_data; 359 345 struct snd_soc_dai_link *dai_links; 360 - struct snd_soc_acpi_mach *mach; 361 346 struct sof_card_private *ctx; 362 347 int dmic_be_num, hdmi_num; 363 348 int ret, ssp_codec; ··· 375 360 } else { 376 361 dmic_be_num = 2; 377 362 #if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) 363 + if (mach->mach_params.common_hdmi_codec_drv && 364 + (mach->mach_params.codec_mask & IDISP_CODEC_MASK)) 365 + ctx->idisp_codec = true; 366 + 367 + /* links are always present in topology */ 378 368 hdmi_num = 3; 379 369 #endif 380 370 } ··· 394 374 sof_audio_card_pcm512x.num_links = 1 + dmic_be_num + hdmi_num; 395 375 396 376 dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, 397 - dmic_be_num, hdmi_num); 377 + dmic_be_num, hdmi_num, 378 + ctx->idisp_codec); 398 379 if (!dai_links) 399 380 return -ENOMEM; 400 381 ··· 404 383 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 405 384 406 385 sof_audio_card_pcm512x.dev = &pdev->dev; 407 - mach = (&pdev->dev)->platform_data; 408 386 409 387 /* set platform name for each dailink */ 410 388 ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_pcm512x,
+104 -6
sound/soc/intel/boards/sof_rt5682.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - // Copyright(c) 2019 Intel Corporation. 2 + // Copyright(c) 2019-2020 Intel Corporation. 3 3 4 4 /* 5 5 * Intel SOF Machine Driver with Realtek rt5682 Codec 6 - * and speaker codec MAX98357A 6 + * and speaker codec MAX98357A or RT1015. 7 7 */ 8 8 #include <linux/i2c.h> 9 9 #include <linux/input.h> ··· 18 18 #include <sound/soc.h> 19 19 #include <sound/rt5682.h> 20 20 #include <sound/soc-acpi.h> 21 + #include "../../codecs/rt1015.h" 21 22 #include "../../codecs/rt5682.h" 22 23 #include "../../codecs/hdac_hdmi.h" 23 24 #include "../common/soc-intel-quirks.h" ··· 40 39 #define SOF_RT5682_NUM_HDMIDEV_MASK (GENMASK(12, 10)) 41 40 #define SOF_RT5682_NUM_HDMIDEV(quirk) \ 42 41 ((quirk << SOF_RT5682_NUM_HDMIDEV_SHIFT) & SOF_RT5682_NUM_HDMIDEV_MASK) 42 + #define SOF_RT1015_SPEAKER_AMP_PRESENT BIT(13) 43 43 44 44 /* Default: MCLK on, MCLK 19.2M, SSP0 */ 45 45 static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN | ··· 262 260 .hw_params = sof_rt5682_hw_params, 263 261 }; 264 262 263 + static int sof_rt1015_hw_params(struct snd_pcm_substream *substream, 264 + struct snd_pcm_hw_params *params) 265 + { 266 + struct snd_soc_pcm_runtime *rtd = substream->private_data; 267 + struct snd_soc_card *card = rtd->card; 268 + struct snd_soc_dai *codec_dai; 269 + int i, ret; 270 + 271 + if (!snd_soc_card_get_codec_dai(card, "rt1015-aif")) 272 + return 0; 273 + 274 + for_each_rtd_codec_dais(rtd, i, codec_dai) { 275 + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK, 276 + params_rate(params) * 50, 277 + params_rate(params) * 256); 278 + if (ret < 0) { 279 + dev_err(card->dev, "failed to set pll\n"); 280 + return ret; 281 + } 282 + /* Configure sysclk for codec */ 283 + ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL, 284 + params_rate(params) * 256, 285 + SND_SOC_CLOCK_IN); 286 + if (ret < 0) { 287 + dev_err(card->dev, "failed to set sysclk\n"); 288 + return ret; 289 + } 290 + } 291 + 292 + return 0; 293 + } 294 + 295 + static struct snd_soc_ops sof_rt1015_ops = { 296 + .hw_params = sof_rt1015_hw_params, 297 + }; 298 + 265 299 static struct snd_soc_dai_link_component platform_component[] = { 266 300 { 267 301 /* name might be overridden during probe */ ··· 354 316 SOC_DAPM_PIN_SWITCH("Headphone Jack"), 355 317 SOC_DAPM_PIN_SWITCH("Headset Mic"), 356 318 SOC_DAPM_PIN_SWITCH("Spk"), 319 + SOC_DAPM_PIN_SWITCH("Left Spk"), 320 + SOC_DAPM_PIN_SWITCH("Right Spk"), 321 + 357 322 }; 358 323 359 324 static const struct snd_soc_dapm_widget sof_widgets[] = { 360 325 SND_SOC_DAPM_HP("Headphone Jack", NULL), 361 326 SND_SOC_DAPM_MIC("Headset Mic", NULL), 362 327 SND_SOC_DAPM_SPK("Spk", NULL), 328 + SND_SOC_DAPM_SPK("Left Spk", NULL), 329 + SND_SOC_DAPM_SPK("Right Spk", NULL), 363 330 }; 364 331 365 332 static const struct snd_soc_dapm_widget dmic_widgets[] = { ··· 385 342 { "Spk", NULL, "Speaker" }, 386 343 }; 387 344 345 + static const struct snd_soc_dapm_route speaker_map_lr[] = { 346 + { "Left Spk", NULL, "Left SPO" }, 347 + { "Right Spk", NULL, "Right SPO" }, 348 + }; 349 + 388 350 static const struct snd_soc_dapm_route dmic_map[] = { 389 351 /* digital mics */ 390 352 {"DMic", NULL, "SoC DMIC"}, 391 353 }; 354 + 355 + static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd) 356 + { 357 + return snd_soc_dapm_add_routes(&rtd->card->dapm, speaker_map_lr, 358 + ARRAY_SIZE(speaker_map_lr)); 359 + } 392 360 393 361 static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd) 394 362 { ··· 436 382 return ret; 437 383 } 438 384 385 + static struct snd_soc_codec_conf rt1015_amp_conf[] = { 386 + { 387 + .dlc = COMP_CODEC_CONF("i2c-10EC1015:00"), 388 + .name_prefix = "Left", 389 + }, 390 + { 391 + .dlc = COMP_CODEC_CONF("i2c-10EC1015:01"), 392 + .name_prefix = "Right", 393 + }, 394 + }; 395 + 439 396 /* sof audio machine driver for rt5682 codec */ 440 397 static struct snd_soc_card sof_audio_card_rt5682 = { 441 398 .name = "rt5682", /* the sof- prefix is added by the core */ ··· 480 415 .name = "MX98357A:00", 481 416 .dai_name = "HiFi", 482 417 } 418 + }; 419 + 420 + static struct snd_soc_dai_link_component rt1015_components[] = { 421 + { 422 + .name = "i2c-10EC1015:00", 423 + .dai_name = "rt1015-aif", 424 + }, 425 + { 426 + .name = "i2c-10EC1015:01", 427 + .dai_name = "rt1015-aif", 428 + }, 483 429 }; 484 430 485 431 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ··· 632 556 goto devm_err; 633 557 634 558 links[id].id = id; 635 - links[id].codecs = max98357a_component; 636 - links[id].num_codecs = ARRAY_SIZE(max98357a_component); 559 + if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT) { 560 + links[id].codecs = rt1015_components; 561 + links[id].num_codecs = ARRAY_SIZE(rt1015_components); 562 + links[id].init = speaker_codec_init_lr; 563 + links[id].ops = &sof_rt1015_ops; 564 + } else { 565 + links[id].codecs = max98357a_component; 566 + links[id].num_codecs = ARRAY_SIZE(max98357a_component); 567 + links[id].init = speaker_codec_init; 568 + } 637 569 links[id].platforms = platform_component; 638 570 links[id].num_platforms = ARRAY_SIZE(platform_component); 639 - links[id].init = speaker_codec_init, 640 571 links[id].nonatomic = true; 641 572 links[id].dpcm_playback = 1; 642 573 links[id].no_pcm = 1; ··· 687 604 688 605 dmi_check_system(sof_rt5682_quirk_table); 689 606 690 - mach = (&pdev->dev)->platform_data; 607 + mach = pdev->dev.platform_data; 691 608 692 609 /* A speaker amp might not be present when the quirk claims one is. 693 610 * Detect this via whether the machine driver match includes quirk_data. ··· 752 669 753 670 sof_audio_card_rt5682.dai_link = dai_links; 754 671 672 + if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_PRESENT) { 673 + sof_audio_card_rt5682.codec_conf = rt1015_amp_conf; 674 + sof_audio_card_rt5682.num_configs = ARRAY_SIZE(rt1015_amp_conf); 675 + } 676 + 755 677 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); 756 678 757 679 sof_audio_card_rt5682.dev = &pdev->dev; ··· 802 714 SOF_RT5682_SSP_AMP(1) | 803 715 SOF_RT5682_NUM_HDMIDEV(4)), 804 716 }, 717 + { 718 + .name = "jsl_rt5682_rt1015", 719 + .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | 720 + SOF_RT5682_MCLK_24MHZ | 721 + SOF_RT5682_SSP_CODEC(0) | 722 + SOF_SPEAKER_AMP_PRESENT | 723 + SOF_RT1015_SPEAKER_AMP_PRESENT | 724 + SOF_RT5682_SSP_AMP(1)), 725 + }, 805 726 { } 806 727 }; 807 728 ··· 832 735 MODULE_LICENSE("GPL v2"); 833 736 MODULE_ALIAS("platform:sof_rt5682"); 834 737 MODULE_ALIAS("platform:tgl_max98357a_rt5682"); 738 + MODULE_ALIAS("platform:jsl_rt5682_rt1015");
+32 -2
sound/soc/intel/common/soc-acpi-intel-jsl-match.c
··· 2 2 /* 3 3 * soc-apci-intel-jsl-match.c - tables and support for JSL ACPI enumeration. 4 4 * 5 - * Copyright (c) 2019, Intel Corporation. 5 + * Copyright (c) 2019-2020, Intel Corporation. 6 6 * 7 7 */ 8 8 9 9 #include <sound/soc-acpi.h> 10 10 #include <sound/soc-acpi-intel-match.h> 11 11 12 + static struct snd_soc_acpi_codecs jsl_7219_98373_codecs = { 13 + .num_codecs = 1, 14 + .codecs = {"MX98373"} 15 + }; 16 + 17 + static struct snd_soc_acpi_codecs rt1015_spk = { 18 + .num_codecs = 1, 19 + .codecs = {"10EC1015"} 20 + }; 21 + 22 + /* 23 + * When adding new entry to the snd_soc_acpi_intel_jsl_machines array, 24 + * use .quirk_data member to distinguish different machine driver, 25 + * and keep ACPI .id field unchanged for the common codec. 26 + */ 12 27 struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = { 13 28 { 14 29 .id = "DLGS7219", 15 30 .drv_name = "sof_da7219_max98373", 16 - .machine_quirk = snd_soc_acpi_codec_list, 17 31 .sof_fw_filename = "sof-jsl.ri", 18 32 .sof_tplg_filename = "sof-jsl-da7219.tplg", 33 + .machine_quirk = snd_soc_acpi_codec_list, 34 + .quirk_data = &jsl_7219_98373_codecs, 35 + }, 36 + { 37 + .id = "DLGS7219", 38 + .drv_name = "sof_da7219_max98360a", 39 + .sof_fw_filename = "sof-jsl.ri", 40 + .sof_tplg_filename = "sof-jsl-da7219-mx98360a.tplg", 41 + }, 42 + { 43 + .id = "10EC5682", 44 + .drv_name = "jsl_rt5682_rt1015", 45 + .sof_fw_filename = "sof-jsl.ri", 46 + .machine_quirk = snd_soc_acpi_codec_list, 47 + .quirk_data = &rt1015_spk, 48 + .sof_tplg_filename = "sof-jsl-rt5682-rt1015.tplg", 19 49 }, 20 50 {}, 21 51 };
+2 -2
sound/soc/intel/skylake/skl.c
··· 359 359 struct pci_dev *pci = to_pci_dev(dev); 360 360 struct hdac_bus *bus = pci_get_drvdata(pci); 361 361 struct skl_dev *skl = bus_to_skl(bus); 362 - struct hdac_ext_link *hlink = NULL; 362 + struct hdac_ext_link *hlink; 363 363 int ret; 364 364 365 365 /* ··· 794 794 { 795 795 struct skl_dev *skl = container_of(work, struct skl_dev, probe_work); 796 796 struct hdac_bus *bus = skl_to_bus(skl); 797 - struct hdac_ext_link *hlink = NULL; 797 + struct hdac_ext_link *hlink; 798 798 int err; 799 799 800 800 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
-11
sound/soc/sof/intel/Kconfig
··· 324 324 Say Y if you want to enable DMI Link L1 325 325 If unsure, select "N". 326 326 327 - config SND_SOC_SOF_HDA_COMMON_HDMI_CODEC 328 - bool "SOF common HDA HDMI codec driver" 329 - depends on SND_SOC_SOF_HDA_LINK 330 - depends on SND_HDA_CODEC_HDMI 331 - default SND_HDA_CODEC_HDMI 332 - help 333 - This adds support for HDMI audio by using the common HDA 334 - HDMI/DisplayPort codec driver. 335 - Say Y if you want to use the common codec driver with SOF. 336 - If unsure select "Y". 337 - 338 327 endif ## SND_SOC_SOF_HDA_COMMON 339 328 340 329 config SND_SOC_SOF_HDA_LINK_BASELINE
+1 -2
sound/soc/sof/intel/hda.c
··· 54 54 module_param_named(dmic_num, hda_dmic_num, int, 0444); 55 55 MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number"); 56 56 57 - static bool hda_codec_use_common_hdmi = 58 - IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC); 57 + static bool hda_codec_use_common_hdmi = IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI); 59 58 module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444); 60 59 MODULE_PARM_DESC(use_common_hdmi, "SOF HDA use common HDMI codec driver"); 61 60 #endif