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

Topology: NHLT: Intel: Fix mono DMIC configure for MTL platform #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

singalsu
Copy link
Contributor

@singalsu singalsu commented Jan 8, 2025

This change fixes the blob generator for mono microphone configuration. As difference to previous platforms the FIFO packer mono/stereo mode set up in OUTCONTROLx IPM_SOURCE_MODE bit-field.

@singalsu singalsu force-pushed the intel_ace_mono_dmic_fix branch from 0162116 to d94ed97 Compare January 10, 2025 17:23
@singalsu singalsu marked this pull request as ready for review January 13, 2025 09:29
topology/nhlt/intel/dmic/dmic-process.c Show resolved Hide resolved
@@ -654,6 +662,8 @@ static int configure_registers(struct intel_dmic_params *dmic, struct dmic_calc_
{
int stereo[DMIC_HW_CONTROLLERS];
int swap[DMIC_HW_CONTROLLERS];
int source[OUTCONTROLX_IPM_NUMSOURCES];
int ipmsm[DMIC_HW_FIFOS];
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: if you moved the source anyways, why not spread them to have a nicer looking reverse xmas tree look?

Copy link
Contributor

Choose a reason for hiding this comment

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

btw: what is 'ipmsm' stands for?
Oh, Stereo Mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I was thinking nicer to move all arrays first but was a bit shy. With the tree style, should initialized variables be still in the end?

Yes, short version for OUTCONTROLx_IPM_SOURCE_MODE, where 0 is mono, 1 is stereo. And I've forgotten what IPM was for... but it's the FIFO packer, consumes samples from stereo PDM controllers and interleaves/packs them to FIFO.

@singalsu singalsu force-pushed the intel_ace_mono_dmic_fix branch from d94ed97 to e125ba1 Compare January 13, 2025 15:54
@singalsu singalsu requested a review from ujfalusi January 13, 2025 15:57
Copy link
Contributor

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

@singalsu, I would not do a big variable declaration shuffling it hides the change you have made.

int th = 3; /* Used with TIE=1 */
int source[OUTCONTROLX_IPM_NUMSOURCES];
Copy link
Contributor

Choose a reason for hiding this comment

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

oh my, I cannot see what is changed now ;)

@@ -762,6 +774,12 @@ static int configure_registers(struct intel_dmic_params *dmic, struct dmic_calc_
of0 = (dmic->dmic_prm[0].fifo_bits == 32) ? 2 : 0;
of1 = (dmic->dmic_prm[1].fifo_bits == 32) ? 2 : 0;

ret = stereo_helper(dmic, stereo, swap, ipmsm);
if (ret < 0) {
fprintf(stderr, "%s: enable conflict\n", __func__);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it is a code move, but what the error means?
The only error is in case of if (swap_check && swap[i]) but how that is 'enable conflict'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In topology you can freely enable Mic A or Mic B for dmic0 and dmic1 in any pdmX for DAI, as if they were fully independent, but you can't enable e.g. for dmic0 mono from A and for dmic1 mono from B from same pdm0 controller. Enable of pdm0 stereo A & B for dmic0 and only prm0 mono A as mono can be done. It's difficult to phrase to a compact error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, this part of allowing some funky mic selections and blocking impossible ones is still not fully up-to-date. Need still to revisit this after fixing some tplg2 limitations in freedom for those and when I'm able to better test these with new generation HW.

Copy link

@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.

Aside commit message, looks good to me!

topology/nhlt/intel/dmic/dmic-process.c Show resolved Hide resolved
@singalsu singalsu force-pushed the intel_ace_mono_dmic_fix branch from e125ba1 to d3c7c10 Compare January 14, 2025 14:22
@singalsu singalsu requested a review from ujfalusi January 14, 2025 14:22
This change fixes the blob generator for mono microphone
configuration. As difference to previous platforms the FIFO packer
mono/stereo mode set up in OUTCONTROLx IPM_SOURCE_MODE bit-field.
The previous code version hard-codes the FIFO packer to stereo
mode without support for mono.

As a fix if only one microphone is enabled for dmic0 or dmic1,
then the corresponding IPM_SOURCE_MODE in OUTCONTROL0 or OUTCONTROL1
is set to 0. Otherwise it is set to 1 for stereo mode.

Signed-off-by: Seppo Ingalsuo <[email protected]>
The DMIC HW does not provide all the freedom that topology
syntax appears to provide for DAI configuration. This change
helps to understand better what the error is about.

Signed-off-by: Seppo Ingalsuo <[email protected]>
Copy link
Contributor

@jsarha jsarha left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants