Lines Matching +full:dai +full:- +full:links
1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright(c) 2019-2020 Intel Corporation.
22 #include <sound/soc-acpi.h>
26 #include "../common/soc-intel-quirks.h"
88 sof_rt5682_quirk = (unsigned long)id->driver_data; in sof_rt5682_quirk_cb()
105 DMI_MATCH(DMI_PRODUCT_NAME, "UP-CHT01"),
160 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98373_ALC5682I_I2S_UP4"),
174 DMI_MATCH(DMI_OEM_STRING, "AUDIO-ADL_MAX98373_ALC5682I_I2S"),
187 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S"),
200 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S_4SPK"),
217 DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98360_ALC5682I_I2S_AMP_SSP2"),
243 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in sof_hdmi_init()
244 struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0); in sof_hdmi_init() local
247 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); in sof_hdmi_init()
249 return -ENOMEM; in sof_hdmi_init()
252 pcm->device = rtd->dai_link->id; in sof_hdmi_init()
253 pcm->codec_dai = dai; in sof_hdmi_init()
255 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); in sof_hdmi_init()
273 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in sof_rt5682_codec_init()
274 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; in sof_rt5682_codec_init()
304 ret = clk_prepare_enable(ctx->mclk); in sof_rt5682_codec_init()
306 clk_disable_unprepare(ctx->mclk); in sof_rt5682_codec_init()
308 ret = clk_set_rate(ctx->mclk, 19200000); in sof_rt5682_codec_init()
311 dev_err(rtd->dev, "unable to set MCLK rate\n"); in sof_rt5682_codec_init()
318 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", in sof_rt5682_codec_init()
322 &ctx->sof_headset, in sof_rt5682_codec_init()
326 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); in sof_rt5682_codec_init()
330 jack = &ctx->sof_headset; in sof_rt5682_codec_init()
332 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); in sof_rt5682_codec_init()
333 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); in sof_rt5682_codec_init()
334 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); in sof_rt5682_codec_init()
335 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); in sof_rt5682_codec_init()
339 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); in sof_rt5682_codec_init()
348 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; in sof_rt5682_codec_exit()
357 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in sof_rt5682_hw_params()
363 ret = clk_prepare_enable(ctx->mclk); in sof_rt5682_hw_params()
365 dev_err(rtd->dev, in sof_rt5682_hw_params()
382 dev_warn(rtd->dev, "configure wrong mclk in tplg, please use 24MHz.\n"); in sof_rt5682_hw_params()
417 dev_err(rtd->dev, "snd_soc_dai_set_pll err = %d\n", ret); in sof_rt5682_hw_params()
424 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); in sof_rt5682_hw_params()
433 dev_err(rtd->dev, "set TDM slot err:%d\n", ret); in sof_rt5682_hw_params()
455 struct snd_soc_dapm_context *dapm = &card->dapm; in sof_card_late_probe()
470 if (is_legacy_cpu || !ctx->idisp_codec) in sof_card_late_probe()
473 if (list_empty(&ctx->hdmi_pcm_list)) in sof_card_late_probe()
474 return -EINVAL; in sof_card_late_probe()
476 if (ctx->common_hdmi_codec_drv) { in sof_card_late_probe()
477 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, in sof_card_late_probe()
479 component = pcm->codec_dai->component; in sof_card_late_probe()
483 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { in sof_card_late_probe()
484 component = pcm->codec_dai->component; in sof_card_late_probe()
486 "HDMI/DP, pcm=%d Jack", pcm->device); in sof_card_late_probe()
488 SND_JACK_AVOUT, &pcm->hdmi_jack); in sof_card_late_probe()
493 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, in sof_card_late_probe()
494 &pcm->hdmi_jack); in sof_card_late_probe()
499 return hdac_hdmi_jack_port_init(component, &card->dapm); in sof_card_late_probe()
522 /* HP jack connectors - unknown if we have jack detection */
537 struct snd_soc_card *card = rtd->card; in dmic_init()
540 ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets, in dmic_init()
543 dev_err(card->dev, "DMic widget addition failed: %d\n", ret); in dmic_init()
548 ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map, in dmic_init()
552 dev_err(card->dev, "DMic map addition failed: %d\n", ret); in dmic_init()
559 .name = "rt5682", /* the sof- prefix is added by the core */
573 .name = "i2c-10EC5682:00",
574 .dai_name = "rt5682-aif1",
580 .name = "i2c-RTL5682:00",
581 .dai_name = "rt5682s-aif1",
587 .name = "dmic-codec",
588 .dai_name = "dmic-hifi",
594 .name = "snd-soc-dummy",
595 .dai_name = "snd-soc-dummy-dai",
610 struct snd_soc_dai_link *links; in sof_card_dai_links_create() local
613 links = devm_kcalloc(dev, sof_audio_card_rt5682.num_links, in sof_card_dai_links_create()
617 if (!links || !cpus) in sof_card_dai_links_create()
621 links[id].name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
622 "SSP%d-Codec", ssp_codec); in sof_card_dai_links_create()
623 if (!links[id].name) in sof_card_dai_links_create()
626 links[id].id = id; in sof_card_dai_links_create()
628 links[id].codecs = rt5682s_component; in sof_card_dai_links_create()
629 links[id].num_codecs = ARRAY_SIZE(rt5682s_component); in sof_card_dai_links_create()
631 links[id].codecs = rt5682_component; in sof_card_dai_links_create()
632 links[id].num_codecs = ARRAY_SIZE(rt5682_component); in sof_card_dai_links_create()
634 links[id].platforms = platform_component; in sof_card_dai_links_create()
635 links[id].num_platforms = ARRAY_SIZE(platform_component); in sof_card_dai_links_create()
636 links[id].init = sof_rt5682_codec_init; in sof_card_dai_links_create()
637 links[id].exit = sof_rt5682_codec_exit; in sof_card_dai_links_create()
638 links[id].ops = &sof_rt5682_ops; in sof_card_dai_links_create()
639 links[id].dpcm_playback = 1; in sof_card_dai_links_create()
640 links[id].dpcm_capture = 1; in sof_card_dai_links_create()
641 links[id].no_pcm = 1; in sof_card_dai_links_create()
642 links[id].cpus = &cpus[id]; in sof_card_dai_links_create()
643 links[id].num_cpus = 1; in sof_card_dai_links_create()
645 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
646 "ssp%d-port", in sof_card_dai_links_create()
648 if (!links[id].cpus->dai_name) in sof_card_dai_links_create()
660 links[id].ignore_pmdown_time = 1; in sof_card_dai_links_create()
661 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
664 if (!links[id].cpus->dai_name) in sof_card_dai_links_create()
672 links[id].name = "dmic01"; in sof_card_dai_links_create()
673 links[id].cpus = &cpus[id]; in sof_card_dai_links_create()
674 links[id].cpus->dai_name = "DMIC01 Pin"; in sof_card_dai_links_create()
675 links[id].init = dmic_init; in sof_card_dai_links_create()
677 /* set up 2 BE links at most */ in sof_card_dai_links_create()
678 links[id + 1].name = "dmic16k"; in sof_card_dai_links_create()
679 links[id + 1].cpus = &cpus[id + 1]; in sof_card_dai_links_create()
680 links[id + 1].cpus->dai_name = "DMIC16k Pin"; in sof_card_dai_links_create()
686 links[id].id = id; in sof_card_dai_links_create()
687 links[id].num_cpus = 1; in sof_card_dai_links_create()
688 links[id].codecs = dmic_component; in sof_card_dai_links_create()
689 links[id].num_codecs = ARRAY_SIZE(dmic_component); in sof_card_dai_links_create()
690 links[id].platforms = platform_component; in sof_card_dai_links_create()
691 links[id].num_platforms = ARRAY_SIZE(platform_component); in sof_card_dai_links_create()
692 links[id].ignore_suspend = 1; in sof_card_dai_links_create()
693 links[id].dpcm_capture = 1; in sof_card_dai_links_create()
694 links[id].no_pcm = 1; in sof_card_dai_links_create()
708 links[id].name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
710 if (!links[id].name) in sof_card_dai_links_create()
713 links[id].id = id; in sof_card_dai_links_create()
714 links[id].cpus = &cpus[id]; in sof_card_dai_links_create()
715 links[id].num_cpus = 1; in sof_card_dai_links_create()
716 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
718 if (!links[id].cpus->dai_name) in sof_card_dai_links_create()
722 idisp_components[i - 1].name = "ehdaudio0D2"; in sof_card_dai_links_create()
723 idisp_components[i - 1].dai_name = devm_kasprintf(dev, in sof_card_dai_links_create()
725 "intel-hdmi-hifi%d", in sof_card_dai_links_create()
727 if (!idisp_components[i - 1].dai_name) in sof_card_dai_links_create()
730 idisp_components[i - 1].name = "snd-soc-dummy"; in sof_card_dai_links_create()
731 idisp_components[i - 1].dai_name = "snd-soc-dummy-dai"; in sof_card_dai_links_create()
734 links[id].codecs = &idisp_components[i - 1]; in sof_card_dai_links_create()
735 links[id].num_codecs = 1; in sof_card_dai_links_create()
736 links[id].platforms = platform_component; in sof_card_dai_links_create()
737 links[id].num_platforms = ARRAY_SIZE(platform_component); in sof_card_dai_links_create()
738 links[id].init = sof_hdmi_init; in sof_card_dai_links_create()
739 links[id].dpcm_playback = 1; in sof_card_dai_links_create()
740 links[id].no_pcm = 1; in sof_card_dai_links_create()
746 links[id].name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
747 "SSP%d-Codec", ssp_amp); in sof_card_dai_links_create()
748 if (!links[id].name) in sof_card_dai_links_create()
751 links[id].id = id; in sof_card_dai_links_create()
753 sof_rt1015_dai_link(&links[id]); in sof_card_dai_links_create()
755 sof_rt1015p_dai_link(&links[id]); in sof_card_dai_links_create()
757 sof_rt1019p_dai_link(&links[id]); in sof_card_dai_links_create()
760 links[id].codecs = max_98373_components; in sof_card_dai_links_create()
761 links[id].num_codecs = ARRAY_SIZE(max_98373_components); in sof_card_dai_links_create()
762 links[id].init = max_98373_spk_codec_init; in sof_card_dai_links_create()
763 links[id].ops = &max_98373_ops; in sof_card_dai_links_create()
765 links[id].dpcm_capture = 1; in sof_card_dai_links_create()
768 max_98360a_dai_link(&links[id]); in sof_card_dai_links_create()
771 sof_rt1011_dai_link(&links[id]); in sof_card_dai_links_create()
776 links[id].codecs = max_98390_4spk_components; in sof_card_dai_links_create()
777 links[id].num_codecs = ARRAY_SIZE(max_98390_4spk_components); in sof_card_dai_links_create()
779 links[id].codecs = max_98390_components; in sof_card_dai_links_create()
780 links[id].num_codecs = ARRAY_SIZE(max_98390_components); in sof_card_dai_links_create()
782 links[id].init = max_98390_spk_codec_init; in sof_card_dai_links_create()
783 links[id].ops = &max_98390_ops; in sof_card_dai_links_create()
784 links[id].dpcm_capture = 1; in sof_card_dai_links_create()
787 max_98357a_dai_link(&links[id]); in sof_card_dai_links_create()
789 links[id].platforms = platform_component; in sof_card_dai_links_create()
790 links[id].num_platforms = ARRAY_SIZE(platform_component); in sof_card_dai_links_create()
791 links[id].dpcm_playback = 1; in sof_card_dai_links_create()
792 links[id].no_pcm = 1; in sof_card_dai_links_create()
793 links[id].cpus = &cpus[id]; in sof_card_dai_links_create()
794 links[id].num_cpus = 1; in sof_card_dai_links_create()
796 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
797 "ssp%d-port", in sof_card_dai_links_create()
799 if (!links[id].cpus->dai_name) in sof_card_dai_links_create()
803 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
806 if (!links[id].cpus->dai_name) in sof_card_dai_links_create()
817 links[id].id = id; in sof_card_dai_links_create()
818 links[id].cpus = &cpus[id]; in sof_card_dai_links_create()
819 links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in sof_card_dai_links_create()
821 if (!links[id].cpus->dai_name) in sof_card_dai_links_create()
823 links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); in sof_card_dai_links_create()
824 if (!links[id].name) in sof_card_dai_links_create()
826 links[id].codecs = dummy_component; in sof_card_dai_links_create()
827 links[id].num_codecs = ARRAY_SIZE(dummy_component); in sof_card_dai_links_create()
828 links[id].platforms = platform_component; in sof_card_dai_links_create()
829 links[id].num_platforms = ARRAY_SIZE(platform_component); in sof_card_dai_links_create()
830 links[id].dpcm_playback = 1; in sof_card_dai_links_create()
831 links[id].dpcm_capture = 1; in sof_card_dai_links_create()
832 links[id].no_pcm = 1; in sof_card_dai_links_create()
833 links[id].num_cpus = 1; in sof_card_dai_links_create()
836 return links; in sof_card_dai_links_create()
849 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in sof_audio_probe()
851 return -ENOMEM; in sof_audio_probe()
853 if (pdev->id_entry && pdev->id_entry->driver_data) in sof_audio_probe()
854 sof_rt5682_quirk = (unsigned long)pdev->id_entry->driver_data; in sof_audio_probe()
858 mach = pdev->dev.platform_data; in sof_audio_probe()
863 if ((sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT) && !mach->quirk_data) in sof_audio_probe()
867 if (acpi_dev_present("RTL5682", NULL, -1)) in sof_audio_probe()
871 if (acpi_dev_present("RTL5682", NULL, -1)) in sof_audio_probe()
886 /* default number of HDMI DAI's */ in sof_audio_probe()
890 if (mach->mach_params.codec_mask & IDISP_CODEC_MASK) in sof_audio_probe()
891 ctx->idisp_codec = true; in sof_audio_probe()
896 ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); in sof_audio_probe()
897 if (IS_ERR(ctx->mclk)) { in sof_audio_probe()
898 ret = PTR_ERR(ctx->mclk); in sof_audio_probe()
900 dev_err(&pdev->dev, in sof_audio_probe()
906 ret = clk_prepare_enable(ctx->mclk); in sof_audio_probe()
908 dev_err(&pdev->dev, in sof_audio_probe()
914 dev_dbg(&pdev->dev, "sof_rt5682_quirk = %lx\n", sof_rt5682_quirk); in sof_audio_probe()
921 /* compute number of dai links */ in sof_audio_probe()
945 dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp, in sof_audio_probe()
946 dmic_be_num, hdmi_num, ctx->idisp_codec); in sof_audio_probe()
948 return -ENOMEM; in sof_audio_probe()
955 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); in sof_audio_probe()
957 sof_audio_card_rt5682.dev = &pdev->dev; in sof_audio_probe()
961 mach->mach_params.platform); in sof_audio_probe()
965 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; in sof_audio_probe()
969 return devm_snd_soc_register_card(&pdev->dev, in sof_audio_probe()