Lines Matching +full:analog +full:- +full:out
1 // SPDX-License-Identifier: GPL-2.0-only
6 #include "../common/soc-intel-quirks.h"
15 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in hdmi_init()
18 ctx->hdmi.hdmi_comp = dai->component; in hdmi_init()
27 if (!ctx->hdmi_num) in sof_intel_board_card_late_probe()
30 if (!ctx->hdmi.idisp_codec) in sof_intel_board_card_late_probe()
33 if (!ctx->hdmi.hdmi_comp) in sof_intel_board_card_late_probe()
34 return -EINVAL; in sof_intel_board_card_late_probe()
36 return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp); in sof_intel_board_card_late_probe()
53 struct snd_soc_card *card = rtd->card; in dmic_init()
56 ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets, in dmic_init()
59 dev_err(rtd->dev, "fail to add dmic widgets, ret %d\n", ret); in dmic_init()
63 ret = snd_soc_dapm_add_routes(&card->dapm, dmic_routes, in dmic_init()
66 dev_err(rtd->dev, "fail to add dmic routes, ret %d\n", ret); in dmic_init()
77 SND_SOC_DAPM_MIC("Analog In", NULL),
79 SND_SOC_DAPM_MIC("Alt Analog In", NULL),
81 SND_SOC_DAPM_HP("Analog Out", NULL),
82 SND_SOC_DAPM_SPK("Digital Out", NULL),
83 SND_SOC_DAPM_HP("Alt Analog Out", NULL),
87 { "Codec Input Pin1", NULL, "Analog In" },
89 { "Codec Input Pin3", NULL, "Alt Analog In" },
91 { "Analog Out", NULL, "Codec Output Pin1" },
92 { "Digital Out", NULL, "Codec Output Pin2" },
93 { "Alt Analog Out", NULL, "Codec Output Pin3" },
96 { "codec0_in", NULL, "Analog CPU Capture" },
97 { "Analog CPU Capture", NULL, "Analog Codec Capture" },
100 { "codec2_in", NULL, "Alt Analog CPU Capture" },
101 { "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" },
103 { "Analog Codec Playback", NULL, "Analog CPU Playback" },
104 { "Analog CPU Playback", NULL, "codec0_out" },
107 { "Alt Analog Codec Playback", NULL, "Alt Analog CPU Playback" },
108 { "Alt Analog CPU Playback", NULL, "codec2_out" },
113 struct snd_soc_card *card = rtd->card; in hda_init()
116 ret = snd_soc_dapm_new_controls(&card->dapm, hda_widgets, in hda_init()
119 dev_err(rtd->dev, "fail to add hda widgets, ret %d\n", ret); in hda_init()
123 ret = snd_soc_dapm_add_routes(&card->dapm, hda_routes, in hda_init()
126 dev_err(rtd->dev, "fail to add hda routes, ret %d\n", ret); in hda_init()
156 .name = "dmic-codec",
157 .dai_name = "dmic-hifi",
162 DAILINK_COMP_ARRAY(COMP_CPU("Analog CPU DAI")));
164 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D0", "Analog Codec DAI")));
188 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_codec); in set_ssp_codec_link()
189 if (!link->name) in set_ssp_codec_link()
190 return -ENOMEM; in set_ssp_codec_link()
196 return -ENOMEM; in set_ssp_codec_link()
199 /* backward-compatibility for BYT/CHT boards */ in set_ssp_codec_link()
200 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "ssp%d-port", in set_ssp_codec_link()
203 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", in set_ssp_codec_link()
206 if (!cpus->dai_name) in set_ssp_codec_link()
207 return -ENOMEM; in set_ssp_codec_link()
209 link->cpus = cpus; in set_ssp_codec_link()
210 link->num_cpus = 1; in set_ssp_codec_link()
212 /* codecs - caller to handle */ in set_ssp_codec_link()
215 link->platforms = platform_component; in set_ssp_codec_link()
216 link->num_platforms = ARRAY_SIZE(platform_component); in set_ssp_codec_link()
218 link->id = be_id; in set_ssp_codec_link()
219 link->no_pcm = 1; in set_ssp_codec_link()
220 link->dpcm_capture = 1; in set_ssp_codec_link()
221 link->dpcm_playback = 1; in set_ssp_codec_link()
235 return -ENOMEM; in set_dmic_link()
241 link->name = "dmic01"; in set_dmic_link()
242 cpus->dai_name = "DMIC01 Pin"; in set_dmic_link()
247 link->name = "dmic16k"; in set_dmic_link()
248 cpus->dai_name = "DMIC16k Pin"; in set_dmic_link()
252 return -EINVAL; in set_dmic_link()
255 link->cpus = cpus; in set_dmic_link()
256 link->num_cpus = 1; in set_dmic_link()
259 link->codecs = dmic_component; in set_dmic_link()
260 link->num_codecs = ARRAY_SIZE(dmic_component); in set_dmic_link()
263 link->platforms = platform_component; in set_dmic_link()
264 link->num_platforms = ARRAY_SIZE(platform_component); in set_dmic_link()
266 link->id = be_id; in set_dmic_link()
268 link->init = dmic_init; in set_dmic_link()
269 link->ignore_suspend = 1; in set_dmic_link()
270 link->no_pcm = 1; in set_dmic_link()
271 link->dpcm_capture = 1; in set_dmic_link()
285 link->name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", hdmi_id); in set_idisp_hdmi_link()
286 if (!link->name) in set_idisp_hdmi_link()
287 return -ENOMEM; in set_idisp_hdmi_link()
293 return -ENOMEM; in set_idisp_hdmi_link()
295 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", hdmi_id); in set_idisp_hdmi_link()
296 if (!cpus->dai_name) in set_idisp_hdmi_link()
297 return -ENOMEM; in set_idisp_hdmi_link()
299 link->cpus = cpus; in set_idisp_hdmi_link()
300 link->num_cpus = 1; in set_idisp_hdmi_link()
308 return -ENOMEM; in set_idisp_hdmi_link()
310 codecs->name = "ehdaudio0D2"; in set_idisp_hdmi_link()
311 codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, in set_idisp_hdmi_link()
312 "intel-hdmi-hifi%d", hdmi_id); in set_idisp_hdmi_link()
313 if (!codecs->dai_name) in set_idisp_hdmi_link()
314 return -ENOMEM; in set_idisp_hdmi_link()
316 link->codecs = codecs; in set_idisp_hdmi_link()
318 link->codecs = &snd_soc_dummy_dlc; in set_idisp_hdmi_link()
320 link->num_codecs = 1; in set_idisp_hdmi_link()
323 link->platforms = platform_component; in set_idisp_hdmi_link()
324 link->num_platforms = ARRAY_SIZE(platform_component); in set_idisp_hdmi_link()
326 link->id = be_id; in set_idisp_hdmi_link()
327 link->init = (hdmi_id == 1) ? hdmi_init : NULL; in set_idisp_hdmi_link()
328 link->no_pcm = 1; in set_idisp_hdmi_link()
329 link->dpcm_playback = 1; in set_idisp_hdmi_link()
344 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_amp); in set_ssp_amp_link()
345 if (!link->name) in set_ssp_amp_link()
346 return -ENOMEM; in set_ssp_amp_link()
352 return -ENOMEM; in set_ssp_amp_link()
354 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_amp); in set_ssp_amp_link()
355 if (!cpus->dai_name) in set_ssp_amp_link()
356 return -ENOMEM; in set_ssp_amp_link()
358 link->cpus = cpus; in set_ssp_amp_link()
359 link->num_cpus = 1; in set_ssp_amp_link()
361 /* codecs - caller to handle */ in set_ssp_amp_link()
364 link->platforms = platform_component; in set_ssp_amp_link()
365 link->num_platforms = ARRAY_SIZE(platform_component); in set_ssp_amp_link()
367 link->id = be_id; in set_ssp_amp_link()
368 link->no_pcm = 1; in set_ssp_amp_link()
369 link->dpcm_capture = 1; /* feedback stream or firmware-generated echo reference */ in set_ssp_amp_link()
370 link->dpcm_playback = 1; in set_ssp_amp_link()
383 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", ssp_bt); in set_bt_offload_link()
384 if (!link->name) in set_bt_offload_link()
385 return -ENOMEM; in set_bt_offload_link()
391 return -ENOMEM; in set_bt_offload_link()
393 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_bt); in set_bt_offload_link()
394 if (!cpus->dai_name) in set_bt_offload_link()
395 return -ENOMEM; in set_bt_offload_link()
397 link->cpus = cpus; in set_bt_offload_link()
398 link->num_cpus = 1; in set_bt_offload_link()
401 link->codecs = &snd_soc_dummy_dlc; in set_bt_offload_link()
402 link->num_codecs = 1; in set_bt_offload_link()
405 link->platforms = platform_component; in set_bt_offload_link()
406 link->num_platforms = ARRAY_SIZE(platform_component); in set_bt_offload_link()
408 link->id = be_id; in set_bt_offload_link()
409 link->no_pcm = 1; in set_bt_offload_link()
410 link->dpcm_capture = 1; in set_bt_offload_link()
411 link->dpcm_playback = 1; in set_bt_offload_link()
421 dev_dbg(dev, "link %d: hdmi-in, ssp %d\n", be_id, ssp_hdmi); in set_hdmi_in_link()
424 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-HDMI", ssp_hdmi); in set_hdmi_in_link()
425 if (!link->name) in set_hdmi_in_link()
426 return -ENOMEM; in set_hdmi_in_link()
432 return -ENOMEM; in set_hdmi_in_link()
434 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_hdmi); in set_hdmi_in_link()
435 if (!cpus->dai_name) in set_hdmi_in_link()
436 return -ENOMEM; in set_hdmi_in_link()
438 link->cpus = cpus; in set_hdmi_in_link()
439 link->num_cpus = 1; in set_hdmi_in_link()
442 link->codecs = &snd_soc_dummy_dlc; in set_hdmi_in_link()
443 link->num_codecs = 1; in set_hdmi_in_link()
446 link->platforms = platform_component; in set_hdmi_in_link()
447 link->num_platforms = ARRAY_SIZE(platform_component); in set_hdmi_in_link()
449 link->id = be_id; in set_hdmi_in_link()
450 link->no_pcm = 1; in set_hdmi_in_link()
451 link->dpcm_capture = 1; in set_hdmi_in_link()
461 dev_dbg(dev, "link %d: hda analog\n", be_id); in set_hda_codec_link()
463 link->name = "Analog Playback and Capture"; in set_hda_codec_link()
466 link->cpus = hda_analog_cpus; in set_hda_codec_link()
467 link->num_cpus = ARRAY_SIZE(hda_analog_cpus); in set_hda_codec_link()
470 link->codecs = hda_analog_codecs; in set_hda_codec_link()
471 link->num_codecs = ARRAY_SIZE(hda_analog_codecs); in set_hda_codec_link()
476 link->name = "Digital Playback and Capture"; in set_hda_codec_link()
479 link->cpus = hda_digital_cpus; in set_hda_codec_link()
480 link->num_cpus = ARRAY_SIZE(hda_digital_cpus); in set_hda_codec_link()
483 link->codecs = hda_digital_codecs; in set_hda_codec_link()
484 link->num_codecs = ARRAY_SIZE(hda_digital_codecs); in set_hda_codec_link()
488 return -EINVAL; in set_hda_codec_link()
492 link->platforms = platform_component; in set_hda_codec_link()
493 link->num_platforms = ARRAY_SIZE(platform_component); in set_hda_codec_link()
495 link->id = be_id; in set_hda_codec_link()
497 link->init = hda_init; in set_hda_codec_link()
498 link->no_pcm = 1; in set_hda_codec_link()
499 link->dpcm_capture = 1; in set_hda_codec_link()
500 link->dpcm_playback = 1; in set_hda_codec_link()
510 if (ctx->codec_type != CODEC_NONE) in calculate_num_links()
514 if (ctx->dmic_be_num > 0) in calculate_num_links()
517 if (ctx->dmic_be_num > 1) in calculate_num_links()
521 num_links += ctx->hdmi_num; in calculate_num_links()
524 if (ctx->amp_type != CODEC_NONE) in calculate_num_links()
528 if (ctx->bt_offload_present) in calculate_num_links()
531 /* HDMI-In */ in calculate_num_links()
532 num_links += hweight32(ctx->ssp_mask_hdmi_in); in calculate_num_links()
535 if (ctx->hda_codec_present) in calculate_num_links()
558 return -ENOMEM; in sof_intel_board_set_dai_link()
560 if (ctx->link_order_overwrite) in sof_intel_board_set_dai_link()
561 link_order = ctx->link_order_overwrite; in sof_intel_board_set_dai_link()
565 if (ctx->link_id_overwrite) in sof_intel_board_set_dai_link()
566 link_ids = ctx->link_id_overwrite; in sof_intel_board_set_dai_link()
577 if (ctx->link_id_overwrite) { in sof_intel_board_set_dai_link()
588 if (ctx->codec_type == CODEC_NONE) in sof_intel_board_set_dai_link()
592 ctx->codec_type, ctx->ssp_codec); in sof_intel_board_set_dai_link()
599 ctx->codec_link = &links[idx]; in sof_intel_board_set_dai_link()
604 if (ctx->dmic_be_num == 0) in sof_intel_board_set_dai_link()
619 if (ctx->dmic_be_num <= 1) in sof_intel_board_set_dai_link()
635 for (i = 1; i <= ctx->hdmi_num; i++) { in sof_intel_board_set_dai_link()
638 ctx->hdmi.idisp_codec); in sof_intel_board_set_dai_link()
651 if (ctx->amp_type == CODEC_NONE) in sof_intel_board_set_dai_link()
655 ctx->amp_type, ctx->ssp_amp); in sof_intel_board_set_dai_link()
662 ctx->amp_link = &links[idx]; in sof_intel_board_set_dai_link()
667 if (!ctx->bt_offload_present) in sof_intel_board_set_dai_link()
671 ctx->ssp_bt); in sof_intel_board_set_dai_link()
681 /* HDMI-In */ in sof_intel_board_set_dai_link()
682 for_each_set_bit(ssp_hdmi_in, &ctx->ssp_mask_hdmi_in, 32) { in sof_intel_board_set_dai_link()
686 dev_err(dev, "fail to set hdmi-in link, ret %d\n", in sof_intel_board_set_dai_link()
697 if (!ctx->hda_codec_present) in sof_intel_board_set_dai_link()
703 dev_err(dev, "fail to set hda analog link, ret %d\n", in sof_intel_board_set_dai_link()
726 return -EINVAL; in sof_intel_board_set_dai_link()
733 return -EINVAL; in sof_intel_board_set_dai_link()
736 card->dai_link = links; in sof_intel_board_set_dai_link()
737 card->num_links = num_links; in sof_intel_board_set_dai_link()
754 ctx->codec_type = snd_soc_acpi_intel_detect_codec_type(dev); in sof_intel_board_get_ctx()
755 ctx->amp_type = snd_soc_acpi_intel_detect_amp_type(dev); in sof_intel_board_get_ctx()
757 ctx->dmic_be_num = 2; in sof_intel_board_get_ctx()
758 ctx->hdmi_num = (board_quirk & SOF_NUM_IDISP_HDMI_MASK) >> in sof_intel_board_get_ctx()
761 if (!ctx->hdmi_num) in sof_intel_board_get_ctx()
762 ctx->hdmi_num = 3; in sof_intel_board_get_ctx()
765 if (ctx->codec_type != CODEC_NONE) in sof_intel_board_get_ctx()
766 ctx->ssp_codec = (board_quirk & SOF_SSP_PORT_CODEC_MASK) >> in sof_intel_board_get_ctx()
769 if (ctx->amp_type != CODEC_NONE) in sof_intel_board_get_ctx()
770 ctx->ssp_amp = (board_quirk & SOF_SSP_PORT_AMP_MASK) >> in sof_intel_board_get_ctx()
774 ctx->bt_offload_present = true; in sof_intel_board_get_ctx()
775 ctx->ssp_bt = (board_quirk & SOF_SSP_PORT_BT_OFFLOAD_MASK) >> in sof_intel_board_get_ctx()
779 ctx->ssp_mask_hdmi_in = (board_quirk & SOF_SSP_MASK_HDMI_CAPTURE_MASK) >> in sof_intel_board_get_ctx()