[PATCH] ASoC: stm32: sai: manage context in set_sysclk callback

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Sep 17 18:34:41 PDT 2025


Hi Olivier

Thank you for clarify the situation

> Looking at the traces (see below), initially, we had one call with the 
> 'in' direction (kernel clock frequency) and one call with the 'out' 
> direction.
(snip)
> Now, both calls have the 'out' direction when the property 
> 'system-clock-direction-out' is set. This seems more consistent with the 
> changes from commit 5725bce709db1.

Ah.. simple-card-utils calls snd_soc_dai_set_sysclk() from 3 functions

	- simple_init_dai()
	- simple_util_hw_params()
	- simple_util_shutdown()

but its "direction" is...

Step0:
	Before
	a728f56094e7cf60a1dc0642fe86901d1a4dfb4e
	 ("ASoC: make clock direction configurable in asoc-simple")

	- simple_init_dai()		fixed: 0
	- simple_util_hw_params()	fixed: SND_SOC_CLOCK_xx
	- simple_util_shutdown()	fixed: SND_SOC_CLOCK_xx

Step1:
	After
	a728f56094e7cf60a1dc0642fe86901d1a4dfb4e
	 ("ASoC: make clock direction configurable in asoc-simple")

	and before

	5725bce709db1c001140d79398581e067e28c031
	("ASoC: simple-card-utils: Unify clock direction by clk_direction")


	- simple_init_dai()		dai->clk_direction
	- simple_util_hw_params()	fixed: SND_SOC_CLOCK_xx
	- simple_util_shutdown()	fixed: SND_SOC_CLOCK_xx

Step2:
	After
	5725bce709db1c001140d79398581e067e28c031
	("ASoC: simple-card-utils: Unify clock direction by clk_direction")

	- simple_init_dai()		dai->clk_direction
	- simple_util_hw_params()	dai->clk_direction
	- simple_util_shutdown()	dai->clk_direction

In Step0 and Step1, your dirver is called with both dir IN/OUT ?

> In my setup, the kernel clock is an input clock. Maybe it should be 
> tagged as an input clock. However, we have no 
> 'system-clock-direction-in' property yet.
> Anyway, the patch in the STM32 SAI driver is still valid.

OK

Or maybe reset simple_dai->sysclk somehow (not sure...) ?
(simple_init_dai() will call snd_soc_dai_set_sysclk() if it has
simple_dai->sysclk)

Thank you for your help !!

Best regards
---
Kuninori Morimoto



More information about the linux-arm-kernel mailing list