mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
To: Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Subject: [PATCH v4 2/5] ASoC: qcom: sc8280xp: add backend handling for Shikra sound cards
Date: Tue, 01 Dec 2026 03:00:35 +0530	[thread overview]
Message-ID: <20261201-shikra-machine-v4-2-5c7261806dae@oss.qualcomm.com> (raw)
In-Reply-To: <20261201-shikra-machine-v4-0-5c7261806dae@oss.qualcomm.com>

From: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>

The Shikra sound cards reuse the sc8280xp machine driver, but their
audio links still need three pieces of backend handling that the
driver does not provide. Add them now that the generic QAIF DAI ID
support is upstream.

Shikra routes its VA macro capture path through VA_CODEC_DMA_TX_1, so
handle that DAI like the other codec DMA DAIs: treat it as a
SoundWire-style DAI, lower the backend channel minimum to one channel,
and allow a WCD jack to be registered on it.

Shikra CQM drives its QAIF TDM speaker backend with DSP_A framing,
while the other links on this driver use the default I2S framing. Add
a cpu_dai_fmt field to the per-DAI board data and, when it is set,
program it instead of the hardcoded SND_SOC_DAIFMT_BP_FP. This lets a
board override the CPU DAI format for a single DAI without changing
the default for every other DAI or board.

Boards that do not route audio through the DSP describe plain
CPU <-> codec links with no platform node. Such links are neither
dynamic nor no_pcm, so they were skipped by sc8280xp_add_be_ops() and
were left without the ops that configure the codec DAI. Attach the ops
to non-dynamic links as well. link->dynamic has to be the test here
because qcom_snd_parse_of() attaches snd_soc_dummy_dlc to DPCM
frontends, which leaves num_codecs non-zero for them too, so the codec
count cannot distinguish a frontend from a plain codec link.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
 sound/soc/qcom/common.c   |  1 +
 sound/soc/qcom/sc8280xp.c | 24 +++++++++++++++++++++---
 sound/soc/qcom/sdw.c      |  1 +
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index af5cacddf67d..77845d43c219 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -426,6 +426,7 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
 	case TX_CODEC_DMA_TX_1:
 	case TX_CODEC_DMA_TX_2:
 	case TX_CODEC_DMA_TX_3:
