Commit c3746a07 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: tlv320dac33: Start/stop sequence change

To avoid race condition especially in FIFO modes the
sequence for enabling and disabling the codec need to
be changed.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent aa9b88ee
...@@ -310,7 +310,8 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power) ...@@ -310,7 +310,8 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
if (power) if (power)
reg |= DAC33_PDNALLB; reg |= DAC33_PDNALLB;
else else
reg &= ~DAC33_PDNALLB; reg &= ~(DAC33_PDNALLB | DAC33_OSCPDNB |
DAC33_DACRPDNB | DAC33_DACLPDNB);
dac33_write(codec, DAC33_PWR_CTRL, reg); dac33_write(codec, DAC33_PWR_CTRL, reg);
} }
...@@ -634,26 +635,6 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev) ...@@ -634,26 +635,6 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void dac33_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_device *socdev = rtd->socdev;
struct snd_soc_codec *codec = socdev->card->codec;
struct tlv320dac33_priv *dac33 = codec->private_data;
unsigned int pwr_ctrl;
/* Stop pending workqueue */
if (dac33->fifo_mode)
cancel_work_sync(&dac33->work);
mutex_lock(&dac33->mutex);
pwr_ctrl = dac33_read_reg_cache(codec, DAC33_PWR_CTRL);
pwr_ctrl &= ~(DAC33_OSCPDNB | DAC33_DACRPDNB | DAC33_DACLPDNB);
dac33_write(codec, DAC33_PWR_CTRL, pwr_ctrl);
mutex_unlock(&dac33->mutex);
}
static void dac33_oscwait(struct snd_soc_codec *codec) static void dac33_oscwait(struct snd_soc_codec *codec)
{ {
int timeout = 20; int timeout = 20;
...@@ -751,6 +732,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) ...@@ -751,6 +732,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
} }
mutex_lock(&dac33->mutex); mutex_lock(&dac33->mutex);
dac33_soft_power(codec, 0);
dac33_soft_power(codec, 1); dac33_soft_power(codec, 1);
reg_tmp = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL); reg_tmp = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL);
...@@ -1185,7 +1167,6 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33); ...@@ -1185,7 +1167,6 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33);
#define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE #define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE
static struct snd_soc_dai_ops dac33_dai_ops = { static struct snd_soc_dai_ops dac33_dai_ops = {
.shutdown = dac33_shutdown,
.hw_params = dac33_hw_params, .hw_params = dac33_hw_params,
.prepare = dac33_pcm_prepare, .prepare = dac33_pcm_prepare,
.trigger = dac33_pcm_trigger, .trigger = dac33_pcm_trigger,
......
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