From patchwork Fri Feb 6 09:22:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Urs_F=C3=A4ssler?= X-Patchwork-Id: 5789081 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A555D9F30C for ; Fri, 6 Feb 2015 09:28:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C99DD2011D for ; Fri, 6 Feb 2015 09:28:33 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 845D4201CE for ; Fri, 6 Feb 2015 09:28:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BC73A2652B4; Fri, 6 Feb 2015 10:28:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id D599F265134; Fri, 6 Feb 2015 10:26:01 +0100 (CET) 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 DD8A626059B; Fri, 6 Feb 2015 10:22:31 +0100 (CET) Received: from bytesatwork.ch (bytesatwork.ch [91.135.72.15]) by alsa0.perex.cz (Postfix) with ESMTP id 9E599260570 for ; Fri, 6 Feb 2015 10:22:21 +0100 (CET) Received: from [192.168.2.20] (unknown [95.143.48.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: urs) by bytesatwork.ch (Postfix) with ESMTPSA id 2EFF718001AB; Fri, 6 Feb 2015 10:15:03 +0100 (CET) Message-ID: <54D487C1.1010901@bytesatwork.ch> Date: Fri, 06 Feb 2015 10:22:09 +0100 From: =?UTF-8?B?VXJzIEbDpHNzbGVy?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: perex@perex.cz, tiwai@suse.de References: <1423212723-15307-1-git-send-email-urs.fassler@bytesatwork.ch> In-Reply-To: <1423212723-15307-1-git-send-email-urs.fassler@bytesatwork.ch> X-Mailman-Approved-At: Fri, 06 Feb 2015 10:25:55 +0100 Cc: urs.fassler@bytesatwork.ch, alsa-devel@alsa-project.org, lgirdwood@gmail.com, jsarha@ti.com, linux-kernel@vger.kernel.org, peter.ujfalusi@ti.com, broonie@kernel.org, misael.lopez@ti.com Subject: [alsa-devel] [PATCH 2/2] davinci-mcasp: add option to use AHCLKX pin as clock in 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 Signed-off-by: Urs Fässler --- .../bindings/sound/davinci-mcasp-audio.txt | 1 + sound/soc/davinci/davinci-mcasp.c | 26 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) break; case SND_SOC_DAIFMT_CBM_CFS: /* codec is clock master and frame slave */ - mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE); + if (mcasp->ahclkx_pin) + mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, + ACLKXE); + else + mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, + ACLKXE); mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE); mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); @@ -441,7 +447,12 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, break; case SND_SOC_DAIFMT_CBM_CFM: /* codec is clock and frame master */ - mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE); + if (mcasp->ahclkx_pin) + mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, + ACLKXE); + else + mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, + ACLKXE); mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE); mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); @@ -542,7 +553,12 @@ static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); if (mcasp->bclk_master) { - mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE); + if (mcasp->ahclkx_pin) + mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, + AHCLKXE); + else + 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 { @@ -1340,6 +1356,8 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of( if (ret >= 0) pdata->sram_size_capture = val; + pdata->clk_input_pin = of_property_read_bool(np, "ahclkx-pin"); + return pdata; nodata: @@ -1412,6 +1430,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) goto err; } + mcasp->ahclkx_pin = pdata->clk_input_pin; + mcasp->op_mode = pdata->op_mode; /* sanity check for tdm slots parameter */ if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) { diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 46bc982..22a91d2 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -39,6 +39,7 @@ 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-pin : if set use AHCLKX pin for clock in instead of ACLKX Example: diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 396cdec..3730288 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -85,6 +85,7 @@ struct davinci_mcasp { int sysclk_freq; bool bclk_master; + bool ahclkx_pin; /* McASP FIFO related */ u8 txnumevt; @@ -429,7 +430,12 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,