Lines Matching +full:primary +full:- +full:dai +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/clk-provider.h>
12 #include "i2s-regs.h"
27 struct snd_pcm_runtime *runtime = substream->runtime; in odroid_card_fe_startup()
38 struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); in odroid_card_fe_hw_params()
42 spin_lock_irqsave(&priv->lock, flags); in odroid_card_fe_hw_params()
43 if (priv->be_active && priv->be_sample_rate != params_rate(params)) in odroid_card_fe_hw_params()
44 ret = -EINVAL; in odroid_card_fe_hw_params()
45 spin_unlock_irqrestore(&priv->lock, flags); in odroid_card_fe_hw_params()
59 struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); in odroid_card_be_hw_params()
81 return -EINVAL; in odroid_card_be_hw_params()
84 ret = clk_set_rate(priv->clk_i2s_bus, pll_freq / 2 + 1); in odroid_card_be_hw_params()
95 ret = clk_set_rate(priv->sclk_i2s, rclk_freq); in odroid_card_be_hw_params()
99 if (rtd->dai_link->num_codecs > 1) { in odroid_card_be_hw_params()
108 spin_lock_irqsave(&priv->lock, flags); in odroid_card_be_hw_params()
109 priv->be_sample_rate = params_rate(params); in odroid_card_be_hw_params()
110 spin_unlock_irqrestore(&priv->lock, flags); in odroid_card_be_hw_params()
118 struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); in odroid_card_be_trigger()
121 spin_lock_irqsave(&priv->lock, flags); in odroid_card_be_trigger()
127 priv->be_active = true; in odroid_card_be_trigger()
133 priv->be_active = false; in odroid_card_be_trigger()
137 spin_unlock_irqrestore(&priv->lock, flags); in odroid_card_be_trigger()
149 { "I2S Playback", NULL, "Mixer DAI TX" },
150 { "HiFi Playback", NULL, "Mixer DAI TX" },
153 SND_SOC_DAILINK_DEFS(primary,
165 DAILINK_COMP_ARRAY(COMP_PLATFORM("3830000.i2s-sec")));
169 /* Primary FE <-> BE link */
171 .name = "Primary",
172 .stream_name = "Primary",
175 SND_SOC_DAILINK_REG(primary),
177 /* BE <-> CODECs link */
186 /* Secondary FE <-> BE link */
199 struct device *dev = &pdev->dev; in odroid_audio_probe()
204 struct snd_soc_dai_link *link, *codec_link; in odroid_audio_probe() local
209 return -ENOMEM; in odroid_audio_probe()
211 card = &priv->card; in odroid_audio_probe()
212 card->dev = dev; in odroid_audio_probe()
214 card->owner = THIS_MODULE; in odroid_audio_probe()
215 card->fully_routed = true; in odroid_audio_probe()
217 spin_lock_init(&priv->lock); in odroid_audio_probe()
224 if (of_property_present(dev->of_node, "samsung,audio-widgets")) { in odroid_audio_probe()
226 "samsung,audio-widgets"); in odroid_audio_probe()
232 if (of_property_present(dev->of_node, "audio-routing")) in odroid_audio_probe()
233 ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); in odroid_audio_probe()
234 else if (of_property_present(dev->of_node, "samsung,audio-routing")) in odroid_audio_probe()
235 ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); in odroid_audio_probe()
239 card->dai_link = odroid_card_dais; in odroid_audio_probe()
240 card->num_links = ARRAY_SIZE(odroid_card_dais); in odroid_audio_probe()
242 cpu = of_get_child_by_name(dev->of_node, "cpu"); in odroid_audio_probe()
243 codec = of_get_child_by_name(dev->of_node, "codec"); in odroid_audio_probe()
244 link = card->dai_link; in odroid_audio_probe()
245 codec_link = &card->dai_link[1]; in odroid_audio_probe()
248 * For backwards compatibility create the secondary CPU DAI link only in odroid_audio_probe()
249 * if there are 2 CPU DAI entries in the cpu sound-dai property in DT. in odroid_audio_probe()
252 num_pcms = of_count_phandle_with_args(cpu, "sound-dai", in odroid_audio_probe()
253 "#sound-dai-cells"); in odroid_audio_probe()
255 card->dapm_routes = odroid_dapm_routes; in odroid_audio_probe()
256 card->num_dapm_routes = ARRAY_SIZE(odroid_dapm_routes); in odroid_audio_probe()
257 card->num_links--; in odroid_audio_probe()
260 for (i = 0; i < num_pcms; i++, link += 2) { in odroid_audio_probe()
261 ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name, i); in odroid_audio_probe()
266 cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); in odroid_audio_probe()
268 ret = -EINVAL; in odroid_audio_probe()
280 if (codec_link->num_codecs > 1) { in odroid_audio_probe()
281 card->dai_link[0].dpcm_capture = 1; in odroid_audio_probe()
282 card->dai_link[1].dpcm_capture = 1; in odroid_audio_probe()
285 priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1"); in odroid_audio_probe()
286 if (IS_ERR(priv->sclk_i2s)) { in odroid_audio_probe()
287 ret = PTR_ERR(priv->sclk_i2s); in odroid_audio_probe()
291 priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); in odroid_audio_probe()
292 if (IS_ERR(priv->clk_i2s_bus)) { in odroid_audio_probe()
293 ret = PTR_ERR(priv->clk_i2s_bus); in odroid_audio_probe()
308 clk_put(priv->clk_i2s_bus); in odroid_audio_probe()
310 clk_put(priv->sclk_i2s); in odroid_audio_probe()
323 snd_soc_of_put_dai_link_codecs(&priv->card.dai_link[1]); in odroid_audio_remove()
324 clk_put(priv->sclk_i2s); in odroid_audio_remove()
325 clk_put(priv->clk_i2s_bus); in odroid_audio_remove()
329 { .compatible = "hardkernel,odroid-xu3-audio" },
330 { .compatible = "hardkernel,odroid-xu4-audio" },
331 { .compatible = "samsung,odroid-xu3-audio" },
332 { .compatible = "samsung,odroid-xu4-audio" },
339 .name = "odroid-audio",