[PATCH v7 3/9] ASoC: qcom: lpass-rx-macro: Add shikra compatible

From: Mohammad Rafi Shaik

Date: Sun Nov 22 2026 - 13:42:13 EST


Add Shikra RX macro compatible data and hook it into the LPASS
codec v4.0 flow.

The Shikra RX macro register layout matches the existing v2.5+
layout, so reuse the v2.5 register access helpers, controls and
widgets.

For shikra requires the FS counter to be bypassed before enabling
it during MCLK enable.

Reviewed-by: Ajay Kumar Nandam <ajay.nandam@xxxxxxxxxxxxxxxx>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@xxxxxxxxxxxxxxxx>
---
sound/soc/codecs/lpass-macro-common.h | 5 +++++
sound/soc/codecs/lpass-rx-macro.c | 15 +++++++++++++++
2 files changed, 20 insertions(+)

diff --git a/sound/soc/codecs/lpass-macro-common.h b/sound/soc/codecs/lpass-macro-common.h
index 573b2145e1c4..77933eb8c4d5 100644
--- a/sound/soc/codecs/lpass-macro-common.h
+++ b/sound/soc/codecs/lpass-macro-common.h
@@ -10,6 +10,8 @@
#define LPASS_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
/* The soundwire block should be internally reset at probe */
#define LPASS_MACRO_FLAG_RESET_SWR BIT(1)
+/* FS counter control bit[7] must be toggled*/
+#define LPASS_MACRO_FLAG_BYPASS_FS_CONTROL BIT(2)

enum lpass_version {
LPASS_VER_9_0_0,
@@ -30,6 +32,7 @@ enum lpass_codec_version {
LPASS_CODEC_VERSION_2_7,
LPASS_CODEC_VERSION_2_8,
LPASS_CODEC_VERSION_2_9,
+ LPASS_CODEC_VERSION_4_0,
};

struct lpass_macro {
@@ -70,6 +73,8 @@ static inline const char *lpass_macro_get_codec_version_string(int version)
return "v2.8";
case LPASS_CODEC_VERSION_2_9:
return "v2.9";
+ case LPASS_CODEC_VERSION_4_0:
+ return "v4.0";
default:
break;
}
diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 5253ad438188..b3adb32f7d33 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -59,6 +59,7 @@
#define CDC_RX_FS_MCLK_CNT_ENABLE BIT(0)
#define CDC_RX_FS_MCLK_CNT_CLR_MASK BIT(1)
#define CDC_RX_FS_MCLK_CNT_CLR BIT(1)
+#define CDC_RX_FS_CNT_BYPASS BIT(7)
#define CDC_RX_CLK_RST_CTRL_SWR_CONTROL (0x0108)
#define CDC_RX_SWR_CLK_EN_MASK BIT(0)
#define CDC_RX_SWR_RESET_MASK BIT(1)
@@ -651,6 +652,7 @@ struct rx_macro {
bool is_ear_mode_on;
bool hph_pwr_mode;
bool hph_hd2_mode;
+ bool fs_cnt_bypass;
struct snd_soc_component *component;
unsigned long active_ch_mask[RX_MACRO_MAX_DAIS];
unsigned long active_ch_cnt[RX_MACRO_MAX_DAIS];
@@ -1659,6 +1661,7 @@ static bool rx_is_rw_register(struct device *dev, unsigned int reg)
case LPASS_CODEC_VERSION_2_6:
case LPASS_CODEC_VERSION_2_7:
case LPASS_CODEC_VERSION_2_8:
+ case LPASS_CODEC_VERSION_4_0:
return rx_2_5_is_rw_register(dev, reg);
default:
break;
@@ -2091,6 +2094,11 @@ static int rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable)
CDC_RX_CLK_MCLK2_ENABLE);
regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
CDC_RX_FS_MCLK_CNT_CLR_MASK, 0x00);
+
+ if (rx->fs_cnt_bypass)
+ regmap_set_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
+ CDC_RX_FS_CNT_BYPASS);
+
regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
CDC_RX_FS_MCLK_CNT_EN_MASK,
CDC_RX_FS_MCLK_CNT_ENABLE);
@@ -3698,6 +3706,7 @@ static int rx_macro_component_probe(struct snd_soc_component *component)
case LPASS_CODEC_VERSION_2_6:
case LPASS_CODEC_VERSION_2_7:
case LPASS_CODEC_VERSION_2_8:
+ case LPASS_CODEC_VERSION_4_0:
controls = rx_macro_2_5_snd_controls;
num_controls = ARRAY_SIZE(rx_macro_2_5_snd_controls);
widgets = rx_macro_2_5_dapm_widgets;
@@ -3861,6 +3870,7 @@ static int rx_macro_probe(struct platform_device *pdev)
return PTR_ERR(base);

rx->codec_version = lpass_macro_get_codec_version();
+ rx->fs_cnt_bypass = !!(flags & LPASS_MACRO_FLAG_BYPASS_FS_CONTROL);
struct reg_default *reg_defaults __free(kfree) = NULL;

switch (rx->codec_version) {
@@ -3883,6 +3893,7 @@ static int rx_macro_probe(struct platform_device *pdev)
case LPASS_CODEC_VERSION_2_6:
case LPASS_CODEC_VERSION_2_7:
case LPASS_CODEC_VERSION_2_8:
+ case LPASS_CODEC_VERSION_4_0:
rx->rxn_reg_stride = 0xc0;
rx->rxn_reg_stride2 = 0x0;
def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults);
@@ -3989,6 +4000,10 @@ static const struct of_device_id rx_macro_dt_match[] = {
}, {
.compatible = "qcom,sc8280xp-lpass-rx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,shikra-lpass-rx-macro",
+ .data = (void *)(LPASS_MACRO_FLAG_HAS_NPL_CLOCK |
+ LPASS_MACRO_FLAG_BYPASS_FS_CONTROL),
},
{ }
};

--
2.34.1