Skip to content

Commit

Permalink
ASoC: tegra: move AC97 clock handling to the machine driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lucas Stach authored and Mark Brown committed Mar 25, 2014
1 parent 38dbfb5 commit 1ca2e84
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
15 changes: 1 addition & 14 deletions sound/soc/tegra/tegra20_ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>

#include "tegra_asoc_utils.h"
#include "tegra20_ac97.h"

#define DRV_NAME "tegra20-ac97"
Expand Down Expand Up @@ -376,18 +375,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
ac97->playback_dma_data.maxburst = 4;

ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev);
if (ret)
goto err_clk_put;

ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data);
if (ret)
goto err_asoc_utils_fini;

ret = clk_prepare_enable(ac97->clk_ac97);
if (ret) {
dev_err(&pdev->dev, "clk_enable failed: %d\n", ret);
goto err_asoc_utils_fini;
goto err;
}

ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops);
Expand Down Expand Up @@ -419,8 +410,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
snd_soc_unregister_component(&pdev->dev);
err_clk_disable_unprepare:
clk_disable_unprepare(ac97->clk_ac97);
err_asoc_utils_fini:
tegra_asoc_utils_fini(&ac97->util_data);
err_clk_put:
err:
snd_soc_set_ac97_ops(NULL);
Expand All @@ -434,8 +423,6 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev)
tegra_pcm_platform_unregister(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);

tegra_asoc_utils_fini(&ac97->util_data);

clk_disable_unprepare(ac97->clk_ac97);

snd_soc_set_ac97_ops(NULL);
Expand Down
1 change: 0 additions & 1 deletion sound/soc/tegra/tegra20_ac97.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,5 @@ struct tegra20_ac97 {
struct regmap *regmap;
int reset_gpio;
int sync_gpio;
struct tegra_asoc_utils_data util_data;
};
#endif /* __TEGRA20_AC97_H__ */
17 changes: 16 additions & 1 deletion sound/soc/tegra/tegra_wm9712.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>

#include "tegra_asoc_utils.h"

#define DRV_NAME "tegra-snd-wm9712"

struct tegra_wm9712 {
struct platform_device *codec;
struct tegra_asoc_utils_data util_data;
};

static const struct snd_soc_dapm_widget tegra_wm9712_dapm_widgets[] = {
Expand Down Expand Up @@ -118,15 +121,25 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev)

tegra_wm9712_dai.platform_of_node = tegra_wm9712_dai.cpu_of_node;

ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret)
goto codec_unregister;

ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data);
if (ret)
goto asoc_utils_fini;

ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
goto codec_unregister;
goto asoc_utils_fini;
}

return 0;

asoc_utils_fini:
tegra_asoc_utils_fini(&machine->util_data);
codec_unregister:
platform_device_del(machine->codec);
codec_put:
Expand All @@ -141,6 +154,8 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev)

snd_soc_unregister_card(card);

tegra_asoc_utils_fini(&machine->util_data);

platform_device_unregister(machine->codec);

return 0;
Expand Down

0 comments on commit 1ca2e84

Please sign in to comment.