Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Zachary Huang <zuzhenhuang365@gmail.com>
To: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org,
	Mario Limonciello <mario.limonciello@amd.com>,
	Vijendar Mukunda <Vijendar.Mukunda@amd.com>,
	zhangyi@everest-semi.com
Subject: [PATCH] ASoC: es9356: add missing DAI rates and formats
Date: Thu, 08 Oct 2026 17:03:19 +0800	[thread overview]
Message-ID: <179145019931.16888.9682263186729943710@gmail.com> (raw)

The ES9356 DAI definitions only describe the channel count. Since
snd_soc_runtime_calc_hw() derives hw->rates and hw->formats by intersecting
the capabilities of the CPU and codec DAIs, an empty mask on the codec side
leaves the whole PCM with no usable configuration, and soc_hw_sanity_check()
fails every open with -EINVAL:

    ASoC error (-22): es9356-sdp-aif1 <-> SDW0 Pin0 No matching rates

es9356_sdw_pcm_hw_params() already programs 16 kHz, 44.1 kHz, 48 kHz and
96 kHz, so advertise that set, plus the formats used by the other SDCA codecs.
Verified on a MECHREVO WUJIE 14SAH (AMD ACP6.3, ES9356 on SoundWire link 0):
with this change the PCMs open and speaker playback, headset playback,
internal DMIC capture and headset mic capture all work.

Link: https://lore.kernel.org/linux-sound/20261007193038.2473068-1-mario.limonciello@amd.com/
Link: https://bugzilla.kernel.org/show_bug.cgi?id=222092
Assisted-by: LLM
Signed-off-by: Zachary Huang <zuzhenhuang365@gmail.com>
---

Zachary writes:

This is the separate ES9356 codec change that Mario mentioned in the machine
entry patch linked above. Both changes are needed for audio on this board;
with both applied the internal speakers, the internal DMIC, the 3.5 mm jack
and desktop playback (PipeWire) all work.

Tested on: MECHREVO WUJIE 14SAH, AMD Ryzen 7 H 255, ACP6.3 (rev 63),
ES9356 as sdw:0:0:04b3:9356:01 on link 0, kernel 7.2.9 + the machine entry
patch above (localversion -es9356test). The corresponding alsa-ucm-conf
change (no ES9356 UCM profile exists yet, so PipeWire only exposes the jack
PCM) will be sent separately.

 sound/soc/codecs/es9356.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/sound/soc/codecs/es9356.c b/sound/soc/codecs/es9356.c
index 80db0f2..b8b3ffc 100644
--- a/sound/soc/codecs/es9356.c
+++ b/sound/soc/codecs/es9356.c
@@ -26,6 +26,20 @@
 #include <sound/sdca_asoc.h>
 #include "es9356.h"
 
+/*
+ * The DAI stream capabilities were never filled in. snd_soc_runtime_calc_hw()
+ * intersects the capabilities of the CPU and codec DAIs to derive hw->rates
+ * and hw->formats, so an empty mask on the codec side leaves the PCM with no
+ * usable configuration and soc_hw_sanity_check() fails every open with -EINVAL
+ * ("No matching rates"). es9356_sdw_pcm_hw_params() already programs 16 kHz,
+ * 44.1 kHz, 48 kHz and 96 kHz, so advertise exactly that set, with the formats
+ * used by the other SDCA codecs in the tree.
+ */
+#define ES9356_RATES (SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_44100 | \
+		      SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
+#define ES9356_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
+			SNDRV_PCM_FMTBIT_S32_LE)
+
 struct  es9356_sdw_priv {
 	struct sdw_slave *slave;
 	struct device *dev;
@@ -617,6 +631,8 @@ static struct snd_soc_dai_driver es9356_sdw_dai[] = {
 		.id = ES9356_DMIC,
 		.capture = {
 			.stream_name = "DP1 Capture",
+			.rates = ES9356_RATES,
+			.formats = ES9356_FORMATS,
 			.channels_min = 1,
 			.channels_max = 2,
 		},
@@ -627,6 +643,8 @@ static struct snd_soc_dai_driver es9356_sdw_dai[] = {
 		.id = ES9356_JACK_IN,
 		.capture = {
 			.stream_name = "DP2 Capture",
+			.rates = ES9356_RATES,
+			.formats = ES9356_FORMATS,
 			.channels_min = 1,
 			.channels_max = 2,
 		},
@@ -637,6 +655,8 @@ static struct snd_soc_dai_driver es9356_sdw_dai[] = {
 		.id = ES9356_AMP,
 		.playback = {
 			.stream_name = "DP3 Playback",
+			.rates = ES9356_RATES,
+			.formats = ES9356_FORMATS,
 			.channels_min = 1,
 			.channels_max = 2,
 		},
@@ -647,6 +667,8 @@ static struct snd_soc_dai_driver es9356_sdw_dai[] = {
 		.id = ES9356_JACK_OUT,
 		.playback = {
 			.stream_name = "DP4 Playback",
+			.rates = ES9356_RATES,
+			.formats = ES9356_FORMATS,
 			.channels_min = 1,
 			.channels_max = 2,
 		},
-- 
2.53.0




                 reply	other threads:[~2026-10-08  9:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=179145019931.16888.9682263186729943710@gmail.com \
    --to=zuzhenhuang365@gmail.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=zhangyi@everest-semi.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