Merge remote-tracking branch 'asoc/fix/dma' into asoc-dma
authorMark Brown <broonie@linaro.org>
Mon, 9 Dec 2013 18:44:55 +0000 (18:44 +0000)
committerMark Brown <broonie@linaro.org>
Mon, 9 Dec 2013 18:44:55 +0000 (18:44 +0000)
1  2 
sound/soc/soc-generic-dmaengine-pcm.c

index fbc28a799e0681db2bff9411c5afe9a9948f5fc8,41949af3baaed2580dae2df585222339ade75208..1cb3494cf27835b2db0316b89511d23e959400e4
@@@ -298,21 -294,31 +298,35 @@@ static void dmaengine_pcm_request_chan_
            !dev->of_node)
                return;
  
 -      if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) {
 -              pcm->chan[0] = dma_request_slave_channel(dev, "rx-tx");
 -              pcm->chan[1] = pcm->chan[0];
 -      } else {
 -              for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
 -                      pcm->chan[i] = dma_request_slave_channel(dev,
 -                                      dmaengine_pcm_dma_channel_names[i]);
 -              }
 +      for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE;
 +           i++) {
 +              if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
 +                      name = "rx-tx";
 +              else
 +                      name = dmaengine_pcm_dma_channel_names[i];
 +              pcm->chan[i] = dma_request_slave_channel(dev, name);
 +              if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
 +                      break;
        }
 +
 +      if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
 +              pcm->chan[1] = pcm->chan[0];
  }
  
+ static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm)
+ {
+       unsigned int i;
+       for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE;
+            i++) {
+               if (!pcm->chan[i])
+                       continue;
+               dma_release_channel(pcm->chan[i]);
+               if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
+                       break;
+       }
+ }
  /**
   * snd_dmaengine_pcm_register - Register a dmaengine based PCM device
   * @dev: The parent device for the PCM device