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()
233 return -ENOMEM; in set_dmic_link()
239 link->name = "dmic01"; in set_dmic_link()
240 cpus->dai_name = "DMIC01 Pin"; in set_dmic_link()
245 link->name = "dmic16k"; in set_dmic_link()
246 cpus->dai_name = "DMIC16k Pin"; in set_dmic_link()
250 return -EINVAL; in set_dmic_link()
253 link->cpus = cpus; in set_dmic_link()
254 link->num_cpus = 1; in set_dmic_link()
257 link->codecs = dmic_component; in set_dmic_link()
258 link->num_codecs = ARRAY_SIZE(dmic_component); in set_dmic_link()
261 link->platforms = platform_component; in set_dmic_link()
262 link->num_platforms = ARRAY_SIZE(platform_component); in set_dmic_link()
264 link->id = be_id; in set_dmic_link()
266 link->init = dmic_init; in set_dmic_link()
267 link->ignore_suspend = 1; in set_dmic_link()
268 link->no_pcm = 1; in set_dmic_link()
269 link->capture_only = 1; in set_dmic_link()
283 link->name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", hdmi_id); in set_idisp_hdmi_link()
284 if (!link->name) in set_idisp_hdmi_link()
285 return -ENOMEM; in set_idisp_hdmi_link()
291 return -ENOMEM; in set_idisp_hdmi_link()
293 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", hdmi_id); in set_idisp_hdmi_link()
294 if (!cpus->dai_name) in set_idisp_hdmi_link()
295 return -ENOMEM; in set_idisp_hdmi_link()
297 link->cpus = cpus; in set_idisp_hdmi_link()
298 link->num_cpus = 1; in set_idisp_hdmi_link()
306 return -ENOMEM; in set_idisp_hdmi_link()
308 codecs->name = "ehdaudio0D2"; in set_idisp_hdmi_link()
309 codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, in set_idisp_hdmi_link()
310 "intel-hdmi-hifi%d", hdmi_id); in set_idisp_hdmi_link()
311 if (!codecs->dai_name) in set_idisp_hdmi_link()
312 return -ENOMEM; in set_idisp_hdmi_link()
314 link->codecs = codecs; in set_idisp_hdmi_link()
316 link->codecs = &snd_soc_dummy_dlc; in set_idisp_hdmi_link()
318 link->num_codecs = 1; in set_idisp_hdmi_link()
321 link->platforms = platform_component; in set_idisp_hdmi_link()
322 link->num_platforms = ARRAY_SIZE(platform_component); in set_idisp_hdmi_link()
324 link->id = be_id; in set_idisp_hdmi_link()
325 link->init = (hdmi_id == 1) ? hdmi_init : NULL; in set_idisp_hdmi_link()
326 link->no_pcm = 1; in set_idisp_hdmi_link()
327 link->playback_only = 1; in set_idisp_hdmi_link()
342 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_amp); in set_ssp_amp_link()
343 if (!link->name) in set_ssp_amp_link()
344 return -ENOMEM; in set_ssp_amp_link()
350 return -ENOMEM; in set_ssp_amp_link()
352 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_amp); in set_ssp_amp_link()
353 if (!cpus->dai_name) in set_ssp_amp_link()
354 return -ENOMEM; in set_ssp_amp_link()
356 link->cpus = cpus; in set_ssp_amp_link()
357 link->num_cpus = 1; in set_ssp_amp_link()
359 /* codecs - caller to handle */ in set_ssp_amp_link()
362 /* feedback stream or firmware-generated echo reference */ in set_ssp_amp_link()
363 link->platforms = platform_component; in set_ssp_amp_link()
364 link->num_platforms = ARRAY_SIZE(platform_component); in set_ssp_amp_link()
366 link->id = be_id; in set_ssp_amp_link()
367 link->no_pcm = 1; in set_ssp_amp_link()
380 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", ssp_bt); in set_bt_offload_link()
381 if (!link->name) in set_bt_offload_link()
382 return -ENOMEM; in set_bt_offload_link()
388 return -ENOMEM; in set_bt_offload_link()
390 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_bt); in set_bt_offload_link()
391 if (!cpus->dai_name) in set_bt_offload_link()
392 return -ENOMEM; in set_bt_offload_link()
394 link->cpus = cpus; in set_bt_offload_link()
395 link->num_cpus = 1; in set_bt_offload_link()
398 link->codecs = &snd_soc_dummy_dlc; in set_bt_offload_link()
399 link->num_codecs = 1; in set_bt_offload_link()
402 link->platforms = platform_component; in set_bt_offload_link()
403 link->num_platforms = ARRAY_SIZE(platform_component); in set_bt_offload_link()
405 link->id = be_id; in set_bt_offload_link()
406 link->no_pcm = 1; in set_bt_offload_link()
416 dev_dbg(dev, "link %d: hdmi-in, ssp %d\n", be_id, ssp_hdmi); in set_hdmi_in_link()
419 link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-HDMI", ssp_hdmi); in set_hdmi_in_link()
420 if (!link->name) in set_hdmi_in_link()
421 return -ENOMEM; in set_hdmi_in_link()
427 return -ENOMEM; in set_hdmi_in_link()
429 cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_hdmi); in set_hdmi_in_link()
430 if (!cpus->dai_name) in set_hdmi_in_link()
431 return -ENOMEM; in set_hdmi_in_link()
433 link->cpus = cpus; in set_hdmi_in_link()
434 link->num_cpus = 1; in set_hdmi_in_link()
437 link->codecs = &snd_soc_dummy_dlc; in set_hdmi_in_link()
438 link->num_codecs = 1; in set_hdmi_in_link()
441 link->platforms = platform_component; in set_hdmi_in_link()
442 link->num_platforms = ARRAY_SIZE(platform_component); in set_hdmi_in_link()
444 link->id = be_id; in set_hdmi_in_link()
445 link->no_pcm = 1; in set_hdmi_in_link()
446 link->capture_only = 1; in set_hdmi_in_link()
456 dev_dbg(dev, "link %d: hda analog\n", be_id); in set_hda_codec_link()
458 link->name = "Analog Playback and Capture"; in set_hda_codec_link()
461 link->cpus = hda_analog_cpus; in set_hda_codec_link()
462 link->num_cpus = ARRAY_SIZE(hda_analog_cpus); in set_hda_codec_link()
465 link->codecs = hda_analog_codecs; in set_hda_codec_link()
466 link->num_codecs = ARRAY_SIZE(hda_analog_codecs); in set_hda_codec_link()
471 link->name = "Digital Playback and Capture"; in set_hda_codec_link()
474 link->cpus = hda_digital_cpus; in set_hda_codec_link()
475 link->num_cpus = ARRAY_SIZE(hda_digital_cpus); in set_hda_codec_link()
478 link->codecs = hda_digital_codecs; in set_hda_codec_link()
479 link->num_codecs = ARRAY_SIZE(hda_digital_codecs); in set_hda_codec_link()
483 return -EINVAL; in set_hda_codec_link()
487 link->platforms = platform_component; in set_hda_codec_link()
488 link->num_platforms = ARRAY_SIZE(platform_component); in set_hda_codec_link()
490 link->id = be_id; in set_hda_codec_link()
492 link->init = hda_init; in set_hda_codec_link()
493 link->no_pcm = 1; in set_hda_codec_link()
503 if (ctx->codec_type != CODEC_NONE) in calculate_num_links()
507 if (ctx->dmic_be_num > 0) in calculate_num_links()
510 if (ctx->dmic_be_num > 1) in calculate_num_links()
514 num_links += ctx->hdmi_num; in calculate_num_links()
517 if (ctx->amp_type != CODEC_NONE) in calculate_num_links()
521 if (ctx->bt_offload_present) in calculate_num_links()
524 /* HDMI-In */ in calculate_num_links()
525 num_links += hweight32(ctx->ssp_mask_hdmi_in); in calculate_num_links()
528 if (ctx->hda_codec_present) in calculate_num_links()
551 return -ENOMEM; in sof_intel_board_set_dai_link()
553 if (ctx->link_order_overwrite) in sof_intel_board_set_dai_link()
554 link_order = ctx->link_order_overwrite; in sof_intel_board_set_dai_link()
558 if (ctx->link_id_overwrite) in sof_intel_board_set_dai_link()
559 link_ids = ctx->link_id_overwrite; in sof_intel_board_set_dai_link()
570 if (ctx->link_id_overwrite) { in sof_intel_board_set_dai_link()
581 if (ctx->codec_type == CODEC_NONE) in sof_intel_board_set_dai_link()
585 ctx->codec_type, ctx->ssp_codec); in sof_intel_board_set_dai_link()
592 ctx->codec_link = &links[idx]; in sof_intel_board_set_dai_link()
597 if (ctx->dmic_be_num == 0) in sof_intel_board_set_dai_link()
612 if (ctx->dmic_be_num <= 1) in sof_intel_board_set_dai_link()
628 for (i = 1; i <= ctx->hdmi_num; i++) { in sof_intel_board_set_dai_link()
631 ctx->hdmi.idisp_codec); in sof_intel_board_set_dai_link()
644 if (ctx->amp_type == CODEC_NONE) in sof_intel_board_set_dai_link()
648 ctx->amp_type, ctx->ssp_amp); in sof_intel_board_set_dai_link()
655 ctx->amp_link = &links[idx]; in sof_intel_board_set_dai_link()
660 if (!ctx->bt_offload_present) in sof_intel_board_set_dai_link()
664 ctx->ssp_bt); in sof_intel_board_set_dai_link()
674 /* HDMI-In */ in sof_intel_board_set_dai_link()
675 for_each_set_bit(ssp_hdmi_in, &ctx->ssp_mask_hdmi_in, 32) { in sof_intel_board_set_dai_link()
679 dev_err(dev, "fail to set hdmi-in link, ret %d\n", in sof_intel_board_set_dai_link()
690 if (!ctx->hda_codec_present) in sof_intel_board_set_dai_link()
696 dev_err(dev, "fail to set hda analog link, ret %d\n", in sof_intel_board_set_dai_link()
719 return -EINVAL; in sof_intel_board_set_dai_link()
726 return -EINVAL; in sof_intel_board_set_dai_link()
729 card->dai_link = links; in sof_intel_board_set_dai_link()
730 card->num_links = num_links; in sof_intel_board_set_dai_link()
747 ctx->codec_type = snd_soc_acpi_intel_detect_codec_type(dev); in sof_intel_board_get_ctx()
748 ctx->amp_type = snd_soc_acpi_intel_detect_amp_type(dev); in sof_intel_board_get_ctx()
750 ctx->dmic_be_num = 2; in sof_intel_board_get_ctx()
751 ctx->hdmi_num = (board_quirk & SOF_NUM_IDISP_HDMI_MASK) >> in sof_intel_board_get_ctx()
754 if (!ctx->hdmi_num) in sof_intel_board_get_ctx()
755 ctx->hdmi_num = 3; in sof_intel_board_get_ctx()
758 if (ctx->codec_type != CODEC_NONE) in sof_intel_board_get_ctx()
759 ctx->ssp_codec = (board_quirk & SOF_SSP_PORT_CODEC_MASK) >> in sof_intel_board_get_ctx()
762 if (ctx->amp_type != CODEC_NONE) in sof_intel_board_get_ctx()
763 ctx->ssp_amp = (board_quirk & SOF_SSP_PORT_AMP_MASK) >> in sof_intel_board_get_ctx()
767 ctx->bt_offload_present = true; in sof_intel_board_get_ctx()
768 ctx->ssp_bt = (board_quirk & SOF_SSP_PORT_BT_OFFLOAD_MASK) >> in sof_intel_board_get_ctx()
772 ctx->ssp_mask_hdmi_in = (board_quirk & SOF_SSP_MASK_HDMI_CAPTURE_MASK) >> in sof_intel_board_get_ctx()