ALSA: line6: Enable different number of URBs for frame transfers

This basically changes LINE6_ISO_BUFFERS constant to a configurable
iso_buffers property.

Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Andrej Krutak
2016-09-18 20:59:21 +02:00
committed by Takashi Iwai
parent c5a905d312
commit b2233d97a0
6 changed files with 41 additions and 21 deletions

View File

@@ -154,10 +154,10 @@ static int submit_audio_out_urb(struct snd_line6_pcm *line6pcm)
(USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL);
struct urb *urb_out;
index =
find_first_zero_bit(&line6pcm->out.active_urbs, LINE6_ISO_BUFFERS);
index = find_first_zero_bit(&line6pcm->out.active_urbs,
line6pcm->line6->iso_buffers);
if (index < 0 || index >= LINE6_ISO_BUFFERS) {
if (index < 0 || index >= line6pcm->line6->iso_buffers) {
dev_err(line6pcm->line6->ifcdev, "no free URB found\n");
return -EINVAL;
}
@@ -286,7 +286,7 @@ int line6_submit_audio_out_all_urbs(struct snd_line6_pcm *line6pcm)
{
int ret = 0, i;
for (i = 0; i < LINE6_ISO_BUFFERS; ++i) {
for (i = 0; i < line6pcm->line6->iso_buffers; ++i) {
ret = submit_audio_out_urb(line6pcm);
if (ret < 0)
break;
@@ -313,11 +313,11 @@ static void audio_out_callback(struct urb *urb)
line6pcm->out.last_frame = urb->start_frame;
/* find index of URB */
for (index = 0; index < LINE6_ISO_BUFFERS; index++)
for (index = 0; index < line6pcm->line6->iso_buffers; index++)
if (urb == line6pcm->out.urbs[index])
break;
if (index >= LINE6_ISO_BUFFERS)
if (index >= line6pcm->line6->iso_buffers)
return; /* URB has been unlinked asynchronously */
for (i = 0; i < LINE6_ISO_PACKETS; i++)
@@ -401,8 +401,13 @@ int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
struct usb_line6 *line6 = line6pcm->line6;
int i;
line6pcm->out.urbs = kzalloc(
sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL);
if (line6pcm->out.urbs == NULL)
return -ENOMEM;
/* create audio URBs and fill in constant values: */
for (i = 0; i < LINE6_ISO_BUFFERS; ++i) {
for (i = 0; i < line6->iso_buffers; ++i) {
struct urb *urb;
/* URB for audio out: */