linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Urs Fässler" <urs.fassler@bytesatwork.ch>
To: perex@perex.cz, tiwai@suse.de
Cc: urs.fassler@bytesatwork.ch, lgirdwood@gmail.com,
	broonie@kernel.org, peter.ujfalusi@ti.com, jsarha@ti.com,
	misael.lopez@ti.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] davinci-mcasp: add option to use AHCLKX pin as clock in
Date: Fri, 06 Feb 2015 10:22:09 +0100	[thread overview]
Message-ID: <54D487C1.1010901@bytesatwork.ch> (raw)
In-Reply-To: <1423212723-15307-1-git-send-email-urs.fassler@bytesatwork.ch>

[-- Attachment #1: Type: text/plain, Size: 3399 bytes --]

Signed-off-by: Urs Fässler <urs.fassler@bytesatwork.ch>
---
 .../bindings/sound/davinci-mcasp-audio.txt         |  1 +
 sound/soc/davinci/davinci-mcasp.c                  | 26
+++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

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,
 		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) {
-- 
2.1.4



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-02-06  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1423212723-15307-1-git-send-email-urs.fassler@bytesatwork.ch>
2015-02-06  9:22 ` [PATCH 1/2] davinci-mcasp: use bclk_master flag to decide if the SOC is clock master Urs Fässler
2015-02-06  9:22 ` Urs Fässler [this message]
2015-02-06 11:49   ` [PATCH 2/2] davinci-mcasp: add option to use AHCLKX pin as clock in Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D487C1.1010901@bytesatwork.ch \
    --to=urs.fassler@bytesatwork.ch \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=misael.lopez@ti.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).