aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
commit8ceafbfa91ffbdbb2afaea5c24ccb519ffb8b587 (patch)
tree98c9ea93362536f1ddd73175b13b7847583350df /sound
parent42a2d923cc349583ebf6fdd52a7d35e1c2f7e6bd (diff)
parent26ba47b18318abe7dadbe9294a611c0e932651d8 (diff)
Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm
Pull DMA mask updates from Russell King: "This series cleans up the handling of DMA masks in a lot of drivers, fixing some bugs as we go. Some of the more serious errors include: - drivers which only set their coherent DMA mask if the attempt to set the streaming mask fails. - drivers which test for a NULL dma mask pointer, and then set the dma mask pointer to a location in their module .data section - which will cause problems if the module is reloaded. To counter these, I have introduced two helper functions: - dma_set_mask_and_coherent() takes care of setting both the streaming and coherent masks at the same time, with the correct error handling as specified by the API. - dma_coerce_mask_and_coherent() which resolves the problem of drivers forcefully setting DMA masks. This is more a marker for future work to further clean these locations up - the code which creates the devices really should be initialising these, but to fix that in one go along with this change could potentially be very disruptive. The last thing this series does is prise away some of Linux's addition to "DMA addresses are physical addresses and RAM always starts at zero". We have ARM LPAE systems where all system memory is above 4GB physical, hence having DMA masks interpreted by (eg) the block layers as describing physical addresses in the range 0..DMAMASK fails on these platforms. Santosh Shilimkar addresses this in this series; the patches were copied to the appropriate people multiple times but were ignored. Fixing this also gets rid of some ARM weirdness in the setup of the max*pfn variables, and brings ARM into line with every other Linux architecture as far as those go" * 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits) ARM: 7805/1: mm: change max*pfn to include the physical offset of memory ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit() ARM: DMA-API: better handing of DMA masks for coherent allocations ARM: 7857/1: dma: imx-sdma: setup dma mask DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks DMA-API: dcdbas: update DMA mask handing DMA-API: dma: edma.c: no need to explicitly initialize DMA masks DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks DMA-API: crypto: remove last references to 'static struct device *dev' DMA-API: crypto: fix ixp4xx crypto platform device support DMA-API: others: use dma_set_coherent_mask() DMA-API: staging: use dma_set_coherent_mask() DMA-API: usb: use new dma_coerce_mask_and_coherent() DMA-API: usb: use dma_set_coherent_mask() DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent() DMA-API: net: octeon: use dma_coerce_mask_and_coherent() DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent() ...
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/pxa2xx-pcm.c10
-rw-r--r--sound/soc/atmel/atmel-pcm.c11
-rw-r--r--sound/soc/blackfin/bf5xx-ac97-pcm.c11
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c10
-rw-r--r--sound/soc/davinci/davinci-pcm.c9
-rw-r--r--sound/soc/fsl/fsl_dma.c9
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c12
-rw-r--r--sound/soc/fsl/mpc5200_dma.c10
-rw-r--r--sound/soc/jz4740/jz4740-pcm.c12
-rw-r--r--sound/soc/kirkwood/kirkwood-dma.c9
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c9
-rw-r--r--sound/soc/omap/omap-pcm.c11
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c11
-rw-r--r--sound/soc/s6000/s6000-pcm.c9
-rw-r--r--sound/soc/samsung/dma.c11
-rw-r--r--sound/soc/samsung/idma.c11
16 files changed, 61 insertions, 104 deletions
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c
index 69a2455b4472..e6c727b317fb 100644
--- a/sound/arm/pxa2xx-pcm.c
+++ b/sound/arm/pxa2xx-pcm.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/dma-mapping.h>
14#include <linux/dmaengine.h> 15#include <linux/dmaengine.h>
15 16
16#include <sound/core.h> 17#include <sound/core.h>
@@ -83,8 +84,6 @@ static struct snd_pcm_ops pxa2xx_pcm_ops = {
83 .mmap = pxa2xx_pcm_mmap, 84 .mmap = pxa2xx_pcm_mmap,
84}; 85};
85 86
86static u64 pxa2xx_pcm_dmamask = 0xffffffff;
87
88int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client, 87int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client,
89 struct snd_pcm **rpcm) 88 struct snd_pcm **rpcm)
90{ 89{
@@ -100,10 +99,9 @@ int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client,
100 pcm->private_data = client; 99 pcm->private_data = client;
101 pcm->private_free = pxa2xx_pcm_free_dma_buffers; 100 pcm->private_free = pxa2xx_pcm_free_dma_buffers;
102 101
103 if (!card->dev->dma_mask) 102 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
104 card->dev->dma_mask = &pxa2xx_pcm_dmamask; 103 if (ret)
105 if (!card->dev->coherent_dma_mask) 104 goto out;
106 card->dev->coherent_dma_mask = 0xffffffff;
107 105
108 if (play) { 106 if (play) {
109 int stream = SNDRV_PCM_STREAM_PLAYBACK; 107 int stream = SNDRV_PCM_STREAM_PLAYBACK;
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index 612e5801003f..8ae3fa5ac60a 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -68,18 +68,15 @@ int atmel_pcm_mmap(struct snd_pcm_substream *substream,
68} 68}
69EXPORT_SYMBOL_GPL(atmel_pcm_mmap); 69EXPORT_SYMBOL_GPL(atmel_pcm_mmap);
70 70
71static u64 atmel_pcm_dmamask = DMA_BIT_MASK(32);
72
73int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) 71int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
74{ 72{
75 struct snd_card *card = rtd->card->snd_card; 73 struct snd_card *card = rtd->card->snd_card;
76 struct snd_pcm *pcm = rtd->pcm; 74 struct snd_pcm *pcm = rtd->pcm;
77 int ret = 0; 75 int ret;
78 76
79 if (!card->dev->dma_mask) 77 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
80 card->dev->dma_mask = &atmel_pcm_dmamask; 78 if (ret)
81 if (!card->dev->coherent_dma_mask) 79 return ret;
82 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
83 80
84 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 81 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
85 pr_debug("atmel-pcm: allocating PCM playback DMA buffer\n"); 82 pr_debug("atmel-pcm: allocating PCM playback DMA buffer\n");
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c
index 53f84085bf1f..1d4c676eb6cc 100644
--- a/sound/soc/blackfin/bf5xx-ac97-pcm.c
+++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c
@@ -415,19 +415,16 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
415 } 415 }
416} 416}
417 417
418static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
419
420static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) 418static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
421{ 419{
422 struct snd_card *card = rtd->card->snd_card; 420 struct snd_card *card = rtd->card->snd_card;
423 struct snd_pcm *pcm = rtd->pcm; 421 struct snd_pcm *pcm = rtd->pcm;
424 int ret = 0; 422 int ret;
425 423
426 pr_debug("%s enter\n", __func__); 424 pr_debug("%s enter\n", __func__);
427 if (!card->dev->dma_mask) 425 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
428 card->dev->dma_mask = &bf5xx_pcm_dmamask; 426 if (ret)
429 if (!card->dev->coherent_dma_mask) 427 return ret;
430 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
431 428
432 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 429 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
433 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 430 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index 9cb4a80df98e..2a5b43417fd5 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -323,18 +323,16 @@ static struct snd_pcm_ops bf5xx_pcm_i2s_ops = {
323 .silence = bf5xx_pcm_silence, 323 .silence = bf5xx_pcm_silence,
324}; 324};
325 325
326static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
327
328static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) 326static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
329{ 327{
330 struct snd_card *card = rtd->card->snd_card; 328 struct snd_card *card = rtd->card->snd_card;
331 size_t size = bf5xx_pcm_hardware.buffer_bytes_max; 329 size_t size = bf5xx_pcm_hardware.buffer_bytes_max;
330 int ret;
332 331
333 pr_debug("%s enter\n", __func__); 332 pr_debug("%s enter\n", __func__);
334 if (!card->dev->dma_mask) 333 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
335 card->dev->dma_mask = &bf5xx_pcm_dmamask; 334 if (ret)
336 if (!card->dev->coherent_dma_mask) 335 return ret;
337 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
338 336
339 return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, 337 return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm,
340 SNDRV_DMA_TYPE_DEV, card->dev, size, size); 338 SNDRV_DMA_TYPE_DEV, card->dev, size, size);
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 443e9e599a75..fa64cd85204f 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -843,18 +843,15 @@ static void davinci_pcm_free(struct snd_pcm *pcm)
843 } 843 }
844} 844}
845 845
846static u64 davinci_pcm_dmamask = DMA_BIT_MASK(32);
847
848static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) 846static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
849{ 847{
850 struct snd_card *card = rtd->card->snd_card; 848 struct snd_card *card = rtd->card->snd_card;
851 struct snd_pcm *pcm = rtd->pcm; 849 struct snd_pcm *pcm = rtd->pcm;
852 int ret; 850 int ret;
853 851
854 if (!card->dev->dma_mask) 852 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
855 card->dev->dma_mask = &davinci_pcm_dmamask; 853 if (ret)
856 if (!card->dev->coherent_dma_mask) 854 return ret;
857 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
858 855
859 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 856 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
860 ret = davinci_pcm_preallocate_dma_buffer(pcm, 857 ret = davinci_pcm_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index d1b111e7fc07..fb9bb9eb5ca3 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -300,14 +300,11 @@ static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd)
300{ 300{
301 struct snd_card *card = rtd->card->snd_card; 301 struct snd_card *card = rtd->card->snd_card;
302 struct snd_pcm *pcm = rtd->pcm; 302 struct snd_pcm *pcm = rtd->pcm;
303 static u64 fsl_dma_dmamask = DMA_BIT_MASK(36);
304 int ret; 303 int ret;
305 304
306 if (!card->dev->dma_mask) 305 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(36));
307 card->dev->dma_mask = &fsl_dma_dmamask; 306 if (ret)
308 307 return ret;
309 if (!card->dev->coherent_dma_mask)
310 card->dev->coherent_dma_mask = fsl_dma_dmamask;
311 308
312 /* Some codecs have separate DAIs for playback and capture, so we 309 /* Some codecs have separate DAIs for playback and capture, so we
313 * should allocate a DMA buffer only for the streams that are valid. 310 * should allocate a DMA buffer only for the streams that are valid.
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 10e330514ed8..41740e488820 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -254,18 +254,16 @@ static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
254 return 0; 254 return 0;
255} 255}
256 256
257static u64 imx_pcm_dmamask = DMA_BIT_MASK(32);
258
259static int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) 257static int imx_pcm_new(struct snd_soc_pcm_runtime *rtd)
260{ 258{
261 struct snd_card *card = rtd->card->snd_card; 259 struct snd_card *card = rtd->card->snd_card;
262 struct snd_pcm *pcm = rtd->pcm; 260 struct snd_pcm *pcm = rtd->pcm;
263 int ret = 0; 261 int ret;
262
263 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
264 if (ret)
265 return ret;
264 266
265 if (!card->dev->dma_mask)
266 card->dev->dma_mask = &imx_pcm_dmamask;
267 if (!card->dev->coherent_dma_mask)
268 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
269 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 267 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
270 ret = imx_pcm_preallocate_dma_buffer(pcm, 268 ret = imx_pcm_preallocate_dma_buffer(pcm,
271 SNDRV_PCM_STREAM_PLAYBACK); 269 SNDRV_PCM_STREAM_PLAYBACK);
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 161e5055ce94..71bf2f248cd4 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -301,7 +301,6 @@ static struct snd_pcm_ops psc_dma_ops = {
301 .hw_params = psc_dma_hw_params, 301 .hw_params = psc_dma_hw_params,
302}; 302};
303 303
304static u64 psc_dma_dmamask = DMA_BIT_MASK(32);
305static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) 304static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
306{ 305{
307 struct snd_card *card = rtd->card->snd_card; 306 struct snd_card *card = rtd->card->snd_card;
@@ -309,15 +308,14 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
309 struct snd_pcm *pcm = rtd->pcm; 308 struct snd_pcm *pcm = rtd->pcm;
310 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); 309 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai);
311 size_t size = psc_dma_hardware.buffer_bytes_max; 310 size_t size = psc_dma_hardware.buffer_bytes_max;
312 int rc = 0; 311 int rc;
313 312
314 dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n", 313 dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
315 card, dai, pcm); 314 card, dai, pcm);
316 315
317 if (!card->dev->dma_mask) 316 rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
318 card->dev->dma_mask = &psc_dma_dmamask; 317 if (rc)
319 if (!card->dev->coherent_dma_mask) 318 return rc;
320 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
321 319
322 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 320 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
323 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev, 321 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
diff --git a/sound/soc/jz4740/jz4740-pcm.c b/sound/soc/jz4740/jz4740-pcm.c
index 710059292318..1d7ef28585e1 100644
--- a/sound/soc/jz4740/jz4740-pcm.c
+++ b/sound/soc/jz4740/jz4740-pcm.c
@@ -297,19 +297,15 @@ static void jz4740_pcm_free(struct snd_pcm *pcm)
297 } 297 }
298} 298}
299 299
300static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32);
301
302static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) 300static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
303{ 301{
304 struct snd_card *card = rtd->card->snd_card; 302 struct snd_card *card = rtd->card->snd_card;
305 struct snd_pcm *pcm = rtd->pcm; 303 struct snd_pcm *pcm = rtd->pcm;
306 int ret = 0; 304 int ret;
307
308 if (!card->dev->dma_mask)
309 card->dev->dma_mask = &jz4740_pcm_dmamask;
310 305
311 if (!card->dev->coherent_dma_mask) 306 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
312 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 307 if (ret)
308 return ret;
313 309
314 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 310 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
315 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 311 ret = jz4740_pcm_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index 55d0d9d3a9fd..4af1936cf0f4 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -57,8 +57,6 @@ static struct snd_pcm_hardware kirkwood_dma_snd_hw = {
57 .fifo_size = 0, 57 .fifo_size = 0,
58}; 58};
59 59
60static u64 kirkwood_dma_dmamask = DMA_BIT_MASK(32);
61
62static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id) 60static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id)
63{ 61{
64 struct kirkwood_dma_data *priv = dev_id; 62 struct kirkwood_dma_data *priv = dev_id;
@@ -290,10 +288,9 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
290 struct snd_pcm *pcm = rtd->pcm; 288 struct snd_pcm *pcm = rtd->pcm;
291 int ret; 289 int ret;
292 290
293 if (!card->dev->dma_mask) 291 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
294 card->dev->dma_mask = &kirkwood_dma_dmamask; 292 if (ret)
295 if (!card->dev->coherent_dma_mask) 293 return ret;
296 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
297 294
298 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 295 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
299 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 296 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index c894ff0f2580..f588ee45b4fd 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -314,16 +314,15 @@ static void nuc900_dma_free_dma_buffers(struct snd_pcm *pcm)
314 snd_pcm_lib_preallocate_free_for_all(pcm); 314 snd_pcm_lib_preallocate_free_for_all(pcm);
315} 315}
316 316
317static u64 nuc900_pcm_dmamask = DMA_BIT_MASK(32);
318static int nuc900_dma_new(struct snd_soc_pcm_runtime *rtd) 317static int nuc900_dma_new(struct snd_soc_pcm_runtime *rtd)
319{ 318{
320 struct snd_card *card = rtd->card->snd_card; 319 struct snd_card *card = rtd->card->snd_card;
321 struct snd_pcm *pcm = rtd->pcm; 320 struct snd_pcm *pcm = rtd->pcm;
321 int ret;
322 322
323 if (!card->dev->dma_mask) 323 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
324 card->dev->dma_mask = &nuc900_pcm_dmamask; 324 if (ret)
325 if (!card->dev->coherent_dma_mask) 325 return ret;
326 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
327 326
328 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 327 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
329 card->dev, 4 * 1024, (4 * 1024) - 1); 328 card->dev, 4 * 1024, (4 * 1024) - 1);
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index a11405de86e8..b8fa9862e54c 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -156,8 +156,6 @@ static struct snd_pcm_ops omap_pcm_ops = {
156 .mmap = omap_pcm_mmap, 156 .mmap = omap_pcm_mmap,
157}; 157};
158 158
159static u64 omap_pcm_dmamask = DMA_BIT_MASK(64);
160
161static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, 159static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
162 int stream) 160 int stream)
163{ 161{
@@ -202,12 +200,11 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
202{ 200{
203 struct snd_card *card = rtd->card->snd_card; 201 struct snd_card *card = rtd->card->snd_card;
204 struct snd_pcm *pcm = rtd->pcm; 202 struct snd_pcm *pcm = rtd->pcm;
205 int ret = 0; 203 int ret;
206 204
207 if (!card->dev->dma_mask) 205 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(64));
208 card->dev->dma_mask = &omap_pcm_dmamask; 206 if (ret)
209 if (!card->dev->coherent_dma_mask) 207 return ret;
210 card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
211 208
212 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 209 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
213 ret = omap_pcm_preallocate_dma_buffer(pcm, 210 ret = omap_pcm_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index 806da27b8b67..d58b09f4f7a4 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -87,18 +87,15 @@ static struct snd_pcm_ops pxa2xx_pcm_ops = {
87 .mmap = pxa2xx_pcm_mmap, 87 .mmap = pxa2xx_pcm_mmap,
88}; 88};
89 89
90static u64 pxa2xx_pcm_dmamask = DMA_BIT_MASK(32);
91
92static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) 90static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
93{ 91{
94 struct snd_card *card = rtd->card->snd_card; 92 struct snd_card *card = rtd->card->snd_card;
95 struct snd_pcm *pcm = rtd->pcm; 93 struct snd_pcm *pcm = rtd->pcm;
96 int ret = 0; 94 int ret;
97 95
98 if (!card->dev->dma_mask) 96 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
99 card->dev->dma_mask = &pxa2xx_pcm_dmamask; 97 if (ret)
100 if (!card->dev->coherent_dma_mask) 98 return ret;
101 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
102 99
103 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 100 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
104 ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, 101 ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c
index 5cfaa5464eba..d219880815c0 100644
--- a/sound/soc/s6000/s6000-pcm.c
+++ b/sound/soc/s6000/s6000-pcm.c
@@ -445,8 +445,6 @@ static void s6000_pcm_free(struct snd_pcm *pcm)
445 snd_pcm_lib_preallocate_free_for_all(pcm); 445 snd_pcm_lib_preallocate_free_for_all(pcm);
446} 446}
447 447
448static u64 s6000_pcm_dmamask = DMA_BIT_MASK(32);
449
450static int s6000_pcm_new(struct snd_soc_pcm_runtime *runtime) 448static int s6000_pcm_new(struct snd_soc_pcm_runtime *runtime)
451{ 449{
452 struct snd_card *card = runtime->card->snd_card; 450 struct snd_card *card = runtime->card->snd_card;
@@ -457,10 +455,9 @@ static int s6000_pcm_new(struct snd_soc_pcm_runtime *runtime)
457 params = snd_soc_dai_get_dma_data(runtime->cpu_dai, 455 params = snd_soc_dai_get_dma_data(runtime->cpu_dai,
458 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); 456 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream);
459 457
460 if (!card->dev->dma_mask) 458 res = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
461 card->dev->dma_mask = &s6000_pcm_dmamask; 459 if (res)
462 if (!card->dev->coherent_dma_mask) 460 return res;
463 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
464 461
465 if (params->dma_in) { 462 if (params->dma_in) {
466 s6dmac_disable_chan(DMA_MASK_DMAC(params->dma_in), 463 s6dmac_disable_chan(DMA_MASK_DMAC(params->dma_in),
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index 9338d11e9216..fe2748b494d4 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -406,20 +406,17 @@ static void dma_free_dma_buffers(struct snd_pcm *pcm)
406 } 406 }
407} 407}
408 408
409static u64 dma_mask = DMA_BIT_MASK(32);
410
411static int dma_new(struct snd_soc_pcm_runtime *rtd) 409static int dma_new(struct snd_soc_pcm_runtime *rtd)
412{ 410{
413 struct snd_card *card = rtd->card->snd_card; 411 struct snd_card *card = rtd->card->snd_card;
414 struct snd_pcm *pcm = rtd->pcm; 412 struct snd_pcm *pcm = rtd->pcm;
415 int ret = 0; 413 int ret;
416 414
417 pr_debug("Entered %s\n", __func__); 415 pr_debug("Entered %s\n", __func__);
418 416
419 if (!card->dev->dma_mask) 417 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
420 card->dev->dma_mask = &dma_mask; 418 if (ret)
421 if (!card->dev->coherent_dma_mask) 419 return ret;
422 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
423 420
424 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 421 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
425 ret = preallocate_dma_buffer(pcm, 422 ret = preallocate_dma_buffer(pcm,
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index ce1e1e16f250..e4f318fc2f82 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -383,18 +383,15 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream)
383 return 0; 383 return 0;
384} 384}
385 385
386static u64 idma_mask = DMA_BIT_MASK(32);
387
388static int idma_new(struct snd_soc_pcm_runtime *rtd) 386static int idma_new(struct snd_soc_pcm_runtime *rtd)
389{ 387{
390 struct snd_card *card = rtd->card->snd_card; 388 struct snd_card *card = rtd->card->snd_card;
391 struct snd_pcm *pcm = rtd->pcm; 389 struct snd_pcm *pcm = rtd->pcm;
392 int ret = 0; 390 int ret;
393 391
394 if (!card->dev->dma_mask) 392 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
395 card->dev->dma_mask = &idma_mask; 393 if (ret)
396 if (!card->dev->coherent_dma_mask) 394 return ret;
397 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
398 395
399 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 396 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
400 ret = preallocate_idma_buffer(pcm, 397 ret = preallocate_idma_buffer(pcm,