Skip to content

Commit 49cb894

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: ipc4-topology: Add support for NHLT with 16-bit only DMIC blob
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: f920964 ("ASoC: SOF: ipc4-topology: Correct DAI copier config and NHLT blob request") Link: thesofproject/linux#4973 Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Seppo Ingalsuo <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1613e60 commit 49cb894

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,14 +1483,29 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
14831483
dir, dev_type);
14841484

14851485
if (!cfg) {
1486+
bool get_new_blob = false;
1487+
14861488
if (format_change) {
14871489
/*
14881490
* The 32-bit blob was not found in NHLT table, try to
14891491
* look for one based on the params
14901492
*/
14911493
bit_depth = params_width(params);
14921494
format_change = false;
1495+
get_new_blob = true;
1496+
} else if (linktype == SOF_DAI_INTEL_DMIC && !single_format) {
1497+
/*
1498+
* The requested 32-bit blob (no format change for the
1499+
* blob request) was not found in NHLT table, try to
1500+
* look for 16-bit blob if the copier supports multiple
1501+
* formats
1502+
*/
1503+
bit_depth = 16;
1504+
format_change = true;
1505+
get_new_blob = true;
1506+
}
14931507

1508+
if (get_new_blob) {
14941509
cfg = intel_nhlt_get_endpoint_blob(sdev->dev, ipc4_data->nhlt,
14951510
dai_index, nhlt_type,
14961511
bit_depth, bit_depth,
@@ -1513,16 +1528,20 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
15131528

15141529
if (format_change) {
15151530
/*
1516-
* Update the params to reflect that we have loaded 32-bit blob
1517-
* instead of the 16-bit.
1531+
* Update the params to reflect that different blob was loaded
1532+
* instead of the requested bit depth (16 -> 32 or 32 -> 16).
15181533
* This information is going to be used by the caller to find
15191534
* matching copier format on the dai side.
15201535
*/
15211536
struct snd_mask *m;
15221537

15231538
m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
15241539
snd_mask_none(m);
1525-
snd_mask_set_format(m, SNDRV_PCM_FORMAT_S32_LE);
1540+
if (bit_depth == 16)
1541+
snd_mask_set_format(m, SNDRV_PCM_FORMAT_S16_LE);
1542+
else
1543+
snd_mask_set_format(m, SNDRV_PCM_FORMAT_S32_LE);
1544+
15261545
}
15271546

15281547
return 0;

0 commit comments

Comments
 (0)