Skip to content

Conversation

@Cryolitia
Copy link
Member

@Cryolitia Cryolitia commented Dec 25, 2025

Summary by Sourcery

Add codec configuration and quirks to support CS35L41 audio on new Lenovo ThinkBook 13x Gen 5 models.

New Features:

  • Enable CS35L41 HDA amplifier support for Lenovo ThinkBook 13x Gen 5 systems via new configuration entries.
  • Register Realtek ALC287 quirk entries for the ThinkBook 13x Gen 5 to wire it up with the CS35L41 I2C audio path.

Bou-Saan Che added 2 commits December 25, 2025 20:43
This laptop does not contain _DSD so needs to be supported using the
configuration table.

Signed-off-by: Bou-Saan Che <yungmeat@inboxia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit f205ed2)
Signed-off-by: Cryolitia <cryolitia@deepin.org>
The laptop does not contain valid _DSD for these amps, so requires
entries into the CS35L41 configuration table to function correctly.

Signed-off-by: Bou-Saan Che <yungmeat@inboxia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit c1d3189)
Signed-off-by: Cryolitia <cryolitia@deepin.org>
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 25, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds Lenovo Thinkbook 13x Gen 5 support to the CS35L41 HDA configuration and Realtek ALC287 quirk handling so that the correct amplifier and codec fixups are applied for this hardware.

Flow diagram for CS35L41 HDA configuration lookup for Thinkbook13xGen5

flowchart TD
    Start[Codec probe for CS35L41] --> ReadIDs[Read ACPI HID and subsystem ID]
    ReadIDs --> CheckHID{ACPI HID CSC3551?}
    CheckHID -->|No| EndNoMatch[No CS35L41 property model applied]
    CheckHID -->|Yes| LookupPropModel[Lookup in cs35l41_prop_model_table]

    LookupPropModel --> CheckSubsys{Subsystem ID 17AA3929 or 17AA392B?}
    CheckSubsys -->|No| EndNoMatch
    CheckSubsys -->|Yes| ApplyGenericDSD[Apply generic_dsd_config]

    ApplyGenericDSD --> LookupConfig[Lookup in cs35l41_config_table]
    LookupConfig --> MatchConfig[Find entry with 17AA3929 or 17AA392B]
    MatchConfig --> ApplyRouting[Configure 4 INTERNAL amps
with RIGHT LEFT RIGHT LEFT
and timing 1000 4500 24]
    ApplyRouting --> End[CS35L41 configured for Thinkbook13xGen5]
Loading

Flow diagram for Realtek ALC287 quirk selection for Thinkbook13xGen5

flowchart TD
    Start[HDA codec probe] --> DetectCodec[Detect Realtek codec]
    DetectCodec --> CheckCodec{Codec is ALC287?}
    CheckCodec -->|No| EndOther[Use generic handling]
    CheckCodec -->|Yes| ReadPCI[Read PCI vendor and device IDs]

    ReadPCI --> CheckVendor{Vendor ID 0x17aa?}
    CheckVendor -->|No| EndOther
    CheckVendor -->|Yes| LookupQuirk[Search alc269_fixup_tbl]

    LookupQuirk --> CheckDevice{Device ID 0x3929 or 0x392b?}
    CheckDevice -->|No| EndOther
    CheckDevice -->|Yes| ApplyFixup[Apply ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD]

    ApplyFixup --> End[ALC287 configured for
Thinkbook13xGen5 with CS35L41 amp]
Loading

File-Level Changes

Change Details Files
Add CS35L41 configuration entries for new Lenovo Thinkbook 13x Gen 5 hardware IDs.
  • Extend the cs35l41_config_table with two new INTERNAL speaker configs using the existing 4-channel RIGHT/LEFT pattern and timing parameters reused from prior Lenovo entries.
  • Extend the cs35l41_prop_model_table to map the CSC3551 codec with the new subsystem IDs to the generic_dsd_config handler.
sound/pci/hda/cs35l41_hda_property.c
Register ALC287 codec quirks for Lenovo Thinkbook 13x Gen 5 subsystem IDs.
  • Add two SND_PCI_QUIRK entries for the new Lenovo vendor/subsystem IDs to use the existing ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD fixup profile, matching the ThinkPad CS35L41 I2C amp topology.