+	case VA_CODEC_DMA_TX_1:
 		for_each_rtd_codec_dais(rtd, i, codec_dai) {
 			rval = snd_soc_component_set_jack(codec_dai->component,
 							  jack, NULL);
diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index ac4dfb2c2182..889543daadf3 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -71,6 +71,7 @@ enum sc8280xp_jack_setup {
 struct sc8280xp_dai_data {
 	unsigned int id;
 	unsigned int mclk_rate;
+	unsigned int cpu_dai_fmt;
 	bool codec_sysclk_set;
 	bool mi2s_mclk_enable;
 	bool mi2s_bclk_enable;
@@ -159,6 +160,7 @@ static int sc8280xp_tdm_hw_params(struct snd_pcm_substream *substream,
 	struct qcom_snd_tdm_slot_cfg codec_cfg;
 	bool codec_sysclk_set = data->priv->codec_sysclk_set;
 	bool mi2s_bclk_enable = data->priv->mi2s_bclk_enable;
+	unsigned int cpu_dai_fmt = SND_SOC_DAIFMT_BP_FP;
 	int bclk_freq;
 	int ret;
 	int i;
@@ -167,6 +169,8 @@ static int sc8280xp_tdm_hw_params(struct snd_pcm_substream *substream,
 	if (dai_data) {
 		codec_sysclk_set = dai_data->codec_sysclk_set;
 		mi2s_bclk_enable = dai_data->mi2s_bclk_enable;
+		if (dai_data->cpu_dai_fmt)
+			cpu_dai_fmt = dai_data->cpu_dai_fmt;
 	}
 
 	ret = qcom_snd_get_dai_tdm_slots(rtd, &cpu_cfg, &codec_cfg);
@@ -176,7 +180,7 @@ static int sc8280xp_tdm_hw_params(struct snd_pcm_substream *substream,
 	if (!cpu_cfg.slots)
 		return 0;
 
-	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
+	ret = snd_soc_dai_set_fmt(cpu_dai, cpu_dai_fmt);
 	if (ret && ret != -ENOTSUPP)
 		return ret;
 
@@ -329,6 +333,7 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	case TX_CODEC_DMA_TX_1:
 	case TX_CODEC_DMA_TX_2:
 	case TX_CODEC_DMA_TX_3:
+	case VA_CODEC_DMA_TX_1:
 		channels->min = 1;
 		break;
 	case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX:
@@ -388,6 +393,7 @@ static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
 	bool codec_sysclk_set = data->priv->codec_sysclk_set;
 	bool mi2s_mclk_enable = data->priv->mi2s_mclk_enable;
 	bool mi2s_bclk_enable = data->priv->mi2s_bclk_enable;
+	unsigned int cpu_dai_fmt = SND_SOC_DAIFMT_BP_FP;
 	int mclk_freq;
 	int bclk_freq = sc8280xp_get_bclk_freq(params);
 	int ret;
@@ -398,6 +404,8 @@ static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
 		codec_sysclk_set = dai_data->codec_sysclk_set;
 		mi2s_mclk_enable = dai_data->mi2s_mclk_enable;
 		mi2s_bclk_enable = dai_data->mi2s_bclk_enable;
+		if (dai_data->cpu_dai_fmt)
+			cpu_dai_fmt = dai_data->cpu_dai_fmt;
 		if (dai_data->mclk_rate)
 			mclk_freq = dai_data->mclk_rate;
 	}
@@ -408,7 +416,7 @@ static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
 	case SENARY_MI2S_RX ... SENARY_MI2S_TX:
 	case LPI_MI2S_RX_0 ... LPI_MI2S_TX_4:
 	case AIF_MI2S_RX_0 ... AIF_MI2S_TX_12:
-		ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
+		ret = snd_soc_dai_set_fmt(cpu_dai, cpu_dai_fmt);
 		if (ret && ret != -ENOTSUPP)
 			return ret;
 
@@ -544,7 +552,17 @@ static void sc8280xp_add_be_ops(struct snd_soc_card *card)
 	int i;
 
 	for_each_card_prelinks(card, i, link) {
-		if (link->no_pcm == 1) {
+		/*
+		 * Attach the ops to DPCM backends and to plain CPU <-> codec
+		 * links, which boards that do not route audio through the DSP
+		 * describe without a platform node. Both have a real codec DAI
+		 * to configure.
+		 *
+		 * DPCM frontends must be skipped: qcom_snd_parse_of() marks
+		 * them dynamic and attaches snd_soc_dummy_dlc to them, so
+		 * num_codecs is never zero and cannot tell them apart.
+		 */
+		if (link->no_pcm == 1 || !link->dynamic) {
 			link->init = sc8280xp_snd_init;
 			link->exit = sc8280xp_snd_exit;
 			link->be_hw_params_fixup = sc8280xp_be_hw_params_fixup;
diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c
index 6576b47a4c8c..e19adb7c750b 100644
--- a/sound/soc/qcom/sdw.c
+++ b/sound/soc/qcom/sdw.c
@@ -30,6 +30,7 @@ static bool qcom_snd_is_sdw_dai(int id)
 	case TX_CODEC_DMA_TX_5:
 	case RX_CODEC_DMA_RX_6:
 	case RX_CODEC_DMA_RX_7:
+	case VA_CODEC_DMA_TX_1:
 	case SLIMBUS_0_RX...SLIMBUS_6_TX:
 		return true;
 	default:

-- 
2.34.1


  parent reply	other threads:[~2026-11-30 21:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 21:30 [PATCH v4 0/5] ASoC: qcom: Shikra machine driver and DT binding support Mohammad Rafi Shaik
2026-11-30 21:30 ` [PATCH v4 1/5] ASoC: dt-bindings: qcom,sm8250: add Shikra sound card compatibles Mohammad Rafi Shaik
2026-11-30 21:30 ` Mohammad Rafi Shaik [this message]
2026-11-30 21:30 ` [PATCH v4 3/5] ASoC: qcom: sc8280xp: Add shikra-cqm-evk compatible support Mohammad Rafi Shaik
2026-11-30 21:30 ` [PATCH v4 4/5] ASoC: qcom: sc8280xp: Add shikra-cqs-evk " Mohammad Rafi Shaik
2026-11-30 21:30 ` [PATCH v4 5/5] ASoC: qcom: sc8280xp: Add shikra-iqs-evk " Mohammad Rafi Shaik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201-shikra-machine-v4-2-5c7261806dae@oss.qualcomm.com \
    --to=mohammad.rafi.shaik@oss.qualcomm.com \
    --cc=ajay.nandam@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®