Skip to content

Commit

Permalink
ALSA: USB-audio: Also move out hwptr_done wrap from prepare_playback_…
Browse files Browse the repository at this point in the history
…urb()

Refactoring in preparation for adding Zoom R16/24 quirk.
No functional change.

Signed-off-by: Ricard Wanderlof <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
Ricard Wanderlof authored and tiwai committed Oct 19, 2015
1 parent 07a40c2 commit 4c4e439
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sound/usb/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,8 @@ static inline void fill_playback_urb_dsd_dop(struct snd_usb_substream *subs,
subs->hwptr_done++;
}
}
if (subs->hwptr_done >= runtime->buffer_size * stride)
subs->hwptr_done -= runtime->buffer_size * stride;
}

static void copy_to_urb(struct snd_usb_substream *subs,
Expand All @@ -1403,6 +1405,8 @@ static void copy_to_urb(struct snd_usb_substream *subs,
runtime->dma_area + subs->hwptr_done, bytes);
}
subs->hwptr_done += bytes;
if (subs->hwptr_done >= runtime->buffer_size * stride)
subs->hwptr_done -= runtime->buffer_size * stride;
}

static void prepare_playback_urb(struct snd_usb_substream *subs,
Expand Down Expand Up @@ -1480,14 +1484,13 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
}

subs->hwptr_done += bytes;
if (subs->hwptr_done >= runtime->buffer_size * stride)
subs->hwptr_done -= runtime->buffer_size * stride;
} else {
/* usual PCM */
copy_to_urb(subs, urb, stride, bytes);
}

if (subs->hwptr_done >= runtime->buffer_size * stride)
subs->hwptr_done -= runtime->buffer_size * stride;

/* update delay with exact number of samples queued */
runtime->delay = subs->last_delay;
runtime->delay += frames;
Expand Down

0 comments on commit 4c4e439

Please sign in to comment.