Lines Matching +full:odroid +full:- +full:xu3

1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/clk-provider.h>
13 #include "i2s-regs.h"
28 struct snd_pcm_runtime *runtime = substream->runtime; in odroid_card_fe_startup()
39 struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); in odroid_card_fe_hw_params()
43 spin_lock_irqsave(&priv->lock, flags); in odroid_card_fe_hw_params()
44 if (priv->be_active && priv->be_sample_rate != params_rate(params)) in odroid_card_fe_hw_params()
45 ret = -EINVAL; in odroid_card_fe_hw_params()
46 spin_unlock_irqrestore(&priv->lock, flags); in odroid_card_fe_hw_params()
60 struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); in odroid_card_be_hw_params()
82 return -EINVAL; in odroid_card_be_hw_params()
85 ret = clk_set_rate(priv->clk_i2s_bus, pll_freq / 2 + 1); in odroid_card_be_hw_params()
96 ret = clk_set_rate(priv->sclk_i2s, rclk_freq); in odroid_card_be_hw_params()
100 if (rtd->num_codecs > 1) { in odroid_card_be_hw_params()
109 spin_lock_irqsave(&priv->lock, flags); in odroid_card_be_hw_params()
110 priv->be_sample_rate = params_rate(params); in odroid_card_be_hw_params()
111 spin_unlock_irqrestore(&priv->lock, flags); in odroid_card_be_hw_params()
119 struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); in odroid_card_be_trigger()
122 spin_lock_irqsave(&priv->lock, flags); in odroid_card_be_trigger()
128 priv->be_active = true; in odroid_card_be_trigger()
134 priv->be_active = false; in odroid_card_be_trigger()
138 spin_unlock_irqrestore(&priv->lock, flags); in odroid_card_be_trigger()
167 DAILINK_COMP_ARRAY(COMP_PLATFORM("3830000.i2s-sec")));
171 /* Primary FE <-> BE link */
179 /* BE <-> CODECs link */
188 /* Secondary FE <-> BE link */
201 struct device *dev = &pdev->dev; in odroid_audio_probe()
212 return -ENOMEM; in odroid_audio_probe()
214 card = &priv->card; in odroid_audio_probe()
215 card->dev = dev; in odroid_audio_probe()
217 card->owner = THIS_MODULE; in odroid_audio_probe()
218 card->fully_routed = true; in odroid_audio_probe()
220 spin_lock_init(&priv->lock); in odroid_audio_probe()
227 if (of_property_read_bool(dev->of_node, "samsung,audio-widgets")) { in odroid_audio_probe()
229 "samsung,audio-widgets"); in odroid_audio_probe()
234 if (of_property_read_bool(dev->of_node, "samsung,audio-routing")) { in odroid_audio_probe()
236 "samsung,audio-routing"); in odroid_audio_probe()
241 card->dai_link = odroid_card_dais; in odroid_audio_probe()
242 card->num_links = ARRAY_SIZE(odroid_card_dais); in odroid_audio_probe()
244 cpu = of_get_child_by_name(dev->of_node, "cpu"); in odroid_audio_probe()
245 codec = of_get_child_by_name(dev->of_node, "codec"); in odroid_audio_probe()
246 link = card->dai_link; in odroid_audio_probe()
247 codec_link = &card->dai_link[1]; in odroid_audio_probe()
251 * if there are 2 CPU DAI entries in the cpu sound-dai property in DT. in odroid_audio_probe()
254 num_pcms = of_count_phandle_with_args(cpu, "sound-dai", in odroid_audio_probe()
255 "#sound-dai-cells"); in odroid_audio_probe()
257 card->dapm_routes = odroid_dapm_routes; in odroid_audio_probe()
258 card->num_dapm_routes = ARRAY_SIZE(odroid_dapm_routes); in odroid_audio_probe()
259 card->num_links--; in odroid_audio_probe()
263 ret = of_parse_phandle_with_args(cpu, "sound-dai", in odroid_audio_probe()
264 "#sound-dai-cells", i, &args); in odroid_audio_probe()
269 dev_err(dev, "sound-dai property parse error: %d\n", ret); in odroid_audio_probe()
270 ret = -EINVAL; in odroid_audio_probe()
274 ret = snd_soc_get_dai_name(&args, &link->cpus->dai_name); in odroid_audio_probe()
281 cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); in odroid_audio_probe()
283 ret = -EINVAL; in odroid_audio_probe()
295 if (codec_link->num_codecs > 1) { in odroid_audio_probe()
296 card->dai_link[0].dpcm_capture = 1; in odroid_audio_probe()
297 card->dai_link[1].dpcm_capture = 1; in odroid_audio_probe()
300 priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1"); in odroid_audio_probe()
301 if (IS_ERR(priv->sclk_i2s)) { in odroid_audio_probe()
302 ret = PTR_ERR(priv->sclk_i2s); in odroid_audio_probe()
306 priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); in odroid_audio_probe()
307 if (IS_ERR(priv->clk_i2s_bus)) { in odroid_audio_probe()
308 ret = PTR_ERR(priv->clk_i2s_bus); in odroid_audio_probe()
314 if (ret != -EPROBE_DEFER) in odroid_audio_probe()
325 clk_put(priv->clk_i2s_bus); in odroid_audio_probe()
327 clk_put(priv->sclk_i2s); in odroid_audio_probe()
340 snd_soc_of_put_dai_link_codecs(&priv->card.dai_link[1]); in odroid_audio_remove()
341 clk_put(priv->sclk_i2s); in odroid_audio_remove()
342 clk_put(priv->clk_i2s_bus); in odroid_audio_remove()
348 { .compatible = "hardkernel,odroid-xu3-audio" },
349 { .compatible = "hardkernel,odroid-xu4-audio" },
350 { .compatible = "samsung,odroid-xu3-audio" },
351 { .compatible = "samsung,odroid-xu4-audio" },
358 .name = "odroid-audio",
368 MODULE_DESCRIPTION("Odroid XU3/XU4 audio support");