Re: [PATCH RFC 5/6] ASoC: cs35l36: Implement set_tdm_slot to program RX slot register

Richard Fitzgerald <[email protected]> Thu, 30 Jul 2026 10:18:36 +0100
Newsgroups org.kernel.vger.phone-devel,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <[email protected]>
On 30/7/26 09:53, Charles Keepax wrote:
> On Wed, Jul 29, 2026 at 08:22:42PM +0200, David Heidelberg wrote:
>> On 06/07/2026 10:52, Charles Keepax wrote:
>>> On Sun, Jul 05, 2026 at 10:06:55PM +0200, David Heidelberg via B4 Relay wrote:
>>>> +	if (rx_mask)
>>>> +		regmap_update_bits(cs35l36->regmap, CS35L36_ASP_RX1_SLOT,
>>>> +				   CS35L36_ASP_RX1_SLOT_MASK,
>>>> +				   ffs(rx_mask) - 1);
>>>
>>> It is more normal for the masks to specify the slot number rather
>>> than the bit number, it would probably be nicer to stick with
>>> that convention even though it will complicate the code here a
>>> little.
>>
>> Thank you, is there one of the cs*l* series which implements in similar
>> fashion as requested?
> 
> sound/soc/codecs/arizona.c, sound/soc/codecs/cs42l43.c or
> sound/soc/codecs/cs35l56.c all implement set_tdm, those are
> probably reasonable inspiration.
> 
> Thanks,
> Charles

Worth noting that it's not mandatory to implement set_tdm_slot().
If nothing needs it this is just adding dead code.

However, cs35l56_make_tdm_config_word() is probably what you want
as a starting point. It uses the mask to indicate which TDM slots are
active and assigns those slot numbers to consecutive RX/TX channels.
But the register layout of the *X_SLOT fields is different on CS35L36,
so the code will need some adjustment.