Lines Matching refs:line6pcm
25 static int submit_audio_in_urb(struct snd_line6_pcm *line6pcm) in submit_audio_in_urb() argument
33 find_first_zero_bit(&line6pcm->in.active_urbs, LINE6_ISO_BUFFERS); in submit_audio_in_urb()
36 dev_err(line6pcm->line6->ifcdev, "no free URB found\n"); in submit_audio_in_urb()
40 urb_in = line6pcm->in.urbs[index]; in submit_audio_in_urb()
47 fin->length = line6pcm->max_packet_size; in submit_audio_in_urb()
48 urb_size += line6pcm->max_packet_size; in submit_audio_in_urb()
52 line6pcm->in.buffer + in submit_audio_in_urb()
53 index * LINE6_ISO_PACKETS * line6pcm->max_packet_size; in submit_audio_in_urb()
55 urb_in->context = line6pcm; in submit_audio_in_urb()
60 set_bit(index, &line6pcm->in.active_urbs); in submit_audio_in_urb()
62 dev_err(line6pcm->line6->ifcdev, in submit_audio_in_urb()
72 int line6_submit_audio_in_all_urbs(struct snd_line6_pcm *line6pcm) in line6_submit_audio_in_all_urbs() argument
77 ret = submit_audio_in_urb(line6pcm); in line6_submit_audio_in_all_urbs()
88 void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf, int fsize) in line6_capture_copy() argument
91 get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE); in line6_capture_copy()
93 const int bytes_per_frame = line6pcm->properties->bytes_per_frame; in line6_capture_copy()
99 if (line6pcm->in.pos_done + frames > runtime->buffer_size) { in line6_capture_copy()
106 len = runtime->buffer_size - line6pcm->in.pos_done; in line6_capture_copy()
110 line6pcm->in.pos_done * bytes_per_frame, fbuf, in line6_capture_copy()
116 dev_err(line6pcm->line6->ifcdev, in line6_capture_copy()
122 line6pcm->in.pos_done * bytes_per_frame, fbuf, fsize); in line6_capture_copy()
125 line6pcm->in.pos_done += frames; in line6_capture_copy()
126 if (line6pcm->in.pos_done >= runtime->buffer_size) in line6_capture_copy()
127 line6pcm->in.pos_done -= runtime->buffer_size; in line6_capture_copy()
130 void line6_capture_check_period(struct snd_line6_pcm *line6pcm, int length) in line6_capture_check_period() argument
133 get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE); in line6_capture_check_period()
135 line6pcm->in.bytes += length; in line6_capture_check_period()
136 if (line6pcm->in.bytes >= line6pcm->in.period) { in line6_capture_check_period()
137 line6pcm->in.bytes %= line6pcm->in.period; in line6_capture_check_period()
138 spin_unlock(&line6pcm->in.lock); in line6_capture_check_period()
140 spin_lock(&line6pcm->in.lock); in line6_capture_check_period()
152 struct snd_line6_pcm *line6pcm = (struct snd_line6_pcm *)urb->context; in audio_in_callback() local
154 line6pcm->in.last_frame = urb->start_frame; in audio_in_callback()
158 if (urb == line6pcm->in.urbs[index]) in audio_in_callback()
161 spin_lock_irqsave(&line6pcm->in.lock, flags); in audio_in_callback()
176 if (fsize > line6pcm->max_packet_size) { in audio_in_callback()
177 dev_err(line6pcm->line6->ifcdev, in audio_in_callback()
179 fsize, line6pcm->max_packet_size); in audio_in_callback()
185 line6pcm->prev_fbuf = fbuf; in audio_in_callback()
186 line6pcm->prev_fsize = fsize; in audio_in_callback()
188 if (!test_bit(LINE6_STREAM_IMPULSE, &line6pcm->in.running) && in audio_in_callback()
189 test_bit(LINE6_STREAM_PCM, &line6pcm->in.running) && in audio_in_callback()
191 line6_capture_copy(line6pcm, fbuf, fsize); in audio_in_callback()
194 clear_bit(index, &line6pcm->in.active_urbs); in audio_in_callback()
196 if (test_and_clear_bit(index, &line6pcm->in.unlink_urbs)) in audio_in_callback()
200 submit_audio_in_urb(line6pcm); in audio_in_callback()
202 if (!test_bit(LINE6_STREAM_IMPULSE, &line6pcm->in.running) && in audio_in_callback()
203 test_bit(LINE6_STREAM_PCM, &line6pcm->in.running)) in audio_in_callback()
204 line6_capture_check_period(line6pcm, length); in audio_in_callback()
207 spin_unlock_irqrestore(&line6pcm->in.lock, flags); in audio_in_callback()
215 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); in snd_line6_capture_open() local
219 &line6pcm->properties->rates); in snd_line6_capture_open()
223 runtime->hw = line6pcm->properties->capture_hw; in snd_line6_capture_open()
245 int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm) in line6_create_audio_in_urbs() argument
247 struct usb_line6 *line6 = line6pcm->line6; in line6_create_audio_in_urbs()
255 urb = line6pcm->in.urbs[i] = in line6_create_audio_in_urbs()