From 4367e9e0fa3193dca6975f173defbf546e7be3df Mon Sep 17 00:00:00 2001 From: msaitoh Date: Thu, 28 Oct 2021 09:15:35 +0000 Subject: [PATCH] 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. --- sys/dev/pci/hdaudio_pci.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/sys/dev/pci/hdaudio_pci.c b/sys/dev/pci/hdaudio_pci.c index d712567de723..3436be8840c9 100644 --- a/sys/dev/pci/hdaudio_pci.c +++ b/sys/dev/pci/hdaudio_pci.c @@ -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 @@ -34,7 +34,7 @@ */ #include -__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 #include @@ -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, cfdata_t match, void *opaque) { 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