Re: [PATCH] ASoC: cros_ec_codec: Support setting bclk ratio
From: Tzung-Bi Shih
Date: Sat Jan 25 2020 - 09:19:46 EST
On Sat, Jan 25, 2020 at 12:18 AM Yu-Hsuan Hsu <yuhsuan@xxxxxxxxxxxx> wrote:
>
> Support setting bclk ratio from machine drivers.
>
> Signed-off-by: Yu-Hsuan Hsu <yuhsuan@xxxxxxxxxxxx>
Please at least cc to <alsa-devel@xxxxxxxxxxxxxxxx> for ASoC-related patches.
> @@ -42,6 +42,8 @@ struct cros_ec_codec_priv {
> uint64_t ap_shm_addr;
> uint64_t ap_shm_last_alloc;
>
> + uint32_t i2s_rx_bclk_ratio;
> +
To be consistent, move the variable after the "DMIC" part and add a /*
I2S_RX */ comment.
> /* DMIC */
> atomic_t dmic_probed;
> if (params_rate(params) != 48000)
> @@ -284,15 +287,30 @@ static int i2s_rx_hw_params(struct snd_pcm_substream *substream,
> if (ret < 0)
> return ret;
>
> - dev_dbg(component->dev, "set bclk to %u\n",
> - snd_soc_params_to_bclk(params));
> + /* If the blck ratio is not set, get bclk from hw_params. */
A typo, s/blck/bclk/. I don't think the comment is very necessary.
The code block is obvious.
> + if (priv->i2s_rx_bclk_ratio)
> + bclk = params_rate(params) * priv->i2s_rx_bclk_ratio;
> + else
> + bclk = snd_soc_params_to_bclk(params);
> +
> + dev_dbg(component->dev, "set bclk to %u\n", bclk);