aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/samsung/i2s.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 2bac71945b3e..20cc51fc76ae 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -94,6 +94,10 @@ struct i2s_dai {
94 u32 suspend_i2scon; 94 u32 suspend_i2scon;
95 u32 suspend_i2spsr; 95 u32 suspend_i2spsr;
96 const struct samsung_i2s_variant_regs *variant_regs; 96 const struct samsung_i2s_variant_regs *variant_regs;
97
98 /* Spinlock protecting access to the device's registers */
99 spinlock_t spinlock;
100 spinlock_t *lock;
97}; 101};
98 102
99/* Lock for cross i/f checks */ 103/* Lock for cross i/f checks */
@@ -867,10 +871,10 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
867 case SNDRV_PCM_TRIGGER_START: 871 case SNDRV_PCM_TRIGGER_START:
868 case SNDRV_PCM_TRIGGER_RESUME: 872 case SNDRV_PCM_TRIGGER_RESUME:
869 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 873 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
870 local_irq_save(flags); 874 spin_lock_irqsave(i2s->lock, flags);
871 875
872 if (config_setup(i2s)) { 876 if (config_setup(i2s)) {
873 local_irq_restore(flags); 877 spin_unlock_irqrestore(i2s->lock, flags);
874 return -EINVAL; 878 return -EINVAL;
875 } 879 }
876 880
@@ -879,12 +883,12 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
879 else 883 else
880 i2s_txctrl(i2s, 1); 884 i2s_txctrl(i2s, 1);
881 885
882 local_irq_restore(flags); 886 spin_unlock_irqrestore(i2s->lock, flags);
883 break; 887 break;
884 case SNDRV_PCM_TRIGGER_STOP: 888 case SNDRV_PCM_TRIGGER_STOP:
885 case SNDRV_PCM_TRIGGER_SUSPEND: 889 case SNDRV_PCM_TRIGGER_SUSPEND:
886 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 890 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
887 local_irq_save(flags); 891 spin_lock_irqsave(i2s->lock, flags);
888 892
889 if (capture) { 893 if (capture) {
890 i2s_rxctrl(i2s, 0); 894 i2s_rxctrl(i2s, 0);
@@ -894,7 +898,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
894 i2s_fifo(i2s, FIC_TXFLUSH); 898 i2s_fifo(i2s, FIC_TXFLUSH);
895 } 899 }
896 900
897 local_irq_restore(flags); 901 spin_unlock_irqrestore(i2s->lock, flags);
898 break; 902 break;
899 } 903 }
900 904
@@ -1157,6 +1161,9 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1157 return -ENOMEM; 1161 return -ENOMEM;
1158 } 1162 }
1159 1163
1164 spin_lock_init(&pri_dai->spinlock);
1165 pri_dai->lock = &pri_dai->spinlock;
1166
1160 if (!np) { 1167 if (!np) {
1161 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1168 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
1162 if (!res) { 1169 if (!res) {
@@ -1234,6 +1241,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1234 return -ENOMEM; 1241 return -ENOMEM;
1235 } 1242 }
1236 1243
1244 sec_dai->lock = &pri_dai->spinlock;
1237 sec_dai->variant_regs = pri_dai->variant_regs; 1245 sec_dai->variant_regs = pri_dai->variant_regs;
1238 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; 1246 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
1239 sec_dai->dma_playback.ch_name = "tx-sec"; 1247 sec_dai->dma_playback.ch_name = "tx-sec";