lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a4950a0d-32a2-4cdd-8c8a-8f451181b0d6@foss.st.com>
Date: Wed, 24 Sep 2025 11:48:58 +0200
From: Olivier MOYSAN <olivier.moysan@...s.st.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
CC: Arnaud Pouliquen <arnaud.pouliquen@...s.st.com>,
        Liam Girdwood
	<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela
	<perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
        Maxime Coquelin
	<mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        <linux-sound@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ASoC: stm32: sai: manage context in set_sysclk callback

Hi Kuninori,

On 9/18/25 03:34, Kuninori Morimoto wrote:
> 
> 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 ?
> 

Yes, based on the trace, this appears to be the case.

>> 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)
> 

Yes, resetting simple_dai->sysclk may also be an option, but I could not 
find a way to do it in practice. Requesting a reset of 
simple_dai->sysclk from the CPU DAI .probe callback might be the right 
time I think, but there is no service that allows this.
Another way would be to set "system-clock-frequency = <0>" in the CPU DT 
node. However, this is not possible, as it conflicts with the following 
check in the simple_set_clk_rate() function:
if (simple_dai->clk_fixed && rate != simple_dai->sysclk) {
    dev_err(...)
}

So, the current patch still seems like the better option to me.

Best regards
Olivier

> Thank you for your help !!
> 
> Best regards
> ---
> Kuninori Morimoto

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