Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into topic/asoc

+58 -63
+2
drivers/mfd/wm8994-core.c
··· 268 268 wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, 269 269 wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET)); 270 270 271 + regcache_cache_only(wm8994->regmap, true); 271 272 regcache_mark_dirty(wm8994->regmap); 272 273 273 274 wm8994->suspended = true; ··· 299 298 return ret; 300 299 } 301 300 301 + regcache_cache_only(wm8994->regmap, false); 302 302 ret = regcache_sync(wm8994->regmap); 303 303 if (ret != 0) { 304 304 dev_err(dev, "Failed to restore register map: %d\n", ret);
+3 -3
include/sound/soc.h
··· 847 847 848 848 /* SoC machine DAI configuration, glues a codec and cpu DAI together */ 849 849 struct snd_soc_pcm_runtime { 850 - struct device dev; 850 + struct device *dev; 851 851 struct snd_soc_card *card; 852 852 struct snd_soc_dai_link *dai_link; 853 853 struct mutex pcm_mutex; ··· 933 933 static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 934 934 void *data) 935 935 { 936 - dev_set_drvdata(&rtd->dev, data); 936 + dev_set_drvdata(rtd->dev, data); 937 937 } 938 938 939 939 static 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 944 944 static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
+1 -1
sound/soc/atmel/Kconfig
··· 26 26 27 27 config SND_AT91_SOC_AFEB9260 28 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 30 select SND_ATMEL_SOC_SSC 31 31 select SND_SOC_TLV320AIC23 32 32 help
+2 -3
sound/soc/atmel/atmel-pcm.c
··· 367 367 static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) 368 368 { 369 369 struct snd_card *card = rtd->card->snd_card; 370 - struct snd_soc_dai *dai = rtd->cpu_dai; 371 370 struct snd_pcm *pcm = rtd->pcm; 372 371 int ret = 0; 373 372 ··· 375 376 if (!card->dev->coherent_dma_mask) 376 377 card->dev->coherent_dma_mask = 0xffffffff; 377 378 378 - if (dai->driver->playback.channels_min) { 379 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 379 380 ret = atmel_pcm_preallocate_dma_buffer(pcm, 380 381 SNDRV_PCM_STREAM_PLAYBACK); 381 382 if (ret) 382 383 goto out; 383 384 } 384 385 385 - if (dai->driver->capture.channels_min) { 386 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 386 387 pr_debug("atmel-pcm:" 387 388 "Allocating PCM capture DMA buffer\n"); 388 389 ret = atmel_pcm_preallocate_dma_buffer(pcm,
+2 -3
sound/soc/blackfin/bf5xx-ac97-pcm.c
··· 421 421 static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) 422 422 { 423 423 struct snd_card *card = rtd->card->snd_card; 424 - struct snd_soc_dai *dai = rtd->cpu_dai; 425 424 struct snd_pcm *pcm = rtd->pcm; 426 425 int ret = 0; 427 426 ··· 430 431 if (!card->dev->coherent_dma_mask) 431 432 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 432 433 433 - if (dai->driver->playback.channels_min) { 434 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 434 435 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 435 436 SNDRV_PCM_STREAM_PLAYBACK); 436 437 if (ret) 437 438 goto out; 438 439 } 439 440 440 - if (dai->driver->capture.channels_min) { 441 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 441 442 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 442 443 SNDRV_PCM_STREAM_CAPTURE); 443 444 if (ret)
+2 -3
sound/soc/blackfin/bf5xx-i2s-pcm.c
··· 260 260 static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) 261 261 { 262 262 struct snd_card *card = rtd->card->snd_card; 263 - struct snd_soc_dai *dai = rtd->cpu_dai; 264 263 struct snd_pcm *pcm = rtd->pcm; 265 264 int ret = 0; 266 265 ··· 269 270 if (!card->dev->coherent_dma_mask) 270 271 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 271 272 272 - if (dai->driver->playback.channels_min) { 273 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 273 274 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 274 275 SNDRV_PCM_STREAM_PLAYBACK); 275 276 if (ret) 276 277 goto out; 277 278 } 278 279 279 - if (dai->driver->capture.channels_min) { 280 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 280 281 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 281 282 SNDRV_PCM_STREAM_CAPTURE); 282 283 if (ret)
+2 -3
sound/soc/blackfin/bf5xx-tdm-pcm.c
··· 286 286 static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) 287 287 { 288 288 struct snd_card *card = rtd->card->snd_card; 289 - struct snd_soc_dai *dai = rtd->cpu_dai; 290 289 struct snd_pcm *pcm = rtd->pcm; 291 290 int ret = 0; 292 291 ··· 294 295 if (!card->dev->coherent_dma_mask) 295 296 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 296 297 297 - if (dai->driver->playback.channels_min) { 298 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 298 299 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 299 300 SNDRV_PCM_STREAM_PLAYBACK); 300 301 if (ret) 301 302 goto out; 302 303 } 303 304 304 - if (dai->driver->capture.channels_min) { 305 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 305 306 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 306 307 SNDRV_PCM_STREAM_CAPTURE); 307 308 if (ret)
+2 -3
sound/soc/davinci/davinci-pcm.c
··· 831 831 static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) 832 832 { 833 833 struct snd_card *card = rtd->card->snd_card; 834 - struct snd_soc_dai *dai = rtd->cpu_dai; 835 834 struct snd_pcm *pcm = rtd->pcm; 836 835 int ret; 837 836 ··· 839 840 if (!card->dev->coherent_dma_mask) 840 841 card->dev->coherent_dma_mask = 0xffffffff; 841 842 842 - if (dai->driver->playback.channels_min) { 843 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 843 844 ret = davinci_pcm_preallocate_dma_buffer(pcm, 844 845 SNDRV_PCM_STREAM_PLAYBACK, 845 846 pcm_hardware_playback.buffer_bytes_max); ··· 847 848 return ret; 848 849 } 849 850 850 - if (dai->driver->capture.channels_min) { 851 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 851 852 ret = davinci_pcm_preallocate_dma_buffer(pcm, 852 853 SNDRV_PCM_STREAM_CAPTURE, 853 854 pcm_hardware_capture.buffer_bytes_max);
+2 -3
sound/soc/ep93xx/ep93xx-pcm.c
··· 286 286 static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) 287 287 { 288 288 struct snd_card *card = rtd->card->snd_card; 289 - struct snd_soc_dai *dai = rtd->cpu_dai; 290 289 struct snd_pcm *pcm = rtd->pcm; 291 290 int ret = 0; 292 291 ··· 294 295 if (!card->dev->coherent_dma_mask) 295 296 card->dev->coherent_dma_mask = 0xffffffff; 296 297 297 - if (dai->driver->playback.channels_min) { 298 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 298 299 ret = ep93xx_pcm_preallocate_dma_buffer(pcm, 299 300 SNDRV_PCM_STREAM_PLAYBACK); 300 301 if (ret) 301 302 return ret; 302 303 } 303 304 304 - if (dai->driver->capture.channels_min) { 305 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 305 306 ret = ep93xx_pcm_preallocate_dma_buffer(pcm, 306 307 SNDRV_PCM_STREAM_CAPTURE); 307 308 if (ret)
+2 -3
sound/soc/jz4740/jz4740-pcm.c
··· 302 302 static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) 303 303 { 304 304 struct snd_card *card = rtd->card->snd_card; 305 - struct snd_soc_dai *dai = rtd->cpu_dai; 306 305 struct snd_pcm *pcm = rtd->pcm; 307 306 int ret = 0; 308 307 ··· 311 312 if (!card->dev->coherent_dma_mask) 312 313 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 313 314 314 - if (dai->driver->playback.channels_min) { 315 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 315 316 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 316 317 SNDRV_PCM_STREAM_PLAYBACK); 317 318 if (ret) 318 319 goto err; 319 320 } 320 321 321 - if (dai->driver->capture.channels_min) { 322 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 322 323 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 323 324 SNDRV_PCM_STREAM_CAPTURE); 324 325 if (ret)
+2 -3
sound/soc/kirkwood/kirkwood-dma.c
··· 315 315 static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) 316 316 { 317 317 struct snd_card *card = rtd->card->snd_card; 318 - struct snd_soc_dai *dai = rtd->cpu_dai; 319 318 struct snd_pcm *pcm = rtd->pcm; 320 319 int ret; 321 320 ··· 323 324 if (!card->dev->coherent_dma_mask) 324 325 card->dev->coherent_dma_mask = 0xffffffff; 325 326 326 - if (dai->driver->playback.channels_min) { 327 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 327 328 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 328 329 SNDRV_PCM_STREAM_PLAYBACK); 329 330 if (ret) 330 331 return ret; 331 332 } 332 333 333 - if (dai->driver->capture.channels_min) { 334 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 334 335 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 335 336 SNDRV_PCM_STREAM_CAPTURE); 336 337 if (ret)
+2 -3
sound/soc/mid-x86/sst_platform.c
··· 446 446 447 447 static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) 448 448 { 449 - struct snd_soc_dai *dai = rtd->cpu_dai; 450 449 struct snd_pcm *pcm = rtd->pcm; 451 450 int retval = 0; 452 451 453 452 pr_debug("sst_pcm_new called\n"); 454 - if (dai->driver->playback.channels_min || 455 - dai->driver->capture.channels_min) { 453 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || 454 + pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 456 455 retval = snd_pcm_lib_preallocate_pages_for_all(pcm, 457 456 SNDRV_DMA_TYPE_CONTINUOUS, 458 457 snd_dma_continuous_data(GFP_KERNEL),
+2 -3
sound/soc/omap/omap-pcm.c
··· 378 378 static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) 379 379 { 380 380 struct snd_card *card = rtd->card->snd_card; 381 - struct snd_soc_dai *dai = rtd->cpu_dai; 382 381 struct snd_pcm *pcm = rtd->pcm; 383 382 int ret = 0; 384 383 ··· 386 387 if (!card->dev->coherent_dma_mask) 387 388 card->dev->coherent_dma_mask = DMA_BIT_MASK(64); 388 389 389 - if (dai->driver->playback.channels_min) { 390 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 390 391 ret = omap_pcm_preallocate_dma_buffer(pcm, 391 392 SNDRV_PCM_STREAM_PLAYBACK); 392 393 if (ret) 393 394 goto out; 394 395 } 395 396 396 - if (dai->driver->capture.channels_min) { 397 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 397 398 ret = omap_pcm_preallocate_dma_buffer(pcm, 398 399 SNDRV_PCM_STREAM_CAPTURE); 399 400 if (ret)
+2 -3
sound/soc/samsung/dma.c
··· 403 403 static int dma_new(struct snd_soc_pcm_runtime *rtd) 404 404 { 405 405 struct snd_card *card = rtd->card->snd_card; 406 - struct snd_soc_dai *dai = rtd->cpu_dai; 407 406 struct snd_pcm *pcm = rtd->pcm; 408 407 int ret = 0; 409 408 ··· 413 414 if (!card->dev->coherent_dma_mask) 414 415 card->dev->coherent_dma_mask = 0xffffffff; 415 416 416 - if (dai->driver->playback.channels_min) { 417 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 417 418 ret = preallocate_dma_buffer(pcm, 418 419 SNDRV_PCM_STREAM_PLAYBACK); 419 420 if (ret) 420 421 goto out; 421 422 } 422 423 423 - if (dai->driver->capture.channels_min) { 424 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 424 425 ret = preallocate_dma_buffer(pcm, 425 426 SNDRV_PCM_STREAM_CAPTURE); 426 427 if (ret)
+2 -2
sound/soc/samsung/idma.c
··· 387 387 static int idma_new(struct snd_soc_pcm_runtime *rtd) 388 388 { 389 389 struct snd_card *card = rtd->card->snd_card; 390 - struct snd_soc_dai *dai = rtd->cpu_dai; 391 390 struct snd_pcm *pcm = rtd->pcm; 392 391 int ret = 0; 393 392 ··· 395 396 if (!card->dev->coherent_dma_mask) 396 397 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 397 398 398 - if (dai->driver->playback.channels_min) 399 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 399 400 ret = preallocate_idma_buffer(pcm, 400 401 SNDRV_PCM_STREAM_PLAYBACK); 402 + } 401 403 402 404 return ret; 403 405 }
+25 -19
sound/soc/soc-core.c
··· 169 169 static ssize_t codec_reg_show(struct device *dev, 170 170 struct device_attribute *attr, char *buf) 171 171 { 172 - struct snd_soc_pcm_runtime *rtd = 173 - container_of(dev, struct snd_soc_pcm_runtime, dev); 172 + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); 174 173 175 174 return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0); 176 175 } ··· 179 180 static ssize_t pmdown_time_show(struct device *dev, 180 181 struct device_attribute *attr, char *buf) 181 182 { 182 - struct snd_soc_pcm_runtime *rtd = 183 - container_of(dev, struct snd_soc_pcm_runtime, dev); 183 + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); 184 184 185 185 return sprintf(buf, "%ld\n", rtd->pmdown_time); 186 186 } ··· 188 190 struct device_attribute *attr, 189 191 const char *buf, size_t count) 190 192 { 191 - struct snd_soc_pcm_runtime *rtd = 192 - container_of(dev, struct snd_soc_pcm_runtime, dev); 193 + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); 193 194 int ret; 194 195 195 196 ret = strict_strtol(buf, 10, &rtd->pmdown_time); ··· 881 884 882 885 /* unregister the rtd device */ 883 886 if (rtd->dev_registered) { 884 - device_remove_file(&rtd->dev, &dev_attr_pmdown_time); 885 - device_remove_file(&rtd->dev, &dev_attr_codec_reg); 886 - device_unregister(&rtd->dev); 887 + device_remove_file(rtd->dev, &dev_attr_pmdown_time); 888 + device_remove_file(rtd->dev, &dev_attr_codec_reg); 889 + device_unregister(rtd->dev); 887 890 rtd->dev_registered = 0; 888 891 } 889 892 ··· 1058 1061 return ret; 1059 1062 } 1060 1063 1061 - static void rtd_release(struct device *dev) {} 1064 + static void rtd_release(struct device *dev) 1065 + { 1066 + kfree(dev); 1067 + } 1062 1068 1063 1069 static int soc_post_component_init(struct snd_soc_card *card, 1064 1070 struct snd_soc_codec *codec, ··· 1104 1104 1105 1105 /* register the rtd device */ 1106 1106 rtd->codec = codec; 1107 - rtd->dev.parent = card->dev; 1108 - rtd->dev.release = rtd_release; 1109 - rtd->dev.init_name = name; 1107 + 1108 + rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL); 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 1116 mutex_init(&rtd->pcm_mutex); 1111 - ret = device_register(&rtd->dev); 1117 + ret = device_add(rtd->dev); 1112 1118 if (ret < 0) { 1113 1119 dev_err(card->dev, 1114 1120 "asoc: failed to register runtime device: %d\n", ret); ··· 1123 1117 rtd->dev_registered = 1; 1124 1118 1125 1119 /* add DAPM sysfs entries for this codec */ 1126 - ret = snd_soc_dapm_sys_add(&rtd->dev); 1120 + ret = snd_soc_dapm_sys_add(rtd->dev); 1127 1121 if (ret < 0) 1128 1122 dev_err(codec->dev, 1129 1123 "asoc: failed to add codec dapm sysfs entries: %d\n", 1130 1124 ret); 1131 1125 1132 1126 /* add codec sysfs entries */ 1133 - ret = device_create_file(&rtd->dev, &dev_attr_codec_reg); 1127 + ret = device_create_file(rtd->dev, &dev_attr_codec_reg); 1134 1128 if (ret < 0) 1135 1129 dev_err(codec->dev, 1136 1130 "asoc: failed to add codec sysfs files: %d\n", ret); ··· 1219 1213 if (ret) 1220 1214 return ret; 1221 1215 1222 - ret = device_create_file(&rtd->dev, &dev_attr_pmdown_time); 1216 + ret = device_create_file(rtd->dev, &dev_attr_pmdown_time); 1223 1217 if (ret < 0) 1224 1218 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); 1225 1219 ··· 1317 1311 1318 1312 /* unregister the rtd device */ 1319 1313 if (rtd->dev_registered) { 1320 - device_remove_file(&rtd->dev, &dev_attr_codec_reg); 1321 - device_unregister(&rtd->dev); 1314 + device_remove_file(rtd->dev, &dev_attr_codec_reg); 1315 + device_del(rtd->dev); 1322 1316 rtd->dev_registered = 0; 1323 1317 } 1324 1318
+1 -2
sound/soc/soc-dapm.c
··· 1738 1738 static ssize_t dapm_widget_show(struct device *dev, 1739 1739 struct device_attribute *attr, char *buf) 1740 1740 { 1741 - struct snd_soc_pcm_runtime *rtd = 1742 - container_of(dev, struct snd_soc_pcm_runtime, dev); 1741 + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); 1743 1742 struct snd_soc_codec *codec =rtd->codec; 1744 1743 struct snd_soc_dapm_widget *w; 1745 1744 int count = 0;
+2 -3
sound/soc/tegra/tegra_pcm.c
··· 330 330 static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) 331 331 { 332 332 struct snd_card *card = rtd->card->snd_card; 333 - struct snd_soc_dai *dai = rtd->cpu_dai; 334 333 struct snd_pcm *pcm = rtd->pcm; 335 334 int ret = 0; 336 335 ··· 338 339 if (!card->dev->coherent_dma_mask) 339 340 card->dev->coherent_dma_mask = 0xffffffff; 340 341 341 - if (dai->driver->playback.channels_min) { 342 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 342 343 ret = tegra_pcm_preallocate_dma_buffer(pcm, 343 344 SNDRV_PCM_STREAM_PLAYBACK); 344 345 if (ret) 345 346 goto err; 346 347 } 347 348 348 - if (dai->driver->capture.channels_min) { 349 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 349 350 ret = tegra_pcm_preallocate_dma_buffer(pcm, 350 351 SNDRV_PCM_STREAM_CAPTURE); 351 352 if (ret)