From: Stefano Radaelli <stefano.radaelli21@gmail.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
alexander.h@variscite.com, pierluigi.p@variscite.com,
Stefano Radaelli <stefano.r@variscite.com>
Subject: Re: [PATCH v1] ASoC: simple-card-utils: set CPU sysclk before codec for mclk-fs
Date: Tue, 10 Feb 2026 10:32:44 +0100 [thread overview]
Message-ID: <aYr7PMyJ1ERcG8rp@Lord-Beerus.station> (raw)
In-Reply-To: <873439o1xt.wl-kuninori.morimoto.gx@renesas.com>
Hi Kuninori
>
> Actually, this is one of my concern (= which should be worked first
> (CPU or Codec)). I don't remember why current code calls Codec first,
> but maybe original code was.
> I guess, some other Card needs to call as-is (= Codec first), and
> you want to call opposite (= CPU first). It depends on clock
> provider/consumer settings, instead of mclk-fs, but based on each Card.
>
> Not same but similar issue we had before about how we want to call
> .trigger.
>
> 356caf663deee8dc46ff3168ec0b24bcbeb00b28
> ("ASoC: add new trigger ordering method")
>
> It was fixed order, but is now controlled by flag.
> Maybe we want to have similar method ?
>
> // unreliable name
> #define XX_CLK_START_CODEC_FIRST 0
> #define XX_CLK_START_CPU_FIRST 1
>
> if (xx_clk_start_first == XX_CLK_START_CODEC_FIRST) {
> // same as current code
> start_codec_clk()
> start_cpu_clk()
> } else {
> // opposite
> start_cpu_clk()
> start_codec_clk()
> }
>
Thank you for your suggestion. I agree that the default ordering should
remain unchanged to maintain backward compatibility, and we should
implement a configurable feature to change the order when needed.
Following your recommendation, I could implement something similar to the
trigger ordering approach:
#define SND_SOC_SYSCLK_ORDER_CODEC_FIRST 0
#define SND_SOC_SYSCLK_ORDER_CPU_FIRST 1
static int asoc_simple_init_dai(struct snd_soc_dai *dai,
struct asoc_simple_dai *simple_dai)
{
int sysclk_order = SND_SOC_SYSCLK_ORDER_CODEC_FIRST; // <- Default
if (simple_dai->sysclk) {
if (sysclk_order == SND_SOC_SYSCLK_ORDER_CODEC_FIRST) {
// Codec first
ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, ...);
ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, ...);
} else {
// CPU first
ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, ...);
ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, ...);
}
}
}
This approach would work well for our case and is acceptable as-is for now.
The ordering would be controlled via the define in the driver code.
As a future enhancement, would you be open to adding a device tree property
to make this configurable per-board?
I'll send you v2 with this modification.
Thanks a lot for your guidance,
Best Regards,
Stefano
prev parent reply other threads:[~2026-02-10 9:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 13:40 Stefano Radaelli
2026-02-10 0:51 ` Kuninori Morimoto
2026-02-10 9:32 ` Stefano Radaelli [this message]
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=aYr7PMyJ1ERcG8rp@Lord-Beerus.station \
--to=stefano.radaelli21@gmail.com \
--cc=alexander.h@variscite.com \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierluigi.p@variscite.com \
--cc=stefano.r@variscite.com \
--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
all inboxes | Powered by JetHome®