aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-03-30 19:07:16 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 06:28:32 -0400
commit30d436a64415e6d01b8696d6288abe7ad0b383b5 (patch)
treeb896be7dc848ea5745c16ee216f348417ab20e06 /sound/soc/tegra
parentc0d5a47ca86047aca1616b744ab3ef31b3448994 (diff)
ASoC: tegra: remove open-coded clk reference counting
clk_enable/disable() already reference count the enable calls, so there's no need for the callers to do the same. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra')
-rw-r--r--sound/soc/tegra/tegra_i2s.c14
-rw-r--r--sound/soc/tegra/tegra_i2s.h1
-rw-r--r--sound/soc/tegra/tegra_spdif.c8
-rw-r--r--sound/soc/tegra/tegra_spdif.h1
4 files changed, 6 insertions, 18 deletions
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c
index d66e5095363a..2d32b8ce5f2e 100644
--- a/sound/soc/tegra/tegra_i2s.c
+++ b/sound/soc/tegra/tegra_i2s.c
@@ -220,8 +220,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
220 if (i2sclock % (2 * srate)) 220 if (i2sclock % (2 * srate))
221 reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE; 221 reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE;
222 222
223 if (!i2s->clk_refs) 223 clk_enable(i2s->clk_i2s);
224 clk_enable(i2s->clk_i2s);
225 224
226 tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg); 225 tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg);
227 226
@@ -229,8 +228,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
229 TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS | 228 TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS |
230 TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS); 229 TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS);
231 230
232 if (!i2s->clk_refs) 231 clk_disable(i2s->clk_i2s);
233 clk_disable(i2s->clk_i2s);
234 232
235 return 0; 233 return 0;
236} 234}
@@ -268,9 +266,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
268 case SNDRV_PCM_TRIGGER_START: 266 case SNDRV_PCM_TRIGGER_START:
269 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 267 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
270 case SNDRV_PCM_TRIGGER_RESUME: 268 case SNDRV_PCM_TRIGGER_RESUME:
271 if (!i2s->clk_refs) 269 clk_enable(i2s->clk_i2s);
272 clk_enable(i2s->clk_i2s);
273 i2s->clk_refs++;
274 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 270 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
275 tegra_i2s_start_playback(i2s); 271 tegra_i2s_start_playback(i2s);
276 else 272 else
@@ -283,9 +279,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
283 tegra_i2s_stop_playback(i2s); 279 tegra_i2s_stop_playback(i2s);
284 else 280 else
285 tegra_i2s_stop_capture(i2s); 281 tegra_i2s_stop_capture(i2s);
286 i2s->clk_refs--; 282 clk_disable(i2s->clk_i2s);
287 if (!i2s->clk_refs)
288 clk_disable(i2s->clk_i2s);
289 break; 283 break;
290 default: 284 default:
291 return -EINVAL; 285 return -EINVAL;
diff --git a/sound/soc/tegra/tegra_i2s.h b/sound/soc/tegra/tegra_i2s.h
index 15ce1e2e8bde..c08e019c0260 100644
--- a/sound/soc/tegra/tegra_i2s.h
+++ b/sound/soc/tegra/tegra_i2s.h
@@ -155,7 +155,6 @@
155struct tegra_i2s { 155struct tegra_i2s {
156 struct snd_soc_dai_driver dai; 156 struct snd_soc_dai_driver dai;
157 struct clk *clk_i2s; 157 struct clk *clk_i2s;
158 int clk_refs;
159 struct tegra_pcm_dma_params capture_dma_data; 158 struct tegra_pcm_dma_params capture_dma_data;
160 struct tegra_pcm_dma_params playback_dma_data; 159 struct tegra_pcm_dma_params playback_dma_data;
161 void __iomem *regs; 160 void __iomem *regs;
diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c
index cd836cbcb0c9..3426633e9147 100644
--- a/sound/soc/tegra/tegra_spdif.c
+++ b/sound/soc/tegra/tegra_spdif.c
@@ -196,18 +196,14 @@ static int tegra_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
196 case SNDRV_PCM_TRIGGER_START: 196 case SNDRV_PCM_TRIGGER_START:
197 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 197 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
198 case SNDRV_PCM_TRIGGER_RESUME: 198 case SNDRV_PCM_TRIGGER_RESUME:
199 if (!spdif->clk_refs) 199 clk_enable(spdif->clk_spdif_out);
200 clk_enable(spdif->clk_spdif_out);
201 spdif->clk_refs++;
202 tegra_spdif_start_playback(spdif); 200 tegra_spdif_start_playback(spdif);
203 break; 201 break;
204 case SNDRV_PCM_TRIGGER_STOP: 202 case SNDRV_PCM_TRIGGER_STOP:
205 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 203 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
206 case SNDRV_PCM_TRIGGER_SUSPEND: 204 case SNDRV_PCM_TRIGGER_SUSPEND:
207 tegra_spdif_stop_playback(spdif); 205 tegra_spdif_stop_playback(spdif);
208 spdif->clk_refs--; 206 clk_disable(spdif->clk_spdif_out);
209 if (!spdif->clk_refs)
210 clk_disable(spdif->clk_spdif_out);
211 break; 207 break;
212 default: 208 default:
213 return -EINVAL; 209 return -EINVAL;
diff --git a/sound/soc/tegra/tegra_spdif.h b/sound/soc/tegra/tegra_spdif.h
index 2e03db430279..f5fc7124aa7b 100644
--- a/sound/soc/tegra/tegra_spdif.h
+++ b/sound/soc/tegra/tegra_spdif.h
@@ -462,7 +462,6 @@
462 462
463struct tegra_spdif { 463struct tegra_spdif {
464 struct clk *clk_spdif_out; 464 struct clk *clk_spdif_out;
465 int clk_refs;
466 struct tegra_pcm_dma_params capture_dma_data; 465 struct tegra_pcm_dma_params capture_dma_data;
467 struct tegra_pcm_dma_params playback_dma_data; 466 struct tegra_pcm_dma_params playback_dma_data;
468 void __iomem *regs; 467 void __iomem *regs;