From patchwork Mon Jun 6 17:16:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DigitalDreamtime X-Patchwork-Id: 9158919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51B3360572 for ; Mon, 6 Jun 2016 17:16:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41E1828335 for ; Mon, 6 Jun 2016 17:16:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36EE42834F; Mon, 6 Jun 2016 17:16:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 829A728335 for ; Mon, 6 Jun 2016 17:16:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D8DC7265B51; Mon, 6 Jun 2016 19:16:44 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C3E552659B2; Mon, 6 Jun 2016 19:16:35 +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 225DE2659FB; Mon, 6 Jun 2016 19:16:35 +0200 (CEST) Received: from mail.dreamtime.org (barcelona.digitaldreamtime.co.uk [85.158.46.130]) by alsa0.perex.cz (Postfix) with ESMTP id 799D02658E5 for ; Mon, 6 Jun 2016 19:16:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dreamtime.org; s=dt20140624; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=e/DUqHdWgIQCt+gFyXfqafA6b8zo6Wo2r53zio6wW9A=; b=dRKI6l8Nv6zCQfxmcfL1hU3CLua7jW5KUY5d3ht6l2mqCXkHLPLxqGAegNhq7roC0qThhxvGrafc7nojh92LBqEc10Ci/rsROuFFkINBjjodYf+5o9Hk3H9RQiCuHB4woGQszggjxGWV3iWuNkh6BIFcIAkTqXwk9Diww0ALcpkTIYgHv8pR+PSRPhpsaObb/EldFWT267zfKFHPJMHtc+wV0aedOoJZjAsvUvzQPpj9I3BB6j2GGe3YI9oARqhrjYKbNttsR9XGP9hlbmodrqSTHF480ELFI9ng9sHkobX4BHv8AfWq0pa2C/KaAHq3F1Vc6c3s8N/CpJHnPGrg6Q==; Received: from host-92-17-228-213.as13285.net ([92.17.228.213] helo=e5530.vacuumtube.org.uk) by mail.dreamtime.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1b9y8b-00007q-6M; Mon, 06 Jun 2016 17:16:29 +0000 From: Clive Messer To: alsa-devel@alsa-project.org Date: Mon, 6 Jun 2016 18:16:17 +0100 Message-Id: <1465233377-28037-1-git-send-email-clive.messer@digitaldreamtime.co.uk> X-Mailer: git-send-email 2.5.5 In-Reply-To: References: X-SA-Exim-Connect-IP: 92.17.228.213 X-SA-Exim-Mail-From: clive.messer@digitaldreamtime.co.uk X-SA-Exim-Scanned: No (on mail.dreamtime.org); SAEximRunCond expanded to false Cc: Clive Messer Subject: [alsa-devel] [PATCH] ALSA: Add rate defines for 352k8 and 384k 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 Add SNDRV_PCM_RATE_352800 and SNDRV_PCM_RATE_384000 defines to pcm.h, for 352k8 and 384k sample rates. Add SNDRV_PCM_RATE_8000_384000 define to pcm.h. Update rates list in pcm_native.c. Yes, we can use CONTINUOUS/KNOT and constraints, to support the x8 sample rates, but having the defines requires less code in drivers. Many more DAC chips are now supporting the x8 44k1/48k multiples. From a high-res viewpoint, the DXD standard is 352k8, 24 bit. That alone should justify the addition of a define for it. Signed-off-by: Clive Messer --- include/sound/pcm.h | 5 +++++ sound/core/pcm_native.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index af1fb37..86e0bbe 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -129,6 +129,8 @@ struct snd_pcm_ops { #define SNDRV_PCM_RATE_96000 (1<<10) /* 96000Hz */ #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */ #define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */ +#define SNDRV_PCM_RATE_352800 (1<<13) /* 352800Hz */ +#define SNDRV_PCM_RATE_384000 (1<<14) /* 384000Hz */ #define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */ #define SNDRV_PCM_RATE_KNOT (1<<31) /* supports more non-continuos rates */ @@ -141,6 +143,9 @@ struct snd_pcm_ops { SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ SNDRV_PCM_RATE_192000) +#define SNDRV_PCM_RATE_8000_384000 (SNDRV_PCM_RATE_8000_192000 |\ + SNDRV_PCM_RATE_352800 |\ + SNDRV_PCM_RATE_384000) #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt) #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8) #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index c61fd50..21cc13d 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1981,12 +1981,13 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params, return snd_interval_refine(hw_param_interval(params, rule->var), &t); } -#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12 +#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_384000 != 1 << 14 #error "Change this table" #endif static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, - 48000, 64000, 88200, 96000, 176400, 192000 }; + 48000, 64000, 88200, 96000, 176400, 192000, + 352800, 384000 }; const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = { .count = ARRAY_SIZE(rates),