-
Notifications
You must be signed in to change notification settings - Fork 27
linux-ptl: add Lenovo 83QK SOF SoundWire audio quirk #97
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
Open
itisyb
wants to merge
3
commits into
omacom-io:master
Choose a base branch
from
itisyb:lenovo-83qk-audio-ptl-patches
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c | ||
| index b3d61d973ce40b..24604e71386d6d 100644 | ||
| --- a/sound/soc/sof/intel/hda.c | ||
| +++ b/sound/soc/sof/intel/hda.c | ||
| @@ -1337,6 +1337,8 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev | ||
| return NULL; | ||
| } | ||
|
|
||
| + chip = get_chip_info(sdev->pdata); | ||
| + | ||
| /* | ||
| * Select SoundWire machine driver if needed using the | ||
| * alternate tables. This case deals with SoundWire-only | ||
| @@ -1352,8 +1354,13 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev | ||
| * first check whether link_mask of mach is subset of | ||
| * link_mask supported by hw and then go on searching | ||
| * link_adr | ||
| + * For those platforms that can use the created SDW mach below, | ||
| + * match the two masks exactly to avoid using an unexpected | ||
| + * mach. | ||
| */ | ||
| - if (~hdev->info.link_mask & mach->link_mask) | ||
| + if (~hdev->info.link_mask & mach->link_mask || | ||
| + (hdev->info.link_mask != mach->link_mask && | ||
| + chip->hw_ip_version >= SOF_INTEL_ACE_2_0)) | ||
| continue; | ||
|
|
||
| /* No need to match adr if there is no links defined */ | ||
| @@ -1393,8 +1400,6 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev | ||
| peripherals->array[i]->id.part_id, | ||
| peripherals->array[i]->id.sdw_version); | ||
|
|
||
| - chip = get_chip_info(sdev->pdata); | ||
| - | ||
| /* SDCA was not well supported in the BIOS before ACE2.0 */ | ||
| if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) | ||
| return NULL; |
62 changes: 62 additions & 0 deletions
62
pkgbuilds/linux-ptl/0031-ptl-mach-lenovo-83qk-rt722-ghost.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| diff --git a/sound/soc/intel/common/soc-acpi-intel-ptl-match.c b/sound/soc/intel/common/soc-acpi-intel-ptl-match.c | ||
| index 3b7818355ff645..8f3d7b6c0a1e2 100644 | ||
| --- a/sound/soc/intel/common/soc-acpi-intel-ptl-match.c | ||
| +++ b/sound/soc/intel/common/soc-acpi-intel-ptl-match.c | ||
| @@ -245,6 +245,28 @@ | ||
| } | ||
| }; | ||
|
|
||
| +static const struct snd_soc_acpi_adr_device cs42l43_3_agg_rt722_l3_ghost_adr[] = { | ||
| + { | ||
| + .adr = 0x00033001FA424301ull, | ||
| + .num_endpoints = ARRAY_SIZE(cs42l43_amp_spkagg_endpoints), | ||
| + .endpoints = cs42l43_amp_spkagg_endpoints, | ||
| + .name_prefix = "cs42l43" | ||
| + }, | ||
| + /* | ||
| + * Lenovo Yoga Slim 7 Ultra 14IPH11 (83QK, SSID 17aa:3821) exposes | ||
| + * an RT722 SDCA function at link 3 in firmware. On Linux this function | ||
| + * remains UNATTACHED and any attempt to route speaker/jack audio through | ||
| + * it fails with rt722 DPN_PortCtrl errors. Treat it as a zero-endpoint | ||
| + * ghost so the real CS42L43 + CS35L56 sidecar speaker path can be used. | ||
| + */ | ||
| + { | ||
| + .adr = 0x000330025d072201ull, /* Ghost RT722/ALC722 */ | ||
| + .num_endpoints = 0, | ||
| + .endpoints = NULL, | ||
| + .name_prefix = "ghost" | ||
| + } | ||
| +}; | ||
| + | ||
| static const struct snd_soc_acpi_adr_device cs35l56_2_lr_adr[] = { | ||
| { | ||
| .adr = 0x00023001fa355601ull, | ||
| @@ -460,6 +482,15 @@ | ||
| {} | ||
| }; | ||
|
|
||
| +static const struct snd_soc_acpi_link_adr ptl_lenovo_83qk_cs42l43_l3_rt722_ghost[] = { | ||
| + { | ||
| + .mask = BIT(3), | ||
| + .num_adr = ARRAY_SIZE(cs42l43_3_agg_rt722_l3_ghost_adr), | ||
| + .adr_d = cs42l43_3_agg_rt722_l3_ghost_adr, | ||
| + }, | ||
| + {} | ||
| +}; | ||
| + | ||
| static const struct snd_soc_acpi_link_adr ptl_cs42l43_l2_cs35l56x6_l13[] = { | ||
| { | ||
| .mask = BIT(2), | ||
| @@ -693,6 +724,12 @@ | ||
| .sof_tplg_filename = "sof-ptl-cs42l43-agg-l3-cs35l56-l2.tplg", | ||
| }, | ||
| { | ||
| + .link_mask = BIT(3), | ||
| + .links = ptl_lenovo_83qk_cs42l43_l3_rt722_ghost, | ||
| + .drv_name = "sof_sdw", | ||
| + .sof_tplg_filename = "sof-arl-cs42l43-l2-cs35l56-l3.tplg", | ||
| + }, | ||
| + { | ||
| .link_mask = BIT(0), | ||
| .links = ptl_rvp, | ||
| .drv_name = "sof_sdw", |
25 changes: 25 additions & 0 deletions
25
pkgbuilds/linux-ptl/0032-sdw-utils-lenovo-83qk-skip-cs42l43-sdca-check.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c | ||
| index 0a000000000000..0b000000000000 100644 | ||
| --- a/sound/soc/sdw_utils/soc_sdw_utils.c | ||
| +++ b/sound/soc/sdw_utils/soc_sdw_utils.c | ||
| @@ -1542,8 +1542,18 @@ | ||
| soc_end->include_sidecar = true; | ||
| } | ||
|
|
||
| - if (SDW_CLASS_ID(adr_dev->adr) && adr_dev->num_endpoints > 1) | ||
| - check_sdca = true; | ||
| + if (SDW_CLASS_ID(adr_dev->adr) && adr_dev->num_endpoints > 1) { | ||
| + /* | ||
| + * Lenovo 83QK exposes CS42L43 endpoints through firmware in a | ||
| + * way that reports only SmartAmp SDCA functions. If we enforce | ||
| + * SDCA endpoint probing here, SimpleJack endpoints are skipped | ||
| + * and CS42L43 topologies fail to connect Playback-SimpleJack. | ||
| + */ | ||
| + if (!(ctx->mc_quirk & SOC_SDW_SIDECAR_AMPS && | ||
| + SDW_MFG_ID(adr_dev->adr) == 0x01fa && | ||
| + SDW_PART_ID(adr_dev->adr) == 0x4243)) | ||
| + check_sdca = true; | ||
| + } | ||
|
|
||
| for (j = 0; j < adr_dev->num_endpoints; j++) { | ||
| const struct snd_soc_acpi_endpoint *adr_end; |
25 changes: 25 additions & 0 deletions
25
pkgbuilds/linux-ptl/0033-lenovo-83qk-force-2ch-pch-dmic.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c | ||
| index 111111111111..222222222222 100644 | ||
| --- a/sound/soc/sof/intel/hda.c | ||
| +++ b/sound/soc/sof/intel/hda.c | ||
| @@ -1584,6 +1584,20 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) | ||
| /* report to machine driver if any DMICs are found */ | ||
| mach->mach_params.dmic_num = check_dmic_num(sdev); | ||
|
|
||
| + /* | ||
| + * Lenovo Yoga Slim 7 Ultra 14IPH11 (83QK, SSID 17aa:3821) | ||
| + * reports 4 PCH DMICs in NHLT, but sof-firmware currently ships | ||
| + * the matching ARL CS42L43 + CS35L56 topology only in a 2ch DMIC | ||
| + * variant. Clamp the DMIC count to 2 so topology filename fixup | ||
| + * selects sof-arl-cs42l43-l2-cs35l56-l3-2ch.tplg instead of the | ||
| + * unavailable/non-working -4ch variant, while still creating the | ||
| + * PCH DMIC capture links for the built-in microphones. | ||
| + */ | ||
| + if (sof_pdata->subsystem_id_set && | ||
| + sof_pdata->subsystem_vendor == 0x17aa && | ||
| + sof_pdata->subsystem_device == 0x3821) | ||
| + mach->mach_params.dmic_num = 2; | ||
| + | ||
| if (sdw_mach_found || mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER) | ||
| dmic_fixup = true; | ||
|
|
21 changes: 21 additions & 0 deletions
21
pkgbuilds/linux-ptl/0034-lenovo-83qk-exclude-cs42l43-sdw-dmic.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c | ||
| index 111111111111..222222222222 100644 | ||
| --- a/sound/soc/intel/boards/sof_sdw.c | ||
| +++ b/sound/soc/intel/boards/sof_sdw.c | ||
| @@ -858,7 +858,15 @@ static const struct snd_pci_quirk sof_sdw_ssid_quirk_table[] = { | ||
| SND_PCI_QUIRK(0x17aa, 0x2347, "Lenovo P16", SOC_SDW_CODEC_MIC), | ||
| SND_PCI_QUIRK(0x17aa, 0x2348, "Lenovo P16", SOC_SDW_CODEC_MIC), | ||
| SND_PCI_QUIRK(0x17aa, 0x2349, "Lenovo P1", SOC_SDW_CODEC_MIC), | ||
| - SND_PCI_QUIRK(0x17aa, 0x3821, "Lenovo 0x3821", SOC_SDW_SIDECAR_AMPS), | ||
| + /* | ||
| + * Lenovo Yoga Slim 7 Ultra 14IPH11 (83QK, SSID 17aa:3821) | ||
| + * needs the CS35L56/CS35L57 sidecar speaker path, but the internal | ||
| + * microphone is the PCH DMIC path selected by the -2ch topology. | ||
| + * Mark SOC_SDW_CODEC_MIC as a quirk so the CS42L43 SmartMic endpoint | ||
| + * with quirk_exclude=true is skipped; otherwise the SDW DMIC consumes | ||
| + * DAI id 4 and dmic01 is not created at topology-expected id 3. | ||
| + */ | ||
| + SND_PCI_QUIRK(0x17aa, 0x3821, "Lenovo 0x3821", SOC_SDW_SIDECAR_AMPS | SOC_SDW_CODEC_MIC), | ||
| {} | ||
| }; | ||
|
|
||
26 changes: 26 additions & 0 deletions
26
pkgbuilds/linux-ptl/0035-lenovo-83qk-use-topology-nhlt-for-pch-dmic.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c | ||
| index 111111111111..222222222222 100644 | ||
| --- a/sound/soc/sof/intel/hda-dai.c | ||
| +++ b/sound/soc/sof/intel/hda-dai.c | ||
| @@ -758,6 +758,21 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops) | ||
| ssp_set_dai_drv_ops(sdev, ops); | ||
| dmic_set_dai_drv_ops(sdev, ops); | ||
|
|
||
| + /* | ||
| + * Lenovo Yoga Slim 7 Ultra 14IPH11 (83QK, SSID 17aa:3821) | ||
| + * exposes a PCH DMIC capture path via the ARL CS42L43 + CS35L56 | ||
| + * -2ch topology, but the BIOS NHLT blob lookup fails for that path | ||
| + * with "no matching blob" on DMIC Raw capture. Use the topology-provided | ||
| + * NHLT blobs on this machine so the PCH DMIC copier can be configured | ||
| + * from the topology manifest instead of the BIOS NHLT table. | ||
| + */ | ||
| + if (sdev->pdata->subsystem_id_set && | ||
| + sdev->pdata->subsystem_vendor == 0x17aa && | ||
| + sdev->pdata->subsystem_device == 0x3821) { | ||
| + dev_info(sdev->dev, "Lenovo 83QK: using topology NHLT blobs for PCH DMIC\n"); | ||
| + hda_use_tplg_nhlt = true; | ||
| + } | ||
| + | ||
| if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4 && !hda_use_tplg_nhlt) { | ||
| struct sof_ipc4_fw_data *ipc4_data = sdev->private; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this looks like it needs updated, according to our notes this should have the MIC quirk it appears to have been missed when this was upstreamed. Are you able to send this upstream (I would move the comment to the commit message, no need for that in the code)? Or would you like me to send this one for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hang on, sorry no this should be pulling this from the ACPI these days. Lets start with the ACPI dump and then think this through.