aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/stream.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2012-04-12 07:51:12 -0400
committerTakashi Iwai <tiwai@suse.de>2012-04-13 04:24:08 -0400
commitedcd3633e72a1590c4cf46befe5e6cd03b5aec3e (patch)
tree57aab87190179ba8995d05a93c3ece3a91f870ae /sound/usb/stream.c
parent8fdff6a319e7dac757c558bd283dc4577e68cde7 (diff)
ALSA: snd-usb: switch over to new endpoint streaming logic
With the previous commit that added the new streaming model, all endpoint and streaming related code is now in endpoint.c, and pcm.c only acts as a wrapper for handling the packet's payload. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/stream.c')
-rw-r--r--sound/usb/stream.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 5ff8010b2d6f..6b7d7a2b7baa 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -73,6 +73,31 @@ static void snd_usb_audio_pcm_free(struct snd_pcm *pcm)
73 } 73 }
74} 74}
75 75
76/*
77 * initialize the substream instance.
78 */
79
80static void snd_usb_init_substream(struct snd_usb_stream *as,
81 int stream,
82 struct audioformat *fp)
83{
84 struct snd_usb_substream *subs = &as->substream[stream];
85
86 INIT_LIST_HEAD(&subs->fmt_list);
87 spin_lock_init(&subs->lock);
88
89 subs->stream = as;
90 subs->direction = stream;
91 subs->dev = as->chip->dev;
92 subs->txfr_quirk = as->chip->txfr_quirk;
93
94 snd_usb_set_pcm_ops(as->pcm, stream);
95
96 list_add_tail(&fp->list, &subs->fmt_list);
97 subs->formats |= fp->formats;
98 subs->num_formats++;
99 subs->fmt_type = fp->fmt_type;
100}
76 101
77/* 102/*
78 * add this endpoint to the chip instance. 103 * add this endpoint to the chip instance.
@@ -94,9 +119,9 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
94 if (as->fmt_type != fp->fmt_type) 119 if (as->fmt_type != fp->fmt_type)
95 continue; 120 continue;
96 subs = &as->substream[stream]; 121 subs = &as->substream[stream];
97 if (!subs->endpoint) 122 if (!subs->data_endpoint)
98 continue; 123 continue;
99 if (subs->endpoint == fp->endpoint) { 124 if (subs->data_endpoint->ep_num == fp->endpoint) {
100 list_add_tail(&fp->list, &subs->fmt_list); 125 list_add_tail(&fp->list, &subs->fmt_list);
101 subs->num_formats++; 126 subs->num_formats++;
102 subs->formats |= fp->formats; 127 subs->formats |= fp->formats;
@@ -109,7 +134,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
109 if (as->fmt_type != fp->fmt_type) 134 if (as->fmt_type != fp->fmt_type)
110 continue; 135 continue;
111 subs = &as->substream[stream]; 136 subs = &as->substream[stream];
112 if (subs->endpoint) 137 if (subs->data_endpoint)
113 continue; 138 continue;
114 err = snd_pcm_new_stream(as->pcm, stream, 1); 139 err = snd_pcm_new_stream(as->pcm, stream, 1);
115 if (err < 0) 140 if (err < 0)