Lines Matching +full:primary +full:- +full:dai +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0+
3 // Copyright (C) 2015 - 2016 Samsung Electronics Co., Ltd.
37 struct snd_soc_component *component = priv->component; in tm2_start_sysclk()
43 priv->sysclk_rate); in tm2_start_sysclk()
45 dev_err(component->dev, "Failed to set FLL1 source: %d\n", ret); in tm2_start_sysclk()
52 priv->sysclk_rate); in tm2_start_sysclk()
54 dev_err(component->dev, "Failed to start FLL1: %d\n", ret); in tm2_start_sysclk()
60 priv->sysclk_rate, in tm2_start_sysclk()
63 dev_err(component->dev, "Failed to set SYSCLK source: %d\n", ret); in tm2_start_sysclk()
73 struct snd_soc_component *component = priv->component; in tm2_stop_sysclk()
78 dev_err(component->dev, "Failed to stop FLL1: %d\n", ret); in tm2_stop_sysclk()
85 dev_err(component->dev, "Failed to stop SYSCLK: %d\n", ret); in tm2_stop_sysclk()
96 struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; in tm2_aif1_hw_params()
97 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); in tm2_aif1_hw_params()
110 priv->sysclk_rate = 147456000U; in tm2_aif1_hw_params()
118 priv->sysclk_rate = 135475200U; in tm2_aif1_hw_params()
121 dev_err(component->dev, "Not supported sample rate: %d\n", in tm2_aif1_hw_params()
123 return -EINVAL; in tm2_aif1_hw_params()
126 return tm2_start_sysclk(rtd->card); in tm2_aif1_hw_params()
137 struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; in tm2_aif2_hw_params()
153 dev_err(component->dev, "Not supported sample rate: %d\n", in tm2_aif2_hw_params()
155 return -EINVAL; in tm2_aif2_hw_params()
163 dev_err(component->dev, "Failed to set FLL2 source: %d\n", ret); in tm2_aif2_hw_params()
172 dev_err(component->dev, "Failed to start FLL2: %d\n", ret); in tm2_aif2_hw_params()
181 dev_err(component->dev, "Failed to set ASYNCCLK source: %d\n", ret); in tm2_aif2_hw_params()
191 struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; in tm2_aif2_hw_free()
198 dev_err(component->dev, "Failed to stop FLL2: %d\n", ret); in tm2_aif2_hw_free()
218 dev_err(rtd->card->dev, "Invalid bit-width: %d\n", bitwidth); in tm2_hdmi_hw_params()
230 dev_err(rtd->card->dev, "Unsupported bit-width: %d\n", bitwidth); in tm2_hdmi_hw_params()
231 return -EINVAL; in tm2_hdmi_hw_params()
240 dev_err(rtd->card->dev, "Unsupported sample rate: %d\n", in tm2_hdmi_hw_params()
242 return -EINVAL; in tm2_hdmi_hw_params()
264 struct snd_soc_card *card = w->dapm->card; in tm2_mic_bias()
269 gpiod_set_value_cansleep(priv->gpio_mic_bias, 1); in tm2_mic_bias()
272 gpiod_set_value_cansleep(priv->gpio_mic_bias, 0); in tm2_mic_bias()
285 rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); in tm2_set_bias_level()
287 if (dapm->dev != snd_soc_rtd_to_codec(rtd, 0)->dev) in tm2_set_bias_level()
292 if (card->dapm.bias_level == SND_SOC_BIAS_OFF) in tm2_set_bias_level()
317 rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[TM2_DAI_AIF1]); in tm2_late_probe()
319 priv->component = snd_soc_rtd_to_codec(rtd, 0)->component; in tm2_late_probe()
323 dev_err(aif1_dai->dev, "Failed to set SYSCLK: %d\n", ret); in tm2_late_probe()
327 rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[TM2_DAI_AIF2]); in tm2_late_probe()
332 dev_err(aif2_dai->dev, "Failed to set ASYNCCLK: %d\n", ret); in tm2_late_probe()
338 return -ENODEV; in tm2_late_probe()
340 /* Set the MAX98504 V/I sense PDM Tx DAI channel mapping */ in tm2_late_probe()
382 .name = "tm2-audio",
430 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm5110-aif1")),
435 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm5110-aif2")),
440 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm5110-aif3")),
451 .stream_name = "HiFi Primary",
501 struct device *dev = &pdev->dev; in tm2_probe()
509 return -ENOMEM; in tm2_probe()
512 card->dev = dev; in tm2_probe()
514 priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias", GPIOD_OUT_HIGH); in tm2_probe()
515 if (IS_ERR(priv->gpio_mic_bias)) { in tm2_probe()
517 return PTR_ERR(priv->gpio_mic_bias); in tm2_probe()
526 ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); in tm2_probe()
529 ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); in tm2_probe()
536 card->aux_dev[0].dlc.of_node = of_parse_phandle(dev->of_node, in tm2_probe()
537 "audio-amplifier", 0); in tm2_probe()
538 if (!card->aux_dev[0].dlc.of_node) { in tm2_probe()
539 dev_err(dev, "audio-amplifier property invalid or missing\n"); in tm2_probe()
540 return -EINVAL; in tm2_probe()
543 num_codecs = of_count_phandle_with_args(dev->of_node, "audio-codec", in tm2_probe()
546 /* Skip the HDMI link if not specified in DT */ in tm2_probe()
548 card->num_links = ARRAY_SIZE(tm2_dai_links); in tm2_probe()
549 cells_name = "#sound-dai-cells"; in tm2_probe()
551 card->num_links = ARRAY_SIZE(tm2_dai_links) - 1; in tm2_probe()
557 ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller", in tm2_probe()
560 dev_err(dev, "i2s-controller property parse error: %d\n", i); in tm2_probe()
561 ret = -EINVAL; in tm2_probe()
566 codec_dai_node[i] = of_parse_phandle(dev->of_node, in tm2_probe()
567 "audio-codec", i); in tm2_probe()
569 dev_err(dev, "audio-codec property parse error\n"); in tm2_probe()
570 ret = -EINVAL; in tm2_probe()
575 /* Initialize WM5110 - I2S and HDMI - I2S1 DAI links */ in tm2_probe()
579 dai_link->cpus->name = NULL; in tm2_probe()
580 dai_link->platforms->name = NULL; in tm2_probe()
582 if (num_codecs > 1 && i == card->num_links - 1) in tm2_probe()
585 dai_link->codecs->of_node = codec_dai_node[dai_index]; in tm2_probe()
586 dai_link->cpus->of_node = cpu_dai_node[dai_index]; in tm2_probe()
587 dai_link->platforms->of_node = cpu_dai_node[dai_index]; in tm2_probe()
593 /* HDMI DAI link (I2S1) */ in tm2_probe()
594 i = card->num_links - 1; in tm2_probe()
596 ret = of_parse_phandle_with_fixed_args(dev->of_node, in tm2_probe()
597 "audio-codec", 0, 1, &args); in tm2_probe()
599 dev_err(dev, "audio-codec property parse error\n"); in tm2_probe()
603 ret = snd_soc_get_dai_name(&args, &card->dai_link[i].codecs->dai_name); in tm2_probe()
629 of_node_put(card->aux_dev[0].dlc.of_node); in tm2_probe()
660 { .compatible = "samsung,tm2-audio" },
667 .name = "tm2-audio",