summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/ad1889.c7
-rw-r--r--sound/pci/aw2/aw2-alsa.c40
-rw-r--r--sound/pci/bt87x.c10
-rw-r--r--sound/pci/ca0106/ca0106_main.c16
-rw-r--r--sound/pci/echoaudio/echoaudio.c16
-rw-r--r--sound/pci/emu10k1/emupcm.c22
-rw-r--r--sound/pci/emu10k1/p16v.c17
-rw-r--r--sound/pci/lx6464es/lx6464es.c8
-rw-r--r--sound/pci/rme9652/hdspm.c20
-rw-r--r--sound/pci/via82xx_modem.c8
10 files changed, 63 insertions, 101 deletions
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index d9c54c08e2db..410fefe5ebde 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -644,16 +644,11 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device)
644 chip->psubs = NULL; 644 chip->psubs = NULL;
645 chip->csubs = NULL; 645 chip->csubs = NULL;
646 646
647 err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 647 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
648 snd_dma_pci_data(chip->pci), 648 snd_dma_pci_data(chip->pci),
649 BUFFER_BYTES_MAX / 2, 649 BUFFER_BYTES_MAX / 2,
650 BUFFER_BYTES_MAX); 650 BUFFER_BYTES_MAX);
651 651
652 if (err < 0) {
653 dev_err(chip->card->dev, "buffer allocation error: %d\n", err);
654 return err;
655 }
656
657 return 0; 652 return 0;
658} 653}
659 654
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 9a49e4243a9c..b07c5fc1da56 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -624,15 +624,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
624 624
625 /* pre-allocation of buffers */ 625 /* pre-allocation of buffers */
626 /* Preallocate continuous pages. */ 626 /* Preallocate continuous pages. */
627 err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana, 627 snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana,
628 SNDRV_DMA_TYPE_DEV, 628 SNDRV_DMA_TYPE_DEV,
629 snd_dma_pci_data 629 snd_dma_pci_data(chip->pci),
630 (chip->pci), 630 64 * 1024, 64 * 1024);
631 64 * 1024, 64 * 1024);
632 if (err)
633 dev_err(chip->card->dev,
634 "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n",
635 err);
636 631
637 err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0, 632 err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0,
638 &pcm_playback_num); 633 &pcm_playback_num);
@@ -661,15 +656,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
661 656
662 /* pre-allocation of buffers */ 657 /* pre-allocation of buffers */
663 /* Preallocate continuous pages. */ 658 /* Preallocate continuous pages. */
664 err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num, 659 snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num,
665 SNDRV_DMA_TYPE_DEV, 660 SNDRV_DMA_TYPE_DEV,
666 snd_dma_pci_data 661 snd_dma_pci_data(chip->pci),
667 (chip->pci), 662 64 * 1024, 64 * 1024);
668 64 * 1024, 64 * 1024);
669 if (err)
670 dev_err(chip->card->dev,
671 "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n",
672 err);
673 663
674 err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1, 664 err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1,
675 &pcm_capture); 665 &pcm_capture);
@@ -699,16 +689,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
699 689
700 /* pre-allocation of buffers */ 690 /* pre-allocation of buffers */
701 /* Preallocate continuous pages. */ 691 /* Preallocate continuous pages. */
702 err = snd_pcm_lib_preallocate_pages_for_all(pcm_capture, 692 snd_pcm_lib_preallocate_pages_for_all(pcm_capture,
703 SNDRV_DMA_TYPE_DEV, 693 SNDRV_DMA_TYPE_DEV,
704 snd_dma_pci_data 694 snd_dma_pci_data(chip->pci),
705 (chip->pci), 695 64 * 1024, 64 * 1024);
706 64 * 1024, 64 * 1024);
707 if (err)
708 dev_err(chip->card->dev,
709 "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n",
710 err);
711
712 696
713 /* Create control */ 697 /* Create control */
714 err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip)); 698 err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip));
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index ba971042f871..0adcba10c067 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -714,11 +714,11 @@ static int snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name)
714 pcm->private_data = chip; 714 pcm->private_data = chip;
715 strcpy(pcm->name, name); 715 strcpy(pcm->name, name);
716 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops); 716 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops);
717 return snd_pcm_lib_preallocate_pages_for_all(pcm, 717 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
718 SNDRV_DMA_TYPE_DEV_SG, 718 snd_dma_pci_data(chip->pci),
719 snd_dma_pci_data(chip->pci), 719 128 * 1024,
720 128 * 1024, 720 ALIGN(255 * 4092, 1024));
721 ALIGN(255 * 4092, 1024)); 721 return 0;
722} 722}
723 723
724static int snd_bt87x_create(struct snd_card *card, 724static int snd_bt87x_create(struct snd_card *card,
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 3d1b0bbff33b..11ef0d636405 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1402,21 +1402,17 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device)
1402 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; 1402 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
1403 substream; 1403 substream;
1404 substream = substream->next) { 1404 substream = substream->next) {
1405 if ((err = snd_pcm_lib_preallocate_pages(substream, 1405 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
1406 SNDRV_DMA_TYPE_DEV, 1406 snd_dma_pci_data(emu->pci),
1407 snd_dma_pci_data(emu->pci), 1407 64*1024, 64*1024);
1408 64*1024, 64*1024)) < 0) /* FIXME: 32*1024 for sound buffer, between 32and64 for Periods table. */
1409 return err;
1410 } 1408 }
1411 1409
1412 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; 1410 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
1413 substream; 1411 substream;
1414 substream = substream->next) { 1412 substream = substream->next) {
1415 if ((err = snd_pcm_lib_preallocate_pages(substream, 1413 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
1416 SNDRV_DMA_TYPE_DEV, 1414 snd_dma_pci_data(emu->pci),
1417 snd_dma_pci_data(emu->pci), 1415 64*1024, 64*1024);
1418 64*1024, 64*1024)) < 0)
1419 return err;
1420 } 1416 }
1421 1417
1422 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, 1418 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2,
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 18d30d479b6b..ea876b0b02b9 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -884,17 +884,15 @@ static const struct snd_pcm_ops digital_capture_ops = {
884static int snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev) 884static int snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev)
885{ 885{
886 struct snd_pcm_substream *ss; 886 struct snd_pcm_substream *ss;
887 int stream, err; 887 int stream;
888 888
889 for (stream = 0; stream < 2; stream++) 889 for (stream = 0; stream < 2; stream++)
890 for (ss = pcm->streams[stream].substream; ss; ss = ss->next) { 890 for (ss = pcm->streams[stream].substream; ss; ss = ss->next)
891 err = snd_pcm_lib_preallocate_pages(ss, SNDRV_DMA_TYPE_DEV_SG, 891 snd_pcm_lib_preallocate_pages(ss, SNDRV_DMA_TYPE_DEV_SG,
892 dev, 892 dev,
893 ss->number ? 0 : 128<<10, 893 ss->number ? 0 : 128<<10,
894 256<<10); 894 256<<10);
895 if (err < 0) 895
896 return err;
897 }
898 return 0; 896 return 0;
899} 897}
900 898
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 30b3472d0b75..f6b4cb9ac75c 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1427,11 +1427,14 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device)
1427 emu->pcm = pcm; 1427 emu->pcm = pcm;
1428 1428
1429 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) 1429 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
1430 if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) 1430 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG,
1431 return err; 1431 snd_dma_pci_data(emu->pci),
1432 64*1024, 64*1024);
1432 1433
1433 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) 1434 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next)
1434 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1435 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
1436 snd_dma_pci_data(emu->pci),
1437 64*1024, 64*1024);
1435 1438
1436 return 0; 1439 return 0;
1437} 1440}
@@ -1455,8 +1458,9 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device)
1455 emu->pcm_multi = pcm; 1458 emu->pcm_multi = pcm;
1456 1459
1457 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) 1460 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
1458 if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) 1461 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG,
1459 return err; 1462 snd_dma_pci_data(emu->pci),
1463 64*1024, 64*1024);
1460 1464
1461 return 0; 1465 return 0;
1462} 1466}
@@ -1489,7 +1493,9 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device)
1489 strcpy(pcm->name, "Mic Capture"); 1493 strcpy(pcm->name, "Mic Capture");
1490 emu->pcm_mic = pcm; 1494 emu->pcm_mic = pcm;
1491 1495
1492 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1496 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1497 snd_dma_pci_data(emu->pci),
1498 64*1024, 64*1024);
1493 1499
1494 return 0; 1500 return 0;
1495} 1501}
@@ -1862,7 +1868,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
1862 if (err < 0) 1868 if (err < 0)
1863 return err; 1869 return err;
1864 1870
1865 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1871 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1872 snd_dma_pci_data(emu->pci),
1873 64*1024, 64*1024);
1866 1874
1867 return 0; 1875 return 0;
1868} 1876}
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 4948b95f6665..672017cac4c7 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -656,11 +656,10 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
656 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; 656 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
657 substream; 657 substream;
658 substream = substream->next) { 658 substream = substream->next) {
659 if ((err = snd_pcm_lib_preallocate_pages(substream, 659 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
660 SNDRV_DMA_TYPE_DEV, 660 snd_dma_pci_data(emu->pci),
661 snd_dma_pci_data(emu->pci), 661 (65536 - 64) * 8,
662 ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) 662 (65536 - 64) * 8);
663 return err;
664 /* 663 /*
665 dev_dbg(emu->card->dev, 664 dev_dbg(emu->card->dev,
666 "preallocate playback substream: err=%d\n", err); 665 "preallocate playback substream: err=%d\n", err);
@@ -670,11 +669,9 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
670 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; 669 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
671 substream; 670 substream;
672 substream = substream->next) { 671 substream = substream->next) {
673 if ((err = snd_pcm_lib_preallocate_pages(substream, 672 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
674 SNDRV_DMA_TYPE_DEV, 673 snd_dma_pci_data(emu->pci),
675 snd_dma_pci_data(emu->pci), 674 65536 - 64, 65536 - 64);
676 65536 - 64, 65536 - 64)) < 0)
677 return err;
678 /* 675 /*
679 dev_dbg(emu->card->dev, 676 dev_dbg(emu->card->dev,
680 "preallocate capture substream: err=%d\n", err); 677 "preallocate capture substream: err=%d\n", err);
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index 54f6252faca6..52ea0da1fe73 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -854,11 +854,9 @@ static int lx_pcm_create(struct lx6464es *chip)
854 pcm->nonatomic = true; 854 pcm->nonatomic = true;
855 strcpy(pcm->name, card_name); 855 strcpy(pcm->name, card_name);
856 856
857 err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 857 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
858 snd_dma_pci_data(chip->pci), 858 snd_dma_pci_data(chip->pci),
859 size, size); 859 size, size);
860 if (err < 0)
861 return err;
862 860
863 chip->pcm = pcm; 861 chip->pcm = pcm;
864 chip->capture_stream.is_capture = 1; 862 chip->capture_stream.is_capture = 1;
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 679ad0415e3b..3e66df7b5d1f 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6411,7 +6411,6 @@ static int snd_hdspm_create_hwdep(struct snd_card *card,
6411 ------------------------------------------------------------*/ 6411 ------------------------------------------------------------*/
6412static int snd_hdspm_preallocate_memory(struct hdspm *hdspm) 6412static int snd_hdspm_preallocate_memory(struct hdspm *hdspm)
6413{ 6413{
6414 int err;
6415 struct snd_pcm *pcm; 6414 struct snd_pcm *pcm;
6416 size_t wanted; 6415 size_t wanted;
6417 6416
@@ -6419,21 +6418,10 @@ static int snd_hdspm_preallocate_memory(struct hdspm *hdspm)
6419 6418
6420 wanted = HDSPM_DMA_AREA_BYTES; 6419 wanted = HDSPM_DMA_AREA_BYTES;
6421 6420
6422 err = 6421 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
6423 snd_pcm_lib_preallocate_pages_for_all(pcm, 6422 snd_dma_pci_data(hdspm->pci),
6424 SNDRV_DMA_TYPE_DEV_SG, 6423 wanted, wanted);
6425 snd_dma_pci_data(hdspm->pci), 6424 dev_dbg(hdspm->card->dev, " Preallocated %zd Bytes\n", wanted);
6426 wanted,
6427 wanted);
6428 if (err < 0) {
6429 dev_dbg(hdspm->card->dev,
6430 "Could not preallocate %zd Bytes\n", wanted);
6431
6432 return err;
6433 } else
6434 dev_dbg(hdspm->card->dev,
6435 " Preallocated %zd Bytes\n", wanted);
6436
6437 return 0; 6425 return 0;
6438} 6426}
6439 6427
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 3f59e0279058..3b3768acf7e1 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -865,11 +865,9 @@ static int snd_via686_pcm_new(struct via82xx_modem *chip)
865 init_viadev(chip, 0, VIA_REG_MO_STATUS, 0); 865 init_viadev(chip, 0, VIA_REG_MO_STATUS, 0);
866 init_viadev(chip, 1, VIA_REG_MI_STATUS, 1); 866 init_viadev(chip, 1, VIA_REG_MI_STATUS, 1);
867 867
868 if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, 868 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
869 snd_dma_pci_data(chip->pci), 869 snd_dma_pci_data(chip->pci),
870 64*1024, 128*1024)) < 0) 870 64*1024, 128*1024);
871 return err;
872
873 return 0; 871 return 0;
874} 872}
875 873