LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Shengjiu Wang <shengjiu.wang@freescale.com>
Cc: pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	timur@tabi.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com,
	lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, shawnguo@kernel.org, alsa-devel@alsa-project.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH V3 2/3] ASoC: fsl_spdif: spba clk is needed by spdif device
Date: Tue, 24 Nov 2015 17:23:39 -0600	[thread overview]
Message-ID: <20151124232339.GA4565@rob-hp-laptop> (raw)
In-Reply-To: <6f03afc87c7958b975df66b163c1186be979afb6.1448348336.git.shengjiu.wang@freescale.com>

On Tue, Nov 24, 2015 at 03:03:29PM +0800, Shengjiu Wang wrote:
> SPDIF need to enable the spba clock, when sdma is using share peripheral
> script. In this case, there is two spba master port is used, if don't
> enable the clock, the spba bus will have arbitration issue, which may
> cause read/write wrong data from/to SPDIF registers.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> ---
>  Documentation/devicetree/bindings/sound/fsl,spdif.txt |  5 +++++

For the binding:

Acked-by: Rob Herring <robh@kernel.org>

>  sound/soc/fsl/fsl_spdif.c                             | 15 +++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt b/Documentation/devicetree/bindings/sound/fsl,spdif.txt
> index b5ee32e..4ca39dd 100644
> --- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt
> +++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt
> @@ -27,6 +27,11 @@ Required properties:
>  			  Transceiver Clock Diagram" of SoC reference manual.
>  			  It can also be referred to TxClk_Source bit of
>  			  register SPDIF_STC.
> +	"spba"		  The spba clock is required when SPDIF is placed as a
> +			  bus slave of the Shared Peripheral Bus and when two
> +			  or more bus masters (CPU, DMA or DSP) try to access
> +			  it. This property is optional depending on the SoC
> +			  design.
>  
>     - big-endian		: If this property is absent, the native endian mode
>  			  will be in use as default, or the big endian mode
> diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
> index 28a8823..64e2a1f 100644
> --- a/sound/soc/fsl/fsl_spdif.c
> +++ b/sound/soc/fsl/fsl_spdif.c
> @@ -88,6 +88,7 @@ struct spdif_mixer_control {
>   * @rxclk: rx clock sources for capture
>   * @coreclk: core clock for register access via DMA
>   * @sysclk: system clock for rx clock rate measurement
> + * @spbaclk: SPBA clock (optional, depending on SoC design)
>   * @dma_params_tx: DMA parameters for transmit channel
>   * @dma_params_rx: DMA parameters for receive channel
>   */
> @@ -106,6 +107,7 @@ struct fsl_spdif_priv {
>  	struct clk *rxclk;
>  	struct clk *coreclk;
>  	struct clk *sysclk;
> +	struct clk *spbaclk;
>  	struct snd_dmaengine_dai_dma_data dma_params_tx;
>  	struct snd_dmaengine_dai_dma_data dma_params_rx;
>  	/* regcache for SRPC */
> @@ -474,6 +476,12 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
>  			return ret;
>  		}
>  
> +		ret = clk_prepare_enable(spdif_priv->spbaclk);
> +		if (ret) {
> +			dev_err(&pdev->dev, "failed to enable spba clock\n");
> +			goto err_spbaclk;
> +		}
> +
>  		ret = spdif_softreset(spdif_priv);
>  		if (ret) {
>  			dev_err(&pdev->dev, "failed to soft reset\n");
> @@ -515,6 +523,8 @@ disable_txclk:
>  	for (i--; i >= 0; i--)
>  		clk_disable_unprepare(spdif_priv->txclk[i]);
>  err:
> +	clk_disable_unprepare(spdif_priv->spbaclk);
> +err_spbaclk:
>  	clk_disable_unprepare(spdif_priv->coreclk);
>  
>  	return ret;
> @@ -548,6 +558,7 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream,
>  		spdif_intr_status_clear(spdif_priv);
>  		regmap_update_bits(regmap, REG_SPDIF_SCR,
>  				SCR_LOW_POWER, SCR_LOW_POWER);
> +		clk_disable_unprepare(spdif_priv->spbaclk);
>  		clk_disable_unprepare(spdif_priv->coreclk);
>  	}
>  }
> @@ -1261,6 +1272,10 @@ static int fsl_spdif_probe(struct platform_device *pdev)
>  		return PTR_ERR(spdif_priv->coreclk);
>  	}
>  
> +	spdif_priv->spbaclk = devm_clk_get(&pdev->dev, "spba");
> +	if (IS_ERR(spdif_priv->spbaclk))
> +		dev_warn(&pdev->dev, "no spba clock in devicetree\n");
> +
>  	/* Select clock source for rx/tx clock */
>  	spdif_priv->rxclk = devm_clk_get(&pdev->dev, "rxtx1");
>  	if (IS_ERR(spdif_priv->rxclk)) {
> -- 
> 1.9.1
> 

  reply	other threads:[~2015-11-24 23:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24  7:03 [PATCH V3 0/3] add spba clock for fsl audio IP Shengjiu Wang
2015-11-24  7:03 ` [PATCH V3 1/3] ASoC: fsl_esai: spba clock is needed by esai device Shengjiu Wang
2015-11-24  8:33   ` Nicolin Chen
2015-11-24  9:02     ` Shengjiu Wang
2015-11-24 23:21   ` Rob Herring
2015-11-25  2:02     ` Shengjiu Wang
2015-11-24  7:03 ` [PATCH V3 2/3] ASoC: fsl_spdif: spba clk is needed by spdif device Shengjiu Wang
2015-11-24 23:23   ` Rob Herring [this message]
2015-11-24  7:03 ` [PATCH V3 3/3] ASoC: fsl_asrc: spba clock is needed by asrc device Shengjiu Wang
2015-11-24 23:24   ` Rob Herring

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=20151124232339.GA4565@rob-hp-laptop \
    --to=robh@kernel.org \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=shawnguo@kernel.org \
    --cc=shengjiu.wang@freescale.com \
    --cc=timur@tabi.org \
    --cc=tiwai@suse.com \
    /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