From: David Heidelberg <[email protected]>

Program ASP_RX1_SLOT with the first set bit of rx_mask so the
amplifier listens on the correct TDM slot when configured by
machine drivers.

Assisted-by: Claude:claude-4.6-opus
Signed-off-by: David Heidelberg <[email protected]>
---
 sound/soc/codecs/cs35l36.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c
index 89645327945f1..944f4cb5763e4 100644
--- a/sound/soc/codecs/cs35l36.c
+++ b/sound/soc/codecs/cs35l36.c
@@ -942,20 +942,36 @@ static const struct cs35l36_pll_config 
*cs35l36_get_clk_config(
        for (i = 0; i < ARRAY_SIZE(cs35l36_pll_sysclk); i++) {
                if (cs35l36_pll_sysclk[i].freq == freq)
                        return &cs35l36_pll_sysclk[i];
        }
 
        return NULL;
 }
 
+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);
+
+       if (rx_mask)
+               regmap_update_bits(cs35l36->regmap, CS35L36_ASP_RX1_SLOT,
+                                  CS35L36_ASP_RX1_SLOT_MASK,
+                                  ffs(rx_mask) - 1);
+
+       return 0;
+}
+
 static const struct snd_soc_dai_ops cs35l36_ops = {
        .set_fmt = cs35l36_set_dai_fmt,
        .hw_params = cs35l36_pcm_hw_params,
        .set_sysclk = cs35l36_dai_set_sysclk,
+       .set_tdm_slot = cs35l36_set_tdm_slot,
 };
 
 #define CS35L36_RATES (                    \
        SNDRV_PCM_RATE_8000_48000 | \
        SNDRV_PCM_RATE_12000 |      \
        SNDRV_PCM_RATE_24000 |      \
        SNDRV_PCM_RATE_88200 |      \
        SNDRV_PCM_RATE_96000 |      \

-- 
2.53.0



Reply via email to