Commit b97a9369 authored by Ricard Wanderlof's avatar Ricard Wanderlof Committed by Takashi Iwai

ALSA: USB-audio: Add offset parameter to copy_to_urb()

Preparation for adding Zoom R16/24 quirk.
No functional change.
Signed-off-by: default avatarRicard Wanderlof <ricardw@axis.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 5cf310e9
...@@ -1387,8 +1387,8 @@ static inline void fill_playback_urb_dsd_dop(struct snd_usb_substream *subs, ...@@ -1387,8 +1387,8 @@ static inline void fill_playback_urb_dsd_dop(struct snd_usb_substream *subs,
subs->hwptr_done -= runtime->buffer_size * stride; subs->hwptr_done -= runtime->buffer_size * stride;
} }
static void copy_to_urb(struct snd_usb_substream *subs, static void copy_to_urb(struct snd_usb_substream *subs, struct urb *urb,
struct urb *urb, int stride, unsigned int bytes) int offset, int stride, unsigned int bytes)
{ {
struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
...@@ -1396,12 +1396,12 @@ static void copy_to_urb(struct snd_usb_substream *subs, ...@@ -1396,12 +1396,12 @@ static void copy_to_urb(struct snd_usb_substream *subs,
/* err, the transferred area goes over buffer boundary. */ /* err, the transferred area goes over buffer boundary. */
unsigned int bytes1 = unsigned int bytes1 =
runtime->buffer_size * stride - subs->hwptr_done; runtime->buffer_size * stride - subs->hwptr_done;
memcpy(urb->transfer_buffer, memcpy(urb->transfer_buffer + offset,
runtime->dma_area + subs->hwptr_done, bytes1); runtime->dma_area + subs->hwptr_done, bytes1);
memcpy(urb->transfer_buffer + bytes1, memcpy(urb->transfer_buffer + offset + bytes1,
runtime->dma_area, bytes - bytes1); runtime->dma_area, bytes - bytes1);
} else { } else {
memcpy(urb->transfer_buffer, memcpy(urb->transfer_buffer + offset,
runtime->dma_area + subs->hwptr_done, bytes); runtime->dma_area + subs->hwptr_done, bytes);
} }
subs->hwptr_done += bytes; subs->hwptr_done += bytes;
...@@ -1488,7 +1488,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, ...@@ -1488,7 +1488,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
subs->hwptr_done -= runtime->buffer_size * stride; subs->hwptr_done -= runtime->buffer_size * stride;
} else { } else {
/* usual PCM */ /* usual PCM */
copy_to_urb(subs, urb, stride, bytes); copy_to_urb(subs, urb, 0, stride, bytes);
} }
/* update delay with exact number of samples queued */ /* update delay with exact number of samples queued */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment