Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/hdaudio add a list of codec id->name mappings. t...
details: https://anonhg.NetBSD.org/src/rev/33c8daef0437
branches: trunk
changeset: 757522:33c8daef0437
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Sep 02 01:55:31 2010 +0000
description:
add a list of codec id->name mappings. they are printed at attach time
and exported via the AUDIO_GETDEV ioctl
diffstat:
sys/dev/pci/hdaudio/files.hdaudio | 3 +-
sys/dev/pci/hdaudio/hdaudio.c | 6 +-
sys/dev/pci/hdaudio/hdaudio_afg.c | 36 +++-
sys/dev/pci/hdaudio/hdaudio_ids.c | 259 ++++++++++++++++++++++++++++++++++++++
sys/dev/pci/hdaudio/hdaudio_ids.h | 48 +++++++
5 files changed, 335 insertions(+), 17 deletions(-)
diffs (truncated from 451 to 300 lines):
diff -r 27a69a54e451 -r 33c8daef0437 sys/dev/pci/hdaudio/files.hdaudio
--- a/sys/dev/pci/hdaudio/files.hdaudio Wed Sep 01 21:54:00 2010 +0000
+++ b/sys/dev/pci/hdaudio/files.hdaudio Thu Sep 02 01:55:31 2010 +0000
@@ -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
diff -r 27a69a54e451 -r 33c8daef0437 sys/dev/pci/hdaudio/hdaudio.c
--- a/sys/dev/pci/hdaudio/hdaudio.c Wed Sep 01 21:54:00 2010 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio.c Thu Sep 02 01:55:31 2010 +0000
@@ -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 <support%precedence.co.uk@localhost>
@@ -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;
diff -r 27a69a54e451 -r 33c8daef0437 sys/dev/pci/hdaudio/hdaudio_afg.c
--- a/sys/dev/pci/hdaudio/hdaudio_afg.c Wed Sep 01 21:54:00 2010 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_afg.c Thu Sep 02 01:55:31 2010 +0000
@@ -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 <support%precedence.co.uk@localhost>
@@ -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;
}
diff -r 27a69a54e451 -r 33c8daef0437 sys/dev/pci/hdaudio/hdaudio_ids.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_ids.c Thu Sep 02 01:55:31 2010 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
+ * 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" },
Home |
Main Index |
Thread Index |
Old Index