Skip to content

ASoC: SOF: Intel: add -bt tplg suffix if BT is present#5518

Merged
bardliao merged 1 commit intothesofproject:topic/sof-devfrom
bardliao:bt-suffix
Oct 2, 2025
Merged

ASoC: SOF: Intel: add -bt tplg suffix if BT is present#5518
bardliao merged 1 commit intothesofproject:topic/sof-devfrom
bardliao:bt-suffix

Conversation

@bardliao
Copy link
Collaborator

We need to distinguish the topologies with and without BT PCM.

@bardliao bardliao requested review from kv2019i and ujfalusi August 21, 2025 05:16
@bardliao bardliao changed the title ASoC: SOF: Intel: add -bt tplg suffix if BT is present [RFC] ASoC: SOF: Intel: add -bt tplg suffix if BT is present Aug 21, 2025
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.

Sorry for late response, please @bardliao check inline. I might be missing something big, I was a bit surprised the BT dai link is added already now added to HDA machine drivers, even though we have no support in HDA topology files. Yet it seems to work... :o

sof_pdata->tplg_filename = tplg_filename;
}

if (tplg_fixup && mach->mach_params.bt_link_mask) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I think this is problematic. bt_link_mask is initialized with "check_nhlt_ssp_mask(sdev, NHLT_DEVICE_BT)" and as BT link is enabled on various Windows devices where we do not have support in Linux (and we have already shipped tplgs+kernel for these devices and the devices themselves are shipping). So adding "-bt" based on this can break a lot of existing devices.

Although, I must say "can break" as I note commit b28b23d introduces this for for HDA devices. And indeed, when I test on a HDA machine, an extra DAI link is created:

[12443.363488] snd_soc_intel_sof_board_helpers:set_bt_offload_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 8: bt offload, ssp 1

... this seems to still work as topology does not use it, and this is the last link, so extra "be_id" doesn't create harm.
Have you @bardliao @ujfalusi noted this before?

Given only Chromebook topologies have had the PCM definition for BT offload, I think we need an opt-in mechanism:
a) if a legacy board case with in all topologies, no need to add "-bt" (the legacy option, used primarily for Chromebooks)
b) if new platform, board has BT link set in NHLT, add "-bt"
c) if new platform, board has DMI quirk to enable, add "-bt" (used for new Chromebooks)

We can continue to use (a) for I2S platforms, but for SDW topologies, we'd need to transition to b+c. Not sure what "new platform" should be. Perhaps a platform not yet shipping (NVL-S perhaps) so we have time to add the necessary "-bt" variants, and ship them. At least then we are not breaking anyone's existing system when the kernel starts looking for "-bt.tplg" variants.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's how it looks on a generic HDA machine where BIOS NHLT has BT links defined:

[13927.913567] snd_soc_skl_hda_dsp:skl_hda_audio_probe: skl_hda_dsp_generic skl_hda_dsp_generic: board_quirk = 4008000
[13927.913573] snd_soc_intel_sof_board_helpers:sof_intel_board_get_ctx: skl_hda_dsp_generic skl_hda_dsp_generic: create ctx, board_quirk 0x4008000
[13927.914974] snd_soc_intel_sof_board_helpers:sof_intel_board_set_dai_link: skl_hda_dsp_generic skl_hda_dsp_generic: create dai links, link_order 0x63284, id_overwrite 0x87641
[13927.914977] snd_soc_intel_sof_board_helpers:set_idisp_hdmi_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 1: idisp hdmi 1, idisp codec 1
[13927.914979] snd_soc_intel_sof_board_helpers:set_idisp_hdmi_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 2: idisp hdmi 2, idisp codec 1
[13927.914982] snd_soc_intel_sof_board_helpers:set_idisp_hdmi_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 3: idisp hdmi 3, idisp codec 1
[13927.914984] snd_soc_intel_sof_board_helpers:set_hda_codec_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 4: hda analog
[13927.914985] snd_soc_intel_sof_board_helpers:set_hda_codec_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 5: hda digital
[13927.914986] snd_soc_intel_sof_board_helpers:set_dmic_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 6: dmic01
[13927.914987] snd_soc_intel_sof_board_helpers:set_dmic_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 7: dmic16k
[13927.914988] snd_soc_intel_sof_board_helpers:set_bt_offload_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 8: bt offload, ssp 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, I think this is problematic. bt_link_mask is initialized with "check_nhlt_ssp_mask(sdev, NHLT_DEVICE_BT)" and as BT link is enabled on various Windows devices where we do not have support in Linux (and we have already shipped tplgs+kernel for these devices and the devices themselves are shipping). So adding "-bt" based on this can break a lot of existing devices.

