git: 2d694deca985 - stable/14 - snd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Sun, 03 Mar 2024 13:18:25 UTC
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=2d694deca985517c3eab9d51bf4c7cf20dd6bc03

commit 2d694deca985517c3eab9d51bf4c7cf20dd6bc03
Author:     Dmitry Lukhtionov <dmitryluhtionov@gmail.com>
AuthorDate: 2024-02-18 17:07:39 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-03-03 13:18:02 +0000

    snd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230
    
    PR:             259640
    MFC after:      2 weeks
    Reviewed by:    delphij, markj
    Differential Revision:  https://reviews.freebsd.org/D43804
    
    (cherry picked from commit 5968e477a560406c480d78ebe438a04f57121119)
---
 sys/dev/sound/pci/hda/hdaa_patches.c | 20 ++++++++++++++++++++
 sys/dev/sound/pci/hda/hdac.h         |  2 ++
 sys/dev/sound/pci/hda/hdacc.c        |  1 +
 3 files changed, 23 insertions(+)

diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c
index 5bb4dcd79af7..3a7dfc63637a 100644
--- a/sys/dev/sound/pci/hda/hdaa_patches.c
+++ b/sys/dev/sound/pci/hda/hdaa_patches.c
@@ -338,6 +338,26 @@ hdac_pin_patch(struct hdaa_widget *w)
 			patch_str = "as=3 seq=15 color=Black loc=Left";
 			break;
 		}
+	} else if (id == HDA_CODEC_ALC230 &&
+	    subid == LENOVO_I330_SUBVENDOR) {
+		switch (nid) {
+		case 20:
+			patch_str = "as=1 seq=0 device=Speaker";
+			break;
+		case 33:
+			patch_str = "as=1 seq=15 device=Headphones";
+			break;
+		}
+	} else if (id == HDA_CODEC_ALC269 &&
+	    subid == LENOVO_X230_SUBVENDOR) {
+		switch (nid) {
+		case 21:
+			patch_str = "as=1 seq=15";
+			break;
+		case 24:
+			patch_str = "as=4 seq=15";
+			break;
+		}
 	} else {
 		/*
 		 * loop over hdaa_model_pin_patch
diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h
index c3951edd362c..31bdc9130d9b 100644
--- a/sys/dev/sound/pci/hda/hdac.h
+++ b/sys/dev/sound/pci/hda/hdac.h
@@ -377,6 +377,7 @@
 #define	LENOVO_L5AMD_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x381b)
 #define	LENOVO_L5INTEL_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x380f)
 #define	LENOVO_3000_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x384e)
+#define	LENOVO_I330_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x3808)
 #define LENOVO_ALL_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0xffff)
 
 /* Samsung */
@@ -537,6 +538,7 @@
 #define HDA_CODEC_ALC221	HDA_CODEC_CONSTRUCT(REALTEK, 0x0221)
 #define HDA_CODEC_ALC222	HDA_CODEC_CONSTRUCT(REALTEK, 0x0222)
 #define HDA_CODEC_ALC225	HDA_CODEC_CONSTRUCT(REALTEK, 0x0225)
+#define HDA_CODEC_ALC230	HDA_CODEC_CONSTRUCT(REALTEK, 0x0230)
 #define HDA_CODEC_ALC231	HDA_CODEC_CONSTRUCT(REALTEK, 0x0231)
 #define HDA_CODEC_ALC233	HDA_CODEC_CONSTRUCT(REALTEK, 0x0233)
 #define HDA_CODEC_ALC234	HDA_CODEC_CONSTRUCT(REALTEK, 0x0234)
diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c
index f815e39392d4..123c64d9c487 100644
--- a/sys/dev/sound/pci/hda/hdacc.c
+++ b/sys/dev/sound/pci/hda/hdacc.c
@@ -79,6 +79,7 @@ static const struct {
 	{ HDA_CODEC_ALC221, 0,		"Realtek ALC221" },
 	{ HDA_CODEC_ALC222, 0,		"Realtek ALC222" },
 	{ HDA_CODEC_ALC225, 0,		"Realtek ALC225" },
+	{ HDA_CODEC_ALC230, 0,		"Realtek ALC230" },
 	{ HDA_CODEC_ALC231, 0,		"Realtek ALC231" },
 	{ HDA_CODEC_ALC233, 0,		"Realtek ALC233" },
 	{ HDA_CODEC_ALC234, 0,		"Realtek ALC234" },