[PATCH v2 5/5] ASoC: qcom: sc8280xp: Add Nord sound card support

From: Mohammad Rafi Shaik

Date: Thu Oct 08 2026 - 07:09:36 EST


Add support for the Nord Ride and RRD sound cards by introducing the
qcom,nord-sndcard compatible and associated platform-specific data.
 
Nord uses external codecs for its playback and capture paths and requires
board-specific DAI and clock configuration. Configure the codec DAI format
for DSP_A operation and enable MI2S bit clock handling for the platform.
 
Add a platform-specific sound card initialization callback to configure
the ADAU1979 capture codec to use LRCLK as its system clock source. This
configuration is done during DAI link initialization so that the codec
clock source and associated rate constraints are established before the
capture stream is opened.

Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@xxxxxxxxxxxxxxxx>
---
sound/soc/qcom/sc8280xp.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)

diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index b5d367486..a759ae951 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -25,6 +25,10 @@
#define I2S_BIT_RATE(rate, channels, format) \
((rate) * (channels) * (format))

+#define ADAU1977_SYSCLK 0
+#define ADAU1977_SYSCLK_SRC_MCLK 0
+#define ADAU1977_SYSCLK_SRC_LRCLK 1
+
static struct snd_soc_dapm_widget sc8280xp_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
@@ -92,6 +96,7 @@ struct qcom_snd_soc_common {
bool wcd_jack;
const struct sc8280xp_dai_data *dai_data;
size_t num_dai_data;
+ int (*snd_init)(struct snd_soc_pcm_runtime *rtd);
int (*snd_prepare)(struct snd_pcm_substream *substream);
};

@@ -224,9 +229,16 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_card *card = rtd->card;
struct snd_soc_jack *dp_jack = NULL;
int dp_pcm_id = 0;
+ int ret;

dai_data = sc8280xp_get_dai_data(data->priv, cpu_dai->id);

+ if (data->priv->snd_init) {
+ ret = data->priv->snd_init(rtd);
+ if (ret)
+ return ret;
+ }
+
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
@@ -305,6 +317,35 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}

+static int nord_snd_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ int ret;
+
+ switch (cpu_dai->id) {
+ case AIF_TDM_TX_8:
+ /*
+ * adau1979 PLL clocked from LRCLK, no external MCLK. Selecting
+ * the source also installs the PLL rate constraint, which the
+ * codec applies from its startup() callback, so it has to be
+ * in place before the first stream is opened. The frequency is
+ * unused for an LRCLK-sourced PLL.
+ */
+ ret = snd_soc_component_set_sysclk(codec_dai->component,
+ ADAU1977_SYSCLK,
+ ADAU1977_SYSCLK_SRC_LRCLK,
+ 48000, SND_SOC_CLOCK_IN);
+ if (ret && ret != -ENOTSUPP)
+ return ret;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
@@ -552,6 +593,15 @@ static const struct qcom_snd_soc_common kaanapali_priv_data = {
.wcd_jack = true,
};

+static const struct qcom_snd_soc_common nord_priv_data = {
+ .driver_name = "nord",
+ .mi2s_bclk_enable = true,
+ .codec_dai_fmt = SND_SOC_DAIFMT_CBC_CFC |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_DSP_A,
+ .snd_init = nord_snd_init,
+};
+
static const struct qcom_snd_soc_common qcs9100_priv_data = {
.driver_name = "sa8775p",
.dapm_widgets = sc8280xp_dapm_widgets,
@@ -677,6 +727,7 @@ static const struct of_device_id snd_sc8280xp_dt_match[] = {
{ .compatible = "qcom,hawi-sndcard", .data = &hawi_priv_data },
{ .compatible = "qcom,kaanapali-sndcard", .data = &kaanapali_priv_data },
{ .compatible = "qcom,maili-sndcard", .data = &hawi_priv_data },
+ { .compatible = "qcom,nord-sndcard", .data = &nord_priv_data },
{ .compatible = "qcom,qcm6490-idp-sndcard", .data = &qcm6490_priv_data },
{ .compatible = "qcom,qcs615-sndcard", .data = &qcs615_priv_data },
{ .compatible = "qcom,qcs6490-rb3gen2-sndcard", .data = &qcs6490_priv_data },

--
2.34.1