aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-03-11 09:26:21 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-12 06:12:24 -0500
commitc3746a07f13f8711885fd3909c03477a1b47ab82 (patch)
treea80f702d0d7df8008fbf36925cd9e2b05427c27f
parentaa9b88ee80d3985ebae9567a8f4e0d07ce15b5a7 (diff)
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: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/tlv320dac33.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index f9f367d29a90..e845c4b9066e 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -310,7 +310,8 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
310 if (power) 310 if (power)
311 reg |= DAC33_PDNALLB; 311 reg |= DAC33_PDNALLB;
312 else 312 else
313 reg &= ~DAC33_PDNALLB; 313 reg &= ~(DAC33_PDNALLB | DAC33_OSCPDNB |
314 DAC33_DACRPDNB | DAC33_DACLPDNB);
314 dac33_write(codec, DAC33_PWR_CTRL, reg); 315 dac33_write(codec, DAC33_PWR_CTRL, reg);
315} 316}
316 317
@@ -634,26 +635,6 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
634 return IRQ_HANDLED; 635 return IRQ_HANDLED;
635} 636}
636 637
637static void dac33_shutdown(struct snd_pcm_substream *substream,
638 struct snd_soc_dai *dai)
639{
640 struct snd_soc_pcm_runtime *rtd = substream->private_data;
641 struct snd_soc_device *socdev = rtd->socdev;
642 struct snd_soc_codec *codec = socdev->card->codec;
643 struct tlv320dac33_priv *dac33 = codec->private_data;
644 unsigned int pwr_ctrl;
645
646 /* Stop pending workqueue */
647 if (dac33->fifo_mode)
648 cancel_work_sync(&dac33->work);
649
650 mutex_lock(&dac33->mutex);
651 pwr_ctrl = dac33_read_reg_cache(codec, DAC33_PWR_CTRL);
652 pwr_ctrl &= ~(DAC33_OSCPDNB | DAC33_DACRPDNB | DAC33_DACLPDNB);
653 dac33_write(codec, DAC33_PWR_CTRL, pwr_ctrl);
654 mutex_unlock(&dac33->mutex);
655}
656
657static void dac33_oscwait(struct snd_soc_codec *codec) 638static void dac33_oscwait(struct snd_soc_codec *codec)
658{ 639{
659 int timeout = 20; 640 int timeout = 20;
@@ -751,6 +732,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
751 } 732 }
752 733
753 mutex_lock(&dac33->mutex); 734 mutex_lock(&dac33->mutex);
735 dac33_soft_power(codec, 0);
754 dac33_soft_power(codec, 1); 736 dac33_soft_power(codec, 1);
755 737
756 reg_tmp = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL); 738 reg_tmp = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL);
@@ -1185,7 +1167,6 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33);
1185#define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE 1167#define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE
1186 1168
1187static struct snd_soc_dai_ops dac33_dai_ops = { 1169static struct snd_soc_dai_ops dac33_dai_ops = {
1188 .shutdown = dac33_shutdown,
1189 .hw_params = dac33_hw_params, 1170 .hw_params = dac33_hw_params,
1190 .prepare = dac33_pcm_prepare, 1171 .prepare = dac33_pcm_prepare,
1191 .trigger = dac33_pcm_trigger, 1172 .trigger = dac33_pcm_trigger,