diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2015-01-14 13:42:31 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-14 14:46:54 -0500 |
commit | 0ec2ba807c1563134a865b6f0b326b8a2e776937 (patch) | |
tree | 0c9781c2543adabe0548aba7ab20f3ac28472aa6 /sound/soc/samsung | |
parent | af1cf5cf9c1881192f72af204e873ac345a3e265 (diff) |
ASoC: samsung: i2s: Move clk_get() to platform driver probe()
Acquire the I2S interface clock in driver probe() callback
as it's a per-device not a per-DAI clock. While at it switch
to the resource managed clk_get().
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r-- | sound/soc/samsung/i2s.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 366b720731e1..a854ffca2416 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -971,18 +971,12 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) | |||
971 | struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; | 971 | struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; |
972 | int ret; | 972 | int ret; |
973 | 973 | ||
974 | if (other && other->clk) { /* If this is probe on secondary */ | 974 | if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ |
975 | samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback, | 975 | samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback, |
976 | NULL); | 976 | NULL); |
977 | goto probe_exit; | 977 | goto probe_exit; |
978 | } | 978 | } |
979 | 979 | ||
980 | i2s->clk = clk_get(&i2s->pdev->dev, "iis"); | ||
981 | if (IS_ERR(i2s->clk)) { | ||
982 | dev_err(&i2s->pdev->dev, "failed to get i2s_clock\n"); | ||
983 | return PTR_ERR(i2s->clk); | ||
984 | } | ||
985 | |||
986 | ret = clk_prepare_enable(i2s->clk); | 980 | ret = clk_prepare_enable(i2s->clk); |
987 | if (ret != 0) { | 981 | if (ret != 0) { |
988 | dev_err(&i2s->pdev->dev, "failed to enable clock: %d\n", ret); | 982 | dev_err(&i2s->pdev->dev, "failed to enable clock: %d\n", ret); |
@@ -991,10 +985,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) | |||
991 | 985 | ||
992 | samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); | 986 | samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); |
993 | 987 | ||
994 | if (other) { | ||
995 | other->clk = i2s->clk; | ||
996 | } | ||
997 | |||
998 | if (i2s->quirks & QUIRK_NEED_RSTCLR) | 988 | if (i2s->quirks & QUIRK_NEED_RSTCLR) |
999 | writel(CON_RSTCLR, i2s->addr + I2SCON); | 989 | writel(CON_RSTCLR, i2s->addr + I2SCON); |
1000 | 990 | ||
@@ -1032,7 +1022,6 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) | |||
1032 | writel(0, i2s->addr + I2SCON); | 1022 | writel(0, i2s->addr + I2SCON); |
1033 | 1023 | ||
1034 | clk_disable_unprepare(i2s->clk); | 1024 | clk_disable_unprepare(i2s->clk); |
1035 | clk_put(i2s->clk); | ||
1036 | } | 1025 | } |
1037 | 1026 | ||
1038 | i2s->clk = NULL; | 1027 | i2s->clk = NULL; |
@@ -1222,6 +1211,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) | |||
1222 | 1211 | ||
1223 | regs_base = res->start; | 1212 | regs_base = res->start; |
1224 | 1213 | ||
1214 | pri_dai->clk = devm_clk_get(&pdev->dev, "iis"); | ||
1215 | if (IS_ERR(pri_dai->clk)) { | ||
1216 | dev_err(&pdev->dev, "Failed to get iis clock\n"); | ||
1217 | return PTR_ERR(pri_dai->clk); | ||
1218 | } | ||
1225 | pri_dai->dma_playback.dma_addr = regs_base + I2STXD; | 1219 | pri_dai->dma_playback.dma_addr = regs_base + I2STXD; |
1226 | pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; | 1220 | pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; |
1227 | pri_dai->dma_playback.ch_name = "tx"; | 1221 | pri_dai->dma_playback.ch_name = "tx"; |
@@ -1253,6 +1247,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) | |||
1253 | 1247 | ||
1254 | sec_dai->dma_playback.dma_size = 4; | 1248 | sec_dai->dma_playback.dma_size = 4; |
1255 | sec_dai->addr = pri_dai->addr; | 1249 | sec_dai->addr = pri_dai->addr; |
1250 | sec_dai->clk = pri_dai->clk; | ||
1256 | sec_dai->quirks = quirks; | 1251 | sec_dai->quirks = quirks; |
1257 | sec_dai->idma_playback.dma_addr = idma_addr; | 1252 | sec_dai->idma_playback.dma_addr = idma_addr; |
1258 | sec_dai->pri_dai = pri_dai; | 1253 | sec_dai->pri_dai = pri_dai; |