Module Name: src Committed By: jmcneill Date: Thu Sep 2 01:55:31 UTC 2010
Modified Files: src/sys/dev/pci/hdaudio: files.hdaudio hdaudio.c hdaudio_afg.c Added Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c hdaudio_ids.h Log Message: add a list of codec id->name mappings. they are printed at attach time and exported via the AUDIO_GETDEV ioctl To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/files.hdaudio cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/hdaudio/hdaudio_afg.c cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/hdaudio/hdaudio_ids.c \ src/sys/dev/pci/hdaudio/hdaudio_ids.h 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/files.hdaudio diff -u src/sys/dev/pci/hdaudio/files.hdaudio:1.2 src/sys/dev/pci/hdaudio/files.hdaudio:1.3 --- src/sys/dev/pci/hdaudio/files.hdaudio:1.2 Tue Sep 8 09:50:56 2009 +++ src/sys/dev/pci/hdaudio/files.hdaudio Thu Sep 2 01:55:31 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.hdaudio,v 1.2 2009/09/08 09:50:56 jmcneill Exp $ +# $NetBSD: files.hdaudio,v 1.3 2010/09/02 01:55:31 jmcneill Exp $ # # Intel High Definition Audio (Revision 1.0) @@ -6,6 +6,7 @@ define hdaudiobus {[nid = -1]} device hdaudio: hdaudiobus file dev/pci/hdaudio/hdaudio.c hdaudio +file dev/pci/hdaudio/hdaudio_ids.c hdaudio device hdafg: audiobus, auconv, aurateconv, mulaw attach hdafg at hdaudiobus Index: src/sys/dev/pci/hdaudio/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.7 src/sys/dev/pci/hdaudio/hdaudio.c:1.8 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.7 Sat Aug 7 16:24:19 2010 +++ src/sys/dev/pci/hdaudio/hdaudio.c Thu Sep 2 01:55:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.7 2010/08/07 16:24:19 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.8 2010/09/02 01:55:31 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd <supp...@precedence.co.uk> @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.7 2010/08/07 16:24:19 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.8 2010/09/02 01:55:31 jmcneill Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -619,7 +619,7 @@ aprint_normal("%s at %s", type, pnp); } - aprint_normal(" vendor 0x%04X product 0x%04X nid 0x%02X", + aprint_debug(" vendor 0x%04X product 0x%04X nid 0x%02X", vendor, product, nid); return UNCONF; Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.26 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.27 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.26 Thu Aug 19 18:06:37 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Thu Sep 2 01:55:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.26 2010/08/19 18:06:37 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.27 2010/09/02 01:55:31 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd <supp...@precedence.co.uk> @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.26 2010/08/19 18:06:37 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.27 2010/09/02 01:55:31 jmcneill Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -79,6 +79,7 @@ #include <dev/pci/hdaudio/hdaudioreg.h> #include <dev/pci/hdaudio/hdaudio_mixer.h> #include <dev/pci/hdaudio/hdaudioio.h> +#include <dev/pci/hdaudio/hdaudio_ids.h> #ifndef AUFMT_SURROUND_7_1 #define AUFMT_SURROUND_7_1 (AUFMT_DOLBY_5_1|AUFMT_SIDE_LEFT|AUFMT_SIDE_RIGHT) @@ -331,12 +332,6 @@ hdaudio_afg_childdet ); -static const struct audio_device hdaudio_afg_audio_device = { - "HD Audio", - "1.0", - "hdaudio" -}; - static int hdaudio_afg_query_encoding(void *, struct audio_encoding *); static int hdaudio_afg_set_params(void *, int, int, audio_params_t *, @@ -3163,6 +3158,7 @@ struct hdaudio_afg_softc *sc = device_private(self); audio_params_t defparams; prop_dictionary_t args = opaque; + char vendor[16], product[16]; uint64_t fgptr = 0; uint8_t nid = 0; int err; @@ -3180,8 +3176,15 @@ sc->sc_config = prop_dictionary_get(args, "pin-config"); if (sc->sc_config && prop_object_type(sc->sc_config) != PROP_TYPE_ARRAY) sc->sc_config = NULL; - hda_print1(sc, " (%s configuration)\n", sc->sc_config ? - "custom" : "firmware"); + + prop_dictionary_get_uint16(args, "vendor-id", &sc->sc_vendor); + prop_dictionary_get_uint16(args, "product-id", &sc->sc_product); + hdaudio_id2name(sc->sc_vendor, HDA_PRODUCT_ANY, + vendor, sizeof(vendor)); + hdaudio_id2name(sc->sc_vendor, sc->sc_product, + product, sizeof(product)); + hda_print1(sc, ": %s %s%s\n", vendor, product, + sc->sc_config ? " (custom configuration)" : ""); rv = prop_dictionary_get_uint64(args, "function-group", &fgptr); if (rv == false || fgptr == 0) { @@ -3193,8 +3196,6 @@ hda_error(sc, "missing node-id property\n"); return; } - prop_dictionary_get_uint16(args, "vendor-id", &sc->sc_vendor); - prop_dictionary_get_uint16(args, "product-id", &sc->sc_product); sc->sc_nid = nid; sc->sc_fg = (struct hdaudio_function_group *)(vaddr_t)fgptr; @@ -3448,7 +3449,16 @@ static int hdaudio_afg_getdev(void *opaque, struct audio_device *audiodev) { - *audiodev = hdaudio_afg_audio_device; + struct hdaudio_audiodev *ad = opaque; + struct hdaudio_afg_softc *sc = ad->ad_sc; + + hdaudio_id2name(sc->sc_vendor, HDA_PRODUCT_ANY, + audiodev->name, sizeof(audiodev->name)); + hdaudio_id2name(sc->sc_vendor, sc->sc_product, + audiodev->version, sizeof(audiodev->version)); + snprintf(audiodev->config, sizeof(audiodev->config) - 1, + "%02Xh", sc->sc_nid); + return 0; } Added files: Index: src/sys/dev/pci/hdaudio/hdaudio_ids.c diff -u /dev/null src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.1 --- /dev/null Thu Sep 2 01:55:31 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Thu Sep 2 01:55:31 2010 @@ -0,0 +1,259 @@ +/* $NetBSD: hdaudio_ids.c,v 1.1 2010/09/02 01:55:31 jmcneill Exp $ */ + +/* + * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca> + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Precedence Technologies Ltd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.1 2010/09/02 01:55:31 jmcneill Exp $"); + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/conf.h> + +#include <dev/pci/hdaudio/hdaudio_ids.h> + +static const struct hdaudio_id { + uint16_t vendor; + uint16_t product; + const char *name; +} hdaudio_ids[] = { + /* ATI */ + { HDA_VENDOR_ATI, 0x7919, "RS600 HDMI" }, + { HDA_VENDOR_ATI, 0x793c, "RS600 HDMI" }, + { HDA_VENDOR_ATI, 0x791a, "RS690/780 HDMI" }, + { HDA_VENDOR_ATI, 0xaa01, "RS600 HDMI" }, + { HDA_VENDOR_ATI, HDA_PRODUCT_ANY, "ATI" }, + /* NVIDIA */ + { HDA_VENDOR_NVIDIA, 0x0002, "MCP77/78 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x0003, "MCP77/78 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x0005, "MCP77/78 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x0006, "MCP77/78 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x0007, "MCP79/7A HDMI" }, + { HDA_VENDOR_NVIDIA, 0x000a, "GT220 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x000b, "GT21x HDMI" }, + { HDA_VENDOR_NVIDIA, 0x000c, "MCP89 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x000d, "GT240 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x0067, "MCP67 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x8001, "MCP73 HDMI" }, + { HDA_VENDOR_NVIDIA, HDA_PRODUCT_ANY, "NVIDIA" }, + /* Realtek */ + { HDA_VENDOR_REALTEK, 0x0260, "ALC260" }, + { HDA_VENDOR_REALTEK, 0x0262, "ALC262" }, + { HDA_VENDOR_REALTEK, 0x0267, "ALC267" }, + { HDA_VENDOR_REALTEK, 0x0268, "ALC268" }, + { HDA_VENDOR_REALTEK, 0x0269, "ALC269" }, + { HDA_VENDOR_REALTEK, 0x0270, "ALC270" }, + { HDA_VENDOR_REALTEK, 0x0272, "ALC272" }, + { HDA_VENDOR_REALTEK, 0x0275, "ALC275" }, + { HDA_VENDOR_REALTEK, 0x0660, "ALC660-VD" }, + { HDA_VENDOR_REALTEK, 0x0662, "ALC662" }, + { HDA_VENDOR_REALTEK, 0x0663, "ALC663" }, + { HDA_VENDOR_REALTEK, 0x0670, "ALC670" }, + { HDA_VENDOR_REALTEK, 0x0861, "ALC861" }, + { HDA_VENDOR_REALTEK, 0x0862, "ALC861-VD" }, + { HDA_VENDOR_REALTEK, 0x0880, "ALC880" }, + { HDA_VENDOR_REALTEK, 0x0882, "ALC882" }, + { HDA_VENDOR_REALTEK, 0x0883, "ALC883" }, + { HDA_VENDOR_REALTEK, 0x0885, "ALC885" }, + { HDA_VENDOR_REALTEK, 0x0887, "ALC887" }, + { HDA_VENDOR_REALTEK, 0x0888, "ALC888" }, + { HDA_VENDOR_REALTEK, 0x0889, "ALC889" }, + { HDA_VENDOR_REALTEK, 0x0892, "ALC892" }, + { HDA_VENDOR_REALTEK, HDA_PRODUCT_ANY, "Realtek" }, + /* VIA */ + { HDA_VENDOR_VIA, 0x1708, "VT1708" }, + { HDA_VENDOR_VIA, 0x1709, "VT1708" }, + { HDA_VENDOR_VIA, 0x170a, "VT1708" }, + { HDA_VENDOR_VIA, 0x170b, "VT1708" }, + { HDA_VENDOR_VIA, 0xe710, "VT1709 10ch" }, + { HDA_VENDOR_VIA, 0xe711, "VT1709 10ch" }, + { HDA_VENDOR_VIA, 0xe712, "VT1709 10ch" }, + { HDA_VENDOR_VIA, 0xe713, "VT1709 10ch" }, + { HDA_VENDOR_VIA, 0xe714, "VT1709 6ch" }, + { HDA_VENDOR_VIA, 0xe715, "VT1709 6ch" }, + { HDA_VENDOR_VIA, 0xe716, "VT1709 6ch" }, + { HDA_VENDOR_VIA, 0xe717, "VT1709 6ch" }, + { HDA_VENDOR_VIA, 0xe720, "VT1708B 8ch" }, + { HDA_VENDOR_VIA, 0xe721, "VT1708B 8ch" }, + { HDA_VENDOR_VIA, 0xe722, "VT1708B 8ch" }, + { HDA_VENDOR_VIA, 0xe723, "VT1708B 8ch" }, + { HDA_VENDOR_VIA, 0xe724, "VT1708B 4ch" }, + { HDA_VENDOR_VIA, 0xe725, "VT1708B 4ch" }, + { HDA_VENDOR_VIA, 0xe726, "VT1708B 4ch" }, + { HDA_VENDOR_VIA, 0xe727, "VT1708B 4ch" }, + { HDA_VENDOR_VIA, 0x0397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x1397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x2397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x3397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x4397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x5397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x6397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x7397, "VT1708S" }, + { HDA_VENDOR_VIA, 0x0398, "VT1702" }, + { HDA_VENDOR_VIA, 0x1398, "VT1702" }, + { HDA_VENDOR_VIA, 0x2398, "VT1702" }, + { HDA_VENDOR_VIA, 0x3398, "VT1702" }, + { HDA_VENDOR_VIA, 0x4398, "VT1702" }, + { HDA_VENDOR_VIA, 0x5398, "VT1702" }, + { HDA_VENDOR_VIA, 0x6398, "VT1702" }, + { HDA_VENDOR_VIA, 0x7398, "VT1702" }, + { HDA_VENDOR_VIA, 0x0428, "VT1718S" }, + { HDA_VENDOR_VIA, 0x4428, "VT1718S" }, + { HDA_VENDOR_VIA, 0x0441, "VT2020" }, + { HDA_VENDOR_VIA, 0x4441, "VT1828S" }, + { HDA_VENDOR_VIA, 0x0433, "VT1716S" }, + { HDA_VENDOR_VIA, 0xa721, "VT1716S" }, + { HDA_VENDOR_VIA, 0x0438, "VT2002P" }, + { HDA_VENDOR_VIA, 0x4438, "VT2002P" }, + { HDA_VENDOR_VIA, 0x0448, "VT1812" }, + { HDA_VENDOR_VIA, 0x0440, "VT1818S" }, + { HDA_VENDOR_VIA, HDA_PRODUCT_ANY, "VIA" }, + /* Analog Devices */ + { HDA_VENDOR_ANALOG_DEVICES, 0x184a, "AD1884A" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1882, "AD1882" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1883, "AD1883" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1884, "AD1884" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x194a, "AD1984A" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x194b, "AD1984B" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1981, "AD1981HD" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1983, "AD1983" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1984, "AD1984" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1986, "AD1986A" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x1988, "AD1988A" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x198b, "AD1988B" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x989a, "AD1989A" }, + { HDA_VENDOR_ANALOG_DEVICES, 0x989b, "AD1989B" }, + { HDA_VENDOR_ANALOG_DEVICES, HDA_PRODUCT_ANY, "ADI" }, + /* CMedia */ + { HDA_VENDOR_CMEDIA, 0x4980, "CMI9880" }, + { HDA_VENDOR_CMEDIA, HDA_PRODUCT_ANY, "CMedia" }, + /* Intel */ + { HDA_VENDOR_INTEL, 0x0054, "Q57 HDMI" }, + { HDA_VENDOR_INTEL, 0x2801, "G45 HDMI" }, + { HDA_VENDOR_INTEL, 0x2802, "G45 HDMI" }, + { HDA_VENDOR_INTEL, 0x2803, "G45 HDMI" }, + { HDA_VENDOR_INTEL, 0x2804, "G45 HDMI" }, + { HDA_VENDOR_INTEL, 0x29fb, "G45 HDMI" }, + { HDA_VENDOR_INTEL, HDA_PRODUCT_ANY, "Intel" }, + /* Sigmatel */ + { HDA_VENDOR_SIGMATEL, 0x7612, "STAC9230X" }, + { HDA_VENDOR_SIGMATEL, 0x7613, "STAC9230D" }, + { HDA_VENDOR_SIGMATEL, 0x7614, "STAC9229X" }, + { HDA_VENDOR_SIGMATEL, 0x7615, "STAC9229D" }, + { HDA_VENDOR_SIGMATEL, 0x7616, "STAC9228X" }, + { HDA_VENDOR_SIGMATEL, 0x7617, "STAC9228D" }, + { HDA_VENDOR_SIGMATEL, 0x7618, "STAC9227X" }, + { HDA_VENDOR_SIGMATEL, 0x7619, "STAC9227D" }, + { HDA_VENDOR_SIGMATEL, 0x7620, "STAC9274" }, + { HDA_VENDOR_SIGMATEL, 0x7621, "STAC9274D" }, + { HDA_VENDOR_SIGMATEL, 0x7622, "STAC9273X" }, + { HDA_VENDOR_SIGMATEL, 0x7623, "STAC9273D" }, + { HDA_VENDOR_SIGMATEL, 0x7624, "STAC9272X" }, + { HDA_VENDOR_SIGMATEL, 0x7625, "STAC9272D" }, + { HDA_VENDOR_SIGMATEL, 0x7626, "STAC9271X" }, + { HDA_VENDOR_SIGMATEL, 0x7627, "STAC9271D" }, + { HDA_VENDOR_SIGMATEL, 0x7628, "STAC9274X5NH" }, + { HDA_VENDOR_SIGMATEL, 0x7629, "STAC9274D5NH" }, + { HDA_VENDOR_SIGMATEL, 0x7632, "STAC9202" }, + { HDA_VENDOR_SIGMATEL, 0x7633, "STAC9202D" }, + { HDA_VENDOR_SIGMATEL, 0x7634, "STAC9250" }, + { HDA_VENDOR_SIGMATEL, 0x7635, "STAC9250D" }, + { HDA_VENDOR_SIGMATEL, 0x7636, "STAC9251" }, + { HDA_VENDOR_SIGMATEL, 0x7637, "STAC9250D" }, + { HDA_VENDOR_SIGMATEL, 0x7645, "92HD206X" }, + { HDA_VENDOR_SIGMATEL, 0x7646, "92HD206D" }, + { HDA_VENDOR_SIGMATEL, 0x7661, "CXD9872RD/K" }, + { HDA_VENDOR_SIGMATEL, 0x7662, "STAC9872AK" }, + { HDA_VENDOR_SIGMATEL, 0x7664, "CXD9872AKD" }, + { HDA_VENDOR_SIGMATEL, 0x7680, "STAC9221 A1" }, + { HDA_VENDOR_SIGMATEL, 0x7681, "STAC9220D" }, /* also 9223D A2 */ + { HDA_VENDOR_SIGMATEL, 0x7682, "STAC9221 A2" }, + { HDA_VENDOR_SIGMATEL, 0x7683, "STAC9221D" }, + { HDA_VENDOR_SIGMATEL, 0x7690, "STAC9200" }, + { HDA_VENDOR_SIGMATEL, 0x7691, "STAC9200D" }, + { HDA_VENDOR_SIGMATEL, 0x7698, "STAC9205" }, + { HDA_VENDOR_SIGMATEL, 0x76a0, "STAC9205" }, + { HDA_VENDOR_SIGMATEL, 0x76a1, "STAC9205D" }, + { HDA_VENDOR_SIGMATEL, 0x76a2, "STAC9204" }, + { HDA_VENDOR_SIGMATEL, 0x76a3, "STAC9204D" }, + { HDA_VENDOR_SIGMATEL, 0x76a4, "STAC9255" }, + { HDA_VENDOR_SIGMATEL, 0x76a5, "STAC9255D" }, + { HDA_VENDOR_SIGMATEL, 0x76a6, "STAC9254" }, + { HDA_VENDOR_SIGMATEL, 0x76a7, "STAC9254D" }, + { HDA_VENDOR_SIGMATEL, 0x7880, "STAC9220 A2" }, + { HDA_VENDOR_SIGMATEL, 0x7882, "STAC9220 A1" }, + { HDA_VENDOR_SIGMATEL, HDA_PRODUCT_ANY, "Sigmatel" }, + /* Sigmatel (alternate vendor ID) */ + { HDA_VENDOR_SIGMATEL2, 0x7603, "92HD75B3X5" }, + { HDA_VENDOR_SIGMATEL2, 0x7604, "92HD83C1X5" }, + { HDA_VENDOR_SIGMATEL2, 0x7605, "92HD81B1X5" }, + { HDA_VENDOR_SIGMATEL2, 0x7608, "92HD75B2X5" }, + { HDA_VENDOR_SIGMATEL2, 0x7666, "92HD88B3" }, + { HDA_VENDOR_SIGMATEL2, 0x7667, "92HD88B1" }, + { HDA_VENDOR_SIGMATEL2, 0x7668, "92HD88B2" }, + { HDA_VENDOR_SIGMATEL2, 0x7669, "92HD88B4" }, + { HDA_VENDOR_SIGMATEL2, 0x7674, "92HD73D1X5" }, + { HDA_VENDOR_SIGMATEL2, 0x7675, "92HD73C1X5" }, + { HDA_VENDOR_SIGMATEL2, 0x7676, "92HD73E1X5" }, + { HDA_VENDOR_SIGMATEL2, 0x76b0, "92HD71B8X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b1, "92HD71B8X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b2, "92HD71B7X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b3, "92HD71B7X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b4, "92HD71B6X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b5, "92HD71B6X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b6, "92HD71B5X" }, + { HDA_VENDOR_SIGMATEL2, 0x76b7, "92HD71B5X" }, + { HDA_VENDOR_SIGMATEL2, 0x76d4, "92HD83C1C5" }, + { HDA_VENDOR_SIGMATEL2, 0x76d5, "92HD81B1C5" }, + { HDA_VENDOR_SIGMATEL2, HDA_PRODUCT_ANY, "Sigmatel" }, +}; + +void +hdaudio_id2name(uint16_t vendor, uint16_t product, char *buf, size_t len) +{ + const char *name = NULL; + int i; + + memset(buf, 0, len); + for (i = 0; i < __arraycount(hdaudio_ids); i++) { + if (hdaudio_ids[i].vendor != vendor) + continue; + if (hdaudio_ids[i].product == product) { + name = hdaudio_ids[i].name; + break; + } + } + + if (name) + snprintf(buf, len - 1, "%s", name); + else if (product == HDA_PRODUCT_ANY) + snprintf(buf, len - 1, "vendor %04x", vendor); + else + snprintf(buf, len - 1, "product %04x", product); +} Index: src/sys/dev/pci/hdaudio/hdaudio_ids.h diff -u /dev/null src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.1 --- /dev/null Thu Sep 2 01:55:31 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.h Thu Sep 2 01:55:31 2010 @@ -0,0 +1,48 @@ +/* $NetBSD: hdaudio_ids.h,v 1.1 2010/09/02 01:55:31 jmcneill Exp $ */ + +/* + * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca> + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Precedence Technologies Ltd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _HDAUDIO_IDS_H +#define _HDAUDIO_IDS_H + +#define HDA_VENDOR_ATI 0x1002 +#define HDA_VENDOR_NVIDIA 0x10de +#define HDA_VENDOR_REALTEK 0x10ec +#define HDA_VENDOR_VIA 0x1106 +#define HDA_VENDOR_SIGMATEL2 0x111d +#define HDA_VENDOR_ANALOG_DEVICES 0x11d4 +#define HDA_VENDOR_CMEDIA 0x434d +#define HDA_VENDOR_INTEL 0x8086 +#define HDA_VENDOR_SIGMATEL 0x8384 + +#define HDA_PRODUCT_ANY 0xffff + +void hdaudio_id2name(uint16_t, uint16_t, char *, size_t); + +#endif /* !_HDAUDIO_IDS_H */