From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D789CC4363D for ; Thu, 1 Oct 2020 02:18:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5D0912087D for ; Thu, 1 Oct 2020 02:18:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qOXcbTGP"; dkim=temperror (0-bit key) header.d=sholland.org header.i=@sholland.org header.b="qSqUd1+j"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Z0VGN5Ah" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D0912087D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iNhc2oGUUtaV0gkwogZ84cyBDIRrCr6xKUGzfqN/2ag=; b=qOXcbTGP6WF/cAT86VtwOVM+A uMj6a0Un2arm/XRssBSeW1Rrluacu7FHEftLe1eZcmLRRFqcPwPGeeP07r77CjzM0d6NkFbErgySL YWPzNJ5C8GFS157zAXec0JR5vJsg4N+shExt1IVZBIndO6lYOxRmd4tTebM41glZqtqBl2FffL6LR QUW+0tb6MpVD/ousx3xpphpS7PhCu9SOSP8fZk8vvr5b+mLNN83hRtF2SFYBz/lTz4pFu8IrQdH8M zTSrLxWfUzCaLkT09UR7QxkUeZXra1yFz6gwdMEz/lPiyQ67nglizS1GDrwS0y88t1egf/9eZLkhM RLRF8Wpfw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNo8d-0000sX-30; Thu, 01 Oct 2020 02:16:07 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNo4h-0007be-Aq for linux-arm-kernel@lists.infradead.org; Thu, 01 Oct 2020 02:12:13 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 008A2580380; Wed, 30 Sep 2020 22:11:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 30 Sep 2020 22:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=wTl9sckAKM0xv p0u0bCj2SQl0uxAhs6YnPzCMhVRDYk=; b=qSqUd1+jLlEB5/mcpESVyOgbPs2e6 RoyOcKqryG29SVIf/bwTlO7Y5H3SnLFiwjdOMf6yajhb8hvLCckvegIy1NpLSU0C 00gSIzxJy+26q9opNKjRyg3ljtXVMYcU1vBom6yPmnz8UhHQBS3BGv/Tiu4P2tdb 8R/LcOD62LUXOpSfvDXgcfdo4KihdUOQ5ecQ1A0aIl5Y1q9FGkkQy6vqOpJNp3Rt 9RKV/YUIYLd3G7V2wlRPP1N4BID1+T5E7ZH2UZQlLFqubHQcG9h8quHOhrT57SWu 0RsGbcnGh74R+QgDHPvbDVPLNk6z1WM205faFgzFqZCyl6SHzZ6qZkFPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=wTl9sckAKM0xvp0u0bCj2SQl0uxAhs6YnPzCMhVRDYk=; b=Z0VGN5Ah KMtW+XCWC6anGBx5UX/0wk5TFdKeDnn/8eCerZNmyfwFYlFzPPwCvYroBJtZ4492 JHMGpqe1YmT6pzTW4XsyA+MvQ1v1FFuPg1tunZzv3aLHir696thKwxZzca6NwXFh cVPq2igneNjGWn9uKxTZXEss1tQx+h7lKIdQQl4YaQ98cGnseCu5lAWhasQ1AECu IKIsD8b0t48dDvES1Q7B6oftHlY104PUyiRY+xoi/w8f+Fv3iqcOtGqprOofgsKj uvHbu/4btPMPn3sjkWufBbejOc0TJARXTf6XJnIE+Sx8WbqNs4/4zBWuSVuhiva5 zOVaPoRr3sDh8w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrfeefgdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheejvdfg jeehueeinecukfhppeejtddrudefhedrudegkedrudehudenucevlhhushhtvghrufhiii gvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgrnhgu rdhorhhg X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 557B83064684; Wed, 30 Sep 2020 22:11:57 -0400 (EDT) From: Samuel Holland To: Mark Brown , Liam Girdwood , Maxime Ripard , Chen-Yu Tsai , Jaroslav Kysela , Takashi Iwai Subject: [PATCH 17/25] ASoC: sun8i-codec: Enable all supported sample rates Date: Wed, 30 Sep 2020 21:11:40 -0500 Message-Id: <20201001021148.15852-18-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001021148.15852-1-samuel@sholland.org> References: <20201001021148.15852-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200930_221203_462034_87257015 X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Samuel Holland Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The system sample rate programmed into the hardware is really a clock divider from SYSCLK to the ADC and DAC. Since we support two SYSCLK frequencies, we can use all sample rates corresponding to one of those frequencies divided by any available divisor. This commit enables support for those sample rates. It also stops advertising support for a 64 kHz sample rate, which is not supported. Signed-off-by: Samuel Holland --- sound/soc/sunxi/sun8i-codec.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index f21274530a0e..f4b2a7cc9810 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -89,16 +89,23 @@ #define SUN8I_SYS_SR_CTRL_AIF1_FS_MASK GENMASK(15, 12) #define SUN8I_SYS_SR_CTRL_AIF2_FS_MASK GENMASK(11, 8) #define SUN8I_AIF1CLK_CTRL_AIF1_CLK_INV_MASK GENMASK(14, 13) #define SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV_MASK GENMASK(12, 9) #define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK GENMASK(8, 6) #define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_MASK GENMASK(5, 4) #define SUN8I_AIF1CLK_CTRL_AIF1_DATA_FMT_MASK GENMASK(3, 2) +#define SUN8I_CODEC_PCM_RATES (SNDRV_PCM_RATE_8000_48000|\ + SNDRV_PCM_RATE_88200 |\ + SNDRV_PCM_RATE_96000 |\ + SNDRV_PCM_RATE_176400 |\ + SNDRV_PCM_RATE_192000 |\ + SNDRV_PCM_RATE_KNOT) + enum { AIF1, NAIFS }; struct sun8i_codec_aif { unsigned int slots; unsigned int slot_width; @@ -142,37 +149,41 @@ static int sun8i_codec_runtime_suspend(struct device *dev) return 0; } static int sun8i_codec_get_hw_rate(struct snd_pcm_hw_params *params) { unsigned int rate = params_rate(params); switch (rate) { - case 8000: case 7350: + case 8000: return 0x0; case 11025: return 0x1; case 12000: return 0x2; + case 14700: case 16000: return 0x3; case 22050: return 0x4; case 24000: return 0x5; + case 29400: case 32000: return 0x6; case 44100: return 0x7; case 48000: return 0x8; + case 88200: case 96000: return 0x9; + case 176400: case 192000: return 0xa; default: return -EINVAL; } } static int sun8i_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) @@ -408,26 +419,26 @@ static struct snd_soc_dai_driver sun8i_codec_dais[] = { .name = "sun8i-codec-aif1", .id = AIF1, .ops = &sun8i_codec_dai_ops, /* capture capabilities */ .capture = { .stream_name = "AIF1 Capture", .channels_min = 1, .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_192000, + .rates = SUN8I_CODEC_PCM_RATES, .formats = SNDRV_PCM_FMTBIT_S16_LE, .sig_bits = 24, }, /* playback capabilities */ .playback = { .stream_name = "AIF1 Playback", .channels_min = 1, .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_192000, + .rates = SUN8I_CODEC_PCM_RATES, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .symmetric_rates = true, .symmetric_channels = true, .symmetric_samplebits = true, }, }; -- 2.26.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel