From patchwork Wed Aug 21 10:27:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11106279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2EC21813 for ; Wed, 21 Aug 2019 10:28:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA85722DD3 for ; Wed, 21 Aug 2019 10:28:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="RiivoCUL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dEvzziXb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA85722DD3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9D24286F; Wed, 21 Aug 2019 12:27:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9D24286F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566383314; bh=QWSDgO78PRJssjkE5oGZsNnhw5fNvL1ovksRf2gRHXk=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=RiivoCULsUK2mAvantuPKT4xje1DU/AFNUDYS5Rop++Opn+LSALkRADsW6bzz5Tu4 ZmkHaTjS+PgQl5j4+mbMF9Y4GEUsDu//7M3lALCBuWa6MYmvS0M30/ZDNU5bjwGW1m wgorEpyWI/51CjriViiJc0OAH381Yz/+47EDrbQ4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BB221F802FB; Wed, 21 Aug 2019 12:27:43 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id B23CFF80306; Wed, 21 Aug 2019 12:27:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 98453F80157 for ; Wed, 21 Aug 2019 12:27:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 98453F80157 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dEvzziXb" Received: by mail-wm1-x344.google.com with SMTP id f72so1535987wmf.5 for ; Wed, 21 Aug 2019 03:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DfcFoGCu+Bqv0m26SvG5wMf49FCbhYgNKFtc/Mu7ArM=; b=dEvzziXbyDYjihHBHAQ4og/g6Ul+JzM+1X3WiZ89KPRoO5AfTMcUKgbTjavvmz7+CO Mdl5Hq0ZNiWwCuznT9fT4WPGFNLthr/+bIK8/Tns7fW8NXKl0htemLGe87xYMmtp370V 08UAUrkyuCQ8MuatWKWGV89mJ+b7XPLIQUF2gLDsNlHRayxNHffm6CtrEeynf6a2/E0C 4ooE1iftKfXqUkdYU+RMGlm8/NZLU4DRnAjbhpUWrqF4NfXaGyOyYAZ13pD/xyDjKWPj EBO56Bx2nVKiVj7Vfb3d68rHOjPG/lK3IDWZS4FQeT5yiIjAJrUKBWafViFlOTIi5H8k SPkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DfcFoGCu+Bqv0m26SvG5wMf49FCbhYgNKFtc/Mu7ArM=; b=cDvJs+csTJfA7EULaETyS61ZJmiEh92TZPSJ0HCXCra38SFwRkaS+kTDbfJD846hwE JOyHmpOdrnJbtRZjOZ0NjK+j5NZ4Ys8o/tmq+OlRblHvNH9k4Uqsbfblk3QP10jN+Ty3 T6UTZujLOeUt1oNzpZL1mGHOSyp/koKtlzP5ytQ86yx8sGbmg2vHCgpRHu5pOmAAhQI8 DrbTAJg2b4SAYCt6ZMNogPpcr8xlle7G3u6JyknyMPLwBercomQw4uAApXHFP6ArpmKJ J9tYJ2PQw1CxaZLdGxWIqwg+xcCfE0UQe8Ulzj3Cb4Qsuo2JbknzzyZqUxAkW9kLGLan i6gw== X-Gm-Message-State: APjAAAX95cS+knGRM0//n5RhOOiPykqvSks95RlixGLTYQXe/2XYYuNT uo6HUHobKanWL/l0BE/sAQ5/vg== X-Google-Smtp-Source: APXvYqy4ImYkCTgqYv5UHwmc2VUZxv6qDWNrqq312b932pdxf7IsrXoWsMHBZbM4Y0whtwt6pa1bkg== X-Received: by 2002:a1c:9648:: with SMTP id y69mr4928650wmd.122.1566383257348; Wed, 21 Aug 2019 03:27:37 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p186sm3475079wme.9.2019.08.21.03.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2019 03:27:36 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, tiwai@suse.de Date: Wed, 21 Aug 2019 11:27:05 +0100 Message-Id: <20190821102705.18382-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, bgoswami@codeaurora.org, Vidyakumar Athota , plai@codeaurora.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [alsa-devel] [PATCH] ALSA: pcm: add support for 352.8KHz and 384KHz sample rate X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Vidyakumar Athota Most of the modern codecs supports 352.8KHz and 384KHz sample rates. Currently HW params fails to set 352.8Kz and 384KHz sample rate as these are not in known rates list. Add these new rates to known list to allow them. This patch also adds defines in pcm.h so that drivers can use it. Signed-off-by: Vidyakumar Athota Signed-off-by: Srinivas Kandagatla --- include/sound/pcm.h | 5 +++++ sound/core/pcm_native.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 1e9bb1c91770..bbe6eb1ff5d2 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -117,6 +117,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 */ @@ -129,6 +131,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 703857aab00f..11e653c8aa0e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2170,7 +2170,7 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params, static const 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 = {