From patchwork Tue Jul 26 12:05:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_M=C3=BCller-Klieser?= X-Patchwork-Id: 9248065 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 20DE360757 for ; Tue, 26 Jul 2016 12:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12208200F5 for ; Tue, 26 Jul 2016 12:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 062BB205AA; Tue, 26 Jul 2016 12:09:49 +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=ham 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 1DA51200F5 for ; Tue, 26 Jul 2016 12:09:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8161A266109; Tue, 26 Jul 2016 14:09:44 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4EB88265E18; Tue, 26 Jul 2016 14:08:09 +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 66B09265E18; Tue, 26 Jul 2016 14:08:08 +0200 (CEST) Received: from root.phytec.de (mail.tricorecenter.de [217.6.246.34]) by alsa0.perex.cz (Postfix) with ESMTP id 70A50266014 for ; Tue, 26 Jul 2016 14:05:13 +0200 (CEST) Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id 2A0D1A0058D for ; Tue, 26 Jul 2016 14:06:32 +0200 (CEST) Received: from lws-mklieser.phytec.de ([172.16.10.21]) by idefix.phytec.de (IBM Domino Release 9.0.1FP5 HF413) with ESMTP id 2016072614051257-136824 ; Tue, 26 Jul 2016 14:05:12 +0200 From: =?UTF-8?q?Stefan=20M=C3=BCller-Klieser?= To: alsa-devel@alsa-project.org Date: Tue, 26 Jul 2016 14:05:10 +0200 Message-Id: <1469534710-4006-1-git-send-email-s.mueller-klieser@phytec.de> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on Idefix/Phytec(Release 9.0.1FP5 HF413|March 21, 2016) at 26.07.2016 14:05:12, Serialize by Router on Idefix/Phytec(Release 9.0.1FP5 HF413|March 21, 2016) at 26.07.2016 14:05:12 X-TNEFEvaluated: 1 Subject: [alsa-devel] [PATCH] ASoC: davinci-mcasp: Add clocking option 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 The AHCLKX clock output of the McASP can be used as audio MCLK, even if the McASP runs in slave mode. Add a DT binding to make this option available in a simple-card setup. Signed-off-by: Stefan Müller-Klieser --- Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | 4 ++++ include/linux/platform_data/davinci_asp.h | 5 +++++ sound/soc/davinci/davinci-mcasp.c | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 46bc982..96d6244 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -39,6 +39,10 @@ Optional properties: please refer to pinctrl-bindings.txt - fck_parent : Should contain a valid clock name which will be used as parent for the McASP fck +- ahclkx-en: In case the MCASP runs in slave mode, e.g. i2s SCK and WS slave, + we can still provide the MCLK to a codec PLL using the AHCLKX + transmit clock output. This setup can be activated by using this + property. Clock master mode remains unaffected. Example: diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 85ad68f..c878836 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h @@ -44,6 +44,11 @@ struct davinci_mcasp_pdata { int clk_input_pin; /* + * Activate AHCLKX clock output in slave mode. + */ + bool ahclkx_en; + + /* * This flag works when both clock and FS are outputs for the cpu * and makes clock more accurate (FS is not symmetrical and the * clock is very fast. diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 237dc67..aba888e 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -94,6 +94,7 @@ struct davinci_mcasp { int sysclk_freq; bool bclk_master; + bool ahclkx_en; /* McASP FIFO related */ u8 txnumevt; @@ -605,6 +606,10 @@ static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE); mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE); mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX); + } else if (mcasp->ahclkx_en) { + mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE); + mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE); + mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX); } else { mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE); mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE); @@ -1610,6 +1615,8 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of( if (ret >= 0) pdata->op_mode = val; + pdata->ahclkx_en = of_property_read_bool(np, "ahclkx-en"); + ret = of_property_read_u32(np, "tdm-slots", &val); if (ret >= 0) { if (val < 2 || val > 32) { @@ -1851,6 +1858,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) mcasp->version = pdata->version; mcasp->txnumevt = pdata->txnumevt; mcasp->rxnumevt = pdata->rxnumevt; + mcasp->ahclkx_en = pdata->ahclkx_en; mcasp->dev = &pdev->dev;