From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: linux-sound@vger.kernel.org,
pierre-louis.bossart@linux.intel.com,
kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com,
seppo.ingalsuo@linux.intel.com, yung-chuan.liao@linux.intel.com
Subject: [PATCH 6.10 1/5] ASoC: SOF: ipc4-topology: Add support for NHLT with 16-bit only DMIC blob
Date: Thu, 30 May 2024 14:19:14 +0300 [thread overview]
Message-ID: <20240530111918.21974-2-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20240530111918.21974-1-peter.ujfalusi@linux.intel.com>
The ACPI NHLT table always had 32-bit DMIC blob even if 16-bit was also
present and taken as a 'rule' which obviously got broken and there is at
least one device on the market which ships with only 16-bit DMIC
configuration blob.
This corner case has never been supported and it is going to need topology
updates for DMIC copier to support multiple formats.
As for the kernel side: if the copier supports multiple formats and the
preferred 32-bit DMIC blob is not found then we will try to get a 16-bit
DMIC configuration and look for a 16-bit copier config.
Fixes: f9209644ae76 ("ASoC: SOF: ipc4-topology: Correct DAI copier config and NHLT blob request")
Link: https://github.com/thesofproject/linux/issues/4973
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
sound/soc/sof/ipc4-topology.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 33e8c5f7d9ca..d653e39ee3ac 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1491,6 +1491,8 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
dir, dev_type);
if (!cfg) {
+ bool get_new_blob = false;
+
if (format_change) {
/*
* The 32-bit blob was not found in NHLT table, try to
@@ -1498,7 +1500,20 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
*/
bit_depth = params_width(params);
format_change = false;
+ get_new_blob = true;
+ } else if (linktype == SOF_DAI_INTEL_DMIC && !single_format) {
+ /*
+ * The requested 32-bit blob (no format change for the
+ * blob request) was not found in NHLT table, try to
+ * look for 16-bit blob if the copier supports multiple
+ * formats
+ */
+ bit_depth = 16;
+ format_change = true;
+ get_new_blob = true;
+ }
+ if (get_new_blob) {
cfg = intel_nhlt_get_endpoint_blob(sdev->dev, ipc4_data->nhlt,
dai_index, nhlt_type,
bit_depth, bit_depth,
@@ -1521,8 +1536,8 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
if (format_change) {
/*
- * Update the params to reflect that we have loaded 32-bit blob
- * instead of the 16-bit.
+ * Update the params to reflect that different blob was loaded
+ * instead of the requested bit depth (16 -> 32 or 32 -> 16).
* This information is going to be used by the caller to find
* matching copier format on the dai side.
*/
@@ -1530,7 +1545,11 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
snd_mask_none(m);
- snd_mask_set_format(m, SNDRV_PCM_FORMAT_S32_LE);
+ if (bit_depth == 16)
+ snd_mask_set_format(m, SNDRV_PCM_FORMAT_S16_LE);
+ else
+ snd_mask_set_format(m, SNDRV_PCM_FORMAT_S32_LE);
+
}
return 0;
--
2.45.1
next prev parent reply other threads:[~2024-05-30 11:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 11:19 [PATCH 6.10 0/5] ASoC: SOF: ipc4-topology: Fix nhlt configuration blob selection Peter Ujfalusi
2024-05-30 11:19 ` Peter Ujfalusi [this message]
2024-05-30 11:19 ` [PATCH 6.10 2/5] ASoC: SOF: ipc4-topology: Print out the channel count in sof_ipc4_dbg_audio_format Peter Ujfalusi
2024-05-30 11:19 ` [PATCH 6.10 3/5] ASoC: SOF: ipc4-topology/pcm: Rename sof_ipc4_copier_is_single_format() Peter Ujfalusi
2024-05-30 11:19 ` [PATCH 6.10 4/5] ASoC: SOF: ipc4-topology: Improve readability of sof_ipc4_prepare_dai_copier() Peter Ujfalusi
2024-05-30 11:19 ` [PATCH 6.10 5/5] ASoC: SOF: ipc4-topology: Adjust the params based on DAI formats Peter Ujfalusi
2024-05-30 15:21 ` [PATCH 6.10 0/5] ASoC: SOF: ipc4-topology: Fix nhlt configuration blob selection Mark Brown
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=20240530111918.21974-2-peter.ujfalusi@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=seppo.ingalsuo@linux.intel.com \
--cc=yung-chuan.liao@linux.intel.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