From patchwork Thu Jul 3 18:15:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reimers X-Patchwork-Id: 4478971 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0221BEEAA for ; Fri, 4 Jul 2014 09:03:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 266D8203E6 for ; Fri, 4 Jul 2014 09:03:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D4A5D201DD for ; Fri, 4 Jul 2014 09:03:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C9F0F2659FB; Fri, 4 Jul 2014 11:03:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B8630265893; Fri, 4 Jul 2014 11:02:43 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B815B261A74; Thu, 3 Jul 2014 20:15:46 +0200 (CEST) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by alsa0.perex.cz (Postfix) with ESMTP id C884E261A2C for ; Thu, 3 Jul 2014 20:15:39 +0200 (CEST) Received: by mail-we0-f178.google.com with SMTP id x48so628983wes.37 for ; Thu, 03 Jul 2014 11:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=jgK0wle/uPIYt9O5M3NCNSrmiTjv1VyCTadUDCq68NE=; b=B2rOsGrlq/Jc/3RW8Yt2ZwE1jvfu7wfxSBnaCVkV/xE+A6/06BshKuxlbrU63d0a5H VhJH0ML9pte4O5lQoDIygpOpeN60IpqA0Rp7P2jZR2SEJMyR1+wuZy8JoGJ+uFMWXU9S bU99eoirXyynGziGJHE1KSIi8ws273kJKLf5G4H5YeZE/CfAZJPp11XfAosQgbcWKtCV doKY3H98PVqzIs1Gktt2p7hOK22Mxpw0mS3wKIJGEo+AuJzEYqMJcUzM5zWdj4ylvkBv oYR4hhW0Tcp+IrDLtqs6fkfD31tgmGfmXreM2BL1DPYxIqe9unjAckRCRMXugeE+4brx 3xbQ== X-Received: by 10.194.185.113 with SMTP id fb17mr4657607wjc.117.1404411339413; Thu, 03 Jul 2014 11:15:39 -0700 (PDT) Received: from studio-connect-dev.fritz.box (p54879BB6.dip0.t-ipconnect.de. [84.135.155.182]) by mx.google.com with ESMTPSA id pj4sm7368115wic.12.2014.07.03.11.15.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Jul 2014 11:15:38 -0700 (PDT) From: Sebastian Reimers X-Google-Original-From: Sebastian Reimers To: Felipe Balbi , Takashi Iwai , alsa-devel@alsa-project.org, linux-usb@vger.kernel.org, Daniel Mack Date: Thu, 3 Jul 2014 20:15:28 +0200 Message-Id: <1404411328-32566-1-git-send-email-sebastian.reimers@gmail.com> X-Mailer: git-send-email 2.0.1 X-Mailman-Approved-At: Fri, 04 Jul 2014 11:02:40 +0200 Cc: Sebastian Reimers Subject: [alsa-devel] [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The pcm playback and capture sample size format was fixed SNDRV_PCM_FMTBIT_S16_LE. This patch respects also 16, 24 and 32 bit p_ssize and c_ssize values. Signed-off-by: Sebastian Reimers --- drivers/usb/gadget/f_uac2.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c index 6261db4a..3ed89ec 100644 --- a/drivers/usb/gadget/f_uac2.c +++ b/drivers/usb/gadget/f_uac2.c @@ -348,14 +348,34 @@ static int uac2_pcm_open(struct snd_pcm_substream *substream) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { spin_lock_init(&uac2->p_prm.lock); runtime->hw.rate_min = p_srate; - runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! p_ssize ! */ + switch (p_ssize) { + case 3: + runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE; + break; + case 4: + runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE; + break; + default: + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + break; + } runtime->hw.channels_min = num_channels(p_chmask); runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize / runtime->hw.periods_min; } else { spin_lock_init(&uac2->c_prm.lock); runtime->hw.rate_min = c_srate; - runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! c_ssize ! */ + switch (c_ssize) { + case 3: + runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE; + break; + case 4: + runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE; + break; + default: + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + break; + } runtime->hw.channels_min = num_channels(c_chmask); runtime->hw.period_bytes_min = 2 * uac2->c_prm.max_psize / runtime->hw.periods_min;