Commit 30d436a6 authored by Stephen Warren's avatar Stephen Warren Committed by Mark Brown

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: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent c0d5a47c
...@@ -220,8 +220,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -220,8 +220,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
if (i2sclock % (2 * srate)) if (i2sclock % (2 * srate))
reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE; reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE;
if (!i2s->clk_refs) clk_enable(i2s->clk_i2s);
clk_enable(i2s->clk_i2s);
tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg); tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg);
...@@ -229,8 +228,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -229,8 +228,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS | TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS |
TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS); TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS);
if (!i2s->clk_refs) clk_disable(i2s->clk_i2s);
clk_disable(i2s->clk_i2s);
return 0; return 0;
} }
...@@ -268,9 +266,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -268,9 +266,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
if (!i2s->clk_refs) clk_enable(i2s->clk_i2s);
clk_enable(i2s->clk_i2s);
i2s->clk_refs++;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
tegra_i2s_start_playback(i2s); tegra_i2s_start_playback(i2s);
else else
...@@ -283,9 +279,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -283,9 +279,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
tegra_i2s_stop_playback(i2s); tegra_i2s_stop_playback(i2s);
else else
tegra_i2s_stop_capture(i2s); tegra_i2s_stop_capture(i2s);
i2s->clk_refs--; clk_disable(i2s->clk_i2s);
if (!i2s->clk_refs)
clk_disable(i2s->clk_i2s);
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -155,7 +155,6 @@ ...@@ -155,7 +155,6 @@
struct tegra_i2s { struct tegra_i2s {
struct snd_soc_dai_driver dai; struct snd_soc_dai_driver dai;
struct clk *clk_i2s; struct clk *clk_i2s;
int clk_refs;
struct tegra_pcm_dma_params capture_dma_data; struct tegra_pcm_dma_params capture_dma_data;
struct tegra_pcm_dma_params playback_dma_data; struct tegra_pcm_dma_params playback_dma_data;
void __iomem *regs; void __iomem *regs;
......
...@@ -196,18 +196,14 @@ static int tegra_spdif_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -196,18 +196,14 @@ static int tegra_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
if (!spdif->clk_refs) clk_enable(spdif->clk_spdif_out);
clk_enable(spdif->clk_spdif_out);
spdif->clk_refs++;
tegra_spdif_start_playback(spdif); tegra_spdif_start_playback(spdif);
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
tegra_spdif_stop_playback(spdif); tegra_spdif_stop_playback(spdif);
spdif->clk_refs--; clk_disable(spdif->clk_spdif_out);
if (!spdif->clk_refs)
clk_disable(spdif->clk_spdif_out);
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -462,7 +462,6 @@ ...@@ -462,7 +462,6 @@
struct tegra_spdif { struct tegra_spdif {
struct clk *clk_spdif_out; struct clk *clk_spdif_out;
int clk_refs;
struct tegra_pcm_dma_params capture_dma_data; struct tegra_pcm_dma_params capture_dma_data;
struct tegra_pcm_dma_params playback_dma_data; struct tegra_pcm_dma_params playback_dma_data;
void __iomem *regs; void __iomem *regs;
......
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