aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2014-03-18 16:30:49 -0400
committerMark Brown <broonie@linaro.org>2014-03-25 14:54:50 -0400
commit1ca2e8474df3626f8d64d23420f8bd16bcef2448 (patch)
tree310ea6df13d36aa0f9422efe6be45d3113239e92 /sound/soc/tegra
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
ASoC: tegra: move AC97 clock handling to the machine driver
On Tegra the convention is to have a single machine driver that's controlling the whole audio subsystem. Move the clock handling to the machine driver, to be in line with the other Tegra drivers and give the machine driver full control over the single Tegra audio PLL. Signed-off-by: Lucas Stach <dev@lynxeye.de> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/tegra')
-rw-r--r--sound/soc/tegra/tegra20_ac97.c15
-rw-r--r--sound/soc/tegra/tegra20_ac97.h1
-rw-r--r--sound/soc/tegra/tegra_wm9712.c17
3 files changed, 17 insertions, 16 deletions
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index cf5e1cfe818d..29f8832a79c4 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -37,7 +37,6 @@
37#include <sound/soc.h> 37#include <sound/soc.h>
38#include <sound/dmaengine_pcm.h> 38#include <sound/dmaengine_pcm.h>
39 39
40#include "tegra_asoc_utils.h"
41#include "tegra20_ac97.h" 40#include "tegra20_ac97.h"
42 41
43#define DRV_NAME "tegra20-ac97" 42#define DRV_NAME "tegra20-ac97"
@@ -376,18 +375,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
376 ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 375 ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
377 ac97->playback_dma_data.maxburst = 4; 376 ac97->playback_dma_data.maxburst = 4;
378 377
379 ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev);
380 if (ret)
381 goto err_clk_put;
382
383 ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data);
384 if (ret)
385 goto err_asoc_utils_fini;
386
387 ret = clk_prepare_enable(ac97->clk_ac97); 378 ret = clk_prepare_enable(ac97->clk_ac97);
388 if (ret) { 379 if (ret) {
389 dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); 380 dev_err(&pdev->dev, "clk_enable failed: %d\n", ret);
390 goto err_asoc_utils_fini; 381 goto err;
391 } 382 }
392 383
393 ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); 384 ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops);
@@ -419,8 +410,6 @@ err_unregister_component:
419 snd_soc_unregister_component(&pdev->dev); 410 snd_soc_unregister_component(&pdev->dev);
420err_clk_disable_unprepare: 411err_clk_disable_unprepare:
421 clk_disable_unprepare(ac97->clk_ac97); 412 clk_disable_unprepare(ac97->clk_ac97);
422err_asoc_utils_fini:
423 tegra_asoc_utils_fini(&ac97->util_data);
424err_clk_put: 413err_clk_put:
425err: 414err:
426 snd_soc_set_ac97_ops(NULL); 415 snd_soc_set_ac97_ops(NULL);
@@ -434,8 +423,6 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev)
434 tegra_pcm_platform_unregister(&pdev->dev); 423 tegra_pcm_platform_unregister(&pdev->dev);
435 snd_soc_unregister_component(&pdev->dev); 424 snd_soc_unregister_component(&pdev->dev);
436 425
437 tegra_asoc_utils_fini(&ac97->util_data);
438
439 clk_disable_unprepare(ac97->clk_ac97); 426 clk_disable_unprepare(ac97->clk_ac97);
440 427
441 snd_soc_set_ac97_ops(NULL); 428 snd_soc_set_ac97_ops(NULL);
diff --git a/sound/soc/tegra/tegra20_ac97.h b/sound/soc/tegra/tegra20_ac97.h
index 4acb3aaba29b..0a39d823edcb 100644
--- a/sound/soc/tegra/tegra20_ac97.h
+++ b/sound/soc/tegra/tegra20_ac97.h
@@ -90,6 +90,5 @@ struct tegra20_ac97 {
90 struct regmap *regmap; 90 struct regmap *regmap;
91 int reset_gpio; 91 int reset_gpio;
92 int sync_gpio; 92 int sync_gpio;
93 struct tegra_asoc_utils_data util_data;
94}; 93};
95#endif /* __TEGRA20_AC97_H__ */ 94#endif /* __TEGRA20_AC97_H__ */
diff --git a/sound/soc/tegra/tegra_wm9712.c b/sound/soc/tegra/tegra_wm9712.c
index 45b57892b6a5..25a7f8211ecf 100644
--- a/sound/soc/tegra/tegra_wm9712.c
+++ b/sound/soc/tegra/tegra_wm9712.c
@@ -29,10 +29,13 @@
29#include <sound/pcm_params.h> 29#include <sound/pcm_params.h>
30#include <sound/soc.h> 30#include <sound/soc.h>
31 31
32#include "tegra_asoc_utils.h"
33
32#define DRV_NAME "tegra-snd-wm9712" 34#define DRV_NAME "tegra-snd-wm9712"
33 35
34struct tegra_wm9712 { 36struct tegra_wm9712 {
35 struct platform_device *codec; 37 struct platform_device *codec;
38 struct tegra_asoc_utils_data util_data;
36}; 39};
37 40
38static const struct snd_soc_dapm_widget tegra_wm9712_dapm_widgets[] = { 41static const struct snd_soc_dapm_widget tegra_wm9712_dapm_widgets[] = {
@@ -118,15 +121,25 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev)
118 121
119 tegra_wm9712_dai.platform_of_node = tegra_wm9712_dai.cpu_of_node; 122 tegra_wm9712_dai.platform_of_node = tegra_wm9712_dai.cpu_of_node;
120 123
124 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
125 if (ret)
126 goto codec_unregister;
127
128 ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data);
129 if (ret)
130 goto asoc_utils_fini;
131
121 ret = snd_soc_register_card(card); 132 ret = snd_soc_register_card(card);
122 if (ret) { 133 if (ret) {
123 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", 134 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
124 ret); 135 ret);
125 goto codec_unregister; 136 goto asoc_utils_fini;
126 } 137 }
127 138
128 return 0; 139 return 0;
129 140
141asoc_utils_fini:
142 tegra_asoc_utils_fini(&machine->util_data);
130codec_unregister: 143codec_unregister:
131 platform_device_del(machine->codec); 144 platform_device_del(machine->codec);
132codec_put: 145codec_put:
@@ -141,6 +154,8 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev)
141 154
142 snd_soc_unregister_card(card); 155 snd_soc_unregister_card(card);
143 156
157 tegra_asoc_utils_fini(&machine->util_data);
158
144 platform_device_unregister(machine->codec); 159 platform_device_unregister(machine->codec);
145 160
146 return 0; 161 return 0;