提交 d8ced479 编写于 作者: S Sascha Hauer 提交者: Mark Brown

ASoC: fsl-ssi: remove unnecessary spinlock

The baudclock_locked variable is only used in functions which
are serialized anyway from the core. No need to have a lock
around the variable, so remove it.
Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de>
Tested-By: NMichael Grzeschik <mgr@pengutronix.de>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 8dd51e23
...@@ -163,7 +163,6 @@ struct fsl_ssi_private { ...@@ -163,7 +163,6 @@ struct fsl_ssi_private {
bool baudclk_locked; bool baudclk_locked;
bool use_dual_fifo; bool use_dual_fifo;
u8 i2s_mode; u8 i2s_mode;
spinlock_t baudclk_lock;
struct clk *baudclk; struct clk *baudclk;
struct clk *clk; struct clk *clk;
unsigned int bitclk_freq; unsigned int bitclk_freq;
...@@ -495,13 +494,9 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream, ...@@ -495,13 +494,9 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct fsl_ssi_private *ssi_private = struct fsl_ssi_private *ssi_private =
snd_soc_dai_get_drvdata(rtd->cpu_dai); snd_soc_dai_get_drvdata(rtd->cpu_dai);
unsigned long flags;
if (!dai->active && !fsl_ssi_is_ac97(ssi_private)) { if (!dai->active && !fsl_ssi_is_ac97(ssi_private))
spin_lock_irqsave(&ssi_private->baudclk_lock, flags);
ssi_private->baudclk_locked = false; ssi_private->baudclk_locked = false;
spin_unlock_irqrestore(&ssi_private->baudclk_lock, flags);
}
/* When using dual fifo mode, it is safer to ensure an even period /* When using dual fifo mode, it is safer to ensure an even period
* size. If appearing to an odd number while DMA always starts its * size. If appearing to an odd number while DMA always starts its
...@@ -532,7 +527,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, ...@@ -532,7 +527,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
struct ccsr_ssi __iomem *ssi = ssi_private->ssi; struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
int synchronous = ssi_private->cpu_dai_drv.symmetric_rates, ret; int synchronous = ssi_private->cpu_dai_drv.symmetric_rates, ret;
u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i; u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
unsigned long flags, clkrate, baudrate, tmprate; unsigned long clkrate, baudrate, tmprate;
u64 sub, savesub = 100000; u64 sub, savesub = 100000;
unsigned int freq; unsigned int freq;
...@@ -603,18 +598,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, ...@@ -603,18 +598,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
else else
write_ssi_mask(&ssi->srccr, mask, stccr); write_ssi_mask(&ssi->srccr, mask, stccr);
spin_lock_irqsave(&ssi_private->baudclk_lock, flags);
if (!ssi_private->baudclk_locked) { if (!ssi_private->baudclk_locked) {
ret = clk_set_rate(ssi_private->baudclk, baudrate); ret = clk_set_rate(ssi_private->baudclk, baudrate);
if (ret) { if (ret) {
spin_unlock_irqrestore(&ssi_private->baudclk_lock,
flags);
dev_err(cpu_dai->dev, "failed to set baudclk rate\n"); dev_err(cpu_dai->dev, "failed to set baudclk rate\n");
return -EINVAL; return -EINVAL;
} }
ssi_private->baudclk_locked = true; ssi_private->baudclk_locked = true;
} }
spin_unlock_irqrestore(&ssi_private->baudclk_lock, flags);
return 0; return 0;
} }
...@@ -899,7 +890,6 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -899,7 +890,6 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(rtd->cpu_dai); struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(rtd->cpu_dai);
struct ccsr_ssi __iomem *ssi = ssi_private->ssi; struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
unsigned long flags;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
...@@ -920,11 +910,9 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -920,11 +910,9 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
fsl_ssi_rx_config(ssi_private, false); fsl_ssi_rx_config(ssi_private, false);
if (!fsl_ssi_is_ac97(ssi_private) && (read_ssi(&ssi->scr) & if (!fsl_ssi_is_ac97(ssi_private) && (read_ssi(&ssi->scr) &
(CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE)) == 0) { (CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE)) == 0)
spin_lock_irqsave(&ssi_private->baudclk_lock, flags);
ssi_private->baudclk_locked = false; ssi_private->baudclk_locked = false;
spin_unlock_irqrestore(&ssi_private->baudclk_lock, flags);
}
break; break;
default: default:
...@@ -1257,7 +1245,6 @@ static int fsl_ssi_probe(struct platform_device *pdev) ...@@ -1257,7 +1245,6 @@ static int fsl_ssi_probe(struct platform_device *pdev)
ssi_private->fifo_depth = 8; ssi_private->fifo_depth = 8;
ssi_private->baudclk_locked = false; ssi_private->baudclk_locked = false;
spin_lock_init(&ssi_private->baudclk_lock);
dev_set_drvdata(&pdev->dev, ssi_private); dev_set_drvdata(&pdev->dev, ssi_private);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册