]> www.infradead.org Git - users/hch/misc.git/commitdiff
ASoC: tas2764: Set the SDOUT polarity correctly
authorHector Martin <marcan@marcan.st>
Tue, 18 Feb 2025 08:36:02 +0000 (18:36 +1000)
committerMark Brown <broonie@kernel.org>
Tue, 18 Feb 2025 20:08:43 +0000 (20:08 +0000)
TX launch polarity needs to be the opposite of RX capture polarity, to
generate the right bit slot alignment.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Link: https://patch.msgid.link/20250218-apple-codec-changes-v2-28-932760fd7e07@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tas2764.c
sound/soc/codecs/tas2764.h

index d482cd194c08c5c443b82c665de7a6d96531ef2e..58315eab492a168c09075a5dabb15696d8b97666 100644 (file)
@@ -365,7 +365,7 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
        struct snd_soc_component *component = dai->component;
        struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
-       u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0;
+       u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0, asi_cfg_4 = 0;
        int ret;
 
        switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -374,12 +374,14 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
                fallthrough;
        case SND_SOC_DAIFMT_NB_NF:
                asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING;
+               asi_cfg_4 = TAS2764_TDM_CFG4_TX_FALLING;
                break;
        case SND_SOC_DAIFMT_IB_IF:
                asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
                fallthrough;
        case SND_SOC_DAIFMT_IB_NF:
                asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING;
+               asi_cfg_4 = TAS2764_TDM_CFG4_TX_RISING;
                break;
        }
 
@@ -389,6 +391,12 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
        if (ret < 0)
                return ret;
 
+       ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG4,
+                                           TAS2764_TDM_CFG4_TX_MASK,
+                                           asi_cfg_4);
+       if (ret < 0)
+               return ret;
+
        switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
        case SND_SOC_DAIFMT_I2S:
                asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
index d13ecae9c9c2f57853db70bb1eef2380f6fec45c..9490f2686e38919a726e649884d9b6ad761493a2 100644 (file)
 #define TAS2764_TDM_CFG3_RXS_SHIFT     0x4
 #define TAS2764_TDM_CFG3_MASK          GENMASK(3, 0)
 
+/* TDM Configuration Reg4 */
+#define TAS2764_TDM_CFG4               TAS2764_REG(0X0, 0x0d)
+#define TAS2764_TDM_CFG4_TX_MASK       BIT(0)
+#define TAS2764_TDM_CFG4_TX_RISING     0x0
+#define TAS2764_TDM_CFG4_TX_FALLING    BIT(0)
+
 /* TDM Configuration Reg5 */
 #define TAS2764_TDM_CFG5               TAS2764_REG(0X0, 0x0e)
 #define TAS2764_TDM_CFG5_VSNS_MASK     BIT(6)