hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/usb/pcm.c
....@@ -1,17 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License as published by
4
- * the Free Software Foundation; either version 2 of the License, or
5
- * (at your option) any later version.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software
14
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
153 */
164
175 #include <linux/init.h>
....@@ -26,6 +14,8 @@
2614 #include <sound/pcm.h>
2715 #include <sound/pcm_params.h>
2816
17
+#include <trace/hooks/sound.h>
18
+
2919 #include "usbaudio.h"
3020 #include "card.h"
3121 #include "quirks.h"
....@@ -35,6 +25,7 @@
3525 #include "pcm.h"
3626 #include "clock.h"
3727 #include "power.h"
28
+#include "media.h"
3829
3930 #define SUBSTREAM_FLAG_DATA_EP_STARTED 0
4031 #define SUBSTREAM_FLAG_SYNC_EP_STARTED 1
....@@ -145,6 +136,8 @@
145136 found = fp;
146137 cur_attr = attr;
147138 }
139
+
140
+ snd_vendor_set_pcm_binterval(fp, found, &cur_attr, &attr);
148141 }
149142 return found;
150143 }
....@@ -334,19 +327,28 @@
334327 return 0;
335328 }
336329
337
-static void stop_endpoints(struct snd_usb_substream *subs, bool wait)
330
+static void sync_pending_stops(struct snd_usb_substream *subs)
338331 {
339
- if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) {
340
- snd_usb_endpoint_stop(subs->sync_endpoint);
341
- if (wait)
342
- snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
343
- }
332
+ snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
333
+ snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
334
+}
344335
345
- if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) {
336
+static void stop_endpoints(struct snd_usb_substream *subs)
337
+{
338
+ if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags))
339
+ snd_usb_endpoint_stop(subs->sync_endpoint);
340
+
341
+ if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags))
346342 snd_usb_endpoint_stop(subs->data_endpoint);
347
- if (wait)
348
- snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
349
- }
343
+}
344
+
345
+/* PCM sync_stop callback */
346
+static int snd_usb_pcm_sync_stop(struct snd_pcm_substream *substream)
347
+{
348
+ struct snd_usb_substream *subs = substream->runtime->private_data;
349
+
350
+ sync_pending_stops(subs);
351
+ return 0;
350352 }
351353
352354 static int search_roland_implicit_fb(struct usb_device *dev, int ifnum,
....@@ -425,6 +427,28 @@
425427 ep = 0x81;
426428 ifnum = 1;
427429 goto add_sync_ep_from_ifnum;
430
+ case USB_ID(0x07fd, 0x0004): /* MOTU MicroBook II/IIc */
431
+ /* MicroBook IIc */
432
+ if (altsd->bInterfaceClass == USB_CLASS_AUDIO)
433
+ return 0;
434
+
435
+ /* MicroBook II */
436
+ ep = 0x84;
437
+ ifnum = 0;
438
+ goto add_sync_ep_from_ifnum;
439
+ case USB_ID(0x07fd, 0x0008): /* MOTU M Series */
440
+ case USB_ID(0x31e9, 0x0001): /* Solid State Logic SSL2 */
441
+ case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */
442
+ case USB_ID(0x0499, 0x172f): /* Steinberg UR22C */
443
+ case USB_ID(0x0d9a, 0x00df): /* RTX6001 */
444
+ ep = 0x81;
445
+ ifnum = 2;
446
+ goto add_sync_ep_from_ifnum;
447
+ case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
448
+ case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
449
+ ep = 0x82;
450
+ ifnum = 0;
451
+ goto add_sync_ep_from_ifnum;
428452 case USB_ID(0x0582, 0x01d8): /* BOSS Katana */
429453 /* BOSS Katana amplifiers do not need quirks */
430454 return 0;
....@@ -458,6 +482,8 @@
458482 SND_USB_ENDPOINT_TYPE_DATA);
459483 if (!subs->sync_endpoint)
460484 return -EINVAL;
485
+
486
+ subs->sync_endpoint->is_implicit_feedback = 1;
461487
462488 subs->data_endpoint->sync_master = subs->sync_endpoint;
463489
....@@ -557,11 +583,14 @@
557583 implicit_fb ?
558584 SND_USB_ENDPOINT_TYPE_DATA :
559585 SND_USB_ENDPOINT_TYPE_SYNC);
586
+
560587 if (!subs->sync_endpoint) {
561588 if (is_playback && attr == USB_ENDPOINT_SYNC_NONE)
562589 return 0;
563590 return -EINVAL;
564591 }
592
+
593
+ subs->sync_endpoint->is_implicit_feedback = implicit_fb;
565594
566595 subs->data_endpoint->sync_master = subs->sync_endpoint;
567596
....@@ -623,6 +652,10 @@
623652 }
624653 dev_dbg(&dev->dev, "setting usb interface %d:%d\n",
625654 fmt->iface, fmt->altsetting);
655
+ err = snd_vendor_set_pcm_intf(iface, fmt->iface,
656
+ fmt->altsetting, subs->direction);
657
+ if (err)
658
+ return err;
626659 snd_usb_set_interface_quirk(dev);
627660 }
628661
....@@ -650,12 +683,8 @@
650683 return 0;
651684 }
652685
653
-/**
654
- * snd_usb_enable_audio_stream - Enable/disable the specified usb substream.
655
- * @subs: pointer to the usb substream.
656
- * @datainterval: data packet interval.
657
- * @enable: if true, enable the usb substream. Else disable.
658
- */
686
+static int snd_usb_pcm_change_state(struct snd_usb_substream *subs, int state);
687
+
659688 int snd_usb_enable_audio_stream(struct snd_usb_substream *subs,
660689 int datainterval, bool enable)
661690 {
....@@ -663,9 +692,6 @@
663692 struct usb_host_interface *alts;
664693 struct usb_interface *iface;
665694 int ret;
666
-
667
- if (!subs || !subs->stream)
668
- return -EINVAL;
669695
670696 if (!enable) {
671697 if (subs->interface >= 0) {
....@@ -680,12 +706,17 @@
680706 }
681707
682708 snd_usb_autoresume(subs->stream->chip);
709
+
710
+ ret = snd_usb_pcm_change_state(subs, UAC3_PD_STATE_D0);
711
+ if (ret < 0)
712
+ return ret;
713
+
683714 if (datainterval != -EINVAL)
684715 fmt = find_format_and_si(subs, datainterval);
685716 else
686717 fmt = find_format(subs);
687718 if (!fmt) {
688
- dev_dbg(&subs->dev->dev,
719
+ dev_err(&subs->dev->dev,
689720 "cannot set format: format = %#x, rate = %d, channels = %d\n",
690721 subs->pcm_format, subs->cur_rate, subs->channels);
691722 return -EINVAL;
....@@ -693,19 +724,12 @@
693724
694725 subs->altset_idx = 0;
695726 subs->interface = -1;
696
-
697
- if (!subs->stream->chip)
698
- return -EINVAL;
699
-
700727 if (atomic_read(&subs->stream->chip->shutdown)) {
701728 ret = -ENODEV;
702729 } else {
703730 ret = set_format(subs, fmt);
704731 if (ret < 0)
705732 return ret;
706
-
707
- if (!subs->cur_audiofmt)
708
- return -EINVAL;
709733
710734 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
711735 if (!iface) {
....@@ -861,7 +885,8 @@
861885 int ret;
862886
863887 /* format changed */
864
- stop_endpoints(subs, true);
888
+ stop_endpoints(subs);
889
+ sync_pending_stops(subs);
865890 ret = snd_usb_endpoint_set_params(subs->data_endpoint,
866891 subs->pcm_format,
867892 subs->channels,
....@@ -945,13 +970,8 @@
945970 struct audioformat *fmt;
946971 int ret;
947972
948
- if (snd_usb_use_vmalloc)
949
- ret = snd_pcm_lib_alloc_vmalloc_buffer(substream,
950
- params_buffer_bytes(hw_params));
951
- else
952
- ret = snd_pcm_lib_malloc_pages(substream,
953
- params_buffer_bytes(hw_params));
954
- if (ret < 0)
973
+ ret = snd_media_start_pipeline(subs);
974
+ if (ret)
955975 return ret;
956976
957977 subs->pcm_format = params_format(hw_params);
....@@ -966,12 +986,13 @@
966986 dev_dbg(&subs->dev->dev,
967987 "cannot set format: format = %#x, rate = %d, channels = %d\n",
968988 subs->pcm_format, subs->cur_rate, subs->channels);
969
- return -EINVAL;
989
+ ret = -EINVAL;
990
+ goto stop_pipeline;
970991 }
971992
972993 ret = snd_usb_lock_shutdown(subs->stream->chip);
973994 if (ret < 0)
974
- return ret;
995
+ goto stop_pipeline;
975996
976997 ret = snd_usb_pcm_change_state(subs, UAC3_PD_STATE_D0);
977998 if (ret < 0)
....@@ -987,6 +1008,12 @@
9871008
9881009 unlock:
9891010 snd_usb_unlock_shutdown(subs->stream->chip);
1011
+ if (ret < 0)
1012
+ goto stop_pipeline;
1013
+ return ret;
1014
+
1015
+ stop_pipeline:
1016
+ snd_media_stop_pipeline(subs);
9901017 return ret;
9911018 }
9921019
....@@ -999,20 +1026,19 @@
9991026 {
10001027 struct snd_usb_substream *subs = substream->runtime->private_data;
10011028
1029
+ snd_media_stop_pipeline(subs);
10021030 subs->cur_audiofmt = NULL;
10031031 subs->cur_rate = 0;
10041032 subs->period_bytes = 0;
10051033 if (!snd_usb_lock_shutdown(subs->stream->chip)) {
1006
- stop_endpoints(subs, true);
1034
+ stop_endpoints(subs);
1035
+ sync_pending_stops(subs);
10071036 snd_usb_endpoint_deactivate(subs->sync_endpoint);
10081037 snd_usb_endpoint_deactivate(subs->data_endpoint);
10091038 snd_usb_unlock_shutdown(subs->stream->chip);
10101039 }
10111040
1012
- if (snd_usb_use_vmalloc)
1013
- return snd_pcm_lib_free_vmalloc_buffer(substream);
1014
- else
1015
- return snd_pcm_lib_free_pages(substream);
1041
+ return 0;
10161042 }
10171043
10181044 /*
....@@ -1028,6 +1054,10 @@
10281054 struct usb_interface *iface;
10291055 int ret;
10301056
1057
+ ret = snd_vendor_set_pcm_buf(subs->dev, subs->cur_audiofmt->iface);
1058
+ if (ret)
1059
+ return ret;
1060
+
10311061 if (! subs->cur_audiofmt) {
10321062 dev_err(&subs->dev->dev, "no format is specified!\n");
10331063 return -ENXIO;
....@@ -1040,9 +1070,6 @@
10401070 ret = -EIO;
10411071 goto unlock;
10421072 }
1043
-
1044
- snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
1045
- snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
10461073
10471074 ret = snd_usb_pcm_change_state(subs, UAC3_PD_STATE_D0);
10481075 if (ret < 0)
....@@ -1063,6 +1090,17 @@
10631090 subs->cur_rate);
10641091 if (ret < 0)
10651092 goto unlock;
1093
+
1094
+ if (snd_vendor_get_ops()) {
1095
+ ret = snd_vendor_set_rate(iface,
1096
+ subs->cur_audiofmt->iface,
1097
+ subs->cur_rate,
1098
+ subs->cur_audiofmt->altsetting);
1099
+ if (!ret) {
1100
+ subs->need_setup_ep = false;
1101
+ goto unlock;
1102
+ }
1103
+ }
10661104
10671105 ret = configure_endpoint(subs);
10681106 if (ret < 0)
....@@ -1471,6 +1509,13 @@
14711509 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
14721510 struct snd_pcm_runtime *runtime = substream->runtime;
14731511 struct snd_usb_substream *subs = &as->substream[direction];
1512
+ int ret;
1513
+ bool is_support = false;
1514
+
1515
+ ret = snd_vendor_set_pcm_connection(subs->dev, SOUND_PCM_OPEN,
1516
+ direction);
1517
+ if (ret)
1518
+ return ret;
14741519
14751520 subs->interface = -1;
14761521 subs->altset_idx = 0;
....@@ -1484,7 +1529,18 @@
14841529 subs->dsd_dop.channel = 0;
14851530 subs->dsd_dop.marker = 1;
14861531
1487
- return setup_hw_info(runtime, subs);
1532
+ ret = setup_hw_info(runtime, subs);
1533
+ if (ret == 0) {
1534
+ ret = snd_media_stream_init(subs, as->pcm, direction);
1535
+ if (ret)
1536
+ snd_usb_autosuspend(subs->stream->chip);
1537
+ }
1538
+
1539
+ trace_android_vh_sound_usb_support_cpu_suspend(subs->dev, direction, &is_support);
1540
+ if (!ret && is_support)
1541
+ snd_usb_autosuspend(subs->stream->chip);
1542
+
1543
+ return ret;
14881544 }
14891545
14901546 static int snd_usb_pcm_close(struct snd_pcm_substream *substream)
....@@ -1493,13 +1549,29 @@
14931549 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
14941550 struct snd_usb_substream *subs = &as->substream[direction];
14951551 int ret;
1552
+ bool is_support = false;
14961553
1497
- stop_endpoints(subs, true);
1554
+ ret = snd_vendor_set_pcm_connection(subs->dev, SOUND_PCM_CLOSE,
1555
+ direction);
1556
+ if (ret)
1557
+ return ret;
1558
+
1559
+ trace_android_vh_sound_usb_support_cpu_suspend(subs->dev, direction, &is_support);
1560
+ if (!ret && is_support)
1561
+ snd_usb_autoresume(subs->stream->chip);
1562
+
1563
+ snd_media_stop_pipeline(subs);
14981564
14991565 if (!as->chip->keep_iface &&
15001566 subs->interface >= 0 &&
15011567 !snd_usb_lock_shutdown(subs->stream->chip)) {
15021568 usb_set_interface(subs->dev, subs->interface, 0);
1569
+ ret = snd_vendor_set_pcm_intf(usb_ifnum_to_if(subs->dev,
1570
+ subs->interface),
1571
+ subs->interface, 0,
1572
+ direction);
1573
+ if (ret)
1574
+ return ret;
15031575 subs->interface = -1;
15041576 ret = snd_usb_pcm_change_state(subs, UAC3_PD_STATE_D1);
15051577 snd_usb_unlock_shutdown(subs->stream->chip);
....@@ -1541,6 +1613,12 @@
15411613 // continue;
15421614 }
15431615 bytes = urb->iso_frame_desc[i].actual_length;
1616
+ if (subs->stream_offset_adj > 0) {
1617
+ unsigned int adj = min(subs->stream_offset_adj, bytes);
1618
+ cp += adj;
1619
+ bytes -= adj;
1620
+ subs->stream_offset_adj -= adj;
1621
+ }
15441622 frames = bytes / stride;
15451623 if (!subs->txfr_quirk)
15461624 bytes = frames * stride;
....@@ -1712,6 +1790,8 @@
17121790 for (i = 0; i < ctx->packets; i++) {
17131791 if (ctx->packet_size[i])
17141792 counts = ctx->packet_size[i];
1793
+ else if (ep->sync_master)
1794
+ counts = snd_usb_endpoint_slave_next_packet_size(ep);
17151795 else
17161796 counts = snd_usb_endpoint_next_packet_size(ep);
17171797
....@@ -1815,8 +1895,8 @@
18151895 int processed = urb->transfer_buffer_length / ep->stride;
18161896 int est_delay;
18171897
1818
- /* ignore the delay accounting when procssed=0 is given, i.e.
1819
- * silent payloads are procssed before handling the actual data
1898
+ /* ignore the delay accounting when processed=0 is given, i.e.
1899
+ * silent payloads are processed before handling the actual data
18201900 */
18211901 if (!processed)
18221902 return;
....@@ -1862,22 +1942,15 @@
18621942
18631943 switch (cmd) {
18641944 case SNDRV_PCM_TRIGGER_START:
1865
- case SNDRV_PCM_TRIGGER_RESUME:
18661945 subs->trigger_tstamp_pending_update = true;
1867
- /* fall through */
1946
+ fallthrough;
18681947 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
18691948 subs->data_endpoint->prepare_data_urb = prepare_playback_urb;
18701949 subs->data_endpoint->retire_data_urb = retire_playback_urb;
18711950 subs->running = 1;
18721951 return 0;
1873
- case SNDRV_PCM_TRIGGER_SUSPEND:
1874
- stop_endpoints(subs, true);
1875
- subs->running = 0;
1876
- if (subs->stream->chip->setup_fmt_after_resume_quirk)
1877
- subs->need_setup_fmt = true;
1878
- return 0;
18791952 case SNDRV_PCM_TRIGGER_STOP:
1880
- stop_endpoints(subs, false);
1953
+ stop_endpoints(subs);
18811954 subs->running = 0;
18821955 return 0;
18831956 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
....@@ -1886,6 +1959,13 @@
18861959 subs->data_endpoint->retire_data_urb = retire_playback_urb;
18871960 subs->running = 0;
18881961 return 0;
1962
+ case SNDRV_PCM_TRIGGER_SUSPEND:
1963
+ if (subs->stream->chip->setup_fmt_after_resume_quirk) {
1964
+ stop_endpoints(subs);
1965
+ subs->need_setup_fmt = true;
1966
+ return 0;
1967
+ }
1968
+ break;
18891969 }
18901970
18911971 return -EINVAL;
....@@ -1899,7 +1979,6 @@
18991979
19001980 switch (cmd) {
19011981 case SNDRV_PCM_TRIGGER_START:
1902
- case SNDRV_PCM_TRIGGER_RESUME:
19031982 err = start_endpoints(subs);
19041983 if (err < 0)
19051984 return err;
....@@ -1907,14 +1986,9 @@
19071986 subs->data_endpoint->retire_data_urb = retire_capture_urb;
19081987 subs->running = 1;
19091988 return 0;
1910
- case SNDRV_PCM_TRIGGER_SUSPEND:
1911
- stop_endpoints(subs, true);
1912
- subs->running = 0;
1913
- if (subs->stream->chip->setup_fmt_after_resume_quirk)
1914
- subs->need_setup_fmt = true;
1915
- return 0;
19161989 case SNDRV_PCM_TRIGGER_STOP:
1917
- stop_endpoints(subs, false);
1990
+ stop_endpoints(subs);
1991
+ subs->data_endpoint->retire_data_urb = NULL;
19181992 subs->running = 0;
19191993 return 0;
19201994 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
....@@ -1925,6 +1999,13 @@
19251999 subs->data_endpoint->retire_data_urb = retire_capture_urb;
19262000 subs->running = 1;
19272001 return 0;
2002
+ case SNDRV_PCM_TRIGGER_SUSPEND:
2003
+ if (subs->stream->chip->setup_fmt_after_resume_quirk) {
2004
+ stop_endpoints(subs);
2005
+ subs->need_setup_fmt = true;
2006
+ return 0;
2007
+ }
2008
+ break;
19282009 }
19292010
19302011 return -EINVAL;
....@@ -1933,61 +2014,31 @@
19332014 static const struct snd_pcm_ops snd_usb_playback_ops = {
19342015 .open = snd_usb_pcm_open,
19352016 .close = snd_usb_pcm_close,
1936
- .ioctl = snd_pcm_lib_ioctl,
19372017 .hw_params = snd_usb_hw_params,
19382018 .hw_free = snd_usb_hw_free,
19392019 .prepare = snd_usb_pcm_prepare,
19402020 .trigger = snd_usb_substream_playback_trigger,
2021
+ .sync_stop = snd_usb_pcm_sync_stop,
19412022 .pointer = snd_usb_pcm_pointer,
1942
- .page = snd_pcm_lib_get_vmalloc_page,
19432023 };
19442024
19452025 static const struct snd_pcm_ops snd_usb_capture_ops = {
19462026 .open = snd_usb_pcm_open,
19472027 .close = snd_usb_pcm_close,
1948
- .ioctl = snd_pcm_lib_ioctl,
19492028 .hw_params = snd_usb_hw_params,
19502029 .hw_free = snd_usb_hw_free,
19512030 .prepare = snd_usb_pcm_prepare,
19522031 .trigger = snd_usb_substream_capture_trigger,
2032
+ .sync_stop = snd_usb_pcm_sync_stop,
19532033 .pointer = snd_usb_pcm_pointer,
1954
- .page = snd_pcm_lib_get_vmalloc_page,
1955
-};
1956
-
1957
-static const struct snd_pcm_ops snd_usb_playback_dev_ops = {
1958
- .open = snd_usb_pcm_open,
1959
- .close = snd_usb_pcm_close,
1960
- .ioctl = snd_pcm_lib_ioctl,
1961
- .hw_params = snd_usb_hw_params,
1962
- .hw_free = snd_usb_hw_free,
1963
- .prepare = snd_usb_pcm_prepare,
1964
- .trigger = snd_usb_substream_playback_trigger,
1965
- .pointer = snd_usb_pcm_pointer,
1966
- .page = snd_pcm_sgbuf_ops_page,
1967
-};
1968
-
1969
-static const struct snd_pcm_ops snd_usb_capture_dev_ops = {
1970
- .open = snd_usb_pcm_open,
1971
- .close = snd_usb_pcm_close,
1972
- .ioctl = snd_pcm_lib_ioctl,
1973
- .hw_params = snd_usb_hw_params,
1974
- .hw_free = snd_usb_hw_free,
1975
- .prepare = snd_usb_pcm_prepare,
1976
- .trigger = snd_usb_substream_capture_trigger,
1977
- .pointer = snd_usb_pcm_pointer,
1978
- .page = snd_pcm_sgbuf_ops_page,
19792034 };
19802035
19812036 void snd_usb_set_pcm_ops(struct snd_pcm *pcm, int stream)
19822037 {
19832038 const struct snd_pcm_ops *ops;
19842039
1985
- if (snd_usb_use_vmalloc)
1986
- ops = stream == SNDRV_PCM_STREAM_PLAYBACK ?
2040
+ ops = stream == SNDRV_PCM_STREAM_PLAYBACK ?
19872041 &snd_usb_playback_ops : &snd_usb_capture_ops;
1988
- else
1989
- ops = stream == SNDRV_PCM_STREAM_PLAYBACK ?
1990
- &snd_usb_playback_dev_ops : &snd_usb_capture_dev_ops;
19912042 snd_pcm_set_ops(pcm, stream, ops);
19922043 }
19932044
....@@ -1997,7 +2048,10 @@
19972048 struct snd_pcm_substream *s = pcm->streams[subs->direction].substream;
19982049 struct device *dev = subs->dev->bus->sysdev;
19992050
2000
- if (!snd_usb_use_vmalloc)
2001
- snd_pcm_lib_preallocate_pages(s, SNDRV_DMA_TYPE_DEV_SG,
2002
- dev, 64*1024, 512*1024);
2051
+ if (snd_usb_use_vmalloc)
2052
+ snd_pcm_set_managed_buffer(s, SNDRV_DMA_TYPE_VMALLOC,
2053
+ NULL, 0, 0);
2054
+ else
2055
+ snd_pcm_set_managed_buffer(s, SNDRV_DMA_TYPE_DEV_SG,
2056
+ dev, 64*1024, 512*1024);
20032057 }