Module Name:    src
Committed By:   msaitoh
Date:           Thu Oct 28 09:15:36 UTC 2021

Modified Files:
        src/sys/dev/pci: hdaudio_pci.c

Log Message:
Support devices that the PCI subclass is not PCI_SUBCLASS_MULTIMEDIA_HDAUDIO.

 - Not tested well.
 - If audioX is not attached, add HDAUDIO_ENABLE_DISPLAYPORT and
   HDAUDIO_ENABLE_HDMI to your kernel config.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/hdaudio_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio_pci.c:1.10 src/sys/dev/pci/hdaudio_pci.c:1.11
--- src/sys/dev/pci/hdaudio_pci.c:1.10	Wed Sep 12 09:49:03 2018
+++ src/sys/dev/pci/hdaudio_pci.c	Thu Oct 28 09:15:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.10 2018/09/12 09:49:03 mrg Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.11 2021/10/28 09:15:35 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <supp...@precedence.co.uk>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.10 2018/09/12 09:49:03 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.11 2021/10/28 09:15:35 msaitoh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -84,6 +84,17 @@ CFATTACH_DECL2_NEW(
     hdaudio_pci_childdet
 );
 
+/* Some devices' sublcass is not PCI_SUBCLASS_MULTIMEDIA_HDAUDIO. */
+static const struct device_compatible_entry compat_data[] = {
+	{ .id = PCI_ID_CODE(PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_2HS_U_HDA) },
+	{ .id = PCI_ID_CODE(PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3HS_U_HDA) },
+	{ .id = PCI_ID_CODE(PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_4HS_H_CAVS) },
+	{ .id = PCI_ID_CODE(PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_5HS_LP_HDA) },
+	{ .id = PCI_ID_CODE(PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_JSL_CAVS) },
+
+	PCI_COMPAT_EOL
+};
+
 /*
  * NetBSD autoconfiguration
  */
@@ -93,12 +104,13 @@ hdaudio_pci_match(device_t parent, cfdat
 {
 	struct pci_attach_args *pa = opaque;
 
-	if (PCI_CLASS(pa->pa_class) != PCI_CLASS_MULTIMEDIA)
-		return 0;
-	if (PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_MULTIMEDIA_HDAUDIO)
-		return 0;
+	if ((PCI_CLASS(pa->pa_class) == PCI_CLASS_MULTIMEDIA) &&
+	    (PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MULTIMEDIA_HDAUDIO))
+		return 10;
+	if (pci_compatible_match(pa, compat_data) != 0)
+		return 10;
 
-	return 10;
+	return 0;
 }
 
 static void

Reply via email to