Lines Matching +full:dai +full:- +full:links

1 // SPDX-License-Identifier: GPL-2.0-only
20 #include <sound/soc-acpi.h>
21 #include <dt-bindings/sound/cs42l42.h>
23 #include "../common/soc-intel-quirks.h"
90 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in sof_hdmi_init()
91 struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0); in sof_hdmi_init() local
94 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); in sof_hdmi_init()
96 return -ENOMEM; in sof_hdmi_init()
99 pcm->device = rtd->dai_link->id; in sof_hdmi_init()
100 pcm->codec_dai = dai; in sof_hdmi_init()
102 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); in sof_hdmi_init()
109 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in sof_cs42l42_init()
110 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; in sof_cs42l42_init()
111 struct snd_soc_jack *jack = &ctx->headset_jack; in sof_cs42l42_init()
118 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", in sof_cs42l42_init()
126 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); in sof_cs42l42_init()
130 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); in sof_cs42l42_init()
131 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP); in sof_cs42l42_init()
132 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); in sof_cs42l42_init()
133 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); in sof_cs42l42_init()
137 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); in sof_cs42l42_init()
146 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; in sof_cs42l42_exit()
161 dev_err(rtd->dev, "get bclk freq failed: %d\n", clk_freq); in sof_cs42l42_hw_params()
162 return -EINVAL; in sof_cs42l42_hw_params()
169 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); in sof_cs42l42_hw_params()
193 if (list_empty(&ctx->hdmi_pcm_list)) in sof_card_late_probe()
194 return -EINVAL; in sof_card_late_probe()
196 if (ctx->common_hdmi_codec_drv) { in sof_card_late_probe()
197 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, in sof_card_late_probe()
199 component = pcm->codec_dai->component; in sof_card_late_probe()
203 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { in sof_card_late_probe()
204 component = pcm->codec_dai->component; in sof_card_late_probe()
206 "HDMI/DP, pcm=%d Jack", pcm->device); in sof_card_late_probe()
208 SND_JACK_AVOUT, &pcm->hdmi_jack); in sof_card_late_probe()
213 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, in sof_card_late_probe()
214 &pcm->hdmi_jack); in sof_card_late_probe()
219 return hdac_hdmi_jack_port_init(component, &card->dapm); in sof_card_late_probe()
237 /* HP jack connectors - unknown if we have jack detection */
251 struct snd_soc_card *card = rtd->card; in dmic_init()
254 ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets, in dmic_init()
257 dev_err(card->dev, "DMic widget addition failed: %d\n", ret); in dmic_init()
262 ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map, in dmic_init()
266 dev_err(card->dev, "DMic map addition failed: %d\n", ret); in dmic_init()
273 .name = "cs42l42", /* the sof- prefix is added by the core */
287 .name = "i2c-10134242:00",
294 .name = "dmic-codec",
295 .dai_name = "dmic-hifi",
301 .name = "snd-soc-dummy",
302 .dai_name = "snd-soc-dummy-dai",
307 struct snd_soc_dai_link *links, in create_spk_amp_dai_links() argument
317 links[*id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", in create_spk_amp_dai_links()
319 if (!links[*id].name) { in create_spk_amp_dai_links()
320 ret = -ENOMEM; in create_spk_amp_dai_links()
324 links[*id].id = *id; in create_spk_amp_dai_links()
327 max_98357a_dai_link(&links[*id]); in create_spk_amp_dai_links()
329 max_98360a_dai_link(&links[*id]); in create_spk_amp_dai_links()
332 ret = -EINVAL; in create_spk_amp_dai_links()
336 links[*id].platforms = platform_component; in create_spk_amp_dai_links()
337 links[*id].num_platforms = ARRAY_SIZE(platform_component); in create_spk_amp_dai_links()
338 links[*id].dpcm_playback = 1; in create_spk_amp_dai_links()
339 links[*id].no_pcm = 1; in create_spk_amp_dai_links()
340 links[*id].cpus = &cpus[*id]; in create_spk_amp_dai_links()
341 links[*id].num_cpus = 1; in create_spk_amp_dai_links()
343 links[*id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in create_spk_amp_dai_links()
345 if (!links[*id].cpus->dai_name) { in create_spk_amp_dai_links()
346 ret = -ENOMEM; in create_spk_amp_dai_links()
357 struct snd_soc_dai_link *links, in create_hp_codec_dai_links() argument
362 links[*id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", in create_hp_codec_dai_links()
364 if (!links[*id].name) in create_hp_codec_dai_links()
367 links[*id].id = *id; in create_hp_codec_dai_links()
368 links[*id].codecs = cs42l42_component; in create_hp_codec_dai_links()
369 links[*id].num_codecs = ARRAY_SIZE(cs42l42_component); in create_hp_codec_dai_links()
370 links[*id].platforms = platform_component; in create_hp_codec_dai_links()
371 links[*id].num_platforms = ARRAY_SIZE(platform_component); in create_hp_codec_dai_links()
372 links[*id].init = sof_cs42l42_init; in create_hp_codec_dai_links()
373 links[*id].exit = sof_cs42l42_exit; in create_hp_codec_dai_links()
374 links[*id].ops = &sof_cs42l42_ops; in create_hp_codec_dai_links()
375 links[*id].dpcm_playback = 1; in create_hp_codec_dai_links()
376 links[*id].dpcm_capture = 1; in create_hp_codec_dai_links()
377 links[*id].no_pcm = 1; in create_hp_codec_dai_links()
378 links[*id].cpus = &cpus[*id]; in create_hp_codec_dai_links()
379 links[*id].num_cpus = 1; in create_hp_codec_dai_links()
381 links[*id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in create_hp_codec_dai_links()
384 if (!links[*id].cpus->dai_name) in create_hp_codec_dai_links()
392 return -ENOMEM; in create_hp_codec_dai_links()
396 struct snd_soc_dai_link *links, in create_dmic_dai_links() argument
407 links[*id].name = "dmic01"; in create_dmic_dai_links()
408 links[*id].cpus = &cpus[*id]; in create_dmic_dai_links()
409 links[*id].cpus->dai_name = "DMIC01 Pin"; in create_dmic_dai_links()
410 links[*id].init = dmic_init; in create_dmic_dai_links()
412 /* set up 2 BE links at most */ in create_dmic_dai_links()
413 links[*id + 1].name = "dmic16k"; in create_dmic_dai_links()
414 links[*id + 1].cpus = &cpus[*id + 1]; in create_dmic_dai_links()
415 links[*id + 1].cpus->dai_name = "DMIC16k Pin"; in create_dmic_dai_links()
420 links[*id].id = *id; in create_dmic_dai_links()
421 links[*id].num_cpus = 1; in create_dmic_dai_links()
422 links[*id].codecs = dmic_component; in create_dmic_dai_links()
423 links[*id].num_codecs = ARRAY_SIZE(dmic_component); in create_dmic_dai_links()
424 links[*id].platforms = platform_component; in create_dmic_dai_links()
425 links[*id].num_platforms = ARRAY_SIZE(platform_component); in create_dmic_dai_links()
426 links[*id].ignore_suspend = 1; in create_dmic_dai_links()
427 links[*id].dpcm_capture = 1; in create_dmic_dai_links()
428 links[*id].no_pcm = 1; in create_dmic_dai_links()
437 struct snd_soc_dai_link *links, in create_hdmi_dai_links() argument
455 links[*id].name = devm_kasprintf(dev, GFP_KERNEL, in create_hdmi_dai_links()
457 if (!links[*id].name) in create_hdmi_dai_links()
460 links[*id].id = *id; in create_hdmi_dai_links()
461 links[*id].cpus = &cpus[*id]; in create_hdmi_dai_links()
462 links[*id].num_cpus = 1; in create_hdmi_dai_links()
463 links[*id].cpus->dai_name = devm_kasprintf(dev, in create_hdmi_dai_links()
467 if (!links[*id].cpus->dai_name) in create_hdmi_dai_links()
470 idisp_components[i - 1].name = "ehdaudio0D2"; in create_hdmi_dai_links()
471 idisp_components[i - 1].dai_name = devm_kasprintf(dev, in create_hdmi_dai_links()
473 "intel-hdmi-hifi%d", in create_hdmi_dai_links()
475 if (!idisp_components[i - 1].dai_name) in create_hdmi_dai_links()
478 links[*id].codecs = &idisp_components[i - 1]; in create_hdmi_dai_links()
479 links[*id].num_codecs = 1; in create_hdmi_dai_links()
480 links[*id].platforms = platform_component; in create_hdmi_dai_links()
481 links[*id].num_platforms = ARRAY_SIZE(platform_component); in create_hdmi_dai_links()
482 links[*id].init = sof_hdmi_init; in create_hdmi_dai_links()
483 links[*id].dpcm_playback = 1; in create_hdmi_dai_links()
484 links[*id].no_pcm = 1; in create_hdmi_dai_links()
492 return -ENOMEM; in create_hdmi_dai_links()
496 struct snd_soc_dai_link *links, in create_bt_offload_dai_links() argument
504 links[*id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", in create_bt_offload_dai_links()
506 if (!links[*id].name) in create_bt_offload_dai_links()
509 links[*id].id = *id; in create_bt_offload_dai_links()
510 links[*id].codecs = dummy_component; in create_bt_offload_dai_links()
511 links[*id].num_codecs = ARRAY_SIZE(dummy_component); in create_bt_offload_dai_links()
512 links[*id].platforms = platform_component; in create_bt_offload_dai_links()
513 links[*id].num_platforms = ARRAY_SIZE(platform_component); in create_bt_offload_dai_links()
515 links[*id].dpcm_playback = 1; in create_bt_offload_dai_links()
516 links[*id].dpcm_capture = 1; in create_bt_offload_dai_links()
517 links[*id].no_pcm = 1; in create_bt_offload_dai_links()
518 links[*id].cpus = &cpus[*id]; in create_bt_offload_dai_links()
519 links[*id].num_cpus = 1; in create_bt_offload_dai_links()
521 links[*id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in create_bt_offload_dai_links()
524 if (!links[*id].cpus->dai_name) in create_bt_offload_dai_links()
532 return -ENOMEM; in create_bt_offload_dai_links()
543 struct snd_soc_dai_link *links; in sof_card_dai_links_create() local
546 links = devm_kcalloc(dev, sof_audio_card_cs42l42.num_links, in sof_card_dai_links_create()
550 if (!links || !cpus) in sof_card_dai_links_create()
560 ret = create_hp_codec_dai_links(dev, links, cpus, &id, ssp_codec); in sof_card_dai_links_create()
562 dev_err(dev, "fail to create hp codec dai links, ret %d\n", in sof_card_dai_links_create()
568 ret = create_spk_amp_dai_links(dev, links, cpus, &id, ssp_amp); in sof_card_dai_links_create()
570 dev_err(dev, "fail to create spk amp dai links, ret %d\n", in sof_card_dai_links_create()
576 ret = create_dmic_dai_links(dev, links, cpus, &id, dmic_be_num); in sof_card_dai_links_create()
578 dev_err(dev, "fail to create dmic dai links, ret %d\n", in sof_card_dai_links_create()
584 ret = create_hdmi_dai_links(dev, links, cpus, &id, hdmi_num); in sof_card_dai_links_create()
586 dev_err(dev, "fail to create hdmi dai links, ret %d\n", in sof_card_dai_links_create()
592 ret = create_bt_offload_dai_links(dev, links, cpus, &id, ssp_bt); in sof_card_dai_links_create()
594 dev_err(dev, "fail to create bt offload dai links, ret %d\n", in sof_card_dai_links_create()
609 return links; in sof_card_dai_links_create()
622 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in sof_audio_probe()
624 return -ENOMEM; in sof_audio_probe()
626 if (pdev->id_entry && pdev->id_entry->driver_data) in sof_audio_probe()
627 sof_cs42l42_quirk = (unsigned long)pdev->id_entry->driver_data; in sof_audio_probe()
629 mach = pdev->dev.platform_data; in sof_audio_probe()
638 /* default number of HDMI DAI's */ in sof_audio_probe()
643 dev_dbg(&pdev->dev, "sof_cs42l42_quirk = %lx\n", sof_cs42l42_quirk); in sof_audio_probe()
653 /* compute number of dai links */ in sof_audio_probe()
661 dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp, in sof_audio_probe()
664 return -ENOMEM; in sof_audio_probe()
668 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); in sof_audio_probe()
670 sof_audio_card_cs42l42.dev = &pdev->dev; in sof_audio_probe()
674 mach->mach_params.platform); in sof_audio_probe()
678 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; in sof_audio_probe()
682 return devm_snd_soc_register_card(&pdev->dev, in sof_audio_probe()