On 9/3/26 8:26 PM, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <[email protected]>
>
> Program the ASP RX and TX slot registers from the TDM masks passed by
> the machine driver. Each set bit in a mask names a slot; codec channels
> are assigned to those slots in order, ASPRX1 taking the first RX slot
> and ASPTX1..TX8 the first eight TX slots, with a warning if the mask
> names more slots than the device has channels.
>
> Passing slots == 0 or an empty mask restores the hardware defaults,
> ASPRX1 in slot 0 and ASPTX1..TX8 in slots 0..7.
>
> This lets a machine driver with several amplifiers on one bus, such as
> sdm845 with two CS35L36, put each amplifier on its own RX slot and keep
> their TX slots from colliding.
>
> Assisted-by: Claude:claude-4.6-opus
> Signed-off-by: David Heidelberg <[email protected]>
> ---
[...]
> +static int cs35l36_set_tdm_slot(struct snd_soc_dai *dai,
> + unsigned int tx_mask, unsigned int rx_mask,
> + int slots, int slot_width)
> +{
> + struct cs35l36_private *cs35l36 =
> + snd_soc_component_get_drvdata(dai->component);
> +
> + /* Note: rx/tx is from point of view of the CPU end */
> + if (!slots || !rx_mask)
> + rx_mask = BIT(0); /* ASPRX1 in slot 0 */
> +
> + if (!slots || !tx_mask)
> + tx_mask = GENMASK(7, 0); /* ASPTX1..8 in slots 0..7 */
> +
> + cs35l36_mask_to_slots(cs35l36, rx_mask, CS35L36_ASP_RX1_SLOT, 1);
GPT says:
Findings
1. High: patch 5 makes the TDM RX slot compete with the codec’s Input Mux
control.
cs35l36_set_tdm_slot() programs CS35L36_ASP_RX1_SLOT with a six-bit TDM slot
value in patch 5. That register’s bit 0 is already exposed as the Input Mux
DAPM control:
- sound/soc/codecs/cs35l36.c:588 defines the control from CS35L36_ASP_RX1_SLOT,
shift 0.
- sound/soc/codecs/cs35l36.c:583-586 defines its values as RX1 and RX2.
Konrad