Commit a46b7824 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Mark Brown

ASoC: tegra20: ac97: Add reset control

Tegra20 AC97 driver doesn't manage the AC97 controller reset, relying on
implicit deassertion of the reset by tegra-clk driver, which needs to be
fixed since this behaviour is unacceptable by other Tegra drivers. Add
explicit reset control to the Tegra20 AC97 driver.

Note that AC97 reset was always specified in Tegra20 device-tree, hence
DTB ABI changes aren't required.
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210314154459.15375-2-digetx@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a38fd874
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -313,6 +314,12 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ...@@ -313,6 +314,12 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
} }
dev_set_drvdata(&pdev->dev, ac97); dev_set_drvdata(&pdev->dev, ac97);
ac97->reset = devm_reset_control_get_exclusive(&pdev->dev, "ac97");
if (IS_ERR(ac97->reset)) {
dev_err(&pdev->dev, "Can't retrieve ac97 reset\n");
return PTR_ERR(ac97->reset);
}
ac97->clk_ac97 = devm_clk_get(&pdev->dev, NULL); ac97->clk_ac97 = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(ac97->clk_ac97)) { if (IS_ERR(ac97->clk_ac97)) {
dev_err(&pdev->dev, "Can't retrieve ac97 clock\n"); dev_err(&pdev->dev, "Can't retrieve ac97 clock\n");
...@@ -364,12 +371,26 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ...@@ -364,12 +371,26 @@ 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.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
ac97->playback_dma_data.maxburst = 4; ac97->playback_dma_data.maxburst = 4;
ret = reset_control_assert(ac97->reset);
if (ret) {
dev_err(&pdev->dev, "Failed to assert AC'97 reset: %d\n", ret);
goto err_clk_put;
}
ret = clk_prepare_enable(ac97->clk_ac97); ret = clk_prepare_enable(ac97->clk_ac97);
if (ret) { if (ret) {
dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); dev_err(&pdev->dev, "clk_enable failed: %d\n", ret);
goto err_clk_put; goto err_clk_put;
} }
usleep_range(10, 100);
ret = reset_control_deassert(ac97->reset);
if (ret) {
dev_err(&pdev->dev, "Failed to deassert AC'97 reset: %d\n", ret);
goto err_clk_disable_unprepare;
}
ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret);
......
...@@ -78,6 +78,7 @@ struct tegra20_ac97 { ...@@ -78,6 +78,7 @@ struct tegra20_ac97 {
struct clk *clk_ac97; struct clk *clk_ac97;
struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data capture_dma_data;
struct snd_dmaengine_dai_dma_data playback_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data;
struct reset_control *reset;
struct regmap *regmap; struct regmap *regmap;
int reset_gpio; int reset_gpio;
int sync_gpio; int sync_gpio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment