Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALSA: hda: intel-nhlt: Ignore vbps when looking for DMIC 32 bps format #4690

Conversation

ujfalusi
Copy link
Collaborator

@ujfalusi ujfalusi commented Nov 7, 2023

When looking up DMIC blob from the NHLT table and the format is 32 bits,
ignore the vbps matching for 32 bps for DMIC since some NHLT table have
the vbps as 24, some have it as 32.
The DMIC hardware supports only one type of 32 bit sample size, which is
24 bit sampling on the MSB side and bits[1:0] is used for indicating the
channel number.

/*
* The DMIC bps=32 configuration is described in some
* table with vbps=32 (the DMIC hardware is vbps=24)
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ujfalusi this patch feels a bit odd. May I suggest a different approach in the SOF driver by looking up both 32/32 and 24/32 when the bit-depth is 32 instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063, I had that implementation first, but it felt out of place and hackish. The reason why I have moved it here is that it is the NHLT table itself which is incorrect and it is better to handle this in the NHLT code rather then in upper layer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the NHLT is not incorrect. It's really that vbs is irrelevant and should be ignored.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so rewording the comments and the commit message would suffice?
But then if the user asks for 32/32 then we need to look for 32/24 also, right? For DMIC, that is.
The NHLT core can do this:
if DMIC and bps == 32, set the vbps to 24 first, try to find the blob, if not found, look for it using vbps = 32.
Or pass vbps = 0 to nhlt_get_specific_cfg() and if vbps is 0, do not try to match it, only look for bps match.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass vbps = 0 to nhlt_get_specific_cfg() and if vbps is 0, do not try to match it, only look for bps match.

that would be my preference. vbps is a wildcard - ignored.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me too!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this as long as we can limit this to DMIC in the caller (i.e. pass 0 to use a wildcard).

@ujfalusi ujfalusi force-pushed the peter/sof/pr/32bit_dmic_blob_01 branch from 9205b48 to f294891 Compare November 8, 2023 07:30
@ujfalusi ujfalusi changed the title ALSA/ASoC: SOF: nhlt dmic blob lookup fix for 32bit format ALSA: hda: intel-nhlt: Ignore vbps when looking for DMIC 32 bps format Nov 8, 2023
@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Nov 8, 2023

Changes since v1:

  • Drop the SOF patch
  • Ignore vbps when looking for DMIC blob with 32bps

kv2019i
kv2019i previously approved these changes Nov 8, 2023
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise ok. I have no favorites whether this should be on SOF or in intel-nhlt.c. I guess depends on wheter AVS et al assume this to be handled by intel-nhlt.c or not.

@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Nov 9, 2023

Changes since v2:

  • Only ignore vbps in case of DMIC with bps==32, use a local flag to not change the handling of vbps from caller in other cases.

kv2019i
kv2019i previously approved these changes Nov 10, 2023
ranj063
ranj063 previously approved these changes Nov 10, 2023
Copy link
Collaborator

@ranj063 ranj063 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of typos to fix before upstreaming

* table have the vbps as 24, some have it as 32.
* The DMIC hardware supports only one type of 32 bit sample
* size, which is 24 bit sampling on the MSB side and bits[1:0]
* is used for indicating the channel number.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of typos: some NHLT tables .... bits[1:0] are used....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also say that the 32 bit case is harmless, otherwise the whole point of ignoring vbs could be seen as a regression or a miss.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, both

@ujfalusi ujfalusi dismissed stale reviews from ranj063 and kv2019i via bb43bdd November 13, 2023 10:23
@ujfalusi ujfalusi force-pushed the peter/sof/pr/32bit_dmic_blob_01 branch from bcd24c4 to bb43bdd Compare November 13, 2023 10:23
@ujfalusi
Copy link
Collaborator Author

Changes since v2:

  • Reword the comment
  • Make the ignoring vbps more strict and only do it when vbps is either 32 or 24

sound/hda/intel-nhlt.c Outdated Show resolved Hide resolved
@ujfalusi ujfalusi force-pushed the peter/sof/pr/32bit_dmic_blob_01 branch from bb43bdd to c315e56 Compare November 13, 2023 15:15
@ujfalusi
Copy link
Collaborator Author

Changes since v3:

  • Fix the stale comment in nhlt_get_specific_cfg()

plbossart
plbossart previously approved these changes Nov 13, 2023
@@ -255,8 +255,12 @@ nhlt_get_specific_cfg(struct device *dev, struct nhlt_fmt *fmt, u8 num_ch,
dev_dbg(dev, "Endpoint format: ch=%d fmt=%d/%d rate=%d\n",
wfmt->channels, _vbps, _bps, wfmt->samples_per_sec);

/*
* When looking for exact match of configuration ignore the vbps
* from NHTL table when ignore_vbps is true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo NHTL 🙂

ranj063
ranj063 previously approved these changes Nov 13, 2023
@ujfalusi ujfalusi dismissed stale reviews from ranj063 and plbossart via 00a77ff November 14, 2023 11:04
@ujfalusi ujfalusi force-pushed the peter/sof/pr/32bit_dmic_blob_01 branch from c315e56 to 00a77ff Compare November 14, 2023 11:04
@ujfalusi
Copy link
Collaborator Author

Changers since v4:

  • Fixed another typo in a comment (NHTL -> NHLT)

@plbossart plbossart requested a review from ranj063 November 14, 2023 15:56
@ujfalusi
Copy link
Collaborator Author

SOFCI TEST

1 similar comment
@ranj063
Copy link
Collaborator

ranj063 commented Nov 16, 2023

SOFCI TEST

@ujfalusi ujfalusi force-pushed the peter/sof/pr/32bit_dmic_blob_01 branch from 00a77ff to 07cfd5b Compare November 20, 2023 06:50
When looking up DMIC blob from the NHLT table and the format is 32 bits,
ignore the vbps matching for 32 bps for DMIC since some NHLT table have
the vbps as 24, some have it as 32.
The DMIC hardware supports only one type of 32 bit sample size, which is
24 bit sampling on the MSB side and bits[1:0] is used for indicating the
channel number.

Signed-off-by: Peter Ujfalusi <[email protected]>
@ujfalusi
Copy link
Collaborator Author

Sorry, force pushed to kick a new CI run. The recent failures cannot be caused by this PR - they were not present in earlier versions and there were no change in functionality...

@plbossart plbossart merged commit ff10cf7 into thesofproject:topic/sof-dev Nov 20, 2023
9 checks passed
@ujfalusi ujfalusi deleted the peter/sof/pr/32bit_dmic_blob_01 branch November 30, 2023 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][MTL] 24bit pch-dmic capture fails due to missing config in NHLT
4 participants