aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/wm8994-core.c2
-rw-r--r--include/sound/soc.h6
-rw-r--r--sound/soc/atmel/Kconfig2
-rw-r--r--sound/soc/atmel/atmel-pcm.c5
-rw-r--r--sound/soc/blackfin/bf5xx-ac97-pcm.c5
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c5
-rw-r--r--sound/soc/blackfin/bf5xx-tdm-pcm.c5
-rw-r--r--sound/soc/davinci/davinci-pcm.c5
-rw-r--r--sound/soc/ep93xx/ep93xx-pcm.c5
-rw-r--r--sound/soc/jz4740/jz4740-pcm.c5
-rw-r--r--sound/soc/kirkwood/kirkwood-dma.c5
-rw-r--r--sound/soc/mid-x86/sst_platform.c5
-rw-r--r--sound/soc/omap/omap-pcm.c5
-rw-r--r--sound/soc/samsung/dma.c5
-rw-r--r--sound/soc/samsung/idma.c4
-rw-r--r--sound/soc/soc-core.c44
-rw-r--r--sound/soc/soc-dapm.c3
-rw-r--r--sound/soc/tegra/tegra_pcm.c5
18 files changed, 58 insertions, 63 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 9b8d1ad28ee1..d3d9d53ca9e3 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -268,6 +268,7 @@ static int wm8994_suspend(struct device *dev)
268 wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, 268 wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET,
269 wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET)); 269 wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
270 270
271 regcache_cache_only(wm8994->regmap, true);
271 regcache_mark_dirty(wm8994->regmap); 272 regcache_mark_dirty(wm8994->regmap);
272 273
273 wm8994->suspended = true; 274 wm8994->suspended = true;
@@ -298,6 +299,7 @@ static int wm8994_resume(struct device *dev)
298 return ret; 299 return ret;
299 } 300 }
300 301
302 regcache_cache_only(wm8994->regmap, false);
301 ret = regcache_sync(wm8994->regmap); 303 ret = regcache_sync(wm8994->regmap);
302 if (ret != 0) { 304 if (ret != 0) {
303 dev_err(dev, "Failed to restore register map: %d\n", ret); 305 dev_err(dev, "Failed to restore register map: %d\n", ret);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f75d1ccc5c58..0992dff55959 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -847,7 +847,7 @@ struct snd_soc_card {
847 847
848/* SoC machine DAI configuration, glues a codec and cpu DAI together */ 848/* SoC machine DAI configuration, glues a codec and cpu DAI together */
849struct snd_soc_pcm_runtime { 849struct snd_soc_pcm_runtime {
850 struct device dev; 850 struct device *dev;
851 struct snd_soc_card *card; 851 struct snd_soc_card *card;
852 struct snd_soc_dai_link *dai_link; 852 struct snd_soc_dai_link *dai_link;
853 struct mutex pcm_mutex; 853 struct mutex pcm_mutex;
@@ -933,12 +933,12 @@ static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platfo
933static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 933static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
934 void *data) 934 void *data)
935{ 935{
936 dev_set_drvdata(&rtd->dev, data); 936 dev_set_drvdata(rtd->dev, data);
937} 937}
938 938
939static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) 939static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
940{ 940{
941 return dev_get_drvdata(&rtd->dev); 941 return dev_get_drvdata(rtd->dev);
942} 942}
943 943
944static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 944static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index d1fcc816ce97..72b09cfd3dc3 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -26,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731
26 26
27config SND_AT91_SOC_AFEB9260 27config SND_AT91_SOC_AFEB9260
28 tristate "SoC Audio support for AFEB9260 board" 28 tristate "SoC Audio support for AFEB9260 board"
29 depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC 29 depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
30 select SND_ATMEL_SOC_SSC 30 select SND_ATMEL_SOC_SSC
31 select SND_SOC_TLV320AIC23 31 select SND_SOC_TLV320AIC23
32 help 32 help
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index 60de05525c06..a21ff459e5d3 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -367,7 +367,6 @@ static u64 atmel_pcm_dmamask = 0xffffffff;
367static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) 367static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
368{ 368{
369 struct snd_card *card = rtd->card->snd_card; 369 struct snd_card *card = rtd->card->snd_card;
370 struct snd_soc_dai *dai = rtd->cpu_dai;
371 struct snd_pcm *pcm = rtd->pcm; 370 struct snd_pcm *pcm = rtd->pcm;
372 int ret = 0; 371 int ret = 0;
373 372
@@ -376,14 +375,14 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
376 if (!card->dev->coherent_dma_mask) 375 if (!card->dev->coherent_dma_mask)
377 card->dev->coherent_dma_mask = 0xffffffff; 376 card->dev->coherent_dma_mask = 0xffffffff;
378 377
379 if (dai->driver->playback.channels_min) { 378 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
380 ret = atmel_pcm_preallocate_dma_buffer(pcm, 379 ret = atmel_pcm_preallocate_dma_buffer(pcm,
381 SNDRV_PCM_STREAM_PLAYBACK); 380 SNDRV_PCM_STREAM_PLAYBACK);
382 if (ret) 381 if (ret)
383 goto out; 382 goto out;
384 } 383 }
385 384
386 if (dai->driver->capture.channels_min) { 385 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
387 pr_debug("atmel-pcm:" 386 pr_debug("atmel-pcm:"
388 "Allocating PCM capture DMA buffer\n"); 387 "Allocating PCM capture DMA buffer\n");
389 ret = atmel_pcm_preallocate_dma_buffer(pcm, 388 ret = atmel_pcm_preallocate_dma_buffer(pcm,
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c
index fcff58390848..d7dc9bde0976 100644
--- a/sound/soc/blackfin/bf5xx-ac97-pcm.c
+++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c
@@ -421,7 +421,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
421static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) 421static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
422{ 422{
423 struct snd_card *card = rtd->card->snd_card; 423 struct snd_card *card = rtd->card->snd_card;
424 struct snd_soc_dai *dai = rtd->cpu_dai;
425 struct snd_pcm *pcm = rtd->pcm; 424 struct snd_pcm *pcm = rtd->pcm;
426 int ret = 0; 425 int ret = 0;
427 426
@@ -431,14 +430,14 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
431 if (!card->dev->coherent_dma_mask) 430 if (!card->dev->coherent_dma_mask)
432 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 431 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
433 432
434 if (dai->driver->playback.channels_min) { 433 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
435 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 434 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
436 SNDRV_PCM_STREAM_PLAYBACK); 435 SNDRV_PCM_STREAM_PLAYBACK);
437 if (ret) 436 if (ret)
438 goto out; 437 goto out;
439 } 438 }
440 439
441 if (dai->driver->capture.channels_min) { 440 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
442 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 441 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
443 SNDRV_PCM_STREAM_CAPTURE); 442 SNDRV_PCM_STREAM_CAPTURE);
444 if (ret) 443 if (ret)
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index 6ec3d41b9b6d..63205d723eab 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -260,7 +260,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
260static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) 260static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
261{ 261{
262 struct snd_card *card = rtd->card->snd_card; 262 struct snd_card *card = rtd->card->snd_card;
263 struct snd_soc_dai *dai = rtd->cpu_dai;
264 struct snd_pcm *pcm = rtd->pcm; 263 struct snd_pcm *pcm = rtd->pcm;
265 int ret = 0; 264 int ret = 0;
266 265
@@ -270,14 +269,14 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
270 if (!card->dev->coherent_dma_mask) 269 if (!card->dev->coherent_dma_mask)
271 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 270 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
272 271
273 if (dai->driver->playback.channels_min) { 272 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
274 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 273 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
275 SNDRV_PCM_STREAM_PLAYBACK); 274 SNDRV_PCM_STREAM_PLAYBACK);
276 if (ret) 275 if (ret)
277 goto out; 276 goto out;
278 } 277 }
279 278
280 if (dai->driver->capture.channels_min) { 279 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
281 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 280 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
282 SNDRV_PCM_STREAM_CAPTURE); 281 SNDRV_PCM_STREAM_CAPTURE);
283 if (ret) 282 if (ret)
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c
index 4406f9a865ae..254490cf1876 100644
--- a/sound/soc/blackfin/bf5xx-tdm-pcm.c
+++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c
@@ -286,7 +286,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) 286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
287{ 287{
288 struct snd_card *card = rtd->card->snd_card; 288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm; 289 struct snd_pcm *pcm = rtd->pcm;
291 int ret = 0; 290 int ret = 0;
292 291
@@ -295,14 +294,14 @@ static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
295 if (!card->dev->coherent_dma_mask) 294 if (!card->dev->coherent_dma_mask)
296 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 295 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
297 296
298 if (dai->driver->playback.channels_min) { 297 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
299 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 298 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
300 SNDRV_PCM_STREAM_PLAYBACK); 299 SNDRV_PCM_STREAM_PLAYBACK);
301 if (ret) 300 if (ret)
302 goto out; 301 goto out;
303 } 302 }
304 303
305 if (dai->driver->capture.channels_min) { 304 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
306 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 305 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
307 SNDRV_PCM_STREAM_CAPTURE); 306 SNDRV_PCM_STREAM_CAPTURE);
308 if (ret) 307 if (ret)
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 65bff3d30dd7..b26401f87b85 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -831,7 +831,6 @@ static u64 davinci_pcm_dmamask = 0xffffffff;
831static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) 831static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
832{ 832{
833 struct snd_card *card = rtd->card->snd_card; 833 struct snd_card *card = rtd->card->snd_card;
834 struct snd_soc_dai *dai = rtd->cpu_dai;
835 struct snd_pcm *pcm = rtd->pcm; 834 struct snd_pcm *pcm = rtd->pcm;
836 int ret; 835 int ret;
837 836
@@ -840,7 +839,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
840 if (!card->dev->coherent_dma_mask) 839 if (!card->dev->coherent_dma_mask)
841 card->dev->coherent_dma_mask = 0xffffffff; 840 card->dev->coherent_dma_mask = 0xffffffff;
842 841
843 if (dai->driver->playback.channels_min) { 842 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
844 ret = davinci_pcm_preallocate_dma_buffer(pcm, 843 ret = davinci_pcm_preallocate_dma_buffer(pcm,
845 SNDRV_PCM_STREAM_PLAYBACK, 844 SNDRV_PCM_STREAM_PLAYBACK,
846 pcm_hardware_playback.buffer_bytes_max); 845 pcm_hardware_playback.buffer_bytes_max);
@@ -848,7 +847,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
848 return ret; 847 return ret;
849 } 848 }
850 849
851 if (dai->driver->capture.channels_min) { 850 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
852 ret = davinci_pcm_preallocate_dma_buffer(pcm, 851 ret = davinci_pcm_preallocate_dma_buffer(pcm,
853 SNDRV_PCM_STREAM_CAPTURE, 852 SNDRV_PCM_STREAM_CAPTURE,
854 pcm_hardware_capture.buffer_bytes_max); 853 pcm_hardware_capture.buffer_bytes_max);
diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c
index a2de9c42b702..3fc96130d1a6 100644
--- a/sound/soc/ep93xx/ep93xx-pcm.c
+++ b/sound/soc/ep93xx/ep93xx-pcm.c
@@ -286,7 +286,6 @@ static u64 ep93xx_pcm_dmamask = 0xffffffff;
286static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) 286static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
287{ 287{
288 struct snd_card *card = rtd->card->snd_card; 288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm; 289 struct snd_pcm *pcm = rtd->pcm;
291 int ret = 0; 290 int ret = 0;
292 291
@@ -295,14 +294,14 @@ static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
295 if (!card->dev->coherent_dma_mask) 294 if (!card->dev->coherent_dma_mask)
296 card->dev->coherent_dma_mask = 0xffffffff; 295 card->dev->coherent_dma_mask = 0xffffffff;
297 296
298 if (dai->driver->playback.channels_min) { 297 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
299 ret = ep93xx_pcm_preallocate_dma_buffer(pcm, 298 ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
300 SNDRV_PCM_STREAM_PLAYBACK); 299 SNDRV_PCM_STREAM_PLAYBACK);
301 if (ret) 300 if (ret)
302 return ret; 301 return ret;
303 } 302 }
304 303
305 if (dai->driver->capture.channels_min) { 304 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
306 ret = ep93xx_pcm_preallocate_dma_buffer(pcm, 305 ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
307 SNDRV_PCM_STREAM_CAPTURE); 306 SNDRV_PCM_STREAM_CAPTURE);
308 if (ret) 307 if (ret)
diff --git a/sound/soc/jz4740/jz4740-pcm.c b/sound/soc/jz4740/jz4740-pcm.c
index 50cda9ea9156..9b8cf256847d 100644
--- a/sound/soc/jz4740/jz4740-pcm.c
+++ b/sound/soc/jz4740/jz4740-pcm.c
@@ -302,7 +302,6 @@ static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32);
302static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) 302static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
303{ 303{
304 struct snd_card *card = rtd->card->snd_card; 304 struct snd_card *card = rtd->card->snd_card;
305 struct snd_soc_dai *dai = rtd->cpu_dai;
306 struct snd_pcm *pcm = rtd->pcm; 305 struct snd_pcm *pcm = rtd->pcm;
307 int ret = 0; 306 int ret = 0;
308 307
@@ -312,14 +311,14 @@ static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
312 if (!card->dev->coherent_dma_mask) 311 if (!card->dev->coherent_dma_mask)
313 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 312 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
314 313
315 if (dai->driver->playback.channels_min) { 314 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
316 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 315 ret = jz4740_pcm_preallocate_dma_buffer(pcm,
317 SNDRV_PCM_STREAM_PLAYBACK); 316 SNDRV_PCM_STREAM_PLAYBACK);
318 if (ret) 317 if (ret)
319 goto err; 318 goto err;
320 } 319 }
321 320
322 if (dai->driver->capture.channels_min) { 321 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
323 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 322 ret = jz4740_pcm_preallocate_dma_buffer(pcm,
324 SNDRV_PCM_STREAM_CAPTURE); 323 SNDRV_PCM_STREAM_CAPTURE);
325 if (ret) 324 if (ret)
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index 210438261a49..d4a17780cef4 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -315,7 +315,6 @@ static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm,
315static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) 315static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
316{ 316{
317 struct snd_card *card = rtd->card->snd_card; 317 struct snd_card *card = rtd->card->snd_card;
318 struct snd_soc_dai *dai = rtd->cpu_dai;
319 struct snd_pcm *pcm = rtd->pcm; 318 struct snd_pcm *pcm = rtd->pcm;
320 int ret; 319 int ret;
321 320
@@ -324,14 +323,14 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
324 if (!card->dev->coherent_dma_mask) 323 if (!card->dev->coherent_dma_mask)
325 card->dev->coherent_dma_mask = 0xffffffff; 324 card->dev->coherent_dma_mask = 0xffffffff;
326 325
327 if (dai->driver->playback.channels_min) { 326 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
328 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 327 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
329 SNDRV_PCM_STREAM_PLAYBACK); 328 SNDRV_PCM_STREAM_PLAYBACK);
330 if (ret) 329 if (ret)
331 return ret; 330 return ret;
332 } 331 }
333 332
334 if (dai->driver->capture.channels_min) { 333 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
335 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 334 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
336 SNDRV_PCM_STREAM_CAPTURE); 335 SNDRV_PCM_STREAM_CAPTURE);
337 if (ret) 336 if (ret)
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
index c2bf172a196e..d34563b12c3b 100644
--- a/sound/soc/mid-x86/sst_platform.c
+++ b/sound/soc/mid-x86/sst_platform.c
@@ -446,13 +446,12 @@ static void sst_pcm_free(struct snd_pcm *pcm)
446 446
447static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) 447static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
448{ 448{
449 struct snd_soc_dai *dai = rtd->cpu_dai;
450 struct snd_pcm *pcm = rtd->pcm; 449 struct snd_pcm *pcm = rtd->pcm;
451 int retval = 0; 450 int retval = 0;
452 451
453 pr_debug("sst_pcm_new called\n"); 452 pr_debug("sst_pcm_new called\n");
454 if (dai->driver->playback.channels_min || 453 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
455 dai->driver->capture.channels_min) { 454 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
456 retval = snd_pcm_lib_preallocate_pages_for_all(pcm, 455 retval = snd_pcm_lib_preallocate_pages_for_all(pcm,
457 SNDRV_DMA_TYPE_CONTINUOUS, 456 SNDRV_DMA_TYPE_CONTINUOUS,
458 snd_dma_continuous_data(GFP_KERNEL), 457 snd_dma_continuous_data(GFP_KERNEL),
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 52a0f634948e..a59bd352d342 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -378,7 +378,6 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm)
378static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) 378static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
379{ 379{
380 struct snd_card *card = rtd->card->snd_card; 380 struct snd_card *card = rtd->card->snd_card;
381 struct snd_soc_dai *dai = rtd->cpu_dai;
382 struct snd_pcm *pcm = rtd->pcm; 381 struct snd_pcm *pcm = rtd->pcm;
383 int ret = 0; 382 int ret = 0;
384 383
@@ -387,14 +386,14 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
387 if (!card->dev->coherent_dma_mask) 386 if (!card->dev->coherent_dma_mask)
388 card->dev->coherent_dma_mask = DMA_BIT_MASK(64); 387 card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
389 388
390 if (dai->driver->playback.channels_min) { 389 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
391 ret = omap_pcm_preallocate_dma_buffer(pcm, 390 ret = omap_pcm_preallocate_dma_buffer(pcm,
392 SNDRV_PCM_STREAM_PLAYBACK); 391 SNDRV_PCM_STREAM_PLAYBACK);
393 if (ret) 392 if (ret)
394 goto out; 393 goto out;
395 } 394 }
396 395
397 if (dai->driver->capture.channels_min) { 396 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
398 ret = omap_pcm_preallocate_dma_buffer(pcm, 397 ret = omap_pcm_preallocate_dma_buffer(pcm,
399 SNDRV_PCM_STREAM_CAPTURE); 398 SNDRV_PCM_STREAM_CAPTURE);
400 if (ret) 399 if (ret)
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index 797c3d5e79e5..427ae0d9817b 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -403,7 +403,6 @@ static u64 dma_mask = DMA_BIT_MASK(32);
403static int dma_new(struct snd_soc_pcm_runtime *rtd) 403static int dma_new(struct snd_soc_pcm_runtime *rtd)
404{ 404{
405 struct snd_card *card = rtd->card->snd_card; 405 struct snd_card *card = rtd->card->snd_card;
406 struct snd_soc_dai *dai = rtd->cpu_dai;
407 struct snd_pcm *pcm = rtd->pcm; 406 struct snd_pcm *pcm = rtd->pcm;
408 int ret = 0; 407 int ret = 0;
409 408
@@ -414,14 +413,14 @@ static int dma_new(struct snd_soc_pcm_runtime *rtd)
414 if (!card->dev->coherent_dma_mask) 413 if (!card->dev->coherent_dma_mask)
415 card->dev->coherent_dma_mask = 0xffffffff; 414 card->dev->coherent_dma_mask = 0xffffffff;
416 415
417 if (dai->driver->playback.channels_min) { 416 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
418 ret = preallocate_dma_buffer(pcm, 417 ret = preallocate_dma_buffer(pcm,
419 SNDRV_PCM_STREAM_PLAYBACK); 418 SNDRV_PCM_STREAM_PLAYBACK);
420 if (ret) 419 if (ret)
421 goto out; 420 goto out;
422 } 421 }
423 422
424 if (dai->driver->capture.channels_min) { 423 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
425 ret = preallocate_dma_buffer(pcm, 424 ret = preallocate_dma_buffer(pcm,
426 SNDRV_PCM_STREAM_CAPTURE); 425 SNDRV_PCM_STREAM_CAPTURE);
427 if (ret) 426 if (ret)
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index 2bcf75815624..c227c3163cae 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -387,7 +387,6 @@ static u64 idma_mask = DMA_BIT_MASK(32);
387static int idma_new(struct snd_soc_pcm_runtime *rtd) 387static int idma_new(struct snd_soc_pcm_runtime *rtd)
388{ 388{
389 struct snd_card *card = rtd->card->snd_card; 389 struct snd_card *card = rtd->card->snd_card;
390 struct snd_soc_dai *dai = rtd->cpu_dai;
391 struct snd_pcm *pcm = rtd->pcm; 390 struct snd_pcm *pcm = rtd->pcm;
392 int ret = 0; 391 int ret = 0;
393 392
@@ -396,9 +395,10 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd)
396 if (!card->dev->coherent_dma_mask) 395 if (!card->dev->coherent_dma_mask)
397 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 396 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
398 397
399 if (dai->driver->playback.channels_min) 398 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
400 ret = preallocate_idma_buffer(pcm, 399 ret = preallocate_idma_buffer(pcm,
401 SNDRV_PCM_STREAM_PLAYBACK); 400 SNDRV_PCM_STREAM_PLAYBACK);
401 }
402 402
403 return ret; 403 return ret;
404} 404}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index acbb96005a69..3986520b4677 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -169,8 +169,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf,
169static ssize_t codec_reg_show(struct device *dev, 169static ssize_t codec_reg_show(struct device *dev,
170 struct device_attribute *attr, char *buf) 170 struct device_attribute *attr, char *buf)
171{ 171{
172 struct snd_soc_pcm_runtime *rtd = 172 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
173 container_of(dev, struct snd_soc_pcm_runtime, dev);
174 173
175 return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0); 174 return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0);
176} 175}
@@ -180,8 +179,7 @@ static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
180static ssize_t pmdown_time_show(struct device *dev, 179static ssize_t pmdown_time_show(struct device *dev,
181 struct device_attribute *attr, char *buf) 180 struct device_attribute *attr, char *buf)
182{ 181{
183 struct snd_soc_pcm_runtime *rtd = 182 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
184 container_of(dev, struct snd_soc_pcm_runtime, dev);
185 183
186 return sprintf(buf, "%ld\n", rtd->pmdown_time); 184 return sprintf(buf, "%ld\n", rtd->pmdown_time);
187} 185}
@@ -190,8 +188,7 @@ static ssize_t pmdown_time_set(struct device *dev,
190 struct device_attribute *attr, 188 struct device_attribute *attr,
191 const char *buf, size_t count) 189 const char *buf, size_t count)
192{ 190{
193 struct snd_soc_pcm_runtime *rtd = 191 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
194 container_of(dev, struct snd_soc_pcm_runtime, dev);
195 int ret; 192 int ret;
196 193
197 ret = strict_strtol(buf, 10, &rtd->pmdown_time); 194 ret = strict_strtol(buf, 10, &rtd->pmdown_time);
@@ -884,9 +881,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
884 881
885 /* unregister the rtd device */ 882 /* unregister the rtd device */
886 if (rtd->dev_registered) { 883 if (rtd->dev_registered) {
887 device_remove_file(&rtd->dev, &dev_attr_pmdown_time); 884 device_remove_file(rtd->dev, &dev_attr_pmdown_time);
888 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 885 device_remove_file(rtd->dev, &dev_attr_codec_reg);
889 device_unregister(&rtd->dev); 886 device_unregister(rtd->dev);
890 rtd->dev_registered = 0; 887 rtd->dev_registered = 0;
891 } 888 }
892 889
@@ -1061,7 +1058,10 @@ err_probe:
1061 return ret; 1058 return ret;
1062} 1059}
1063 1060
1064static void rtd_release(struct device *dev) {} 1061static void rtd_release(struct device *dev)
1062{
1063 kfree(dev);
1064}
1065 1065
1066static int soc_post_component_init(struct snd_soc_card *card, 1066static int soc_post_component_init(struct snd_soc_card *card,
1067 struct snd_soc_codec *codec, 1067 struct snd_soc_codec *codec,
@@ -1104,11 +1104,17 @@ static int soc_post_component_init(struct snd_soc_card *card,
1104 1104
1105 /* register the rtd device */ 1105 /* register the rtd device */
1106 rtd->codec = codec; 1106 rtd->codec = codec;
1107 rtd->dev.parent = card->dev; 1107
1108 rtd->dev.release = rtd_release; 1108 rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
1109 rtd->dev.init_name = name; 1109 if (!rtd->dev)
1110 return -ENOMEM;
1111 device_initialize(rtd->dev);
1112 rtd->dev->parent = card->dev;
1113 rtd->dev->release = rtd_release;
1114 rtd->dev->init_name = name;
1115 dev_set_drvdata(rtd->dev, rtd);
1110 mutex_init(&rtd->pcm_mutex); 1116 mutex_init(&rtd->pcm_mutex);
1111 ret = device_register(&rtd->dev); 1117 ret = device_add(rtd->dev);
1112 if (ret < 0) { 1118 if (ret < 0) {
1113 dev_err(card->dev, 1119 dev_err(card->dev,
1114 "asoc: failed to register runtime device: %d\n", ret); 1120 "asoc: failed to register runtime device: %d\n", ret);
@@ -1117,14 +1123,14 @@ static int soc_post_component_init(struct snd_soc_card *card,
1117 rtd->dev_registered = 1; 1123 rtd->dev_registered = 1;
1118 1124
1119 /* add DAPM sysfs entries for this codec */ 1125 /* add DAPM sysfs entries for this codec */
1120 ret = snd_soc_dapm_sys_add(&rtd->dev); 1126 ret = snd_soc_dapm_sys_add(rtd->dev);
1121 if (ret < 0) 1127 if (ret < 0)
1122 dev_err(codec->dev, 1128 dev_err(codec->dev,
1123 "asoc: failed to add codec dapm sysfs entries: %d\n", 1129 "asoc: failed to add codec dapm sysfs entries: %d\n",
1124 ret); 1130 ret);
1125 1131
1126 /* add codec sysfs entries */ 1132 /* add codec sysfs entries */
1127 ret = device_create_file(&rtd->dev, &dev_attr_codec_reg); 1133 ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
1128 if (ret < 0) 1134 if (ret < 0)
1129 dev_err(codec->dev, 1135 dev_err(codec->dev,
1130 "asoc: failed to add codec sysfs files: %d\n", ret); 1136 "asoc: failed to add codec sysfs files: %d\n", ret);
@@ -1213,7 +1219,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
1213 if (ret) 1219 if (ret)
1214 return ret; 1220 return ret;
1215 1221
1216 ret = device_create_file(&rtd->dev, &dev_attr_pmdown_time); 1222 ret = device_create_file(rtd->dev, &dev_attr_pmdown_time);
1217 if (ret < 0) 1223 if (ret < 0)
1218 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); 1224 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n");
1219 1225
@@ -1311,8 +1317,8 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
1311 1317
1312 /* unregister the rtd device */ 1318 /* unregister the rtd device */
1313 if (rtd->dev_registered) { 1319 if (rtd->dev_registered) {
1314 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 1320 device_remove_file(rtd->dev, &dev_attr_codec_reg);
1315 device_unregister(&rtd->dev); 1321 device_del(rtd->dev);
1316 rtd->dev_registered = 0; 1322 rtd->dev_registered = 0;
1317 } 1323 }
1318 1324
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index e174d0811dae..3ad1f59b8028 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1738,8 +1738,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1738static ssize_t dapm_widget_show(struct device *dev, 1738static ssize_t dapm_widget_show(struct device *dev,
1739 struct device_attribute *attr, char *buf) 1739 struct device_attribute *attr, char *buf)
1740{ 1740{
1741 struct snd_soc_pcm_runtime *rtd = 1741 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
1742 container_of(dev, struct snd_soc_pcm_runtime, dev);
1743 struct snd_soc_codec *codec =rtd->codec; 1742 struct snd_soc_codec *codec =rtd->codec;
1744 struct snd_soc_dapm_widget *w; 1743 struct snd_soc_dapm_widget *w;
1745 int count = 0; 1744 int count = 0;
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index 90345ee138f3..c22431516ab2 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -330,7 +330,6 @@ static u64 tegra_dma_mask = DMA_BIT_MASK(32);
330static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) 330static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd)
331{ 331{
332 struct snd_card *card = rtd->card->snd_card; 332 struct snd_card *card = rtd->card->snd_card;
333 struct snd_soc_dai *dai = rtd->cpu_dai;
334 struct snd_pcm *pcm = rtd->pcm; 333 struct snd_pcm *pcm = rtd->pcm;
335 int ret = 0; 334 int ret = 0;
336 335
@@ -339,14 +338,14 @@ static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd)
339 if (!card->dev->coherent_dma_mask) 338 if (!card->dev->coherent_dma_mask)
340 card->dev->coherent_dma_mask = 0xffffffff; 339 card->dev->coherent_dma_mask = 0xffffffff;
341 340
342 if (dai->driver->playback.channels_min) { 341 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
343 ret = tegra_pcm_preallocate_dma_buffer(pcm, 342 ret = tegra_pcm_preallocate_dma_buffer(pcm,
344 SNDRV_PCM_STREAM_PLAYBACK); 343 SNDRV_PCM_STREAM_PLAYBACK);
345 if (ret) 344 if (ret)
346 goto err; 345 goto err;
347 } 346 }
348 347
349 if (dai->driver->capture.channels_min) { 348 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
350 ret = tegra_pcm_preallocate_dma_buffer(pcm, 349 ret = tegra_pcm_preallocate_dma_buffer(pcm,
351 SNDRV_PCM_STREAM_CAPTURE); 350 SNDRV_PCM_STREAM_CAPTURE);
352 if (ret) 351 if (ret)