diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2011-03-18 09:15:11 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-03-22 14:10:21 -0400 |
commit | a3b55791b5b2b4b6d31ece9b3975466ec2f07b1b (patch) | |
tree | 0d7ab82b20190a1a96f1be5023a5fcbe2e655252 /sound | |
parent | fa4d1f595a89234647b34a7f507436be873091bc (diff) |
ASoC: tlv320dac33: Fix inconsistent spinlock usage
The lock is used within the interrupt handler.
Correct the spinlock usage, and use irqsave/irqrestore
flavour of spin_lock/unlock.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 71d7be8ac48..93f38b1d624 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -670,6 +670,7 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
670 | { | 670 | { |
671 | struct snd_soc_codec *codec = dac33->codec; | 671 | struct snd_soc_codec *codec = dac33->codec; |
672 | unsigned int delay; | 672 | unsigned int delay; |
673 | unsigned long flags; | ||
673 | 674 | ||
674 | switch (dac33->fifo_mode) { | 675 | switch (dac33->fifo_mode) { |
675 | case DAC33_FIFO_MODE1: | 676 | case DAC33_FIFO_MODE1: |
@@ -677,10 +678,10 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
677 | DAC33_THRREG(dac33->nsample)); | 678 | DAC33_THRREG(dac33->nsample)); |
678 | 679 | ||
679 | /* Take the timestamps */ | 680 | /* Take the timestamps */ |
680 | spin_lock_irq(&dac33->lock); | 681 | spin_lock_irqsave(&dac33->lock, flags); |
681 | dac33->t_stamp2 = ktime_to_us(ktime_get()); | 682 | dac33->t_stamp2 = ktime_to_us(ktime_get()); |
682 | dac33->t_stamp1 = dac33->t_stamp2; | 683 | dac33->t_stamp1 = dac33->t_stamp2; |
683 | spin_unlock_irq(&dac33->lock); | 684 | spin_unlock_irqrestore(&dac33->lock, flags); |
684 | 685 | ||
685 | dac33_write16(codec, DAC33_PREFILL_MSB, | 686 | dac33_write16(codec, DAC33_PREFILL_MSB, |
686 | DAC33_THRREG(dac33->alarm_threshold)); | 687 | DAC33_THRREG(dac33->alarm_threshold)); |
@@ -692,11 +693,11 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
692 | break; | 693 | break; |
693 | case DAC33_FIFO_MODE7: | 694 | case DAC33_FIFO_MODE7: |
694 | /* Take the timestamp */ | 695 | /* Take the timestamp */ |
695 | spin_lock_irq(&dac33->lock); | 696 | spin_lock_irqsave(&dac33->lock, flags); |
696 | dac33->t_stamp1 = ktime_to_us(ktime_get()); | 697 | dac33->t_stamp1 = ktime_to_us(ktime_get()); |
697 | /* Move back the timestamp with drain time */ | 698 | /* Move back the timestamp with drain time */ |
698 | dac33->t_stamp1 -= dac33->mode7_us_to_lthr; | 699 | dac33->t_stamp1 -= dac33->mode7_us_to_lthr; |
699 | spin_unlock_irq(&dac33->lock); | 700 | spin_unlock_irqrestore(&dac33->lock, flags); |
700 | 701 | ||
701 | dac33_write16(codec, DAC33_PREFILL_MSB, | 702 | dac33_write16(codec, DAC33_PREFILL_MSB, |
702 | DAC33_THRREG(DAC33_MODE7_MARGIN)); | 703 | DAC33_THRREG(DAC33_MODE7_MARGIN)); |
@@ -714,13 +715,14 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
714 | static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) | 715 | static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) |
715 | { | 716 | { |
716 | struct snd_soc_codec *codec = dac33->codec; | 717 | struct snd_soc_codec *codec = dac33->codec; |
718 | unsigned long flags; | ||
717 | 719 | ||
718 | switch (dac33->fifo_mode) { | 720 | switch (dac33->fifo_mode) { |
719 | case DAC33_FIFO_MODE1: | 721 | case DAC33_FIFO_MODE1: |
720 | /* Take the timestamp */ | 722 | /* Take the timestamp */ |
721 | spin_lock_irq(&dac33->lock); | 723 | spin_lock_irqsave(&dac33->lock, flags); |
722 | dac33->t_stamp2 = ktime_to_us(ktime_get()); | 724 | dac33->t_stamp2 = ktime_to_us(ktime_get()); |
723 | spin_unlock_irq(&dac33->lock); | 725 | spin_unlock_irqrestore(&dac33->lock, flags); |
724 | 726 | ||
725 | dac33_write16(codec, DAC33_NSAMPLE_MSB, | 727 | dac33_write16(codec, DAC33_NSAMPLE_MSB, |
726 | DAC33_THRREG(dac33->nsample)); | 728 | DAC33_THRREG(dac33->nsample)); |
@@ -773,10 +775,11 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev) | |||
773 | { | 775 | { |
774 | struct snd_soc_codec *codec = dev; | 776 | struct snd_soc_codec *codec = dev; |
775 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | 777 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); |
778 | unsigned long flags; | ||
776 | 779 | ||
777 | spin_lock(&dac33->lock); | 780 | spin_lock_irqsave(&dac33->lock, flags); |
778 | dac33->t_stamp1 = ktime_to_us(ktime_get()); | 781 | dac33->t_stamp1 = ktime_to_us(ktime_get()); |
779 | spin_unlock(&dac33->lock); | 782 | spin_unlock_irqrestore(&dac33->lock, flags); |
780 | 783 | ||
781 | /* Do not schedule the workqueue in Mode7 */ | 784 | /* Do not schedule the workqueue in Mode7 */ |
782 | if (dac33->fifo_mode != DAC33_FIFO_MODE7) | 785 | if (dac33->fifo_mode != DAC33_FIFO_MODE7) |
@@ -1173,15 +1176,16 @@ static snd_pcm_sframes_t dac33_dai_delay( | |||
1173 | unsigned int time_delta, uthr; | 1176 | unsigned int time_delta, uthr; |
1174 | int samples_out, samples_in, samples; | 1177 | int samples_out, samples_in, samples; |
1175 | snd_pcm_sframes_t delay = 0; | 1178 | snd_pcm_sframes_t delay = 0; |
1179 | unsigned long flags; | ||
1176 | 1180 | ||
1177 | switch (dac33->fifo_mode) { | 1181 | switch (dac33->fifo_mode) { |
1178 | case DAC33_FIFO_BYPASS: | 1182 | case DAC33_FIFO_BYPASS: |
1179 | break; | 1183 | break; |
1180 | case DAC33_FIFO_MODE1: | 1184 | case DAC33_FIFO_MODE1: |
1181 | spin_lock(&dac33->lock); | 1185 | spin_lock_irqsave(&dac33->lock, flags); |
1182 | t0 = dac33->t_stamp1; | 1186 | t0 = dac33->t_stamp1; |
1183 | t1 = dac33->t_stamp2; | 1187 | t1 = dac33->t_stamp2; |
1184 | spin_unlock(&dac33->lock); | 1188 | spin_unlock_irqrestore(&dac33->lock, flags); |
1185 | t_now = ktime_to_us(ktime_get()); | 1189 | t_now = ktime_to_us(ktime_get()); |
1186 | 1190 | ||
1187 | /* We have not started to fill the FIFO yet, delay is 0 */ | 1191 | /* We have not started to fill the FIFO yet, delay is 0 */ |
@@ -1246,10 +1250,10 @@ static snd_pcm_sframes_t dac33_dai_delay( | |||
1246 | } | 1250 | } |
1247 | break; | 1251 | break; |
1248 | case DAC33_FIFO_MODE7: | 1252 | case DAC33_FIFO_MODE7: |
1249 | spin_lock(&dac33->lock); | 1253 | spin_lock_irqsave(&dac33->lock, flags); |
1250 | t0 = dac33->t_stamp1; | 1254 | t0 = dac33->t_stamp1; |
1251 | uthr = dac33->uthr; | 1255 | uthr = dac33->uthr; |
1252 | spin_unlock(&dac33->lock); | 1256 | spin_unlock_irqrestore(&dac33->lock, flags); |
1253 | t_now = ktime_to_us(ktime_get()); | 1257 | t_now = ktime_to_us(ktime_get()); |
1254 | 1258 | ||
1255 | /* We have not started to fill the FIFO yet, delay is 0 */ | 1259 | /* We have not started to fill the FIFO yet, delay is 0 */ |