Lines Matching refs:line6pcm

21 static int submit_audio_in_urb(struct snd_line6_pcm *line6pcm)  in submit_audio_in_urb()  argument
28 index = find_first_zero_bit(&line6pcm->in.active_urbs, in submit_audio_in_urb()
29 line6pcm->line6->iso_buffers); in submit_audio_in_urb()
31 if (index < 0 || index >= line6pcm->line6->iso_buffers) { in submit_audio_in_urb()
32 dev_err(line6pcm->line6->ifcdev, "no free URB found\n"); in submit_audio_in_urb()
36 urb_in = line6pcm->in.urbs[index]; in submit_audio_in_urb()
43 fin->length = line6pcm->max_packet_size_in; in submit_audio_in_urb()
44 urb_size += line6pcm->max_packet_size_in; in submit_audio_in_urb()
48 line6pcm->in.buffer + in submit_audio_in_urb()
49 index * LINE6_ISO_PACKETS * line6pcm->max_packet_size_in; in submit_audio_in_urb()
51 urb_in->context = line6pcm; in submit_audio_in_urb()
56 set_bit(index, &line6pcm->in.active_urbs); in submit_audio_in_urb()
58 dev_err(line6pcm->line6->ifcdev, in submit_audio_in_urb()
68 int line6_submit_audio_in_all_urbs(struct snd_line6_pcm *line6pcm) in line6_submit_audio_in_all_urbs() argument
72 for (i = 0; i < line6pcm->line6->iso_buffers; ++i) { in line6_submit_audio_in_all_urbs()
73 ret = submit_audio_in_urb(line6pcm); in line6_submit_audio_in_all_urbs()
84 void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf, int fsize) in line6_capture_copy() argument
87 get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE); in line6_capture_copy()
90 line6pcm->properties->bytes_per_channel * in line6_capture_copy()
91 line6pcm->properties->capture_hw.channels_max; in line6_capture_copy()
97 if (line6pcm->in.pos_done + frames > runtime->buffer_size) { in line6_capture_copy()
104 len = runtime->buffer_size - line6pcm->in.pos_done; in line6_capture_copy()
108 line6pcm->in.pos_done * bytes_per_frame, fbuf, in line6_capture_copy()
114 dev_err(line6pcm->line6->ifcdev, in line6_capture_copy()
120 line6pcm->in.pos_done * bytes_per_frame, fbuf, fsize); in line6_capture_copy()
123 line6pcm->in.pos_done += frames; in line6_capture_copy()
124 if (line6pcm->in.pos_done >= runtime->buffer_size) in line6_capture_copy()
125 line6pcm->in.pos_done -= runtime->buffer_size; in line6_capture_copy()
128 void line6_capture_check_period(struct snd_line6_pcm *line6pcm, int length) in line6_capture_check_period() argument
131 get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE); in line6_capture_check_period()
133 line6pcm->in.bytes += length; in line6_capture_check_period()
134 if (line6pcm->in.bytes >= line6pcm->in.period) { in line6_capture_check_period()
135 line6pcm->in.bytes %= line6pcm->in.period; in line6_capture_check_period()
136 spin_unlock(&line6pcm->in.lock); in line6_capture_check_period()
138 spin_lock(&line6pcm->in.lock); in line6_capture_check_period()
150 struct snd_line6_pcm *line6pcm = (struct snd_line6_pcm *)urb->context; in audio_in_callback() local
152 line6pcm->in.last_frame = urb->start_frame; in audio_in_callback()
155 for (index = 0; index < line6pcm->line6->iso_buffers; ++index) in audio_in_callback()
156 if (urb == line6pcm->in.urbs[index]) in audio_in_callback()
159 spin_lock_irqsave(&line6pcm->in.lock, flags); in audio_in_callback()
174 if (fsize > line6pcm->max_packet_size_in) { in audio_in_callback()
175 dev_err(line6pcm->line6->ifcdev, in audio_in_callback()
177 fsize, line6pcm->max_packet_size_in); in audio_in_callback()
191 line6pcm->prev_fbuf = fbuf; in audio_in_callback()
192 line6pcm->prev_fsize = fsize / in audio_in_callback()
193 (line6pcm->properties->bytes_per_channel * in audio_in_callback()
194 line6pcm->properties->capture_hw.channels_max); in audio_in_callback()
196 if (!test_bit(LINE6_STREAM_IMPULSE, &line6pcm->in.running) && in audio_in_callback()
197 test_bit(LINE6_STREAM_PCM, &line6pcm->in.running) && in audio_in_callback()
199 line6_capture_copy(line6pcm, fbuf, fsize); in audio_in_callback()
202 clear_bit(index, &line6pcm->in.active_urbs); in audio_in_callback()
204 if (test_and_clear_bit(index, &line6pcm->in.unlink_urbs)) in audio_in_callback()
208 submit_audio_in_urb(line6pcm); in audio_in_callback()
210 if (!test_bit(LINE6_STREAM_IMPULSE, &line6pcm->in.running) && in audio_in_callback()
211 test_bit(LINE6_STREAM_PCM, &line6pcm->in.running)) in audio_in_callback()
212 line6_capture_check_period(line6pcm, length); in audio_in_callback()
215 spin_unlock_irqrestore(&line6pcm->in.lock, flags); in audio_in_callback()
223 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); in snd_line6_capture_open() local
227 &line6pcm->properties->rates); in snd_line6_capture_open()
231 line6_pcm_acquire(line6pcm, LINE6_STREAM_CAPTURE_HELPER, false); in snd_line6_capture_open()
233 runtime->hw = line6pcm->properties->capture_hw; in snd_line6_capture_open()
240 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); in snd_line6_capture_close() local
242 line6_pcm_release(line6pcm, LINE6_STREAM_CAPTURE_HELPER); in snd_line6_capture_close()
257 int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm) in line6_create_audio_in_urbs() argument
259 struct usb_line6 *line6 = line6pcm->line6; in line6_create_audio_in_urbs()
262 line6pcm->in.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *), in line6_create_audio_in_urbs()
264 if (line6pcm->in.urbs == NULL) in line6_create_audio_in_urbs()
272 urb = line6pcm->in.urbs[i] = in line6_create_audio_in_urbs()