From: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
To: Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
David Rhodes <david.rhodes@cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
David Rhodes <drhodes@opensource.cirrus.com>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com,
devicetree@vger.kernel.org, phone-devel@vger.kernel.org,
David Heidelberg <david@ixit.cz>
Subject: [PATCH RFC v2 1/6] ASoC: qcom: sdm845: Demystify TDM masks a bit
Date: Thu, 03 Sep 2026 20:26:37 +0200 [thread overview]
Message-ID: <20260903-pixel3-audio-v2-1-7c22ed915291@ixit.cz> (raw)
In-Reply-To: <20260903-pixel3-audio-v2-0-7c22ed915291@ixit.cz>
From: David Heidelberg <david@ixit.cz>
Describe the mask with the bits used for each RX/TX.
Signed-off-by: David Heidelberg <david@ixit.cz>
---
sound/soc/qcom/sdm845.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index 6843ab8ba017e..0ce8265ab1c1f 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -18,19 +18,24 @@
#include "sdw.h"
#include "../codecs/rt5663.h"
#define DRIVER_NAME "sdm845"
#define DEFAULT_SAMPLE_RATE_48K 48000
#define DEFAULT_MCLK_RATE 24576000
#define TDM_BCLK_RATE 6144000
#define MI2S_BCLK_RATE 1536000
-#define LEFT_SPK_TDM_TX_MASK 0x30
-#define RIGHT_SPK_TDM_TX_MASK 0xC0
-#define SPK_TDM_RX_MASK 0x03
+#define LEFT_SPK_TDM_RX_MASK BIT(0)
+#define RIGHT_SPK_TDM_RX_MASK BIT(1)
+#define SPK_TDM_RX_MASK (LEFT_SPK_TDM_RX_MASK | RIGHT_SPK_TDM_RX_MASK)
+#define MIC1_TDM_RX_MASK BIT(2)
+#define MIC2_TDM_RX_MASK BIT(3)
+#define MIC_TDM_RX_MASK (MIC1_TDM_RX_MASK | MIC2_TDM_RX_MASK)
+#define LEFT_SPK_TDM_TX_MASK (BIT(4) | BIT(5))
+#define RIGHT_SPK_TDM_TX_MASK (BIT(6) | BIT(7))
#define NUM_TDM_SLOTS 8
#define SLIM_MAX_TX_PORTS 16
#define SLIM_MAX_RX_PORTS 13
#define WCD934X_DEFAULT_MCLK_RATE 9600000
struct sdm845_snd_data {
struct snd_soc_jack jack;
bool jack_setup;
@@ -107,34 +112,36 @@ static int sdm845_tdm_snd_hw_params(struct snd_pcm_substream *substream,
default:
dev_err(rtd->dev, "%s: invalid param format 0x%x\n",
__func__, params_format(params));
return -EINVAL;
}
channels = params_channels(params);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, 0x3,
- 8, slot_width);
+ ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, SPK_TDM_RX_MASK,
+ NUM_TDM_SLOTS, slot_width);
if (ret < 0) {
dev_err(rtd->dev, "%s: failed to set tdm slot, err:%d\n",
__func__, ret);
goto end;
}
ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
channels, tdm_slot_offset);
if (ret < 0) {
dev_err(rtd->dev, "%s: failed to set channel map, err:%d\n",
__func__, ret);
goto end;
}
} else {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xf, 0,
- 8, slot_width);
+ ret = snd_soc_dai_set_tdm_slot(cpu_dai,
+ SPK_TDM_RX_MASK |
+ MIC_TDM_RX_MASK, 0,
+ NUM_TDM_SLOTS, slot_width);
if (ret < 0) {
dev_err(rtd->dev, "%s: failed to set tdm slot, err:%d\n",
__func__, ret);
goto end;
}
ret = snd_soc_dai_set_channel_map(cpu_dai, channels,
tdm_slot_offset, 0, NULL);
--
2.55.0
next prev parent reply other threads:[~2026-09-03 18:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 18:26 [PATCH RFC v2 0/6] Speakers for Pixel 3 / 3 XL David Heidelberg via B4 Relay
2026-09-03 18:26 ` David Heidelberg via B4 Relay [this message]
2026-09-03 18:26 ` [PATCH RFC v2 2/6] ASoC: qcom: sdm845: use DSP_A format for TDM codec DAIs David Heidelberg via B4 Relay
2026-09-03 18:26 ` [PATCH RFC v2 3/6] ASoC: qcom: sdm845: Use per-speaker RX masks for TDM slot assignment David Heidelberg via B4 Relay
2026-09-03 18:26 ` [PATCH RFC v2 4/6] ASoC: qcom: sdm845: Set codec dai and component sysclk during startup David Heidelberg via B4 Relay
2026-09-03 18:26 ` [PATCH RFC v2 5/6] ASoC: cs35l36: Implement set_tdm_slot to program RX and TX slots David Heidelberg via B4 Relay
2026-09-04 8:22 ` Konrad Dybcio
2026-09-04 9:26 ` Charles Keepax
2026-09-04 9:23 ` Charles Keepax
2026-09-03 18:26 ` [PATCH RFC v2 6/6] arm64: dts: qcom: sdm845-google: Add basic audio support David Heidelberg via B4 Relay
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=20260903-pixel3-audio-v2-1-7c22ed915291@ixit.cz \
--to=devnull+david.ixit.cz@kernel.org \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david.rhodes@cirrus.com \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--cc=drhodes@opensource.cirrus.com \
--cc=konradybcio@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=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=phone-devel@vger.kernel.org \
--cc=rf@opensource.cirrus.com \
--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®