From patchwork Sun Jun 5 14:35:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DigitalDreamtime X-Patchwork-Id: 9160203 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 03F4B60572 for ; Tue, 7 Jun 2016 09:40:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E76DF2656B for ; Tue, 7 Jun 2016 09:40:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC3AE281D2; Tue, 7 Jun 2016 09:40:40 +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 925882656B for ; Tue, 7 Jun 2016 09:40:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3501A2665B9; Tue, 7 Jun 2016 11:40:31 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 31AEA26523B; Tue, 7 Jun 2016 11:39:23 +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 92A3C26517C; Sun, 5 Jun 2016 16:35:23 +0200 (CEST) Received: from mail.dreamtime.org (barcelona.digitaldreamtime.co.uk [85.158.46.130]) by alsa0.perex.cz (Postfix) with ESMTP id 750692605B8 for ; Sun, 5 Jun 2016 16:35:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dreamtime.org; s=dt20140624; h=Message-Id:Date:Subject:Cc:To:From; bh=p1pfXCR2F4LjU0grTwKrsLpI9Dydv6XPDvfhaS7cEo4=; b=uoNiVeKjHjwDNTAp5BlJV7yjRC5IabLqnMyHgnHbdd/7tb0LV/eT975UOzb2kFwkUlXXk5jswBS3xlmph/NoQNsM94NNFo4sVP6nuf9+2btYKRv7Sjj+/KuV5D3pMq4ishU4UMmx9gQGAwaQ+75HmL9Il4PC1J9WisY7eH1uK079iU9cxFrpvZ5JxwxveUhkEqq0Wr3M0cmXIfb34FkJO2h/da8c1HW/1e7bJyW9xRNh4aV3ga51TBsvoHlxxSYXu5qxpmv3YmIGW9dR3S4Mijaoy/w1R876wtl+FEsJ6Dn5WYmFbpSagAyL7c4qBlteb//G4r3ruhstv5XQK9iOoQ==; 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 1b9Z90-0000K8-Ha; Sun, 05 Jun 2016 14:35:14 +0000 From: DigitalDreamtime To: alsa-devel@alsa-project.org Date: Sun, 5 Jun 2016 15:35:01 +0100 Message-Id: <1465137301-21042-1-git-send-email-clive.messer@digitaldreamtime.co.uk> X-Mailer: git-send-email 2.5.5 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 X-Mailman-Approved-At: Tue, 07 Jun 2016 11:39:21 +0200 Cc: DigitalDreamtime 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: DigitalDreamtime Acked-by: Charles Keepax --- 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),