All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, clemens@ladisch.de, Daniel Mack <zonque@gmail.com>,
	demian@auraliti.com, ray@auraliti.com, andreas@akdesigninc.com
Subject: [PATCH v3 2/5] ALSA: snd-usb: use ep->stride from urb callbacks
Date: Wed, 17 Apr 2013 00:01:37 +0800	[thread overview]
Message-ID: <1366128100-9778-3-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1366128100-9778-1-git-send-email-zonque@gmail.com>

For normal PCM transfer, this change has no effect, as the endpoint's
stride is always frame_bits/8. For DSD DOP streams, however, which is
added later, the hardware stride differs from the software stride, and
the endpoint has the correct information in these cases.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 sound/usb/pcm.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 815a37d..6f85202 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1236,8 +1236,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
 			counts = snd_usb_endpoint_next_packet_size(ep);
 
 		/* set up descriptor */
-		urb->iso_frame_desc[i].offset = frames * stride;
-		urb->iso_frame_desc[i].length = counts * stride;
+		urb->iso_frame_desc[i].offset = frames * ep->stride;
+		urb->iso_frame_desc[i].length = counts * ep->stride;
 		frames += counts;
 		urb->number_of_packets++;
 		subs->transfer_done += counts;
@@ -1251,14 +1251,14 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
 					frames -= subs->transfer_done;
 					counts -= subs->transfer_done;
 					urb->iso_frame_desc[i].length =
-						counts * stride;
+						counts * ep->stride;
 					subs->transfer_done = 0;
 				}
 				i++;
 				if (i < ctx->packets) {
 					/* add a transfer delimiter */
 					urb->iso_frame_desc[i].offset =
-						frames * stride;
+						frames * ep->stride;
 					urb->iso_frame_desc[i].length = 0;
 					urb->number_of_packets++;
 				}
@@ -1269,7 +1269,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
 		    !snd_usb_endpoint_implicit_feedback_sink(subs->data_endpoint)) /* finish at the period boundary */
 			break;
 	}
-	bytes = frames * stride;
+	bytes = frames * ep->stride;
 	if (subs->hwptr_done + bytes > runtime->buffer_size * stride) {
 		/* err, the transferred area goes over buffer boundary. */
 		unsigned int bytes1 =
@@ -1310,8 +1310,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
 {
 	unsigned long flags;
 	struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
-	int stride = runtime->frame_bits >> 3;
-	int processed = urb->transfer_buffer_length / stride;
+	struct snd_usb_endpoint *ep = subs->data_endpoint;
+	int processed = urb->transfer_buffer_length / ep->stride;
 	int est_delay;
 
 	/* ignore the delay accounting when procssed=0 is given, i.e.
-- 
1.7.10.4

  parent reply	other threads:[~2013-04-16 16:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 16:01 [PATCH v3 0/5] ALSA: snd-usb: add support for DSD Daniel Mack
2013-04-16 16:01 ` [PATCH v3 1/5] ALSA: add DSD formats Daniel Mack
2013-04-16 16:01 ` Daniel Mack [this message]
2013-04-16 16:01 ` [PATCH v3 3/5] ALSA: snd-usb: add support for DSD DOP stream transport Daniel Mack
2013-04-16 16:01 ` [PATCH v3 4/5] ALSA: snd-usb: add support for bit-reversed byte formats Daniel Mack
2013-04-16 16:01 ` [PATCH v3 5/5] ALSA: snd-usb: add quirks handler for DSD streams Daniel Mack
2013-04-16 16:13 ` [PATCH v3 0/5] ALSA: snd-usb: add support for DSD Takashi Iwai
2013-04-17 10:59 ` Takashi Iwai
2013-04-17 11:03   ` Daniel Mack
2013-04-17 17:01     ` Jussi Laako
2013-04-17 17:04       ` Daniel Mack
2013-04-17 17:13         ` Jussi Laako
2013-04-18  8:05           ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366128100-9778-3-git-send-email-zonque@gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andreas@akdesigninc.com \
    --cc=clemens@ladisch.de \
    --cc=demian@auraliti.com \
    --cc=ray@auraliti.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.