sound/pci/hda/patch_realtek.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个diff进行审查:

  1. 语法逻辑:
  • 代码语法正确,添加了新的设备配置条目
  • 在两个配置表(cs35l41_config_table和cs35l41_prop_model_table)中保持了一致性
  • 在HDA quirk表中正确添加了新的设备ID
  1. 代码质量:
  • 配置参数选择合理,使用了与类似设备相同的配置(INTERNAL, 4个扬声器,相同的boost和功率参数)
  • 使用了已有的fixup函数(ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),保持了代码复用性
  • 配置项按照设备ID顺序排列,保持了代码的可读性和维护性
  1. 代码性能:
  • 使用静态配置表,在运行时查找效率高
  • 没有引入额外的性能开销
  1. 代码安全:
  • 添加的配置参数都在合理范围内
  • 使用了已有的验证过的配置方案
  • 没有引入潜在的安全风险

改进建议:

  1. 考虑添加注释说明这些新增配置对应的硬件特性
  2. 建议在提交信息中说明这些设备ID的具体测试状态
  3. 考虑将重复的配置参数定义为宏,以便于未来维护,例如:
#define THINKPAD_4SPK_CONFIG INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1, 1000, 4500, 24

总的来说,这是一个合理的补丁,添加了新的ThinkBook型号支持,代码质量良好,没有明显问题。

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `sound/pci/hda/patch_realtek.c:11291-11292` </location>
<code_context>
 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
 	SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
 	SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
+	SND_PCI_QUIRK(0x17aa, 0x3929, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
+	SND_PCI_QUIRK(0x17aa, 0x392b, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
</code_context>

<issue_to_address>
**nitpick (typo):** Consider aligning product name capitalization with Lenovo's "ThinkBook" branding.

Lenovo’s official branding uses “ThinkBook” with a capital B. It may be worth updating these strings for consistency and easier grepping, unless DMI/marketing sources for this exact model intentionally use “Thinkbook” as shown.

```suggestion
	SND_PCI_QUIRK(0x17aa, 0x3929, "ThinkBook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
	SND_PCI_QUIRK(0x17aa, 0x392b, "ThinkBook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: opsiff

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff opsiff merged commit ddacef6 into deepin-community:linux-6.12.y Dec 25, 2025
8 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds hardware support for CS35L41 HDA audio amplifiers on Lenovo ThinkBook 13x Gen 5 systems by registering device-specific configuration entries and quirks.

  • Adds quirk entries to wire ThinkBook 13x Gen 5 models (device IDs 0x3929 and 0x392b) with CS35L41 I2C audio path
  • Registers CS35L41 codec configuration for 4-amp internal setup with appropriate boost parameters

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
sound/pci/hda/patch_realtek.c Adds two ALC287 quirk entries for ThinkBook 13x Gen 5 device IDs to enable CS35L41 I2C amplifier support
sound/pci/hda/cs35l41_hda_property.c Registers configuration and property model entries for the new device IDs with 4-amp internal configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
SND_PCI_QUIRK(0x17aa, 0x3929, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The product name should be "ThinkBook" with a capital 'B' to match Lenovo's official branding. While the codebase has inconsistent capitalization (both "Thinkbook" and "ThinkBook" are used), line 11285 in this file uses "ThinkBook" for a similar product. For consistency within proximity and adherence to official branding, "ThinkBook" should be used here.

Copilot uses AI. Check for mistakes.
Comment on lines +11291 to +11292
SND_PCI_QUIRK(0x17aa, 0x3929, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
SND_PCI_QUIRK(0x17aa, 0x392b, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The product name should be "ThinkBook" with a capital 'B' to match Lenovo's official branding. While the codebase has inconsistent capitalization (both "Thinkbook" and "ThinkBook" are used), line 11285 in this file uses "ThinkBook" for a similar product. For consistency within proximity and adherence to official branding, "ThinkBook" should be used here.

Suggested change
SND_PCI_QUIRK(0x17aa, 0x3929, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
SND_PCI_QUIRK(0x17aa, 0x392b, "Thinkbook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
SND_PCI_QUIRK(0x17aa, 0x3929, "ThinkBook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
SND_PCI_QUIRK(0x17aa, 0x392b, "ThinkBook 13x Gen 5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants