ALSA: emu10k1: allow high-resolution mixer controls
[safe/jmp/linux-2.6] / sound / arm / pxa2xx-pcm-lib.c
index 75a0d74..8808b82 100644 (file)
@@ -4,6 +4,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
 
@@ -12,8 +13,7 @@
 #include <sound/pcm_params.h>
 #include <sound/pxa2xx-lib.h>
 
-#include <asm/dma.h>
-#include <mach/pxa-regs.h>
+#include <mach/dma.h>
 
 #include "pxa2xx-pcm.h"
 
@@ -76,7 +76,7 @@ int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream)
 {
        struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
 
-       if (rtd && rtd->params)
+       if (rtd && rtd->params && rtd->params->drcmr)
                *rtd->params->drcmr = 0;
 
        snd_pcm_set_runtime_buffer(substream, NULL);
@@ -137,6 +137,9 @@ int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream)
 {
        struct pxa2xx_runtime_data *prtd = substream->runtime->private_data;
 
+       if (!prtd || !prtd->params)
+               return 0;
+
        DCSR(prtd->dma_ch) &= ~DCSR_RUN;
        DCSR(prtd->dma_ch) = 0;
        DCMD(prtd->dma_ch) = 0;
@@ -203,6 +206,7 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream)
        if (!rtd->dma_desc_array)
                goto err1;
 
+       rtd->dma_ch = -1;
        runtime->private_data = rtd;
        return 0;