From patchwork Thu Aug 4 14:35:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 9264649 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 B13A960754 for ; Fri, 5 Aug 2016 00:30:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F1BE27FAC for ; Fri, 5 Aug 2016 00:30:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91114283E4; Fri, 5 Aug 2016 00:30:20 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=unavailable 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 CAFD627FAC for ; Fri, 5 Aug 2016 00:30:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CEF0E267078; Fri, 5 Aug 2016 02:30:18 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BD558267193; Fri, 5 Aug 2016 01:21:08 +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 9292F266BAB; Fri, 5 Aug 2016 01:21:03 +0200 (CEST) Received: from mail1.bemta5.messagelabs.com (mail1.bemta5.messagelabs.com [195.245.231.151]) by alsa0.perex.cz (Postfix) with ESMTP id C2AAB266AC7 for ; Thu, 4 Aug 2016 16:35:42 +0200 (CEST) Received: from [85.158.139.19] by server-15.bemta-5.messagelabs.com id 1E/C0-12460-EB253A75; Thu, 04 Aug 2016 14:35:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRWlGSWpSXmKPExsUSt3Opse6+oMX hBt9PClhcuXiIyWLqwydsFt+udDBZXN41h82ic1c/q8WG72sZHdg8NnxuYvPYOesuu8emVZ1s HvveLmPzWL/lKovH501yAWxRrJl5SfkVCawZU7c+YSk4JVDxZuE+xgbGe7xdjFwcQgLrGCVmN 7WydDFyAjkVEr/mXWICsXkFMiWenJjCCGJzCrhLvDuxjRGixk1ixtw9YPVsAhYSk088YAOxWQ RUJBrPvwCrERZwlDjx5BMTyAIRgS5GidWvHrODJJgFyiW2fJrIDLFAUOLkzCcsEHEJiYMvXjB DLDCQOL2gESwuIWAvMf39VaA4B5CtL9F4LBYibCjxfdY3FoiwucSLacYTGAVnIRk6C8nQBYxM qxg1ilOLylKLdI1M9ZKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAsO/noGBcQfjr na/Q4ySHExKorwzAhaHC/El5adUZiQWZ8QXleakFh9ilOHgUJLgNQ8EygkWpaanVqRl5gAjES YtwcGjJMIbCJLmLS5IzC3OTIdInWJUlBLn1QRJCIAkMkrz4Npg0X+JUVZKmJeRgYFBiKcgtSg 3swRV/hWjOAejkjBvCsgUnsy8Erjpr4AWMwEtPmGwAGRxSSJCSqqBsUJFRF3Hv5ij45m79mWJ hVN3KU+e272uNSg9tOdjatj+hC+K2h/YWWyn/fMpnnZtV4n8sqVirwpqIrSvdu4t/amYuD1l7 jMxzQ1y+x6227X4zY/MnLl63vNoRtsrzDmlj+u7ow9t9jIwfz6vrkhU8v0SIcnFlecs4z+0Vf M+P3PgXs59Z+utSizFGYmGWsxFxYkA1bv+SfkCAAA= X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-9.tower-178.messagelabs.com!1470321342!52501082!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31799 invoked from network); 4 Aug 2016 14:35:42 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-9.tower-178.messagelabs.com with AES128-SHA encrypted SMTP; 4 Aug 2016 14:35:42 -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; Thu, 4 Aug 2016 15:35:41 +0100 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22379) id 772E93FB84; Thu, 4 Aug 2016 15:35:41 +0100 (BST) Message-ID: <497bb3724104ba16dc3588287f6071f0b7cce09e.1470318378.git.Adam.Thomson.Opensource@diasemi.com> In-Reply-To: References: From: Adam Thomson Date: Thu, 4 Aug 2016 15:35:41 +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: 04/08/2016 12:49:00 Cc: alsa-devel@alsa-project.org, Support Opensource , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 4/4] ASoC: da7213: Improve 32KHz mode PLL locking 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 To aid PLL in locking on to a 32KHz MCLK, some register mods are made during PLL configuration, and when enabling the DAI, to achieve the full range of sample rates. Signed-off-by: Adam Thomson --- sound/soc/codecs/da7213.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) -- 1.9.3 diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 79b8324..095fe40 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -750,11 +750,18 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, DA7213_PC_COUNT, DA7213_PC_FREERUN_MASK, 0); - /* Slave mode, if SRM not enabled no need for status checks */ + /* If SRM not enabled then nothing more to do */ pll_ctrl = snd_soc_read(codec, DA7213_PLL_CTRL); if (!(pll_ctrl & DA7213_PLL_SRM_EN)) return 0; + /* Assist 32KHz mode PLL lock */ + if (pll_ctrl & DA7213_PLL_32K_MODE) { + snd_soc_write(codec, 0xF0, 0x8B); + snd_soc_write(codec, 0xF2, 0x03); + snd_soc_write(codec, 0xF0, 0x00); + } + /* Check SRM has locked */ do { pll_status = snd_soc_read(codec, DA7213_PLL_STATUS); @@ -771,6 +778,14 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w, return 0; case SND_SOC_DAPM_POST_PMD: + /* Revert 32KHz PLL lock udpates if applied previously */ + pll_ctrl = snd_soc_read(codec, DA7213_PLL_CTRL); + if (pll_ctrl & DA7213_PLL_32K_MODE) { + snd_soc_write(codec, 0xF0, 0x8B); + snd_soc_write(codec, 0xF2, 0x01); + snd_soc_write(codec, 0xF0, 0x00); + } + /* PC free-running */ snd_soc_update_bits(codec, DA7213_PC_COUNT, DA7213_PC_FREERUN_MASK, @@ -1428,6 +1443,14 @@ static int da7213_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, DA7213_PLL_INDIV_MASK | DA7213_PLL_MODE_MASK, pll_ctrl); + /* Assist 32KHz mode PLL lock */ + if (source == DA7213_SYSCLK_PLL_32KHZ) { + snd_soc_write(codec, 0xF0, 0x8B); + snd_soc_write(codec, 0xF1, 0x03); + snd_soc_write(codec, 0xF1, 0x01); + snd_soc_write(codec, 0xF0, 0x00); + } + return 0; }