Lines Matching defs:line6pcm
19 must be called in line6pcm->in.lock context
21 static int submit_audio_in_urb(struct snd_line6_pcm *line6pcm)
28 index = find_first_zero_bit(&line6pcm->in.active_urbs,
29 line6pcm->line6->iso_buffers);
31 if (index < 0 || index >= line6pcm->line6->iso_buffers) {
32 dev_err(line6pcm->line6->ifcdev, "no free URB found\n");
36 urb_in = line6pcm->in.urbs[index];
43 fin->length = line6pcm->max_packet_size_in;
44 urb_size += line6pcm->max_packet_size_in;
48 line6pcm->in.buffer +
49 index * LINE6_ISO_PACKETS * line6pcm->max_packet_size_in;
51 urb_in->context = line6pcm;
56 set_bit(index, &line6pcm->in.active_urbs);
58 dev_err(line6pcm->line6->ifcdev,
66 must be called in line6pcm->in.lock context
68 int line6_submit_audio_in_all_urbs(struct snd_line6_pcm *line6pcm)
72 for (i = 0; i < line6pcm->line6->iso_buffers; ++i) {
73 ret = submit_audio_in_urb(line6pcm);
84 void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf, int fsize)
87 get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE);
90 line6pcm->properties->bytes_per_channel *
91 line6pcm->properties->capture_hw.channels_max;
97 if (line6pcm->in.pos_done + frames > runtime->buffer_size) {
104 len = runtime->buffer_size - line6pcm->in.pos_done;
108 line6pcm->in.pos_done * bytes_per_frame, fbuf,
114 dev_err(line6pcm->line6->ifcdev,
120 line6pcm->in.pos_done * bytes_per_frame, fbuf, fsize);
123 line6pcm->in.pos_done += frames;
124 if (line6pcm->in.pos_done >= runtime->buffer_size)
125 line6pcm->in.pos_done -= runtime->buffer_size;
128 void line6_capture_check_period(struct snd_line6_pcm *line6pcm, int length)
131 get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE);
133 line6pcm->in.bytes += length;
134 if (line6pcm->in.bytes >= line6pcm->in.period) {
135 line6pcm->in.bytes %= line6pcm->in.period;
136 spin_unlock(&line6pcm->in.lock);
138 spin_lock(&line6pcm->in.lock);
148 struct snd_line6_pcm *line6pcm = (struct snd_line6_pcm *)urb->context;
150 line6pcm->in.last_frame = urb->start_frame;
153 for (index = 0; index < line6pcm->line6->iso_buffers; ++index)
154 if (urb == line6pcm->in.urbs[index])
157 guard(spinlock_irqsave)(&line6pcm->in.lock);
172 if (fsize > line6pcm->max_packet_size_in) {
173 dev_err(line6pcm->line6->ifcdev,
175 fsize, line6pcm->max_packet_size_in);
189 line6pcm->prev_fbuf = fbuf;
190 line6pcm->prev_fsize = fsize /
191 (line6pcm->properties->bytes_per_channel *
192 line6pcm->properties->capture_hw.channels_max);
194 if (!test_bit(LINE6_STREAM_IMPULSE, &line6pcm->in.running) &&
195 test_bit(LINE6_STREAM_PCM, &line6pcm->in.running) &&
197 line6_capture_copy(line6pcm, fbuf, fsize);
200 clear_bit(index, &line6pcm->in.active_urbs);
202 if (test_and_clear_bit(index, &line6pcm->in.unlink_urbs))
206 submit_audio_in_urb(line6pcm);
208 if (!test_bit(LINE6_STREAM_IMPULSE, &line6pcm->in.running) &&
209 test_bit(LINE6_STREAM_PCM, &line6pcm->in.running))
210 line6_capture_check_period(line6pcm, length);
219 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
223 &line6pcm->properties->rates);
227 line6_pcm_acquire(line6pcm, LINE6_STREAM_CAPTURE_HELPER, false);
229 runtime->hw = line6pcm->properties->capture_hw;
236 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
238 line6_pcm_release(line6pcm, LINE6_STREAM_CAPTURE_HELPER);
253 int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
255 struct usb_line6 *line6 = line6pcm->line6;
258 line6pcm->in.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
260 if (line6pcm->in.urbs == NULL)
268 urb = line6pcm->in.urbs[i] =