From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Alibek Omarov <a1ba.omarov@gmail.com>
Cc: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org, linux-sound@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: rockchip: i2s-tdm: Fix trcm mode by setting clock on right mclk
Date: Wed, 5 Jun 2024 10:13:23 +0200 [thread overview]
Message-ID: <20240605101323.60d7abbc@booty> (raw)
In-Reply-To: <20240604184752.697313-1-a1ba.omarov@gmail.com>
Hello Alibek,
On Tue, 4 Jun 2024 21:47:52 +0300
Alibek Omarov <a1ba.omarov@gmail.com> wrote:
> When TRCM mode is enabled, I2S RX and TX clocks are synchronized through
> selected clock source. Without this fix BCLK and LRCK might get parented
> to an uninitialized MCLK and the DAI will receive data at wrong pace.
>
> However, unlike in original i2s-tdm driver, there is no need to manually
> synchronize mclk_rx and mclk_tx, as only one gets used anyway.
>
> Tested on a board with RK3568 SoC and Silergy SY24145S codec with enabled and
> disabled TRCM mode.
>
> Fixes: 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates")
> Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
> ---
> sound/soc/rockchip/rockchip_i2s_tdm.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
> index 9fa020ef7eab..ee517d7b5b7b 100644
> --- a/sound/soc/rockchip/rockchip_i2s_tdm.c
> +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
> @@ -655,8 +655,17 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
> int err;
>
> if (i2s_tdm->is_master_mode) {
> - struct clk *mclk = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
> - i2s_tdm->mclk_tx : i2s_tdm->mclk_rx;
> + struct clk *mclk;
> +
> + if (i2s_tdm->clk_trcm == TRCM_TX) {
> + mclk = i2s_tdm->mclk_tx;
> + } else if (i2s_tdm->clk_trcm == TRCM_RX) {
> + mclk = i2s_tdm->mclk_rx;
> + } else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> + mclk = i2s_tdm->mclk_tx;
> + } else {
> + mclk = i2s_tdm->mclk_rx;
> + }
I cannot test right now, but it definitely looks correct.
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-06-05 8:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 18:47 [PATCH] ASoC: rockchip: i2s-tdm: Fix trcm mode by setting clock on right mclk Alibek Omarov
2024-06-05 8:13 ` Luca Ceresoli [this message]
2024-06-05 8:17 ` Alibek Omarov
2024-06-05 21:05 ` Mark Brown
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=20240605101323.60d7abbc@booty \
--to=luca.ceresoli@bootlin.com \
--cc=a1ba.omarov@gmail.com \
--cc=broonie@kernel.org \
--cc=frattaroli.nicolas@gmail.com \
--cc=heiko@sntech.de \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--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