Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions sound/soc/intel/boards/sof_sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static int quirk_override = -1;
module_param_named(quirk, quirk_override, int, 0444);
MODULE_PARM_DESC(quirk, "Board-specific quirk override");

#define DMIC_DEFAULT_CHANNELS 2

static void log_quirks(struct device *dev)
{
if (SOC_SDW_JACK_JDSRC(sof_sdw_quirk))
Expand Down Expand Up @@ -1133,22 +1135,24 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
hdmi_num = SOF_PRE_TGL_HDMI_COUNT;

/* enable dmic01 & dmic16k */
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;
if (ctx->ignore_internal_dmic) {
dev_dbg(dev, "SoundWire DMIC is used, ignoring internal DMIC\n");
mach_params->dmic_num = 0;
} else if (mach_params->dmic_num) {
dmic_num = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Regardless of the value of mach_params->dmic_num dmic_num is wired to 2? This might be obvious, but it is really not to me, especially when looking at the next else branch where both dmic_num is set to two.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

dmic_num here means the dmic dai link number. We always create 2 dmic dai links if internal dmic is used, one is "dmic01" and the other is "dmic16k" that's why dmic_num is 2.

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 mach_params->dmic_num 0 by default? If not, what could it be set to before we get to line 1140?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bardliao is mach_params->dmic_num 0 by default? If not, what could it be set to before we get to line 1140?

mach->mach_params.dmic_num = check_dmic_num(sdev); is set when selecting machine driver which is before machine driver is probed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry to keep prolonging the discussion @bardliao . But if mach_params->dmic is 0 and sof_sdw_quirk & SOC_SDW_PCH_DMIC is set, why is the maach_params->dmic_num set to 2? and when will this case happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sorry to keep prolonging the discussion @bardliao . But if mach_params->dmic is 0 and sof_sdw_quirk & SOC_SDW_PCH_DMIC is set, why is the maach_params->dmic_num set to 2? and when will this case happen?

The case happens when it is a Chrome book. The coreboot doesn't provide the dmic information and we don't have a way to know the dmic channels. So set it to 2.

} else if (sof_sdw_quirk & SOC_SDW_PCH_DMIC) {
dmic_num = 2;
/*
* mach_params->dmic_num will be used to set the cfg-mics value of
* card->components string. Set it to the default value.
*/
mach_params->dmic_num = DMIC_DEFAULT_CHANNELS;
}
/*
* 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;

if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
bt_num = 1;

dev_dbg(dev, "sdw %d, ssp %d, dmic %d, hdmi %d, bt: %d\n",
dev_dbg(dev, "DAI link numbers: sdw %d, ssp %d, dmic %d, hdmi %d, bt: %d\n",
sdw_be_num, ssp_num, dmic_num,
intel_ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num);

Expand Down