From patchwork Tue May 10 15:11:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 9058851 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 E4C7FBF29F for ; Tue, 10 May 2016 15:12:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18EDE20145 for ; Tue, 10 May 2016 15:12:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E185F200E8 for ; Tue, 10 May 2016 15:12:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 750D626619F; Tue, 10 May 2016 17:12:51 +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 8E3FC265D12; Tue, 10 May 2016 17:11: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 7E8FB265D1C; Tue, 10 May 2016 17:11:22 +0200 (CEST) Received: from mail1.bemta5.messagelabs.com (mail1.bemta5.messagelabs.com [195.245.231.137]) by alsa0.perex.cz (Postfix) with ESMTP id 50B5A2652C5 for ; Tue, 10 May 2016 17:11:07 +0200 (CEST) Received: from [85.158.139.19] by server-1.bemta-5.messagelabs.com id 00/CA-32266-B0AF1375; Tue, 10 May 2016 15:11:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRWlGSWpSXmKPExsUSt3OpsS73L8N wg9lzGC2uXDzEZDH14RM2i29XOpgsLu+aw2bRuauf1WLD97WMDmweGz43sXnsnHWX3WPTqk42 j31vl7F5rN9ylcXj8ya5ALYo1sy8pPyKBNaMc7eOshb8F6w4cmAuWwNjK38XIxeHkMB6RolN7 44xdzFyAjkVEtMWrWYEsXkFMiUmr1wBZnMKuEt83L+GBaLGTeLg1CZ2EJtNwEJi8okHbCA2i4 CqxJMZr8FqhAUiJL7c+8sOskBEoItRYvWrx2ANzALlEmc3LWKDWCAocXLmExaIuITEwRcvoI4 wkDi9oBEsLiFgLzH9/VWgOAeQrS/ReCwWImwo8X3WN6gSc4nzC6axT2AUnIVk6iwkUxcwMq1i 1ChOLSpLLdI1tNBLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAiMAAYg2MHYtN3zE KMkB5OSKK/gFMNwIb6k/JTKjMTijPii0pzU4kOMMhwcShK8u34C5QSLUtNTK9Iyc4CxCJOW4O BREuFN/QGU5i0uSMwtzkyHSJ1iVJQS5zUA6RMASWSU5sG1weL/EqOslDAvI9AhQjwFqUW5mSW o8q8YxTkYlYR5S0Cm8GTmlcBNfwW0mAlosRybPsjikkSElFQD4yyPEPE/u/hl2lZ77FZv/vGt +2jvv+XZzUJhvp8blVgrRcSNbVP0tn8LMhK+wnf296Rd8Sv2e/md4J7o635iuvKa47c2mkut0 lD3fvFBaqn7u5DWkA+P/6ZMFtl/8FtHFO+UOX0aR/e55U4QW7qFc/n22/fMmCx7Gc1/VTFI3H dZHh69IizvpxJLcUaioRZzUXEiAJyJZG/6AgAA X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-7.tower-178.messagelabs.com!1462893066!38017314!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16731 invoked from network); 10 May 2016 15:11:06 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-7.tower-178.messagelabs.com with AES128-SHA encrypted SMTP; 10 May 2016 15:11:06 -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:07 +0100 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22379) id 695A53FAFC; Tue, 10 May 2016 16:11:06 +0100 (BST) Message-ID: <167258fc9e46971ab2da1fc934e17976cc47678f.1462892732.git.Adam.Thomson.Opensource@diasemi.com> In-Reply-To: References: From: Adam Thomson Date: Tue, 10 May 2016 16:11:06 +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 3/5] ASoC: da7213: Default PC counter to free-running when DAI disabled 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 Currently PC counter is always synchronised to DAI which means that when the DAI is disabled, features such as ALC calibration cannot be executed successfully. This patch makes sure that when the DAI is disabled, PC counter is set to free-running. Signed-off-by: Adam Thomson --- sound/soc/codecs/da7213.c | 13 +++++++++++++ sound/soc/codecs/da7213.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 680d111..657b7eb 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -746,6 +746,10 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w, DA7213_DAI_CLK_EN_MASK, DA7213_DAI_CLK_EN_MASK); + /* PC synchronised to DAI */ + snd_soc_update_bits(codec, DA7213_PC_COUNT, + DA7213_PC_FREERUN_MASK, 0); + /* Slave mode, if SRM not enabled no need for status checks */ pll_ctrl = snd_soc_read(codec, DA7213_PLL_CTRL); if (!(pll_ctrl & DA7213_PLL_SRM_EN)) @@ -767,6 +771,11 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w, return 0; case SND_SOC_DAPM_POST_PMD: + /* PC free-running */ + snd_soc_update_bits(codec, DA7213_PC_COUNT, + DA7213_PC_FREERUN_MASK, + DA7213_PC_FREERUN_MASK); + /* Disable DAI clks if in master mode */ if (da7213->master) snd_soc_update_bits(codec, DA7213_DAI_CLK_MODE, @@ -1599,6 +1608,10 @@ static int da7213_probe(struct snd_soc_codec *codec) /* Default to using SRM for slave mode */ da7213->srm_en = true; + /* Default PC counter to free-running */ + snd_soc_update_bits(codec, DA7213_PC_COUNT, DA7213_PC_FREERUN_MASK, + DA7213_PC_FREERUN_MASK); + /* Enable all Gain Ramps */ snd_soc_update_bits(codec, DA7213_AUX_L_CTRL, DA7213_GAIN_RAMP_EN, DA7213_GAIN_RAMP_EN); diff --git a/sound/soc/codecs/da7213.h b/sound/soc/codecs/da7213.h index af75340..26b87e3 100644 --- a/sound/soc/codecs/da7213.h +++ b/sound/soc/codecs/da7213.h @@ -413,6 +413,9 @@ #define DA7213_DMIC_CLK_RATE_SHIFT 2 #define DA7213_DMIC_CLK_RATE_MASK (0x1 << 2) +/* DA7213_PC_COUNT = 0x94 */ +#define DA7213_PC_FREERUN_MASK (0x1 << 0) + /* DA7213_DIG_CTRL = 0x99 */ #define DA7213_DAC_L_INV_SHIFT 3 #define DA7213_DAC_R_INV_SHIFT 7