linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: "S.j. Wang" <shengjiu.wang@nxp.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"timur@kernel.org" <timur@kernel.org>,
	"Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH V2] ASoC: fsl_esai: Support synchronous mode
Date: Wed, 3 Apr 2019 11:57:16 -0700	[thread overview]
Message-ID: <20190403185716.GA5130@Asurada-Nvidia.nvidia.com> (raw)
In-Reply-To: <dac7c52215b4bb09f3548bcb9246f8fe21799e38.1554285839.git.shengjiu.wang@nxp.com>

This looks better :)

On Wed, Apr 03, 2019 at 10:07:40AM +0000, S.j. Wang wrote:
> @@ -218,7 +218,7 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
>  {
>  	struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
>  	struct clk *clksrc = esai_priv->extalclk;
> -	bool tx = clk_id <= ESAI_HCKT_EXTAL;
> +	bool tx = (clk_id <= ESAI_HCKT_EXTAL || esai_priv->synchronous);
>  	bool in = dir == SND_SOC_CLOCK_IN;
>  	u32 ratio, ecr = 0;
>  	unsigned long clk_rate;
> @@ -253,7 +253,7 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
>  		ecr |= ESAI_ECR_ETI;
>  		/* fall through */

Btw, I am also wondering if the fall through here is a bug....
Because I don't recall that there is a specific reason to fall
through here. Can you please help confirm? Perhaps we need to
submit a separate fix as well by replacing it with a "break;".

>  	case ESAI_HCKR_EXTAL:
> -		ecr |= ESAI_ECR_ERI;
> +		ecr |= esai_priv->synchronous ? ESAI_ECR_ETI : ESAI_ECR_ERI;
>  		break;
>  	default:
>  		return -EINVAL;

> @@ -537,10 +537,18 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
>  
>  	bclk = params_rate(params) * slot_width * esai_priv->slots;
>  
> -	ret = fsl_esai_set_bclk(dai, tx, bclk);
> +	ret = fsl_esai_set_bclk(dai, esai_priv->synchronous || tx, bclk);
>  	if (ret)
>  		return ret;
>  
> +	mask = ESAI_xCR_xSWS_MASK;
> +	val = ESAI_xCR_xSWS(slot_width, width);
> +
> +	regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), mask, val);
> +	/* Recording in synchronous mode needs to set TCR also */
> +	if (!tx && esai_priv->synchronous)
> +		regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, mask, val);
> +
>  	/* Use Normal mode to support monaural audio */
>  	regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
>  			   ESAI_xCR_xMOD_MASK, params_channels(params) > 1 ?
> @@ -556,10 +564,9 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
>  
>  	regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx), mask, val);
>  
> -	mask = ESAI_xCR_xSWS_MASK | (tx ? ESAI_xCR_PADC : 0);
> -	val = ESAI_xCR_xSWS(slot_width, width) | (tx ? ESAI_xCR_PADC : 0);
> -
> -	regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), mask, val);
> +	if (tx)
> +		regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR,
> +					ESAI_xCR_PADC, ESAI_xCR_PADC);

Mind aligning the indentation here like the one below?
		regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR,
				   ESAI_xCR_PADC, ESAI_xCR_PADC);

Once you fix the indentation, add this:

Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>

Thanks

  reply	other threads:[~2019-04-03 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03 10:07 [PATCH V2] ASoC: fsl_esai: Support synchronous mode S.j. Wang
2019-04-03 18:57 ` Nicolin Chen [this message]
2019-04-04  6:29   ` S.j. Wang

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=20190403185716.GA5130@Asurada-Nvidia.nvidia.com \
    --to=nicoleotsuka@gmail.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=shengjiu.wang@nxp.com \
    --cc=timur@kernel.org \
    /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).