From patchwork Thu Jan 9 11:40:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 3459241 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D0F109F384 for ; Thu, 9 Jan 2014 11:40:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DEBE2012E for ; Thu, 9 Jan 2014 11:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA9DF20122 for ; Thu, 9 Jan 2014 11:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751445AbaAILkQ (ORCPT ); Thu, 9 Jan 2014 06:40:16 -0500 Received: from mailout1.w2.samsung.com ([211.189.100.11]:28098 "EHLO usmailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbaAILkP (ORCPT ); Thu, 9 Jan 2014 06:40:15 -0500 Received: from uscpsbgm1.samsung.com (u114.gpu85.samsung.co.kr [203.254.195.114]) by mailout1.w2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MZ400IS2TR20O10@mailout1.w2.samsung.com> for linux-media@vger.kernel.org; Thu, 09 Jan 2014 06:40:14 -0500 (EST) X-AuditID: cbfec372-b7fa96d000006a7b-bf-52ce8a9e6444 Received: from ussync3.samsung.com ( [203.254.195.83]) by uscpsbgm1.samsung.com (USCPMTA) with SMTP id DF.6A.27259.E9A8EC25; Thu, 09 Jan 2014 06:40:14 -0500 (EST) Received: from localhost.localdomain ([105.144.34.9]) by ussync3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MZ400GIXTQZ4X30@ussync3.samsung.com> for linux-media@vger.kernel.org; Thu, 09 Jan 2014 06:40:14 -0500 (EST) Date: Thu, 09 Jan 2014 09:40:10 -0200 From: Mauro Carvalho Chehab To: LMML Subject: [RFC PATCHv1] Fix audio with USB 3.0 Message-id: <20140109094010.0d8559b5@samsung.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKJMWRmVeSWpSXmKPExsVy+t/hYN15XeeCDDY+1bHo2bCV1YHR4/Mm uQDGKC6blNSczLLUIn27BK6MO6972Qre8lXsvtnI1MDYxtPFyMEhIWAi0TKbpYuRE8gUk7hw bz1bFyMXh5DAEkaJ+fs3QTmrmSQeLV/JAtLAIqAqcelgGUgDm4CRxKvGFlYQW0RATWLNokns ILawgK7Esssr2UBsXgFDiSstT5ghdjlJ7D4gBREWlPgx+R7YXmYBLYnN25pYIWx5ic1r3jJP YOSdhaRsFpKyWUjKFjAyr2IULS1OLihOSs811CtOzC0uzUvXS87P3cQICZqiHYzPNlgdYhTg YFTi4WUoOxskxJpYVlyZe4hRgoNZSYR3auO5ICHelMTKqtSi/Pii0pzU4kOMTBycUg2MOzd5 Vto/3Hjr86Y0pureDPf+O06yNS9Xhzj06HyVr7vrx11idHlhbsuc+fnXMzXNGzn2PJMtmPO3 aIVOkOiB3eZPlRrOHKqYUbamzpT75DV9s03/wrV6bFWy721fu8e7gifqrS+/463GvfPvV8dM OvzoaM0WAf1lzF1RdQqzpZnvn4pqsUxQYinOSDTUYi4qTgQA0sBFbvgBAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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, */