diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 32 | ||||
-rw-r--r-- | sound/soc/codecs/twl6040.c | 4 |
2 files changed, 23 insertions, 13 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 00b6d87e7bdb..eb1a0b4e09b6 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -324,6 +324,10 @@ static void dac33_init_chip(struct snd_soc_codec *codec) | |||
324 | dac33_write(codec, DAC33_OUT_AMP_CTRL, | 324 | dac33_write(codec, DAC33_OUT_AMP_CTRL, |
325 | dac33_read_reg_cache(codec, DAC33_OUT_AMP_CTRL)); | 325 | dac33_read_reg_cache(codec, DAC33_OUT_AMP_CTRL)); |
326 | 326 | ||
327 | dac33_write(codec, DAC33_LDAC_PWR_CTRL, | ||
328 | dac33_read_reg_cache(codec, DAC33_LDAC_PWR_CTRL)); | ||
329 | dac33_write(codec, DAC33_RDAC_PWR_CTRL, | ||
330 | dac33_read_reg_cache(codec, DAC33_RDAC_PWR_CTRL)); | ||
327 | } | 331 | } |
328 | 332 | ||
329 | static inline int dac33_read_id(struct snd_soc_codec *codec) | 333 | static inline int dac33_read_id(struct snd_soc_codec *codec) |
@@ -670,6 +674,7 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
670 | { | 674 | { |
671 | struct snd_soc_codec *codec = dac33->codec; | 675 | struct snd_soc_codec *codec = dac33->codec; |
672 | unsigned int delay; | 676 | unsigned int delay; |
677 | unsigned long flags; | ||
673 | 678 | ||
674 | switch (dac33->fifo_mode) { | 679 | switch (dac33->fifo_mode) { |
675 | case DAC33_FIFO_MODE1: | 680 | case DAC33_FIFO_MODE1: |
@@ -677,10 +682,10 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
677 | DAC33_THRREG(dac33->nsample)); | 682 | DAC33_THRREG(dac33->nsample)); |
678 | 683 | ||
679 | /* Take the timestamps */ | 684 | /* Take the timestamps */ |
680 | spin_lock_irq(&dac33->lock); | 685 | spin_lock_irqsave(&dac33->lock, flags); |
681 | dac33->t_stamp2 = ktime_to_us(ktime_get()); | 686 | dac33->t_stamp2 = ktime_to_us(ktime_get()); |
682 | dac33->t_stamp1 = dac33->t_stamp2; | 687 | dac33->t_stamp1 = dac33->t_stamp2; |
683 | spin_unlock_irq(&dac33->lock); | 688 | spin_unlock_irqrestore(&dac33->lock, flags); |
684 | 689 | ||
685 | dac33_write16(codec, DAC33_PREFILL_MSB, | 690 | dac33_write16(codec, DAC33_PREFILL_MSB, |
686 | DAC33_THRREG(dac33->alarm_threshold)); | 691 | DAC33_THRREG(dac33->alarm_threshold)); |
@@ -692,11 +697,11 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
692 | break; | 697 | break; |
693 | case DAC33_FIFO_MODE7: | 698 | case DAC33_FIFO_MODE7: |
694 | /* Take the timestamp */ | 699 | /* Take the timestamp */ |
695 | spin_lock_irq(&dac33->lock); | 700 | spin_lock_irqsave(&dac33->lock, flags); |
696 | dac33->t_stamp1 = ktime_to_us(ktime_get()); | 701 | dac33->t_stamp1 = ktime_to_us(ktime_get()); |
697 | /* Move back the timestamp with drain time */ | 702 | /* Move back the timestamp with drain time */ |
698 | dac33->t_stamp1 -= dac33->mode7_us_to_lthr; | 703 | dac33->t_stamp1 -= dac33->mode7_us_to_lthr; |
699 | spin_unlock_irq(&dac33->lock); | 704 | spin_unlock_irqrestore(&dac33->lock, flags); |
700 | 705 | ||
701 | dac33_write16(codec, DAC33_PREFILL_MSB, | 706 | dac33_write16(codec, DAC33_PREFILL_MSB, |
702 | DAC33_THRREG(DAC33_MODE7_MARGIN)); | 707 | DAC33_THRREG(DAC33_MODE7_MARGIN)); |
@@ -714,13 +719,14 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
714 | static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) | 719 | static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) |
715 | { | 720 | { |
716 | struct snd_soc_codec *codec = dac33->codec; | 721 | struct snd_soc_codec *codec = dac33->codec; |
722 | unsigned long flags; | ||
717 | 723 | ||
718 | switch (dac33->fifo_mode) { | 724 | switch (dac33->fifo_mode) { |
719 | case DAC33_FIFO_MODE1: | 725 | case DAC33_FIFO_MODE1: |
720 | /* Take the timestamp */ | 726 | /* Take the timestamp */ |
721 | spin_lock_irq(&dac33->lock); | 727 | spin_lock_irqsave(&dac33->lock, flags); |
722 | dac33->t_stamp2 = ktime_to_us(ktime_get()); | 728 | dac33->t_stamp2 = ktime_to_us(ktime_get()); |
723 | spin_unlock_irq(&dac33->lock); | 729 | spin_unlock_irqrestore(&dac33->lock, flags); |
724 | 730 | ||
725 | dac33_write16(codec, DAC33_NSAMPLE_MSB, | 731 | dac33_write16(codec, DAC33_NSAMPLE_MSB, |
726 | DAC33_THRREG(dac33->nsample)); | 732 | DAC33_THRREG(dac33->nsample)); |
@@ -773,10 +779,11 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev) | |||
773 | { | 779 | { |
774 | struct snd_soc_codec *codec = dev; | 780 | struct snd_soc_codec *codec = dev; |
775 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | 781 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); |
782 | unsigned long flags; | ||
776 | 783 | ||
777 | spin_lock(&dac33->lock); | 784 | spin_lock_irqsave(&dac33->lock, flags); |
778 | dac33->t_stamp1 = ktime_to_us(ktime_get()); | 785 | dac33->t_stamp1 = ktime_to_us(ktime_get()); |
779 | spin_unlock(&dac33->lock); | 786 | spin_unlock_irqrestore(&dac33->lock, flags); |
780 | 787 | ||
781 | /* Do not schedule the workqueue in Mode7 */ | 788 | /* Do not schedule the workqueue in Mode7 */ |
782 | if (dac33->fifo_mode != DAC33_FIFO_MODE7) | 789 | if (dac33->fifo_mode != DAC33_FIFO_MODE7) |
@@ -1173,15 +1180,16 @@ static snd_pcm_sframes_t dac33_dai_delay( | |||
1173 | unsigned int time_delta, uthr; | 1180 | unsigned int time_delta, uthr; |
1174 | int samples_out, samples_in, samples; | 1181 | int samples_out, samples_in, samples; |
1175 | snd_pcm_sframes_t delay = 0; | 1182 | snd_pcm_sframes_t delay = 0; |
1183 | unsigned long flags; | ||
1176 | 1184 | ||
1177 | switch (dac33->fifo_mode) { | 1185 | switch (dac33->fifo_mode) { |
1178 | case DAC33_FIFO_BYPASS: | 1186 | case DAC33_FIFO_BYPASS: |
1179 | break; | 1187 | break; |
1180 | case DAC33_FIFO_MODE1: | 1188 | case DAC33_FIFO_MODE1: |
1181 | spin_lock(&dac33->lock); | 1189 | spin_lock_irqsave(&dac33->lock, flags); |
1182 | t0 = dac33->t_stamp1; | 1190 | t0 = dac33->t_stamp1; |
1183 | t1 = dac33->t_stamp2; | 1191 | t1 = dac33->t_stamp2; |
1184 | spin_unlock(&dac33->lock); | 1192 | spin_unlock_irqrestore(&dac33->lock, flags); |
1185 | t_now = ktime_to_us(ktime_get()); | 1193 | t_now = ktime_to_us(ktime_get()); |
1186 | 1194 | ||
1187 | /* We have not started to fill the FIFO yet, delay is 0 */ | 1195 | /* We have not started to fill the FIFO yet, delay is 0 */ |
@@ -1246,10 +1254,10 @@ static snd_pcm_sframes_t dac33_dai_delay( | |||
1246 | } | 1254 | } |
1247 | break; | 1255 | break; |
1248 | case DAC33_FIFO_MODE7: | 1256 | case DAC33_FIFO_MODE7: |
1249 | spin_lock(&dac33->lock); | 1257 | spin_lock_irqsave(&dac33->lock, flags); |
1250 | t0 = dac33->t_stamp1; | 1258 | t0 = dac33->t_stamp1; |
1251 | uthr = dac33->uthr; | 1259 | uthr = dac33->uthr; |
1252 | spin_unlock(&dac33->lock); | 1260 | spin_unlock_irqrestore(&dac33->lock, flags); |
1253 | t_now = ktime_to_us(ktime_get()); | 1261 | t_now = ktime_to_us(ktime_get()); |
1254 | 1262 | ||
1255 | /* We have not started to fill the FIFO yet, delay is 0 */ | 1263 | /* We have not started to fill the FIFO yet, delay is 0 */ |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 482fcdb59bfa..255901c4460d 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -1629,8 +1629,10 @@ static int twl6040_probe(struct snd_soc_codec *codec) | |||
1629 | priv->naudint = naudint; | 1629 | priv->naudint = naudint; |
1630 | priv->workqueue = create_singlethread_workqueue("twl6040-codec"); | 1630 | priv->workqueue = create_singlethread_workqueue("twl6040-codec"); |
1631 | 1631 | ||
1632 | if (!priv->workqueue) | 1632 | if (!priv->workqueue) { |
1633 | ret = -ENOMEM; | ||
1633 | goto work_err; | 1634 | goto work_err; |
1635 | } | ||
1634 | 1636 | ||
1635 | INIT_DELAYED_WORK(&priv->delayed_work, twl6040_accessory_work); | 1637 | INIT_DELAYED_WORK(&priv->delayed_work, twl6040_accessory_work); |
1636 | 1638 | ||