All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <m.chehab@samsung.com>
To: LMML <linux-media@vger.kernel.org>
Subject: [RFC PATCHv1] Fix audio with USB 3.0
Date: Thu, 09 Jan 2014 09:40:10 -0200	[thread overview]
Message-ID: <20140109094010.0d8559b5@samsung.com> (raw)

The PCM audio hardware is not properly described. This causes the driver
to use a period shorter than it should be, causing problems with USB 3.0.

This is a first attempt to fix it.

PS.: 

1) This patch is not to be applied. It contains an ugly debug added for
testing purposes, and uses a C99 comment;

2) em28xx can accept other sample rates. It would be good to add support
for those other rates, as some audio playback hardware may not support
48KHz (I have one such hardware here). 

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 30ee389a07f0..1de4fac3db97 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -87,6 +87,14 @@ static void em28xx_audio_isocirq(struct urb *urb)
 	struct snd_pcm_substream *substream;
 	struct snd_pcm_runtime   *runtime;
 
+size_t size = 0;
+
+if (!urb->status)
+for (i = 0; i < urb->number_of_packets; i++)
+	size =+ urb->iso_frame_desc[i].actual_length;
+
+printk("%s, status %d, %d packets (size %d)\n", __func__, urb->status, urb->number_of_packets, size);
+
 	switch (urb->status) {
 	case 0:             /* success */
 	case -ETIMEDOUT:    /* NAK */
@@ -215,14 +223,15 @@ static struct snd_pcm_hardware snd_em28xx_hw_capture = {
 
 	.formats = SNDRV_PCM_FMTBIT_S16_LE,
 
-	.rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
+//	.rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
+	.rates = SNDRV_PCM_RATE_48000,
 
 	.rate_min = 48000,
 	.rate_max = 48000,
 	.channels_min = 2,
 	.channels_max = 2,
 	.buffer_bytes_max = 62720 * 8,	/* just about the value in usbaudio.c */
-	.period_bytes_min = 64,		/* 12544/2, */
+	.period_bytes_min = 188,
 	.period_bytes_max = 12544,
 	.periods_min = 2,
 	.periods_max = 98,		/* 12544, */

                 reply	other threads:[~2014-01-09 11:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140109094010.0d8559b5@samsung.com \
    --to=m.chehab@samsung.com \
    --cc=linux-media@vger.kernel.org \
    /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.