Re: [PATCH v2 2/2] ASoC: ti: omap-mcbsp: Implement set_tdm_slot

From: Joseph Telaak

Date: Sun Nov 29 2026 - 16:59:05 EST


Hi Jarkko,

On 11/29/26 3:04 PM, Jarkko Nikula wrote:
>> + /* Rate and sysclk the slots were configured for */
>> + unsigned int slot_rate;
>> + unsigned int slot_sysclk;
> Is there need for slot_sysclk tracking if omap_mcbsp_dai_set_dai_sysclk()
> would reject changed frequency whenever mcbsp->configured? Now it checks
> the mcbsp->active case.

Good point. I added it because set_dai_sysclk() only refuses a change
while McBSP is running, so the sysclk could still change between the two
directions' hw_params(). Refusing it while configured covers that, so v3
will return -EBUSY there and drop slot_sysclk.

>> +static unsigned int omap_mcbsp_slot_sysclk(struct omap_mcbsp *mcbsp)
>> +{
>> + if (mcbsp->sysclk_fclk && mcbsp->in_freq != clk_get_rate(mcbsp->fclk))
>> + return 0;
>> +
>> + return mcbsp->in_freq;
>> +}
> What is the case when mcbsp->in_freq != clk_get_rate(mcbsp->fclk)? Does
> it mean below omap_mcbsp_dai_set_dai_sysclk() is called with incorrect
> FCLK frequency what SoC is not using? Maybe mcbsp->in_freq !=
> clk_get_rate(mcbsp->fclk) can be validated already there and return
> with -EINVAL?

Yes, that's the case: simple-card's mclk-fs calls set_sysclk(cpu, 0,
rate * mclk-fs) in hw_params, and clk_id 0 is
OMAP_MCBSP_SYSCLK_CLKS_FCLK. McBSP has no MCLK output, so that value is
wrong for it.

v3 will check it in set_dai_sysclk() and drop sysclk_fclk, along with
omap_mcbsp_slot_sysclk(). I'll refuse it only when slots are set: as
clock consumer McBSP ignores the sysclk, and a board using mclk-fs for
its codec would otherwise start failing hw_params.

Thanks for the review,
Joseph