diff options
author | Inha Song <ideal.song@samsung.com> | 2014-08-20 13:45:38 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 12:00:43 +0900 |
commit | 6252d5464d46f1fdd3411d846b2f049f01b52b83 (patch) | |
tree | 4e3d368178dce9350deaa1fbffb9c4d37db708c0 /sound | |
parent | 71e6550dbdff8573843b8fd4d3427436948ec4eb (diff) | |
download | linux-3.10-6252d5464d46f1fdd3411d846b2f049f01b52b83.tar.gz linux-3.10-6252d5464d46f1fdd3411d846b2f049f01b52b83.tar.bz2 linux-3.10-6252d5464d46f1fdd3411d846b2f049f01b52b83.zip |
ASoC: Samsung: i2s: make sure the i2s bus clock is enabled before starting operation
This patch add i2s bus clock enable/disable function. If boards does not have
Audio Sub System, seperate clock is necessary for i2s bus control. This patch
should not effect Exynos4 SoC boards.
Change-Id: Ibcc696767526b3bafaa02b08eec2150410e296c8
Signed-off-by: Inha Song <ideal.song@samsung.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/samsung/i2s.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 95fab0f26a0..bce311d9d9c 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1005,6 +1005,14 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) dev_err(&i2s->pdev->dev, "failed to set clock hierachy.\n"); return ret; } + } else { + i2s->bus_clk = devm_clk_get(&i2s->pdev->dev, "iis"); + if (IS_ERR(i2s->bus_clk)) { + dev_err(&i2s->pdev->dev, "failed to get i2s0_bus gate\n"); + return PTR_ERR(i2s->bus_clk); + } + + clk_prepare_enable(i2s->bus_clk); } if (other) { @@ -1053,10 +1061,16 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) clk_put(i2s->op_clk); } + if (!IS_ERR(i2s->bus_clk)) { + clk_disable_unprepare(i2s->bus_clk); + clk_put(i2s->bus_clk); + } + iounmap(i2s->addr); } i2s->op_clk = ERR_PTR(-EINVAL); + i2s->bus_clk = ERR_PTR(-EINVAL); return 0; } @@ -1149,6 +1163,9 @@ static int i2s_runtime_suspend(struct device *dev) if (!IS_ERR(i2s->op_clk)) clk_disable_unprepare(i2s->op_clk); + if (!IS_ERR(i2s->bus_clk)) + clk_disable_unprepare(i2s->bus_clk); + return 0; } @@ -1159,6 +1176,9 @@ static int i2s_runtime_resume(struct device *dev) if (!IS_ERR(i2s->op_clk)) clk_prepare_enable(i2s->op_clk); + if (!IS_ERR(i2s->bus_clk)) + clk_prepare_enable(i2s->bus_clk); + return 0; } #endif /* CONFIG_PM_RUNTIME */ @@ -1247,10 +1267,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) } } - pri_dai->bus_clk = devm_clk_get(&pdev->dev, "iis"); - if (!IS_ERR(pri_dai->bus_clk)) - clk_prepare_enable(pri_dai->bus_clk); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "Unable to get I2S SFR address\n"); @@ -1342,9 +1358,6 @@ static int samsung_i2s_remove(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res) release_mem_region(res->start, resource_size(res)); - - if (!IS_ERR(i2s->bus_clk)) - clk_disable_unprepare(i2s->bus_clk); } i2s->pri_dai = NULL; |