Skip to content

ASoC: SOF: Intel: don't check number of sdw links when set dmic_fixup#5287

Merged
bardliao merged 2 commits intothesofproject:topic/sof-devfrom
bardliao:dmic_fixup
Feb 6, 2025
Merged

ASoC: SOF: Intel: don't check number of sdw links when set dmic_fixup#5287
bardliao merged 2 commits intothesofproject:topic/sof-devfrom
bardliao:dmic_fixup

Conversation

@bardliao
Copy link
Collaborator

@bardliao bardliao commented Jan 9, 2025

Currently, we assume that the PCH DMIC pins are pin-muxed with SoundWire links. However, we do see a HW design that use PCH DMIC along with 3 SoundWire links. Remove the check now.
With this change BIOS should only report the presence of PCH DMI when it is truly exist.

ujfalusi
ujfalusi previously approved these changes Jan 10, 2025
@bardliao bardliao marked this pull request as ready for review January 14, 2025 07:44
@bardliao
Copy link
Collaborator Author

@ranj063 Do you see any risk that we merge this PR?

if (mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER)
dmic_fixup = true;
}
if (sdw_mach_found || mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bardliao can we please fix the typo in commit message "PCH DMI". Also, the last line somehow reads as though the BIOS is going to report differently because of this change. But rather what you're trying to say is that we check for PCM DMIC reported by the BIOS irrespective of whether there are SDW links present or not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

and also in the case where the SDW and DMIC are pin-muxed, will this change have a detrimental effect on machine driver probe because we ended up choosing the wrong topology name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, if the BIOS report PCH DMIC but there is no PCH DMIC, we will choose the wrong topology name. That's why I am not confident with this change. But on the other hand, that is the BIOS's responsibility to report the real HW configuration and kernel should trust the BIOS.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we don't have a choice but to trust the bios @ujfalusi @lgirdwood what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I vaguely remember we did this for RVPs. Not sure if it happens in real products. The worst case is that someone reports an issue that no sound card is created, and we may need to fix it with some quirk.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@bardliao, you are too optimistic ;) We have seen broken BIOS information and I'm sure we are continue to see them.

But imho we still need to trust the information BIOS provides, it is most likely correct..

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 @ujfalusi Alternative solution is to add SOC_SDW_PCH_DMIC quirk to this specific device. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I would make any assumption obvious in the logs i.e. if we BIOS says we have DMIC & SDW then we can log this with a if this is wrong pls set "force_fix_something=1" in module command line.
This way it should be obvious to a user on how to remedy if BIOS is reporting incorrect data.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Log added

Comment on lines +529 to +531
dev_info(sdev->dev, "DMICs detected in NHLT tables: %d\n", dmic_num);
dev_info(sdev->dev,
"If the DMIC number doesn't match to the real HW design, please overwrite it with \"dmic_num\" kernel param.\n");
Copy link
Member

Choose a reason for hiding this comment

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

I would change this too

dev_info(sdev->dev, "DMICs detected in NHLT tables: %d, can be overidden with \"dmic_num\" kernel param if incorrect\n", dmic_num);

and I would move the new larger warning to the code block when we detect both SDW and DMIC

dev_info(sdev->dev, "NHLT reporting both SDW and DMIC endpoints, if incorrect, pls override with .....);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Update: only show the warning when both SDW mic and PCH DMIC are present.

@bardliao bardliao force-pushed the dmic_fixup branch 2 times, most recently from 26e48f7 to d515cbb Compare January 21, 2025 14:12
@bardliao bardliao requested a review from dbaluta as a code owner January 21, 2025 14:12
if (mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER)
dmic_fixup = true;
}
if (sdw_mach_found || mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bardliao is the check for sdw_mach_found important? I think we only add the dmic prefix to the tplg name if either the tplg quirk is set or the num_dmics reported is non-zero isnt it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, sdw_mach_found is important because we don't add -2ch/-4ch postfix for SSP machines.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

LGTM, just need a string update

for (i = 0; i < num_ends; i++) {
if (sof_end->dai_info->dai_type == SOC_SDW_DAI_TYPE_MIC) {
dev_warn(dev,
"Both SDW DMIC and PCH DMIC are present, if incorrect, please override with kernel params\n");
Copy link
Member

Choose a reason for hiding this comment

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

which params ? lets be more helpful.

* link 2 and 3, or link 1 and 2, thus we only try to enable dmics
* if all conditions are true:
* a) 2 or fewer links are used by SoundWire
* b) the NHLT table reports the presence of microphones
Copy link
Member

Choose a reason for hiding this comment

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

maybe you only need to refine these criteria?

You can have 3 SoundWire links along 1 DMIC link. But I don't think you can have 3 SoundWire links with 2 DMIC links - since in the latter case you need at least 3 wires, 4 if the clock isn't shared.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart Hmm, the question is that do DMIC links always share with SoundWire links and will the SoundWire link number increase? Is it possible that someday we have 3 SoundWire links and 2 DMIC links?

Currently, we assume that the PCH DMIC pins are pin-muxed with SoundWire
links. However, we do see a HW design that use PCH DMIC along with 3
SoundWire links. Remove the check now.
With this change the PCM DMIC will be presented if it is reported by the
BIOS irrespective of whether there are SDW links present or not.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Typically, SoundWire MIC and PCH DMIC will not coexist. However, we may
want to use both of them in some special cases. Add a warning to let
users know that SoundWire MIC and PCH DMIC are both present and they
could overwrite it with kernel params.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao
Copy link
Collaborator Author

bardliao commented Feb 5, 2025

@ujfalusi @ranj063 Are you good with the PR?

@bardliao bardliao merged commit b8e11f2 into thesofproject:topic/sof-dev Feb 6, 2025
10 of 14 checks passed
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.

5 participants