Lines Matching +full:fe +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" },
165 DAILINK_COMP_ARRAY(COMP_PLATFORM("3830000.i2s-sec")));
169 /* Primary FE <-> BE link */
177 /* BE <-> CODECs link */
186 /* Secondary FE <-> BE link */
198 struct device *dev = &pdev->dev; in odroid_audio_probe()
203 struct snd_soc_dai_link *link, *codec_link; in odroid_audio_probe() local
208 return -ENOMEM; in odroid_audio_probe()
210 card = &priv->card; in odroid_audio_probe()
211 card->dev = dev; in odroid_audio_probe()
213 card->owner = THIS_MODULE; in odroid_audio_probe()
214 card->fully_routed = true; in odroid_audio_probe()
216 spin_lock_init(&priv->lock); in odroid_audio_probe()
223 if (of_property_present(dev->of_node, "samsung,audio-widgets")) { in odroid_audio_probe()
225 "samsung,audio-widgets"); in odroid_audio_probe()
231 if (of_property_present(dev->of_node, "audio-routing")) in odroid_audio_probe()
232 ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); in odroid_audio_probe()
233 else if (of_property_present(dev->of_node, "samsung,audio-routing")) in odroid_audio_probe()
234 ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); in odroid_audio_probe()
238 card->dai_link = odroid_card_dais; in odroid_audio_probe()
239 card->num_links = ARRAY_SIZE(odroid_card_dais); in odroid_audio_probe()
241 cpu = of_get_child_by_name(dev->of_node, "cpu"); in odroid_audio_probe()
242 codec = of_get_child_by_name(dev->of_node, "codec"); in odroid_audio_probe()
243 link = card->dai_link; in odroid_audio_probe()
244 codec_link = &card->dai_link[1]; in odroid_audio_probe()
247 * For backwards compatibility create the secondary CPU DAI link only in odroid_audio_probe()
248 * if there are 2 CPU DAI entries in the cpu sound-dai property in DT. in odroid_audio_probe()
251 num_pcms = of_count_phandle_with_args(cpu, "sound-dai", in odroid_audio_probe()
252 "#sound-dai-cells"); in odroid_audio_probe()
254 card->dapm_routes = odroid_dapm_routes; in odroid_audio_probe()
255 card->num_dapm_routes = ARRAY_SIZE(odroid_dapm_routes); in odroid_audio_probe()
256 card->num_links--; in odroid_audio_probe()
259 for (i = 0; i < num_pcms; i++, link += 2) { in odroid_audio_probe()
260 ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name, i); in odroid_audio_probe()
265 cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); in odroid_audio_probe()
267 ret = -EINVAL; in odroid_audio_probe()
279 if (codec_link->num_codecs > 1) { in odroid_audio_probe()
280 card->dai_link[0].playback_only = 0; in odroid_audio_probe()
281 card->dai_link[1].playback_only = 0; in odroid_audio_probe()
284 priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1"); in odroid_audio_probe()
285 if (IS_ERR(priv->sclk_i2s)) { in odroid_audio_probe()
286 ret = PTR_ERR(priv->sclk_i2s); in odroid_audio_probe()
290 priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); in odroid_audio_probe()
291 if (IS_ERR(priv->clk_i2s_bus)) { in odroid_audio_probe()
292 ret = PTR_ERR(priv->clk_i2s_bus); in odroid_audio_probe()
307 clk_put(priv->clk_i2s_bus); in odroid_audio_probe()
309 clk_put(priv->sclk_i2s); in odroid_audio_probe()
322 snd_soc_of_put_dai_link_codecs(&priv->card.dai_link[1]); in odroid_audio_remove()
323 clk_put(priv->sclk_i2s); in odroid_audio_remove()
324 clk_put(priv->clk_i2s_bus); in odroid_audio_remove()
328 { .compatible = "hardkernel,odroid-xu3-audio" },
329 { .compatible = "hardkernel,odroid-xu4-audio" },
330 { .compatible = "samsung,odroid-xu3-audio" },
331 { .compatible = "samsung,odroid-xu4-audio" },
338 .name = "odroid-audio",