Yes, that is my main concern.

Although, I must say "can break" as I note commit b28b23d introduces this for for HDA devices. And indeed, when I test on a HDA machine, an extra DAI link is created:

[12443.363488] snd_soc_intel_sof_board_helpers:set_bt_offload_link: skl_hda_dsp_generic skl_hda_dsp_generic: link 8: bt offload, ssp 1

... this seems to still work as topology does not use it, and this is the last link, so extra "be_id" doesn't create harm. Have you @bardliao @ujfalusi noted this before?

Yes, I reviewed the PR. It basically creates the dai links based on the board_quirk.

Given only Chromebook topologies have had the PCM definition for BT offload, I think we need an opt-in mechanism: a) if a legacy board case with in all topologies, no need to add "-bt" (the legacy option, used primarily for Chromebooks) b) if new platform, board has BT link set in NHLT, add "-bt" c) if new platform, board has DMI quirk to enable, add "-bt" (used for new Chromebooks)

We can continue to use (a) for I2S platforms, but for SDW topologies, we'd need to transition to b+c. Not sure what "new platform" should be. Perhaps a platform not yet shipping (NVL-S perhaps) so we have time to add the necessary "-bt" variants, and ship them. At least then we are not breaking anyone's existing system when the kernel starts looking for "-bt.tplg" variants.

So the -bt suffix only apply if .hw_ip_version >= SOF_INTEL_ACE_4_0, . And we have the tplg_filename module parameter which can be used when a legacy board has with BT and without BT variants. Does it sound good?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it does not matter what is used for the BT link? Which SSP for example.
In a generic machine you will need special user space to be able to use the BT PCM, right? What happens if PW opens the BT link when probing the card? Will that cause it to fail and the card being rejected?

Copy link
Collaborator

@kv2019i kv2019i Aug 28, 2025

Choose a reason for hiding this comment

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

Good point @ujfalusi , it's going to be SSP2 in majority of cases, but we if we start adding the suffix, let's add the ssp id as well, So "-ssp%u-bt" matching the convention we use in topology (bt-defaults.conf -> "BT_NAME").
UPDATE: to match with exisiting topologies, should be "-bt-ssp%u" (like sof-ptl-es8336-ssp1.tplg, sof-ptl-es83x6-ssp1-hdmi-ssp02 and so forth).

Otherwise, if the link is enabled in BIOS, then it's ok, the PCM can be opened. Streaming will work with some parameters (A2DP 48kHz), but for others not (8/16 SCO mode) as there will be no clock provided by the BT chip. But this should be enough for PW, it will just open the PCMs and query capabilities.

@bardliao
Copy link
Collaborator Author

bardliao commented Sep 8, 2025

@kv2019i @ujfalusi PR updated and it depends on #5508

chip->hw_ip_version >= SOF_INTEL_ACE_4_0) {
int bt_port = fls(mach->mach_params.bt_link_mask) - 1;

tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, "%-ssp%d-bt",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks good to me @bardliao @ujfalusi . We just then need to remember this when doing the topologies for ace4 platforms.

Copy link

@macchian macchian Sep 24, 2025

Choose a reason for hiding this comment

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

This should be "%s-ssp%d-bt".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be "%s-ssp%d-bt".

Good catch. Thanks @macchian

Copy link

Choose a reason for hiding this comment

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

LGTM. Verified sof_tplg_name-ssp%d-bt.tplg can be loaded.

@bardliao bardliao marked this pull request as ready for review September 22, 2025 03:50
@bardliao bardliao changed the title [RFC] ASoC: SOF: Intel: add -bt tplg suffix if BT is present ASoC: SOF: Intel: add -bt tplg suffix if BT is present Sep 22, 2025
We need to distinguish the topologies with and without BT PCM.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
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.

Thanks @bardliao !

@bardliao bardliao requested a review from macchian October 2, 2025 01:45
@bardliao bardliao merged commit 7d896f3 into thesofproject:topic/sof-dev Oct 2, 2025
11 of 16 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.

4 participants