From patchwork Tue May 10 15:11:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 9058881 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EF590BF29F for ; Tue, 10 May 2016 15:14:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B86E20165 for ; Tue, 10 May 2016 15:14:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 94FC720145 for ; Tue, 10 May 2016 15:14:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 926EB266577; Tue, 10 May 2016 17:14:08 +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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 971BF265D73; Tue, 10 May 2016 17:11:27 +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 E2E1F265D62; Tue, 10 May 2016 17:11:25 +0200 (CEST) Received: from mail1.bemta3.messagelabs.com (mail1.bemta3.messagelabs.com [195.245.230.175]) by alsa0.perex.cz (Postfix) with ESMTP id 32D6E26578F for ; Tue, 10 May 2016 17:11:10 +0200 (CEST) Received: from [85.158.137.3] by server-15.bemta-3.messagelabs.com id 87/C0-03172-C0AF1375; Tue, 10 May 2016 15:11:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRWlGSWpSXmKPExsUSt3OpsS7PL8N wgxdvWCyuXDzEZDH14RM2i29XOpgsLu+aw2bRuauf1WLD97WMDmweGz43sXnsnHWX3WPTqk42 j31vl7F5rN9ylcXj8ya5ALYo1sy8pPyKBNaM7p+fmAuWyle035NtYHwl1cXIxSEksJ5R4tK3v +xdjJxAToXEy11PwWxegUyJv+/fgdmcAu4SH/evYYGocZM4OLUJLM4mYCEx+cQDNhCbRUBV4t z2f4wgtrBAnMSto79YQBaICHQxSqx+9RisgVmgXOLspkVsEAsEJU7OfMICEZeQOPjiBTPEAgO J0wsaweISAvYS099fBYpzANn6Eo3HYiHChhLfZ32DKjGXOL9gGvsERsFZSKbOQjJ1ASPTKkb1 4tSistQiXWO9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYzA4GcAgh2MzV+cDjFKc jApifIKTjEMF+JLyk+pzEgszogvKs1JLT7EKMPBoSTBO+kHUE6wKDU9tSItMwcYhzBpCQ4eJR HeVJA0b3FBYm5xZjpE6hSjopQ47wSQhABIIqM0D64NFvuXGGWlhHkZgQ4R4ilILcrNLEGVf8U ozsGoJMx7FGQKT2ZeCdz0V0CLmYAWy7HpgywuSURISTUwzl/8rfbzU/mgrojC6F2Mjunthxjc jO6dW77fOMVgyupKs00mTy7+Zn+uvlDGR1VZWcWcc/b25pqWqHqPT/2ZeXtlZ/fHSleueqMnt NzNKOddwqW/cz67TZnwSCU24/WtPffE2RWW33y978iVtM/Fn563Ln+W5ek+5V5H5R71J2oZfZ vNuJckK7EUZyQaajEXFScCAK70XAT4AgAA X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-10.tower-38.messagelabs.com!1462893067!39061338!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20888 invoked from network); 10 May 2016 15:11:08 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-10.tower-38.messagelabs.com with AES128-SHA encrypted SMTP; 10 May 2016 15:11:08 -0000 Received: from swsrvapps-01.diasemi.com (10.20.28.141) by SW-EX-CASHUB01.diasemi.com (10.20.16.140) with Microsoft SMTP Server id 14.3.248.2; Tue, 10 May 2016 16:11:08 +0100 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22379) id 6CAE63FAFC; Tue, 10 May 2016 16:11:07 +0100 (BST) Message-ID: <99d22ab107c104cba002706c0aa88ce5c5e08ad5.1462892732.git.Adam.Thomson.Opensource@diasemi.com> In-Reply-To: References: From: Adam Thomson Date: Tue, 10 May 2016 16:11:07 +0100 To: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai MIME-Version: 1.0 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-ServerInfo: sw-ex-cashub01.diasemi.com, 9 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 10/05/2016 13:08:00 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Support Opensource Subject: [alsa-devel] [PATCH 4/5] ASoC: da7213: Update PLL ranges to improve locking at frequency boundary 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This update changes the dividers used for ranges of input MCLK frequencies, to improve PLL locking for a corner case when at edge of MCLK frequency input divider range. Signed-off-by: Adam Thomson --- sound/soc/codecs/da7213.c | 26 +++++++++++++------------- sound/soc/codecs/da7213.h | 28 ++++++++++++++-------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 657b7eb..a233fe7 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -1344,26 +1344,26 @@ static int da7213_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, /* Workout input divider based on MCLK rate */ if ((da7213->mclk_rate == 32768) && (source == DA7213_SYSCLK_PLL)) { /* 32KHz PLL Mode */ - indiv_bits = DA7213_PLL_INDIV_10_20_MHZ; - indiv = DA7213_PLL_INDIV_10_20_MHZ_VAL; + indiv_bits = DA7213_PLL_INDIV_9_TO_18_MHZ; + indiv = DA7213_PLL_INDIV_9_TO_18_MHZ_VAL; freq_ref = 3750000; pll_ctrl |= DA7213_PLL_32K_MODE; } else { /* 5 - 54MHz MCLK */ if (da7213->mclk_rate < 5000000) { goto pll_err; - } else if (da7213->mclk_rate <= 10000000) { - indiv_bits = DA7213_PLL_INDIV_5_10_MHZ; - indiv = DA7213_PLL_INDIV_5_10_MHZ_VAL; - } else if (da7213->mclk_rate <= 20000000) { - indiv_bits = DA7213_PLL_INDIV_10_20_MHZ; - indiv = DA7213_PLL_INDIV_10_20_MHZ_VAL; - } else if (da7213->mclk_rate <= 40000000) { - indiv_bits = DA7213_PLL_INDIV_20_40_MHZ; - indiv = DA7213_PLL_INDIV_20_40_MHZ_VAL; + } else if (da7213->mclk_rate <= 9000000) { + indiv_bits = DA7213_PLL_INDIV_5_TO_9_MHZ; + indiv = DA7213_PLL_INDIV_5_TO_9_MHZ_VAL; + } else if (da7213->mclk_rate <= 18000000) { + indiv_bits = DA7213_PLL_INDIV_9_TO_18_MHZ; + indiv = DA7213_PLL_INDIV_9_TO_18_MHZ_VAL; + } else if (da7213->mclk_rate <= 36000000) { + indiv_bits = DA7213_PLL_INDIV_18_TO_36_MHZ; + indiv = DA7213_PLL_INDIV_18_TO_36_MHZ_VAL; } else if (da7213->mclk_rate <= 54000000) { - indiv_bits = DA7213_PLL_INDIV_40_54_MHZ; - indiv = DA7213_PLL_INDIV_40_54_MHZ_VAL; + indiv_bits = DA7213_PLL_INDIV_36_TO_54_MHZ; + indiv = DA7213_PLL_INDIV_36_TO_54_MHZ_VAL; } else { goto pll_err; } diff --git a/sound/soc/codecs/da7213.h b/sound/soc/codecs/da7213.h index 26b87e3..fbb7a35 100644 --- a/sound/soc/codecs/da7213.h +++ b/sound/soc/codecs/da7213.h @@ -163,10 +163,10 @@ #define DA7213_VMID_EN (0x1 << 7) /* DA7213_PLL_CTRL = 0x27 */ -#define DA7213_PLL_INDIV_5_10_MHZ (0x0 << 2) -#define DA7213_PLL_INDIV_10_20_MHZ (0x1 << 2) -#define DA7213_PLL_INDIV_20_40_MHZ (0x2 << 2) -#define DA7213_PLL_INDIV_40_54_MHZ (0x3 << 2) +#define DA7213_PLL_INDIV_5_TO_9_MHZ (0x0 << 2) +#define DA7213_PLL_INDIV_9_TO_18_MHZ (0x1 << 2) +#define DA7213_PLL_INDIV_18_TO_36_MHZ (0x2 << 2) +#define DA7213_PLL_INDIV_36_TO_54_MHZ (0x3 << 2) #define DA7213_PLL_INDIV_MASK (0x3 << 2) #define DA7213_PLL_MCLK_SQR_EN (0x1 << 4) #define DA7213_PLL_32K_MODE (0x1 << 5) @@ -499,16 +499,16 @@ #define DA7213_ALC_AVG_ITERATIONS 5 /* PLL related */ -#define DA7213_SYSCLK_MCLK 0 -#define DA7213_SYSCLK_PLL 1 -#define DA7213_PLL_FREQ_OUT_90316800 90316800 -#define DA7213_PLL_FREQ_OUT_98304000 98304000 -#define DA7213_PLL_FREQ_OUT_94310400 94310400 -#define DA7213_PLL_INDIV_5_10_MHZ_VAL 2 -#define DA7213_PLL_INDIV_10_20_MHZ_VAL 4 -#define DA7213_PLL_INDIV_20_40_MHZ_VAL 8 -#define DA7213_PLL_INDIV_40_54_MHZ_VAL 16 -#define DA7213_SRM_CHECK_RETRIES 8 +#define DA7213_SYSCLK_MCLK 0 +#define DA7213_SYSCLK_PLL 1 +#define DA7213_PLL_FREQ_OUT_90316800 90316800 +#define DA7213_PLL_FREQ_OUT_98304000 98304000 +#define DA7213_PLL_FREQ_OUT_94310400 94310400 +#define DA7213_PLL_INDIV_5_TO_9_MHZ_VAL 2 +#define DA7213_PLL_INDIV_9_TO_18_MHZ_VAL 4 +#define DA7213_PLL_INDIV_18_TO_36_MHZ_VAL 8 +#define DA7213_PLL_INDIV_36_TO_54_MHZ_VAL 16 +#define DA7213_SRM_CHECK_RETRIES 8 enum da7213_clk_src { DA7213_CLKSRC_MCLK = 0,