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

ASoC: Intel: sof_sdw: subtract dmic_num when dmic link is not created #5126

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

bardliao
Copy link
Collaborator

WARN_ON(dai_links != card->dai_link + card->num_links); is checked at the end of sof_card_dai_links_create(). We need to subtract dmic_num from card->num_links when dmic link is not created.

plbossart
plbossart previously approved these changes Jul 30, 2024
@@ -1258,6 +1258,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
if (dmic_num > 0) {
if (ctx->ignore_internal_dmic) {
dev_warn(dev, "Ignoring PCH DMIC\n");
card->num_links -= dmic_num;

Choose a reason for hiding this comment

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

I feel like it might make more sense to move the whole check for ignore_internal_dmic up to its initialisation, something like:

if (sof_sdw_quirk & SOC_SDW_PCH_DMIC || mach_params->dmic_num) {
	if (ctx->ignore_internal_dmic)
		dev_warn(dev, "Ignoring PCH DMIC\n");
	else
		dmic_num = 2;
}

That way the dmic_num will be accurrate and all the code handling the number of dmics is together.

dmic links will not be created if ctx->ignore_internal_dmic is set, and
dmic_num should be 0 in this case. Move ignore_internal_dmic check
earlier where dmic_num is set to get an accurate dmic_num.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
plbossart
plbossart previously approved these changes Jul 30, 2024
mach_params->dmic_num will be used to set the cfg-mics value of
card->components string. Overwrite it to the actual number of PCH
DMICs used in the device.

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

@plbossart @charleskeepax I added a commit to make card->components use the actual dmic_num. Could you review again?

Copy link

@charleskeepax charleskeepax left a comment

Choose a reason for hiding this comment

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

No objections on the changes from me, although I am not perhaps the clearest on what should actually be reflected in cfg-mics.

* mach_params->dmic_num will be used to set the cfg-mics value of card->components
* string. Overwrite it to the actual number of PCH DMICs used in the device.
*/
mach_params->dmic_num = dmic_num;
Copy link
Member

Choose a reason for hiding this comment

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

that seems ok, but now that we are looking at the code why do we need this SOC_SDW_PCH_DMIC quirk? if all the information is provided by the dmic_num, the first part of the test line 1212 seems useless.

Choose a reason for hiding this comment

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

It is weird but I am not sure it is pointless. The driver will add 2 dmics if either the quirk is set or mach_params->dmic_num is non-zero. So presumably there are systems where mach_params->dmic_num is zero but one still wants the dmics added.

Copy link
Member

Choose a reason for hiding this comment

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

if the mach_params->dmic_num is zero, then the SOF driver did not select a topology with the mics enabled, so adding a dailink is useless IMHO. I think this is an old quirk from way back, I don't think it serves any purpose now.

Choose a reason for hiding this comment

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

Well in that case, I certainly have no objection to removing 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.

if the mach_params->dmic_num is zero, then the SOF driver did not select a topology with the mics enabled, so adding a dailink is useless IMHO. I think this is an old quirk from way back, I don't think it serves any purpose now.

With SOC_SDW_PCH_DMIC quick enabled, the PCH DMIC link will be created. The topology name may not have -4ch or -2ch suffix even if the PCH DMIC is including in the topology. For example, cavs-sdw;sof-mtl-sdw-cs42l42-l0-max98363-l2;PLATFORM=mtl,NUM_DMICS=4

Copy link
Member

Choose a reason for hiding this comment

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

is this correct to say that this quirk is only useful for Chromebooks then, where there is no NHLT ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is this correct to say that this quirk is only useful for Chromebooks then, where there is no NHLT ?

As far as I know, yes.

Copy link
Member

Choose a reason for hiding this comment

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

ok then, let's keep it. thanks for educating me on this...

@plbossart plbossart merged commit 7913a65 into thesofproject:topic/sof-dev Aug 6, 2024
12 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.

3 participants