git: 08dfec6cf282 - stable/13 - snd_hda(4): Fix sound on headset jack for ThinkPad T51.

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Thu, 24 Mar 2022 13:55:07 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=08dfec6cf28249de5c908c89d36fbe1592f10acc

commit 08dfec6cf28249de5c908c89d36fbe1592f10acc
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2021-07-12 05:43:56 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-03-24 13:52:37 +0000

    snd_hda(4): Fix sound on headset jack for ThinkPad T51.
    
    sys/dev/sound/pci/hda/hdaa_patches.c:
     match_pin_patches: Use HDA_DEV_MATCH instead of regular ==
    
    sys/dev/sound/pci/hda/pin_patch_realtek.h:
     Add quirk for Lenovo laptops when ALC298 is used.
    
    (cherry picked from commit c43bf3f59161ac697a1c3a0a3f9326d4d15216c9)
---
 sys/dev/sound/pci/hda/hdaa_patches.c      |  2 +-
 sys/dev/sound/pci/hda/pin_patch_realtek.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c
index 265697901a2b..45577819e897 100644
--- a/sys/dev/sound/pci/hda/hdaa_patches.c
+++ b/sys/dev/sound/pci/hda/hdaa_patches.c
@@ -157,7 +157,7 @@ match_pin_patches(int vendor_id, int vendor_subid)
 			continue;
 		for (struct model_pin_patch_t *pp =  p->patches; pp->models; pp++) {
 			for (struct pin_machine_model_t *model = pp->models; model->id != 0; model++) {
-				if (vendor_subid == model->id)
+				if (HDA_DEV_MATCH(model->id, vendor_subid))
 					return (pp->pin_patches);
 			}
 		}
diff --git a/sys/dev/sound/pci/hda/pin_patch_realtek.h b/sys/dev/sound/pci/hda/pin_patch_realtek.h
index 02a8d68bee6d..f8f27aedca14 100644
--- a/sys/dev/sound/pci/hda/pin_patch_realtek.h
+++ b/sys/dev/sound/pci/hda/pin_patch_realtek.h
@@ -648,6 +648,17 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = {
 					{ }
 				},
 				.pin_patches = pin_patches_dell_xps_jack
+			},
+			{
+				.models = (struct pin_machine_model_t[]){
+					PIN_SUBVENDOR(LENOVO_ALL_SUBVENDOR),
+					{ }
+				},
+				.pin_patches = (struct pin_patch_t[]){
+					PIN_PATCH_DOCK_LINE_OUT(23),
+					PIN_PATCH_HP_OUT(33),
+					{ }
+				},
 			}, { }
 		}
 	}, { /**** CODEC: HDA_CODEC_ALC861 ****/