All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] ASoC: simple-card-utils: support system-clock-id DT property
@ 2026-05-14 21:28 Sen Wang
  2026-05-14 22:55 ` Kuninori Morimoto
  0 siblings, 1 reply; 3+ messages in thread
From: Sen Wang @ 2026-05-14 21:28 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai
  Cc: linux-sound, linux-kernel, Sen Wang

Looking for feedbacks & on this before I draft a proper series w/
dt-binding.

The generic machine driver never had a mechanism to adjust for various
clk_ids that is tailored for individual codec & cpu peripherial driver.
simple_util_dai_init() has hardcoded 0, thus making non-default clock IDs
unreachable from DTS. Boards needing a specific clk_id have had no choice
but to write dedicated machine drivers.

This adds an optional "system-clock-id" u32 property to the cpu/codec
sub-node. When absent clk_id stays 0, preserving identical behaviour
for all existing boards.

Signed-off-by: Sen Wang <sen@ti.com>
---
 include/sound/simple_card_utils.h      | 1 +
 sound/soc/generic/simple-card-utils.c | 6 +++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index XXXXXXX..XXXXXXX 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -25,6 +25,7 @@ struct simple_util_dai {
 	const char *name;
 	unsigned int sysclk;
 	int clk_direction;
+	int clk_id;
 	int slots;
 	int slot_width;
 	unsigned int tx_slot_mask;
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index XXXXXXX..XXXXXXX 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -290,6 +290,10 @@ int simple_util_parse_clk(struct device *dev,
 	if (of_property_read_bool(node, "system-clock-direction-out"))
 		simple_dai->clk_direction = SND_SOC_CLOCK_OUT;

+	if (!of_property_read_u32(node, "system-clock-id", &val))
+		simple_dai->clk_id = val;
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(simple_util_parse_clk);
@@ -589,7 +593,7 @@ static int simple_init_dai(struct simple_util_priv *priv,

 	if (simple_dai->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk,
+		ret = snd_soc_dai_set_sysclk(dai, simple_dai->clk_id,
+					     simple_dai->sysclk,
 					     simple_dai->clk_direction);
 		if (ret && ret != -ENOTSUPP) {
 			dev_err(dai->dev, "simple-card: set_sysclk error\n");
--
2.43.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] ASoC: simple-card-utils: support system-clock-id DT property
  2026-05-14 21:28 [RFC PATCH] ASoC: simple-card-utils: support system-clock-id DT property Sen Wang
@ 2026-05-14 22:55 ` Kuninori Morimoto
  2026-05-14 23:40   ` Wang, Sen
  0 siblings, 1 reply; 3+ messages in thread
From: Kuninori Morimoto @ 2026-05-14 22:55 UTC (permalink / raw)
  To: Sen Wang
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel


Hi Sen

> Looking for feedbacks & on this before I draft a proper series w/
> dt-binding.
> 
> The generic machine driver never had a mechanism to adjust for various
> clk_ids that is tailored for individual codec & cpu peripherial driver.
> simple_util_dai_init() has hardcoded 0, thus making non-default clock IDs
> unreachable from DTS. Boards needing a specific clk_id have had no choice
> but to write dedicated machine drivers.
> 
> This adds an optional "system-clock-id" u32 property to the cpu/codec
> sub-node. When absent clk_id stays 0, preserving identical behaviour
> for all existing boards.
> 
> Signed-off-by: Sen Wang <sen@ti.com>
> ---

Looks good for me (except DT bindings)

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] ASoC: simple-card-utils: support system-clock-id DT property
  2026-05-14 22:55 ` Kuninori Morimoto
@ 2026-05-14 23:40   ` Wang, Sen
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Sen @ 2026-05-14 23:40 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel

On 5/14/2026 5:55 PM, Kuninori Morimoto wrote:
> 
> Hi Sen
> 
>> Looking for feedbacks & on this before I draft a proper series w/
>> dt-binding.
>>
>> The generic machine driver never had a mechanism to adjust for various
>> clk_ids that is tailored for individual codec & cpu peripherial driver.
>> simple_util_dai_init() has hardcoded 0, thus making non-default clock IDs
>> unreachable from DTS. Boards needing a specific clk_id have had no choice
>> but to write dedicated machine drivers.
>>
>> This adds an optional "system-clock-id" u32 property to the cpu/codec
>> sub-node. When absent clk_id stays 0, preserving identical behaviour
>> for all existing boards.
>>
>> Signed-off-by: Sen Wang <sen@ti.com>
>> ---
> 
> Looks good for me (except DT bindings)
> 
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Thank you for your help !!

Hi Morimoto-san,

Thank you for the review, will send out a V2 with dt-bindings.


Best,
Sen Wang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-14 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 21:28 [RFC PATCH] ASoC: simple-card-utils: support system-clock-id DT property Sen Wang
2026-05-14 22:55 ` Kuninori Morimoto
2026-05-14 23:40   ` Wang, Sen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.