Lines Matching +full:simple +full:- +full:card

1 // SPDX-License-Identifier: GPL-2.0-only
3 // tegra_audio_graph_card.c - Audio Graph based Tegra Machine Driver
5 // Copyright (c) 2020-2021 NVIDIA CORPORATION. All rights reserved.
13 #include <sound/soc-dai.h>
17 #define simple_to_tegra_priv(simple) \ argument
18 container_of(simple, struct tegra_audio_priv, simple)
37 struct simple_util_priv simple; member
51 !dai->driver->ops || in need_clk_update()
52 !dai->driver->name) in need_clk_update()
55 if (strstr(dai->driver->name, "I2S") || in need_clk_update()
56 strstr(dai->driver->name, "DMIC") || in need_clk_update()
57 strstr(dai->driver->name, "DSPK")) in need_clk_update()
68 struct simple_util_priv *simple = snd_soc_card_get_drvdata(rtd->card); in tegra_audio_graph_update_pll() local
69 struct tegra_audio_priv *priv = simple_to_tegra_priv(simple); in tegra_audio_graph_update_pll()
70 struct device *dev = rtd->card->dev; in tegra_audio_graph_update_pll()
82 plla_out0_rate = data->plla_out0_rates[x11_RATE]; in tegra_audio_graph_update_pll()
83 plla_rate = data->plla_rates[x11_RATE]; in tegra_audio_graph_update_pll()
91 plla_out0_rate = data->plla_out0_rates[x8_RATE]; in tegra_audio_graph_update_pll()
92 plla_rate = data->plla_rates[x8_RATE]; in tegra_audio_graph_update_pll()
95 dev_err(rtd->card->dev, "Unsupported sample rate %u\n", in tegra_audio_graph_update_pll()
97 return -EINVAL; in tegra_audio_graph_update_pll()
105 * |--> PLLA_OUT0 in tegra_audio_graph_update_pll()
107 * |---> I2S modules in tegra_audio_graph_update_pll()
109 * |---> DMIC modules in tegra_audio_graph_update_pll()
111 * |---> DSPK modules in tegra_audio_graph_update_pll()
127 dev_dbg(rtd->card->dev, in tegra_audio_graph_update_pll()
132 err = clk_set_rate(priv->clk_plla, plla_rate); in tegra_audio_graph_update_pll()
134 dev_err(rtd->card->dev, in tegra_audio_graph_update_pll()
141 err = clk_set_rate(priv->clk_plla_out0, plla_out0_rate); in tegra_audio_graph_update_pll()
143 dev_err(rtd->card->dev, in tegra_audio_graph_update_pll()
174 static int tegra_audio_graph_card_probe(struct snd_soc_card *card) in tegra_audio_graph_card_probe() argument
176 struct simple_util_priv *simple = snd_soc_card_get_drvdata(card); in tegra_audio_graph_card_probe() local
177 struct tegra_audio_priv *priv = simple_to_tegra_priv(simple); in tegra_audio_graph_card_probe()
179 priv->clk_plla = devm_clk_get(card->dev, "pll_a"); in tegra_audio_graph_card_probe()
180 if (IS_ERR(priv->clk_plla)) { in tegra_audio_graph_card_probe()
181 dev_err(card->dev, "Can't retrieve clk pll_a\n"); in tegra_audio_graph_card_probe()
182 return PTR_ERR(priv->clk_plla); in tegra_audio_graph_card_probe()
185 priv->clk_plla_out0 = devm_clk_get(card->dev, "plla_out0"); in tegra_audio_graph_card_probe()
186 if (IS_ERR(priv->clk_plla_out0)) { in tegra_audio_graph_card_probe()
187 dev_err(card->dev, "Can't retrieve clk plla_out0\n"); in tegra_audio_graph_card_probe()
188 return PTR_ERR(priv->clk_plla_out0); in tegra_audio_graph_card_probe()
191 return graph_util_card_probe(card); in tegra_audio_graph_card_probe()
197 struct device *dev = &pdev->dev; in tegra_audio_graph_probe()
198 struct snd_soc_card *card; in tegra_audio_graph_probe() local
202 return -ENOMEM; in tegra_audio_graph_probe()
204 card = simple_priv_to_card(&priv->simple); in tegra_audio_graph_probe()
205 card->driver_name = "tegra-ape"; in tegra_audio_graph_probe()
207 card->probe = tegra_audio_graph_card_probe; in tegra_audio_graph_probe()
210 card->component_chaining = 1; in tegra_audio_graph_probe()
211 priv->simple.ops = &tegra_audio_graph_ops; in tegra_audio_graph_probe()
212 priv->simple.force_dpcm = 1; in tegra_audio_graph_probe()
214 return audio_graph_parse_of(&priv->simple, dev); in tegra_audio_graph_probe()
236 { .compatible = "nvidia,tegra210-audio-graph-card",
238 { .compatible = "nvidia,tegra186-audio-graph-card",
246 .name = "tegra-audio-graph-card",
256 MODULE_DESCRIPTION("ASoC Tegra Audio Graph Sound Card");