CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: sborrill Date: Sun Sep 6 17:33:53 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudio_afg.c hdaudio_mixer.h hdaudio_pci.c hdaudioio.h hdaudioreg.h hdaudiovar.h Log Message: *blush* Spell my own company name correctly. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/hdaudio/hdaudio.c \ src/sys/dev/pci/hdaudio/hdaudio_afg.c \ src/sys/dev/pci/hdaudio/hdaudio_mixer.h \ src/sys/dev/pci/hdaudio/hdaudio_pci.c src/sys/dev/pci/hdaudio/hdaudioio.h \ src/sys/dev/pci/hdaudio/hdaudioreg.h src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.1 src/sys/dev/pci/hdaudio/hdaudio.c:1.2 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sun Sep 6 17:33:53 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: hdaudio.c,v 1.1 2009/09/06 17:25:56 sborrill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ /* - * Copyright (c) 2009 Precedence Techologies Ltd + * Copyright (c) 2009 Precedence Technologies Ltd * Copyright (c) 2009 Jared D. McNeill * All rights reserved. * @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.1 2009/09/06 17:25:56 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $"); #include #include Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.1 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.2 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Sep 6 17:33:53 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: hdaudio_afg.c,v 1.1 2009/09/06 17:25:56 sborrill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ /* - * Copyright (c) 2009 Precedence Techologies Ltd + * Copyright (c) 2009 Precedence Technologies Ltd * Copyright (c) 2009 Jared D. McNeill * All rights reserved. * @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.1 2009/09/06 17:25:56 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $"); #include #include Index: src/sys/dev/pci/hdaudio/hdaudio_mixer.h diff -u src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.1 src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.2 --- src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_mixer.h Sun Sep 6 17:33:53 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: hdaudio_mixer.h,v 1.1 2009/09/06 17:25:56 sborrill Exp $ */ +/* $NetBSD: hdaudio_mixer.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ /* - * Copyright (c) 2009 Precedence Techologies Ltd + * Copyright (c) 2009 Precedence Technologies Ltd * Copyright (c) 2009 Jared D. McNeill * All rights reserved. * Index: src/sys/dev/pci/hdaudio/hdaudio_pci.c diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.1 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.2 --- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_pci.c Sun Sep 6 17:33:53 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: hdaudio_pci.c,v 1.1 2009/09/06 17:25:56 sborrill Exp $ */ +/* $NetBSD: hdaudio_pci.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ /* - * Copyright (c) 2009 Precedence Techologies Ltd + * Copyright (c) 2009 Precedence Technologies Ltd * Copyright (c) 2009 Jared D. McNeill * All rights reserved. * @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.1 2009/09/06 17:25:56 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $"); #include #include Index: src/sys/dev/pci/hdaudio/hdaudioio.h diff -u src/sys/dev/pci/hdaudio/hdaudioio.h:1.1 src/sys/dev/pci/hdaudio/hdaudioio.h:1.2 --- src/sys/dev/pci/hdaudio/hdaudioio.h:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/hdaudioio.h Sun Sep 6 17:33:53 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: hdaudioio.h,v 1.1 2009/09/06 17:25:56 sborrill Exp $ */ +/* $NetBSD: hdaudioio.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ /* - * Copyright (c) 2009 Precedence Techologies Ltd + * Copyright (c) 2009 Precedence Technologies Ltd * Copyright (c) 2009 Jared D. McNeill * All rights reserved. * Index: src/sys/dev/pci/hdaudio/hdaudioreg.h diff -u src/sys/dev/pci/hdaudio/hdaudioreg.h:1.1 src/sys/dev/pci/hdaudio/hdaudioreg.h:1.2 --- src/sys/dev/pci/hdaudio/hdaudioreg.h:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/hdaudioreg.h Sun Sep 6 17:33:53 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: hdaudioreg.h,v 1.1 2009/09/06 17:25:56 sborrill Exp $ */ +/* $NetBSD: hdaudioreg.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ /* - * Copyright (c) 2009 Precedence Techologies Ltd + * Copyri
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: rmind Date: Sun Sep 6 21:38:17 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudioreg.h hdaudiovar.h Log Message: Replace GCC attributes with __packed. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudioreg.h \ src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudioreg.h diff -u src/sys/dev/pci/hdaudio/hdaudioreg.h:1.2 src/sys/dev/pci/hdaudio/hdaudioreg.h:1.3 --- src/sys/dev/pci/hdaudio/hdaudioreg.h:1.2 Sun Sep 6 17:33:53 2009 +++ src/sys/dev/pci/hdaudio/hdaudioreg.h Sun Sep 6 21:38:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudioreg.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ +/* $NetBSD: hdaudioreg.h,v 1.3 2009/09/06 21:38:17 rmind Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -352,6 +352,6 @@ uint32_t resp_ex; #define RIRB_CODEC_ID(entry) ((entry)->resp_ex & 0xf) #define RIRB_UNSOL(entry) ((entry)->resp_ex & 0x10) -} __attribute__((__packed__)); +} __packed; #endif /* !_HDAUDIOREG_H */ Index: src/sys/dev/pci/hdaudio/hdaudiovar.h diff -u src/sys/dev/pci/hdaudio/hdaudiovar.h:1.2 src/sys/dev/pci/hdaudio/hdaudiovar.h:1.3 --- src/sys/dev/pci/hdaudio/hdaudiovar.h:1.2 Sun Sep 6 17:33:53 2009 +++ src/sys/dev/pci/hdaudio/hdaudiovar.h Sun Sep 6 21:38:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudiovar.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ +/* $NetBSD: hdaudiovar.h,v 1.3 2009/09/06 21:38:17 rmind Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -102,7 +102,7 @@ struct hdaudio_dma_position { uint32_t position; uint32_t reserved; -} __attribute__((__packed__)); +} __packed; struct hdaudio_bdl_entry { uint32_t address_lo; @@ -110,7 +110,7 @@ uint32_t length; uint32_t flags; #define HDAUDIO_BDL_ENTRY_IOC 0x0001 -} __attribute__((__packed__)); +} __packed; #define HDAUDIO_BDL_MAX 256
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 02:04:43 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Add missing colour White (Eh) to hdaudio_afg_color[] table. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.2 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.3 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.2 Sun Sep 6 17:33:53 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Mon Sep 7 02:04:43 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.3 2009/09/07 02:04:43 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.3 2009/09/07 02:04:43 jmcneill Exp $"); #include #include @@ -148,6 +148,7 @@ "ReservedB", "ReservedC", "ReservedD", + "White", "Other" };
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 11:49:27 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_mixer.h Log Message: Don't name the beeper inputs.speaker, or MI audio might get confused. Name it inputs.beep instead so play.gain doesn't get mapped to it. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudio_mixer.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/hdaudio_mixer.h diff -u src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.2 src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.3 --- src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.2 Sun Sep 6 17:33:53 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_mixer.h Mon Sep 7 11:49:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_mixer.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ +/* $NetBSD: hdaudio_mixer.h,v 1.3 2009/09/07 11:49:27 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -65,7 +65,7 @@ #define HDAUDIO_DEVICE_NAMES { \ AudioNmaster, AudioNbass, AudioNtreble, AudioNfmsynth, AudioNdac, \ - AudioNspeaker, AudioNline, AudioNmicrophone, AudioNcd, \ + "beep", AudioNline, AudioNmicrophone, AudioNcd, \ AudioNrecord, AudioNdac"2", "reclvl", AudioNinput, AudioNoutput, \ AudioNline"1", AudioNline"2", AudioNline"3", \ "dig1", "dig2", "dig3", "phin", "phout", \
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 11:50:02 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Remove hdaudio.gpio.* mixer controls, they didn't work anyway. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.3 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.4 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.3 Mon Sep 7 02:04:43 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Mon Sep 7 11:50:01 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.3 2009/09/07 02:04:43 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.3 2009/09/07 02:04:43 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $"); #include #include @@ -98,8 +98,7 @@ #define HDAUDIO_MIXER_CLASS_OUTPUTS 0 #define HDAUDIO_MIXER_CLASS_INPUTS 1 #define HDAUDIO_MIXER_CLASS_RECORD 2 -#define HDAUDIO_MIXER_CLASS_HDAUDIO 3 -#define HDAUDIO_MIXER_CLASS_LAST HDAUDIO_MIXER_CLASS_HDAUDIO +#define HDAUDIO_MIXER_CLASS_LAST HDAUDIO_MIXER_CLASS_RECORD #define HDAUDIO_GPIO_MASK 0 #define HDAUDIO_GPIO_DIR 1 @@ -285,8 +284,6 @@ intsc_nmixers; struct hdaudio_mixer *sc_mixers; - intsc_gpioindex[3]; - intsc_pchan, sc_rchan; intsc_curpchan, sc_currchan; @@ -992,8 +989,6 @@ uint32_t nodecnt; int nid; - sc->sc_gpioindex[0] = sc->sc_gpioindex[1] = sc->sc_gpioindex[2] = -1; - nodecnt = hda_get_param(sc, SUBORDINATE_NODE_COUNT); sc->sc_startnode = COP_NODECNT_STARTNODE(nodecnt); sc->sc_nwidgets = COP_NODECNT_NUMNODES(nodecnt); @@ -2422,11 +2417,8 @@ ++nmixers; if (nadc > 0) ++nmixers; - /* Make room for gpio controls */ - if (numgpio > 0) - nmixers += 3; - hda_trace(sc, " need %d mixers (4 classes%s)\n", + hda_trace(sc, " need %d mixers (3 classes%s)\n", nmixers, needmasterctl ? " + fake master" : ""); /* Allocate memory for the mixers */ @@ -2450,53 +2442,6 @@ case HDAUDIO_MIXER_CLASS_RECORD: strcpy(mx[index].mx_di.label.name, AudioCrecord); break; - case HDAUDIO_MIXER_CLASS_HDAUDIO: - strcpy(mx[index].mx_di.label.name, "hdaudio"); - break; - } - ++index; - } - - /* DAC selector */ - if (ndac > 0) { - mx[index].mx_ctl = NULL; - mx[index].mx_di.index = index; - mx[index].mx_di.type = AUDIO_MIXER_SET; - mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS; - mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST; - strcpy(mx[index].mx_di.label.name, AudioNselect); - mx[index].mx_di.un.s.num_mem = ndac; - for (i = 0, j = 0; i < sc->sc_nassocs; i++) { - if (sc->sc_assocs[i].as_enable == false) -continue; - if (sc->sc_assocs[i].as_dir != HDAUDIO_PINDIR_OUT) -continue; - mx[index].mx_di.un.s.member[j].mask = 1 << i; - sprintf(mx[index].mx_di.un.s.member[j].label.name, - "DAC%02X", i); - ++j; - } - ++index; - } - - /* ADC selector */ - if (nadc > 0) { - mx[index].mx_ctl = NULL; - mx[index].mx_di.index = index; - mx[index].mx_di.type = AUDIO_MIXER_SET; - mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_RECORD; - mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST; - strcpy(mx[index].mx_di.label.name, AudioNsource); - mx[index].mx_di.un.s.num_mem = nadc; - for (i = 0, j = 0; i < sc->sc_nassocs; i++) { - if (sc->sc_assocs[i].as_enable == false) -continue; - if (sc->sc_assocs[i].as_dir != HDAUDIO_PINDIR_IN) -continue; - mx[index].mx_di.un.s.member[j].mask = 1 << i; - sprintf(mx[index].mx_di.un.s.member[j].label.name, - "ADC%02X", i); - ++j; } ++index; } @@ -2556,47 +2501,50 @@ ++index; } - /* GPIO controls */ - if (numgpio > 0) { - /* mask */ - sc->sc_gpioindex[HDAUDIO_GPIO_MASK] = index; - mx[index].mx_ctl = NULL; - mx[index].mx_di.index = index; - mx[index].mx_di.type = AUDIO_MIXER_VALUE; - mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_HDAUDIO; - mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST; - mx[index].mx_di.un.v.num_channels = 1; - mx[index].mx_di.un.v.delta = 1; - strcpy(mx[index].mx_di.label.name, "gpio.mask"); - strcpy(mx[index].mx_di.un.v.units.name, "bitmask"); - ++index; - /* direction */ - sc->sc_gpioindex[HDAUDIO_GPIO_DIR] = index; + /* DAC selector */ + if (ndac > 0) { mx[index].mx_ctl = NULL; mx[index].mx_di.index = index; - mx[index].mx_di.type = AUDIO_MIXER_VALUE; - mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_HDAUDIO; + mx[index].mx_di.type = AUDIO_MIXER_SET; + mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS; mx[index].mx_di.prev = mx[index].mx_di.next =
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 11:59:53 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Until MI audio can handle it better, rename outputs.select -> outputs.dacsel. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.4 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.5 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.4 Mon Sep 7 11:50:01 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Mon Sep 7 11:59:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $"); #include #include @@ -2508,7 +2508,7 @@ mx[index].mx_di.type = AUDIO_MIXER_SET; mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS; mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST; - strcpy(mx[index].mx_di.label.name, AudioNselect); + strcpy(mx[index].mx_di.label.name, "dacsel"); /* AudioNselect */ mx[index].mx_di.un.s.num_mem = ndac; for (i = 0, j = 0; i < sc->sc_nassocs; i++) { if (sc->sc_assocs[i].as_enable == false)
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 16:21:08 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudio_afg.c hdaudiovar.h Log Message: Add support for formats other than 16bit/48kHz. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudio_afg.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.2 src/sys/dev/pci/hdaudio/hdaudio.c:1.3 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.2 Sun Sep 6 17:33:53 2009 +++ src/sys/dev/pci/hdaudio/hdaudio.c Mon Sep 7 16:21:08 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $"); #include #include @@ -948,6 +948,77 @@ mutex_exit(&sc->sc_stream_mtx); } +/* + * Convert most of audio_params_t to stream fmt descriptor; noticably missing + * is the # channels bits, as this is encoded differently in codec and + * stream descriptors. + * + * TODO: validate that the stream and selected codecs can handle the fmt + */ +uint16_t +hdaudio_stream_param(struct hdaudio_stream *st, const audio_params_t *param) +{ + uint16_t fmt = 0; + + switch (param->sample_rate) { + case 8000: + fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) | + HDAUDIO_FMT_DIV(6); + break; + case 11025: + fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(1) | + HDAUDIO_FMT_DIV(4); + break; + case 16000: + fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) | + HDAUDIO_FMT_DIV(3); + break; + case 22050: + fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(1) | + HDAUDIO_FMT_DIV(2); + break; + case 32000: + fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(2) | + HDAUDIO_FMT_DIV(3); + break; + case 44100: + fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(1); + break; + case 48000: + fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1); + break; + case 88200: + fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(2); + break; + case 96000: + fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(2); + break; + case 176400: + fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(4); + break; + case 192000: + fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(4); + break; + default: + return 0; + } + + if (param->precision == 16 && param->validbits == 8) + fmt |= HDAUDIO_FMT_BITS_8_16; + else if (param->precision == 16 && param->validbits == 16) + fmt |= HDAUDIO_FMT_BITS_16_16; + else if (param->precision == 32 && param->validbits == 20) + fmt |= HDAUDIO_FMT_BITS_20_32; + else if (param->precision == 32 && param->validbits == 24) + fmt |= HDAUDIO_FMT_BITS_24_32; + else if (param->precision == 32 && param->validbits == 32) + fmt |= HDAUDIO_FMT_BITS_32_32; + else + return 0; + + return fmt; +} + void hdaudio_stream_reset(struct hdaudio_stream *st) { @@ -996,6 +1067,7 @@ struct hdaudio_bdl_entry *bdl; uint64_t dmaaddr; uint32_t intctl; + uint16_t fmt; uint8_t ctl0, ctl2; int cnt, snum = st->st_shift; @@ -1050,15 +1122,10 @@ /* * Program stream format - * - * XXX 48kHz, 16-bit, stereo for now */ - hda_write2(sc, HDAUDIO_SD_FMT(snum), - HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) | - HDAUDIO_FMT_DIV(1) | HDAUDIO_FMT_BITS_16_16 | - HDAUDIO_FMT_CHAN(params->channels)); - - /* XXX program codecs for stream number */ + fmt = hdaudio_stream_param(st, params) | + HDAUDIO_FMT_CHAN(params->channels); + hda_write2(sc, HDAUDIO_SD_FMT(snum), fmt); /* * Switch on interrupts for this stream Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.5 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.6 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.5 Mon Sep 7 11:59:53 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Mon Sep 7 16:21:08 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $"); #include #include @@ -151,7 +151,7 @@ "Other" }; -#define HDAUDIO_MAXFORMATS 10 +#define HDAUDIO_MAXFORMATS 24 #define HDAUDIO_MAXCONNECTIONS 32 #define HDAUDIO_MAXPINS 16 #define HDAUDIO_PARSE_MAXDEPTH 10 @@ -285,7 +285,7 @@ struct hdaudio_mixer *sc_mixers; in
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 16:35:02 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c Log Message: Avoid setting up bus_dma w/ BUS_DMA_WAITOK while sc_stream_mtx is held. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.3 src/sys/dev/pci/hdaudio/hdaudio.c:1.4 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.3 Mon Sep 7 16:21:08 2009 +++ src/sys/dev/pci/hdaudio/hdaudio.c Mon Sep 7 16:35:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.4 2009/09/07 16:35:02 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4 2009/09/07 16:35:02 jmcneill Exp $"); #include #include @@ -901,8 +901,14 @@ void *cookie) { struct hdaudio_stream *st; + struct hdaudio_dma dma; int i, err; + dma.dma_size = sizeof(struct hdaudio_bdl_entry) * HDAUDIO_BDL_MAX; + err = hdaudio_dma_alloc(sc, &dma, BUS_DMA_COHERENT | BUS_DMA_NOCACHE); + if (err) + return NULL; + mutex_enter(&sc->sc_stream_mtx); for (i = 0; i < HDAUDIO_MAX_STREAMS; i++) { st = &sc->sc_stream[i]; @@ -914,22 +920,17 @@ continue; /* Allocate stream */ - st->st_bdl.dma_size = sizeof(struct hdaudio_bdl_entry) * - HDAUDIO_BDL_MAX; - err = hdaudio_dma_alloc(sc, &st->st_bdl, - BUS_DMA_COHERENT | BUS_DMA_NOCACHE); - if (!err) { - st->st_intr = intr; - st->st_cookie = cookie; - sc->sc_stream_mask |= (1 << i); - } else - st = NULL; + st->st_bdl = dma; + st->st_intr = intr; + st->st_cookie = cookie; + sc->sc_stream_mask |= (1 << i); mutex_exit(&sc->sc_stream_mtx); return st; } mutex_exit(&sc->sc_stream_mtx); /* No streams of requested type available */ + hdaudio_dma_free(sc, &dma); return NULL; }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 7 16:41:37 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Properly initialize struct audio_format when applying the 0ch workaround. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.6 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.7 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.6 Mon Sep 7 16:21:08 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Mon Sep 7 16:41:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.7 2009/09/07 16:41:37 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.7 2009/09/07 16:41:37 jmcneill Exp $"); #include #include @@ -2908,8 +2908,16 @@ * the direction. */ if (sc->sc_rchan == 0 || sc->sc_pchan == 0) { + memset(&f, 0, sizeof(f)); + f.driver_data = NULL; + f.mode = 0; + f.encoding = AUDIO_ENCODING_SLINEAR_LE; + f.validbits = 16; + f.precision = 16; f.channels = 2; f.channel_mask = AUFMT_STEREO; + f.frequency_type = 0; + f.frequency[0] = f.frequency[1] = 48000; f.mode = AUMODE_PLAY|AUMODE_RECORD; hdaudio_afg_append_formats(&sc->sc_audiodev, &f); }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Tue Sep 8 09:50:56 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: files.hdaudio Log Message: PR# kern/42007: hdaudio panics on P5W DH Deluxe (amd64) Make sure hdafg pulls in auconv mulaw support. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/hdaudio/files.hdaudio 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.1 src/sys/dev/pci/hdaudio/files.hdaudio:1.2 --- src/sys/dev/pci/hdaudio/files.hdaudio:1.1 Sun Sep 6 17:25:56 2009 +++ src/sys/dev/pci/hdaudio/files.hdaudio Tue Sep 8 09:50:56 2009 @@ -1,13 +1,13 @@ -# $NetBSD: files.hdaudio,v 1.1 2009/09/06 17:25:56 sborrill Exp $ +# $NetBSD: files.hdaudio,v 1.2 2009/09/08 09:50:56 jmcneill Exp $ # # Intel High Definition Audio (Revision 1.0) # define hdaudiobus {[nid = -1]} -device hdaudio: hdaudiobus, auconv, aurateconv +device hdaudio: hdaudiobus file dev/pci/hdaudio/hdaudio.c hdaudio -device hdafg: audiobus, auconv, aurateconv +device hdafg: audiobus, auconv, aurateconv, mulaw attach hdafg at hdaudiobus file dev/pci/hdaudio/hdaudio_afg.c hdafg
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: drochner Date: Tue Sep 8 18:33:24 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: fix scaling of mixer gain values: the register can be smaller than 7 bits, this is told by some "step" parameter read from the hardware (fixes problems with a 5-bit register observed by Nicolas Joly and me) approved by Jared D. McNeill To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.7 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.8 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.7 Mon Sep 7 16:41:37 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Tue Sep 8 18:33:24 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.7 2009/09/07 16:41:37 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.8 2009/09/08 18:33:24 drochner Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.7 2009/09/07 16:41:37 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.8 2009/09/08 18:33:24 drochner Exp $"); #include #include @@ -3390,8 +3390,8 @@ } hdaudio_afg_control_amp_set(ctl, HDAUDIO_AMP_MUTE_NONE, - mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] / 2, - mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] / 2); + mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] / (255 / ctl->ctl_step), + mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] / (255 / ctl->ctl_step)); return 0; } @@ -3434,8 +3434,10 @@ return 0; } - mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = ctl->ctl_left * 2; - mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = ctl->ctl_right * 2; + mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = + ctl->ctl_left * (255 / ctl->ctl_step); + mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = + ctl->ctl_right * (255 / ctl->ctl_step); return 0; }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Wed Sep 9 01:39:51 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Switch on input monitor support. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.8 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.9 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.8 Tue Sep 8 18:33:24 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Wed Sep 9 01:39:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.8 2009/09/08 18:33:24 drochner Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.9 2009/09/09 01:39:51 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.8 2009/09/08 18:33:24 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.9 2009/09/09 01:39:51 jmcneill Exp $"); #include #include @@ -1479,13 +1479,10 @@ static void hdaudio_afg_assoc_trace_misc(struct hdaudio_afg_softc *sc) { -#if notyet struct hdaudio_assoc *as = sc->sc_assocs; -#endif struct hdaudio_widget *w; int j; -#if notyet /* Input monitor */ /* * Find mixer associated with input, but supplying signal @@ -1505,7 +1502,6 @@ w->w_audiodev = HDAUDIO_MIXER_IMIX; } } -#endif /* Beeper */ for (j = sc->sc_startnode; j < sc->sc_endnode; j++) {
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: drochner Date: Wed Sep 9 11:47:24 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: catch the case where a mixer's "step" value is 0 (read from the hardware), while such a mixer is likely not very useful it should not cause a division by 0 (should fix the crash reported by Tobias Nygren) To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.9 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.10 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.9 Wed Sep 9 01:39:51 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Wed Sep 9 11:47:24 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.9 2009/09/09 01:39:51 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.10 2009/09/09 11:47:24 drochner Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.9 2009/09/09 01:39:51 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.10 2009/09/09 11:47:24 drochner Exp $"); #include #include @@ -3355,7 +3355,7 @@ struct hdaudio_afg_softc *sc = ad->ad_sc; struct hdaudio_mixer *mx; struct hdaudio_control *ctl; - int i; + int i, divisor; if (mc->dev < 0 || mc->dev >= sc->sc_nmixers) return EINVAL; @@ -3385,9 +3385,14 @@ return 0; } + if (ctl->ctl_step == 0) + divisor = 128; /* ??? - just avoid div by 0 */ + else + divisor = 255 / ctl->ctl_step; + hdaudio_afg_control_amp_set(ctl, HDAUDIO_AMP_MUTE_NONE, - mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] / (255 / ctl->ctl_step), - mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] / (255 / ctl->ctl_step)); + mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] / divisor, + mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] / divisor); return 0; } @@ -3400,7 +3405,7 @@ struct hdaudio_mixer *mx; struct hdaudio_control *ctl; u_int mask = 0; - int i; + int i, factor; if (mc->dev < 0 || mc->dev >= sc->sc_nmixers) return EINVAL; @@ -3430,10 +3435,13 @@ return 0; } - mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = - ctl->ctl_left * (255 / ctl->ctl_step); - mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = - ctl->ctl_right * (255 / ctl->ctl_step); + if (ctl->ctl_step == 0) + factor = 128; /* ??? - just avoid div by 0 */ + else + factor = 255 / ctl->ctl_step; + + mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = ctl->ctl_left * factor; + mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = ctl->ctl_right * factor; return 0; }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: apb Date: Thu Sep 17 18:48:47 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Change a few hda_error to hda_debug. Fixes "WARNING: 4 errors while detecting hardware; check system log." when I boot. OK jmcneill. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.10 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.11 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.10 Wed Sep 9 11:47:24 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Thu Sep 17 18:48:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.10 2009/09/09 11:47:24 drochner Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.11 2009/09/17 18:48:47 apb Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.10 2009/09/09 11:47:24 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.11 2009/09/17 18:48:47 apb Exp $"); #include #include @@ -396,7 +396,7 @@ return NULL; } if (nid < sc->sc_startnode || nid >= sc->sc_endnode) { - hda_error(sc, "nid %02X out of range (%02X-%02X)\n", + hda_debug(sc, "nid %02X out of range (%02X-%02X)\n", nid, sc->sc_startnode, sc->sc_endnode); return NULL; } @@ -471,7 +471,7 @@ } } if (cnid < sc->sc_startnode || cnid >= sc->sc_endnode) -hda_error(sc, "ghost nid=%02X\n", cnid); +hda_debug(sc, "ghost nid=%02X\n", cnid); if (CONN_RANGE(res, entnum, j) == 0) addcnid = cnid; else if (prevcnid == 0 || prevcnid >= cnid) { @@ -1543,18 +1543,18 @@ goto retry; } if (!res) { - hda_error(sc, "disable assoc %d (%d) [trace failed]\n", + hda_debug(sc, "disable assoc %d (%d) [trace failed]\n", j, as[j].as_index); for (i = 0; i < HDAUDIO_MAXPINS; i++) { if (as[j].as_pins[i] == 0) continue; -hda_error(sc, " assoc %d pin%d: %02X\n", j, i, +hda_debug(sc, " assoc %d pin%d: %02X\n", j, i, as[j].as_pins[i]); } for (i = 0; i < HDAUDIO_MAXPINS; i++) { if (as[j].as_dacs[i] == 0) continue; -hda_error(sc, " assoc %d dac%d: %02X\n", j, i, +hda_debug(sc, " assoc %d dac%d: %02X\n", j, i, as[j].as_dacs[i]); }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: sborrill Date: Fri Sep 25 19:49:31 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: If the codec does not specify any supported sample size or rates, assume it supports 16-bit. This can be overridden completely by the widgets, so some vendors don't specify a setting at the codec level. Fixes a panic in this situation. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.11 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.12 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.11 Thu Sep 17 18:48:47 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Sep 25 19:49:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.11 2009/09/17 18:48:47 apb Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.12 2009/09/25 19:49:31 sborrill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.11 2009/09/17 18:48:47 apb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.12 2009/09/25 19:49:31 sborrill Exp $"); #include #include @@ -2794,11 +2794,11 @@ static bool hdaudio_afg_probe_encoding(struct hdaudio_afg_softc *sc, -u_int minrate, u_int maxrate, u_int validbits, u_int precision) +u_int minrate, u_int maxrate, u_int validbits, u_int precision, bool force) { struct audio_format f; - if (hdaudio_afg_bits_supported(sc, validbits) == false) + if (!force && hdaudio_afg_bits_supported(sc, validbits) == false) return false; memset(&f, 0, sizeof(f)); @@ -2885,17 +2885,22 @@ if (minrate != maxrate) hda_print1(sc, "-%uHz", maxrate); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 8, 16)) + if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 8, 16, false)) hda_print1(sc, " 8/16"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16)) + if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, false)) hda_print1(sc, " 16/16"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 20, 32)) + if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 20, 32, false)) hda_print1(sc, " 20/32"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 24, 32)) + if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 24, 32, false)) hda_print1(sc, " 24/32"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 32, 32)) + if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 32, 32, false)) hda_print1(sc, " 32/32"); + if (sc->sc_audiodev.ad_nformats == 0) { + hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, true); + hda_print1(sc, " 16/16*"); + } + /* * XXX JDM 20090614 * MI audio assumes that at least one playback and one capture format
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sat Sep 26 17:05:01 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: PR# kern/42110: No mute control on hdaudio(4) PR# kern/42028: hdaudio: mplayer can't change volume Since the driver is not limited to OSS mixer APIs, allow for duplicate mixer nodes with the same role. Resolves a regression where certain controls may no longer be available that were previously possible with azalia(4). Part of a fix for 42028. While here, add .mute controls to address 42110. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.13 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.14 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.13 Sat Sep 26 11:51:29 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sat Sep 26 17:05:01 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.13 2009/09/26 11:51:29 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.14 2009/09/26 17:05:01 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.13 2009/09/26 11:51:29 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.14 2009/09/26 17:05:01 jmcneill Exp $"); #include #include @@ -2365,20 +2365,22 @@ int nmixers = 0; int i, j, index = 0; int ndac, nadc; - int numgpio; - bool needmasterctl = false; + int ctrlcnt[HDAUDIO_MIXER_NRDEVICES]; + + memset(ctrlcnt, 0, sizeof(ctrlcnt)); /* Count the number of required mixers */ for (i = 0; i < sc->sc_nctls; i++) { ctl = &sc->sc_ctls[i]; - if (ctl->ctl_enable == false) + if (ctl->ctl_enable == false || + ctl->ctl_audiomask == 0) continue; audiomask |= ctl->ctl_audiomask; - } - for (i = 0; i < HDAUDIO_MIXER_NRDEVICES; i++) { - if (audiomask & (1 << i)) + ++nmixers; + if (ctl->ctl_mute) ++nmixers; } + /* XXXJDM TODO: softvol */ /* Declare master volume if needed */ if ((audiomask & (HDAUDIO_MASK(VOLUME) | HDAUDIO_MASK(PCM))) == @@ -2387,8 +2389,9 @@ for (i = 0; i < sc->sc_nctls; i++) { if (sc->sc_ctls[i].ctl_audiomask == HDAUDIO_MASK(PCM)) { masterctl = &sc->sc_ctls[i]; -needmasterctl = true; ++nmixers; +if (masterctl->ctl_mute) + ++nmixers; break; } } @@ -2407,8 +2410,6 @@ else if (sc->sc_assocs[i].as_dir == HDAUDIO_PINDIR_IN) ++nadc; } - /* count GPIOs */ - numgpio = COP_GPIO_COUNT_NUM_GPIO(sc->sc_p.gpio_cnt); /* Make room for selectors */ if (ndac > 0) @@ -2417,7 +2418,7 @@ ++nmixers; hda_trace(sc, " need %d mixers (3 classes%s)\n", - nmixers, needmasterctl ? " + fake master" : ""); + nmixers, masterctl ? " + fake master" : ""); /* Allocate memory for the mixers */ mx = kmem_zalloc(nmixers * sizeof(*mx), KM_SLEEP); @@ -2444,33 +2445,62 @@ ++index; } - /* Build volume mixers */ - for (i = 0; i < HDAUDIO_MIXER_NRDEVICES; i++) { - if ((audiomask & (1 << i)) == 0) - continue; - ctl = NULL; - for (j = 0; j < sc->sc_nctls; j++) { - if (sc->sc_ctls[j].ctl_enable == false) -continue; - if (sc->sc_ctls[j].ctl_audiomask & (1 << i)) { -ctl = &sc->sc_ctls[j]; -break; - } - } - if (ctl == NULL && i == HDAUDIO_MIXER_VOLUME && - needmasterctl == true) { - ctl = masterctl; + /* Shadow master control */ + if (masterctl != NULL) { + mx[index].mx_ctl = masterctl; + mx[index].mx_di.index = index; + mx[index].mx_di.type = AUDIO_MIXER_VALUE; + mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST; + mx[index].mx_di.un.v.num_channels = 2; /* XXX */ + mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS; + mx[index].mx_di.un.v.delta = 256 / (masterctl->ctl_step + 1); + strcpy(mx[index].mx_di.label.name, AudioNmaster); + strcpy(mx[index].mx_di.un.v.units.name, AudioNvolume); + hda_trace(sc, " adding outputs.%s\n", + mx[index].mx_di.label.name); + ++index; + if (masterctl->ctl_mute) { + mx[index] = mx[index - 1]; + mx[index].mx_di.index = index; + mx[index].mx_di.type = AUDIO_MIXER_ENUM; + mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST; + strcpy(mx[index].mx_di.label.name, AudioNmaster "." AudioNmute); + mx[index].mx_di.un.e.num_mem = 2; + strcpy(mx[index].mx_di.un.e.member[0].label.name, AudioNoff); + mx[index].mx_di.un.e.member[0].ord = 0; + strcpy(mx[index].mx_di.un.e.member[1].label.name, AudioNon); + mx[index].mx_di.un.e.member[1].ord = 1; + ++index; } - if (ctl == NULL) + } + + /* Build volume mixers */ + for (i = 0; i < sc->sc_nctls; i++) { + uint32_t audiodev; + + ctl = &sc->sc_ctls[i]; + if (ctl->ctl_enable == false || + ctl->ctl_audiomask == 0) continue; + audiodev = ffs(ctl->ctl_audiomask) - 1; mx[index].mx_ct
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sat Sep 26 11:51:29 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Implement and enable headphone sensing. Slightly different from the FreeBSD implementation in that this code does not care if the headphones are seq=15. Instead, for each association, find any HP pins with jack sense capabilities and if at least one has the Presense Detect bit set, enable output on all PWCs of type HP_OUT and disable output on all PWCs of type LINE_OUT, SPEAKER, or AUX. Do the reverse if no HP pins have the Presense Detect bit set. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.12 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.13 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.12 Fri Sep 25 19:49:31 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sat Sep 26 11:51:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.12 2009/09/25 19:49:31 sborrill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.13 2009/09/26 11:51:29 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.12 2009/09/25 19:49:31 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.13 2009/09/26 11:51:29 jmcneill Exp $"); #include #include @@ -106,6 +106,8 @@ #define HDAUDIO_UNSOLTAG_EVENT_HP 0x00 +#define HDAUDIO_HP_SENSE_PERIOD (hz / 2) + static const char *hdaudio_afg_mixer_names[] = HDAUDIO_DEVICE_NAMES; static const char *hdaudio_afg_port_connectivity[] = { @@ -2932,96 +2934,56 @@ struct hdaudio_afg_softc *sc = opaque; struct hdaudio_assoc *as = sc->sc_assocs; struct hdaudio_widget *w; - struct hdaudio_control *ctl; - uint32_t res, v; + uint32_t res = 0; int i, j; - for (i = 0; i < sc->sc_nassocs; i++) { - if (as[i].as_hpredir < 0) - continue; - w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[15]); - if (w == NULL || w->w_enable == false) - continue; - if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) - continue; - - res = hdaudio_command(sc->sc_codec, as[i].as_pins[15], - CORB_GET_PIN_SENSE, 0); - res = (res & COP_GET_PIN_SENSE_PRESENSE_DETECT) >> 31; - - /* mute/unmute headphone pin */ - ctl = hdaudio_afg_control_amp_get(sc, as[i].as_pins[15], - HDAUDIO_PINDIR_IN, -1, 1); - if (ctl && ctl->ctl_mute) { - /* pin has muter, so use it */ - v = (res != 0) ? 0 : 1; - if (v != ctl->ctl_forcemute) { -ctl->ctl_forcemute = v; -hdaudio_afg_control_amp_set(ctl, -HDAUDIO_AMP_MUTE_DEFAULT, -HDAUDIO_AMP_VOL_DEFAULT, -HDAUDIO_AMP_VOL_DEFAULT); - } - } else { - /* no muter, so disable pin output */ - w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[15]); - if (w && w->w_type == COP_AWCAP_TYPE_PIN_COMPLEX) { -if (res) - v = w->w_pin.ctrl | COP_PWC_OUT_ENABLE; -else - v = w->w_pin.ctrl &= ~COP_PWC_OUT_ENABLE; -if (v != w->w_pin.ctrl) { - w->w_pin.ctrl = v; - hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_PIN_WIDGET_CONTROL, v); -} - } - } - /* mute/unmute other pins */ - for (j = 0; j < HDAUDIO_MAXPINS - 1; j++) { - int type = -1; - if (as[i].as_pins[j] <= 0) -continue; + for (i = 0; i < sc->sc_nassocs; i++) + for (j = 0; j < HDAUDIO_MAXPINS; j++) { w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]); - if (w && w->w_type == COP_AWCAP_TYPE_PIN_COMPLEX) -type = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); -#if notyet - ctl = hdaudio_afg_control_amp_get(sc, - as[i].as_pins[j], HDAUDIO_PINDIR_IN, -1, 1); - if (ctl && ctl->ctl_mute) { -/* pin has muter, so use it */ -if (type == COP_DEVICE_HP_OUT) - v = (res != 0) ? 0 : 1; -else - v = (res != 0) ? 1 : 0; -if (v == ctl->ctl_forcemute) - continue; -ctl->ctl_forcemute = v; -hdaudio_afg_control_amp_set(ctl, -HDAUDIO_AMP_MUTE_DEFAULT, -HDAUDIO_AMP_VOL_DEFAULT, -HDAUDIO_AMP_VOL_DEFAULT); + if (w == NULL || w->w_enable == false) continue; - } -#endif - /* no muter, so disable pin output */ + if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) +continue; + if (COP_CFG_DEFAULT_DEVICE(w->w_pin.config) != + COP_DEVICE_HP_OUT) +continue; + res |= hdaudio_command(sc->sc_codec, as[i].as_pins[j], + CORB_GET_PIN_SENSE, 0) & + COP_GET_PIN_SENSE_PRESENSE_DETECT; + } + + for (i = 0; i < sc->sc_nassocs; i++) + for (j = 0; j < HDAUDIO_MAXPINS; j++) { w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]); - if (w && w->w_type == COP_AWCAP_TYPE_PIN_COMPLEX) { -int rres = res; -if (type == COP_DEVICE_HP_OUT) - rres = !rres; -if (rres) - v = w->w_pin.ctrl &= ~COP_PWC_OUT_ENABLE; + if (w == NULL || w
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Sep 27 02:36:38 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: ensure that hp sensing is stopped on suspend, and restarted on resume if required. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.14 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.15 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.14 Sat Sep 26 17:05:01 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Sep 27 02:36:38 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.14 2009/09/26 17:05:01 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.15 2009/09/27 02:36:38 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.14 2009/09/26 17:05:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.15 2009/09/27 02:36:38 jmcneill Exp $"); #include #include @@ -106,7 +106,7 @@ #define HDAUDIO_UNSOLTAG_EVENT_HP 0x00 -#define HDAUDIO_HP_SENSE_PERIOD (hz / 2) +#define HDAUDIO_HP_SENSE_PERIOD hz static const char *hdaudio_afg_mixer_names[] = HDAUDIO_DEVICE_NAMES; @@ -290,6 +290,7 @@ audio_params_t sc_pparam, sc_rparam; struct callout sc_jack_callout; + boolsc_jack_polling; struct { uint32_t afg_cap; @@ -308,6 +309,7 @@ static void hdaudio_afg_attach(device_t, device_t, void *); static int hdaudio_afg_detach(device_t, int); static void hdaudio_afg_childdet(device_t, device_t); +static bool hdaudio_afg_suspend(device_t PMF_FN_PROTO); static bool hdaudio_afg_resume(device_t PMF_FN_PROTO); CFATTACH_DECL2_NEW( @@ -2984,6 +2986,9 @@ uint32_t res = 0; int i, j; + if (!device_is_active(sc->sc_dev)) + goto resched; + for (i = 0; i < sc->sc_nassocs; i++) for (j = 0; j < HDAUDIO_MAXPINS; j++) { w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]); @@ -3030,6 +3035,7 @@ } } +resched: callout_schedule(&sc->sc_jack_callout, HDAUDIO_HP_SENSE_PERIOD); } @@ -3070,8 +3076,8 @@ "unsol" : "poll"); } if (enable) { + sc->sc_jack_polling = true; hdaudio_afg_hp_switch_handler(sc); - callout_schedule(&sc->sc_jack_callout, HDAUDIO_HP_SENSE_PERIOD); } else hda_trace(sc, "jack detect not enabled\n"); } @@ -3093,7 +3099,7 @@ callout_setfunc(&sc->sc_jack_callout, hdaudio_afg_hp_switch_handler, sc); - if (!pmf_device_register(self, NULL, hdaudio_afg_resume)) + if (!pmf_device_register(self, hdaudio_afg_suspend, hdaudio_afg_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); sc->sc_config = prop_dictionary_get(args, "pin-config"); @@ -3241,6 +3247,16 @@ } static bool +hdaudio_afg_suspend(device_t self PMF_FN_ARGS) +{ + struct hdaudio_afg_softc *sc = device_private(self); + + callout_halt(&sc->sc_jack_callout, NULL); + + return true; +} + +static bool hdaudio_afg_resume(device_t self PMF_FN_ARGS) { struct hdaudio_afg_softc *sc = device_private(self); @@ -3258,6 +3274,9 @@ hdaudio_afg_stream_connect(sc, AUMODE_PLAY); hdaudio_afg_stream_connect(sc, AUMODE_RECORD); + if (sc->sc_jack_polling) + hdaudio_afg_hp_switch_handler(sc); + return true; }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: sborrill Date: Sun Oct 11 08:50:12 UTC 2009 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudio_afg.c hdaudioio.h hdaudiovar.h Log Message: Add ioctls required by hdaudioctl. This involves some refactoring of the hdaudio_afg ioctl code. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/hdaudio/hdaudio.c \ src/sys/dev/pci/hdaudio/hdaudiovar.h cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/hdaudio/hdaudio_afg.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudioio.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.4 src/sys/dev/pci/hdaudio/hdaudio.c:1.5 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.4 Mon Sep 7 16:35:02 2009 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sun Oct 11 08:50:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.4 2009/09/07 16:35:02 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.5 2009/10/11 08:50:11 sborrill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4 2009/09/07 16:35:02 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.5 2009/10/11 08:50:11 sborrill Exp $"); #include #include @@ -1339,6 +1339,48 @@ return 0; } +static int +hdaudio_dispatch_fgrp_ioctl(struct hdaudio_softc *sc, u_long cmd, +prop_dictionary_t request, prop_dictionary_t response) +{ + struct hdaudio_function_group *fg; + int16_t codecid, nid; + void *fgrp_sc; + int err; + + if (!prop_dictionary_get_int16(request, "codecid", &codecid) || + !prop_dictionary_get_int16(request, "nid", &nid)) + return EINVAL; + + fg = hdaudioioctl_fgrp_lookup(sc, codecid, nid); + if (fg == NULL) + return ENODEV; + fgrp_sc = device_private(fg->fg_device); + + switch (fg->fg_type) { + case HDAUDIO_GROUP_TYPE_AFG: + switch (cmd) { + case HDAUDIO_FGRP_CODEC_INFO: + err = hdaudio_afg_codec_info(fgrp_sc, + request, response); + break; + case HDAUDIO_FGRP_WIDGET_INFO: + err = hdaudio_afg_widget_info(fgrp_sc, + request, response); + break; + default: + err = EINVAL; + break; + } + break; + + default: + err = EINVAL; + break; + } + return err; +} + int hdaudioopen(dev_t dev, int flag, int mode, struct lwp *l) { @@ -1389,6 +1431,10 @@ case HDAUDIO_FGRP_SETCONFIG: err = hdaudioioctl_fgrp_setconfig(sc, request, response); break; + case HDAUDIO_FGRP_CODEC_INFO: + case HDAUDIO_FGRP_WIDGET_INFO: + err = hdaudio_dispatch_fgrp_ioctl(sc, cmd, request, response); + break; default: err = EINVAL; break; Index: src/sys/dev/pci/hdaudio/hdaudiovar.h diff -u src/sys/dev/pci/hdaudio/hdaudiovar.h:1.4 src/sys/dev/pci/hdaudio/hdaudiovar.h:1.5 --- src/sys/dev/pci/hdaudio/hdaudiovar.h:1.4 Mon Sep 7 16:21:08 2009 +++ src/sys/dev/pci/hdaudio/hdaudiovar.h Sun Oct 11 08:50:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudiovar.h,v 1.4 2009/09/07 16:21:08 jmcneill Exp $ */ +/* $NetBSD: hdaudiovar.h,v 1.5 2009/10/11 08:50:12 sborrill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -178,4 +178,7 @@ int hdaudio_stream_tag(struct hdaudio_stream *); uint16_t hdaudio_stream_param(struct hdaudio_stream *, const audio_params_t *); +int hdaudio_afg_widget_info(void *, prop_dictionary_t, prop_dictionary_t); +int hdaudio_afg_codec_info(void *, prop_dictionary_t, prop_dictionary_t); + #endif /* !_HDAUDIOVAR_H */ Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.16 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.17 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.16 Tue Sep 29 15:58:54 2009 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Oct 11 08:50:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.16 2009/09/29 15:58:54 sborrill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.17 2009/10/11 08:50:11 sborrill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.16 2009/09/29 15:58:54 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.17 2009/10/11 08:50:11 sborrill Exp $"); #include #include @@ -3644,19 +3644,71 @@ return 0; } +int +hdaudio_afg_widget_info(void *opaque, prop_dictionary_t request, +prop_dictionary_t response) +{ + struct hdaudio_afg_softc *sc = opaque; + struct hdaudio_widget *w; + prop_array_t connlist; + uint32_t config, wcap; + uint16_t index; + int nid; + int i; + + if (prop_dictionary_get_uint16(request, "index", &index) == false) + return EINVAL; + + nid = sc->sc_startnode + index; + if (nid >= sc->sc_endnode) + return EINVAL; + + w = hdaudio_afg_widget_lookup(sc, nid); + if (w == NULL) + return ENXIO; + wcap = hda_get_wparam(w, PIN_CAPABILITIES); + config = hdaudio_command(sc->sc_codec, w->w_nid, + CORB_GET_CONFIGURATION_DEFAULT, 0); + prop_dictiona
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jakllsch Date: Tue Aug 3 04:02:21 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudioreg.h Log Message: Use fewer magic constants related to the GCAP register. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudioreg.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.5 src/sys/dev/pci/hdaudio/hdaudio.c:1.6 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.5 Sun Oct 11 08:50:11 2009 +++ src/sys/dev/pci/hdaudio/hdaudio.c Tue Aug 3 04:02:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.5 2009/10/11 08:50:11 sborrill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.6 2010/08/03 04:02:21 jakllsch Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.5 2009/10/11 08:50:11 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.6 2010/08/03 04:02:21 jakllsch Exp $"); #include #include @@ -125,17 +125,17 @@ #endif gcap = hda_read2(sc, HDAUDIO_MMIO_GCAP); - nis = (gcap >> 8) & 0xf; - nos = (gcap >> 12) & 0xf; - nbidir = (gcap >> 3) & 0x1f; + nis = HDAUDIO_GCAP_ISS(gcap); + nos = HDAUDIO_GCAP_OSS(gcap); + nbidir = HDAUDIO_GCAP_BSS(gcap); /* Initialize codecs and streams */ hdaudio_codec_init(sc); hdaudio_stream_init(sc, nis, nos, nbidir); #if defined(HDAUDIO_DEBUG) - nsdo = (gcap >> 1) & 1; - addr64 = gcap & 1; + nsdo = HDAUDIO_GCAP_NSDO(gcap); + addr64 = HDAUDIO_GCAP_64OK(gcap); hda_print(sc, "OSS %d ISS %d BSS %d SDO %d%s\n", nos, nis, nbidir, nsdo, addr64 ? " 64-bit" : ""); Index: src/sys/dev/pci/hdaudio/hdaudioreg.h diff -u src/sys/dev/pci/hdaudio/hdaudioreg.h:1.3 src/sys/dev/pci/hdaudio/hdaudioreg.h:1.4 --- src/sys/dev/pci/hdaudio/hdaudioreg.h:1.3 Sun Sep 6 21:38:17 2009 +++ src/sys/dev/pci/hdaudio/hdaudioreg.h Tue Aug 3 04:02:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudioreg.h,v 1.3 2009/09/06 21:38:17 rmind Exp $ */ +/* $NetBSD: hdaudioreg.h,v 1.4 2010/08/03 04:02:21 jakllsch Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -44,6 +44,11 @@ * High Definition Audio Memory Mapped Configuration Registers */ #define HDAUDIO_MMIO_GCAP 0x000 +#define HDAUDIO_GCAP_64OK(x) ((x) & 1) +#define HDAUDIO_GCAP_NSDO(x) x) & 6) != 0) ? ((x) & 6) : 1) +#define HDAUDIO_GCAP_BSS(x) (((x) >> 3) & 0x1f) +#define HDAUDIO_GCAP_ISS(x) (((x) >> 8) & 0x0f) +#define HDAUDIO_GCAP_OSS(x) (((x) >> 12) & 0x0f) #define HDAUDIO_MMIO_VMIN 0x002 #define HDAUDIO_MMIO_VMAJ 0x003 #define HDAUDIO_MMIO_OUTPAY 0x004
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sat Aug 7 16:24:19 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c Log Message: Reject invalid vendor IDs (say if there was a RIRB timeout while reading the VID registers) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.6 src/sys/dev/pci/hdaudio/hdaudio.c:1.7 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.6 Tue Aug 3 04:02:21 2010 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sat Aug 7 16:24:19 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.6 2010/08/03 04:02:21 jakllsch Exp $ */ +/* $NetBSD: hdaudio.c,v 1.7 2010/08/07 16:24:19 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.6 2010/08/03 04:02:21 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.7 2010/08/07 16:24:19 jmcneill Exp $"); #include #include @@ -668,6 +668,10 @@ snc = hdaudio_command(co, 0, CORB_GET_PARAMETER, COP_SUBORDINATE_NODE_COUNT); + /* make sure the vendor and product IDs are valid */ + if (vid == 0x || vid == 0x) + return; + #ifdef HDAUDIO_DEBUG hda_print(sc, "Codec%02X: %04X:%04X HDA %d.%d rev %d stepping %d\n", co->co_addr, vid >> 16, vid & 0x,
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sat Aug 7 16:59:48 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_pci.c Added Files: src/sys/dev/pci/hdaudio: hdaudio_pci.h Log Message: add support for nvidia hdaudio controllers To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudio_pci.c cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/hdaudio/hdaudio_pci.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/hdaudio_pci.c diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.5 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.6 --- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.5 Wed Feb 24 22:38:08 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_pci.c Sat Aug 7 16:59:48 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_pci.c,v 1.5 2010/02/24 22:38:08 dyoung Exp $ */ +/* $NetBSD: hdaudio_pci.c,v 1.6 2010/08/07 16:59:48 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.5 2010/02/24 22:38:08 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.6 2010/08/07 16:59:48 jmcneill Exp $"); #include #include @@ -49,6 +49,7 @@ #include #include +#include struct hdaudio_pci_softc { struct hdaudio_softc sc_hdaudio; /* must be first */ @@ -153,6 +154,18 @@ if (!pmf_device_register(self, NULL, hdaudio_pci_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); + switch (PCI_VENDOR(pa->pa_id)) { + case PCI_VENDOR_NVIDIA: + /* enable snooping */ + csr = pci_conf_read(sc->sc_pc, sc->sc_tag, + HDAUDIO_NV_REG_SNOOP); + csr &= ~HDAUDIO_NV_SNOOP_MASK; + csr |= HDAUDIO_NV_SNOOP_ENABLE; + pci_conf_write(sc->sc_pc, sc->sc_tag, + HDAUDIO_NV_REG_SNOOP, csr); + break; + } + /* Attach bus-independent HD audio layer */ hdaudio_attach(self, &sc->sc_hdaudio); } Added files: Index: src/sys/dev/pci/hdaudio/hdaudio_pci.h diff -u /dev/null src/sys/dev/pci/hdaudio/hdaudio_pci.h:1.1 --- /dev/null Sat Aug 7 16:59:48 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_pci.h Sat Aug 7 16:59:48 2010 @@ -0,0 +1,38 @@ +/* $NetBSD: hdaudio_pci.h,v 1.1 2010/08/07 16:59:48 jmcneill Exp $ */ + +/* + * Copyright (c) 2010 Jared D. McNeill + * 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_PCI_H +#define _HDAUDIO_PCI_H + +#define HDAUDIO_NV_REG_SNOOP 0x4c +#define HDAUDIO_NV_SNOOP_MASK 0x00ff +#define HDAUDIO_NV_SNOOP_ENABLE 0x000f + +#endif /* !_HDAUDIO_PCI_H */
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: joerg Date: Tue Aug 10 11:14:30 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Reduce noise by explicitly skipping unassociated pins. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.20 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.21 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.20 Wed Feb 24 22:38:08 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Tue Aug 10 11:14:30 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.20 2010/02/24 22:38:08 dyoung Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.21 2010/08/10 11:14:30 joerg Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.20 2010/02/24 22:38:08 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.21 2010/08/10 11:14:30 joerg Exp $"); #include #include @@ -2991,6 +2991,8 @@ for (i = 0; i < sc->sc_nassocs; i++) for (j = 0; j < HDAUDIO_MAXPINS; j++) { + if (as[i].as_pins[j] == 0) +continue; w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]); if (w == NULL || w->w_enable == false) continue; @@ -3006,6 +3008,8 @@ for (i = 0; i < sc->sc_nassocs; i++) for (j = 0; j < HDAUDIO_MAXPINS; j++) { + if (as[i].as_pins[j] == 0) +continue; w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]); if (w == NULL || w->w_enable == false) continue;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: joerg Date: Tue Aug 10 13:47:39 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: Increase safety of the speaker -> beep generator workaround by check that no such widget is defined first. On a Dell Latitude 430, widget 0x14 is the beep generator and the original version would replace the normal speaker output, breaking head phone redirection in the process. Discussed with jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.21 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.22 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.21 Tue Aug 10 11:14:30 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Tue Aug 10 13:47:38 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.21 2010/08/10 11:14:30 joerg Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.22 2010/08/10 13:47:38 joerg Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.21 2010/08/10 11:14:30 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.22 2010/08/10 13:47:38 joerg Exp $"); #include #include @@ -285,6 +285,7 @@ struct hdaudio_control *sc_ctls; intsc_nmixers; struct hdaudio_mixer *sc_mixers; + boolsc_has_beepgen; intsc_pchan, sc_rchan; audio_params_t sc_pparam, sc_rparam; @@ -634,6 +635,7 @@ static uint32_t hdaudio_afg_widget_getcaps(struct hdaudio_widget *w) { + struct hdaudio_afg_softc *sc = w->w_afg; uint32_t wcap, config; wcap = hda_get_wparam(w, AUDIO_WIDGET_CAPABILITIES); @@ -641,7 +643,8 @@ w->w_waspin = false; - if (COP_CFG_DEFAULT_DEVICE(config) == COP_DEVICE_SPEAKER && + if (sc->sc_has_beepgen == false && + COP_CFG_DEFAULT_DEVICE(config) == COP_DEVICE_SPEAKER && (wcap & (COP_AWCAP_INAMP_PRESENT|COP_AWCAP_OUTAMP_PRESENT)) == 0) { wcap &= ~COP_AWCAP_TYPE_MASK; wcap |= (COP_AWCAP_TYPE_BEEP_GENERATOR << COP_AWCAP_TYPE_SHIFT); @@ -990,7 +993,7 @@ hdaudio_afg_parse(struct hdaudio_afg_softc *sc) { struct hdaudio_widget *w; - uint32_t nodecnt; + uint32_t nodecnt, wcap; int nid; nodecnt = hda_get_param(sc, SUBORDINATE_NODE_COUNT); @@ -1025,6 +1028,19 @@ w = hdaudio_afg_widget_lookup(sc, nid); if (w == NULL) continue; + wcap = hdaudio_command(sc->sc_codec, nid, CORB_GET_PARAMETER, + COP_AUDIO_WIDGET_CAPABILITIES); + switch (COP_AWCAP_TYPE(wcap)) { + case COP_AWCAP_TYPE_BEEP_GENERATOR: + sc->sc_has_beepgen = true; + break; + } + } + + for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) { + w = hdaudio_afg_widget_lookup(sc, nid); + if (w == NULL) + continue; w->w_afg = sc; w->w_nid = nid; w->w_enable = true;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Aug 15 16:21:46 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: properly round block and buffer sizes -- nvidia HDA controllers work now To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.22 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.23 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.22 Tue Aug 10 13:47:38 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Aug 15 16:21:46 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.22 2010/08/10 13:47:38 joerg Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.23 2010/08/15 16:21:46 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.22 2010/08/10 13:47:38 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.23 2010/08/15 16:21:46 jmcneill Exp $"); #include #include @@ -3350,7 +3350,7 @@ } /* Multiple of 128 */ - blksize &= ~128; + blksize &= ~127; if (blksize <= 0) blksize = 128; @@ -3358,7 +3358,7 @@ if (bufsize > HDAUDIO_BDL_MAX * blksize) { blksize = bufsize / HDAUDIO_BDL_MAX; if (blksize & 128) - blksize = (blksize + 128) & ~128; + blksize = (blksize + 128) & ~127; } return blksize; @@ -3572,7 +3572,7 @@ hdaudio_afg_round_buffersize(void *opaque, int direction, size_t bufsize) { /* Multiple of 128 */ - bufsize &= ~128; + bufsize &= ~127; if (bufsize <= 0) bufsize = 128; return bufsize;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Aug 15 19:39:56 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c hdaudiovar.h Log Message: be less spammy when dumping assocs. extra details can be had with boot -x To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/hdaudio/hdaudio_afg.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.23 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.24 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.23 Sun Aug 15 16:21:46 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Aug 15 19:39:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.23 2010/08/15 16:21:46 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.23 2010/08/15 16:21:46 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $"); #include #include @@ -94,6 +94,8 @@ #define hda_debug(sc, ...) \ if (hdaudio_afg_debug) hda_print(sc, __VA_ARGS__) +#define hda_debug1(sc, ...) \ + if (hdaudio_afg_debug) hda_print1(sc, __VA_ARGS__) #define HDAUDIO_MIXER_CLASS_OUTPUTS 0 #define HDAUDIO_MIXER_CLASS_INPUTS 1 @@ -700,49 +702,123 @@ } } +static int +hdaudio_afg_assoc_count_channels(struct hdaudio_afg_softc *sc, +struct hdaudio_assoc *as, enum hdaudio_pindir dir) +{ + struct hdaudio_widget *w; + int *dacmap; + int i, dacmapsz = sizeof(*dacmap) * sc->sc_endnode; + int nchans = 0; + + if (as->as_enable == false || as->as_dir != dir) + return 0; + + dacmap = kmem_zalloc(dacmapsz, KM_SLEEP); + if (dacmap == NULL) + return 0; + + for (i = 0; i < HDAUDIO_MAXPINS; i++) + if (as->as_dacs[i]) + dacmap[as->as_dacs[i]] = 1; + + for (i = 1; i < sc->sc_endnode; i++) { + if (!dacmap[i]) + continue; + w = hdaudio_afg_widget_lookup(sc, i); + if (w == NULL || w->w_enable == false) + continue; + nchans += (w->w_p.aw_cap & COP_AWCAP_STEREO) ? 2 : 1; + } + + kmem_free(dacmap, dacmapsz); + + return nchans; +} + static void hdaudio_afg_assoc_dump(struct hdaudio_afg_softc *sc) { struct hdaudio_assoc *as = sc->sc_assocs; struct hdaudio_widget *w; - uint32_t conn, color, defdev; + uint32_t conn, color, defdev, curdev, curport; int maxassocs = sc->sc_nassocs; int i, j; for (i = 0; i < maxassocs; i++) { - int ndacs = 0; + uint32_t devmask = 0, portmask = 0; + bool firstdev = true; + int nchan; if (as[i].as_enable == false) continue; + hda_print(sc, "%s%02X", + as[i].as_dir == HDAUDIO_PINDIR_IN ? "ADC" : "DAC", i); + hda_trace1(sc, " %s", + as[i].as_digital ? "[DIGITAL]" : "[ANALOG]"); + + nchan = hdaudio_afg_assoc_count_channels(sc, &as[i], + as[i].as_dir); + hda_print1(sc, " %dch:", nchan); + for (j = 0; j < HDAUDIO_MAXPINS; j++) { if (as[i].as_dacs[j] == 0) continue; - ++ndacs; - hda_print(sc, "%s%d:%02X, %s ", - as[i].as_dir == HDAUDIO_PINDIR_IN ? "ADC" : "DAC", - i, as[i].as_dacs[j], - as[i].as_digital ? "Digital" : "Analog"); - w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]); - if (w == NULL) { -hda_print1(sc, "\n"); + if (w == NULL) continue; - } conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config); - color = COP_CFG_COLOR(w->w_pin.config); defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); - if (conn != 1) { -hda_print1(sc, "%s: %s (%s, %02X)\n", -hdaudio_afg_default_device[defdev], -hdaudio_afg_port_connectivity[conn], -hdaudio_afg_color[color], w->w_nid); - } else { -hda_print1(sc, "\n"); + if (conn != COP_PORT_NONE) { +devmask |= (1 << defdev); +portmask |= (1 << conn); + } + } + for (curdev = 0; curdev < 16; curdev++) { + bool firstport = true; + if ((devmask & (1 << curdev)) == 0) +continue; + + if (firstdev == false) +hda_print1(sc, ","); + firstdev = false; + hda_print1(sc, " %s", + hdaudio_afg_default_device[curdev]); + + for (curport = 0; curport < 4; curport++) { +if ((portmask & (1 << curport)) == 0) + continue; + +hda_print1(sc, " [%s", +hdaudio_afg_port_connectivity[curport]); +for (j = 0; j < HDAUDIO_MAXPINS; j++) { + if (as[i].as_dacs[j] == 0) + continue; + + w = hdaudio_afg_widget_lookup(sc, + as[i].as_pins[j]); + if (w == NULL) + continue; + conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config); + color = COP_CFG_COLOR(w->w_pin.config); + defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); + if (conn != curport || defdev != curdev) + continue; + + if (firstport == false) + hda_trace1(sc, ","); + else + hda_
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Aug 15 22:32:02 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: kern/43542: 32kHz playback sounds like hissing analog TV snow Instead of specifying a range of supported sample rates based on the lowest and highest available frequencies, only advertise rates that the codec reports as working. Let aurateconv take care of the rest. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.24 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.25 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.24 Sun Aug 15 19:39:56 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Aug 15 22:32:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.25 2010/08/15 22:32:02 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.25 2010/08/15 22:32:02 jmcneill Exp $"); #include #include @@ -110,6 +110,11 @@ #define HDAUDIO_HP_SENSE_PERIOD hz +const u_int hdaudio_afg_possible_rates[] = { + 8000, 11025, 16000, 22050, 32000, 44100, + 48000, 88200, 96000, 176500, 192000, /* 384000, */ +}; + static const char *hdaudio_afg_mixer_names[] = HDAUDIO_DEVICE_NAMES; static const char *hdaudio_afg_port_connectivity[] = { @@ -2903,9 +2908,10 @@ static bool hdaudio_afg_probe_encoding(struct hdaudio_afg_softc *sc, -u_int minrate, u_int maxrate, u_int validbits, u_int precision, bool force) +u_int validbits, u_int precision, bool force) { struct audio_format f; + int i; if (!force && hdaudio_afg_bits_supported(sc, validbits) == false) return false; @@ -2919,8 +2925,11 @@ f.channels = 0; f.channel_mask = 0; f.frequency_type = 0; - f.frequency[0] = minrate; - f.frequency[1] = maxrate; + for (i = 0; i < __arraycount(hdaudio_afg_possible_rates); i++) { + u_int rate = hdaudio_afg_possible_rates[i]; + if (hdaudio_afg_rate_supported(sc, rate)) + f.frequency[f.frequency_type++] = rate; + } #define HDAUDIO_INITFMT(ch, chmask) \ do { \ @@ -2953,17 +2962,11 @@ static void hdaudio_afg_configure_encodings(struct hdaudio_afg_softc *sc) { - const u_int possible_rates[] = { - 8000, 11025, 16000, 22050, 32000, 44100, - 48000, 88200, 96000, 176500, 192000, /* 384000, */ - }; struct hdaudio_assoc *as = sc->sc_assocs; struct audio_format f; - u_int minrate, maxrate; int nchan, i; sc->sc_pchan = sc->sc_rchan = 0; - minrate = maxrate = 0; for (nchan = 0, i = 0; i < sc->sc_nassocs; i++) { nchan = hdaudio_afg_assoc_count_channels(sc, &as[i], @@ -2979,34 +2982,24 @@ } hda_print(sc, "%dch/%dch", sc->sc_pchan, sc->sc_rchan); - for (i = 0; __arraycount(possible_rates); i++) - if (hdaudio_afg_rate_supported(sc, possible_rates[i])) { - minrate = possible_rates[i]; - break; - } - for (i = __arraycount(possible_rates) - 1; i >= 0; i--) - if (hdaudio_afg_rate_supported(sc, possible_rates[i])) { - maxrate = possible_rates[i]; - break; - } - KASSERT(minrate > 0 && maxrate > 0); /* impossible */ - hda_print1(sc, " %uHz", minrate); - if (minrate != maxrate) - hda_print1(sc, "-%uHz", maxrate); + for (i = 0; i < __arraycount(hdaudio_afg_possible_rates); i++) + if (hdaudio_afg_rate_supported(sc, + hdaudio_afg_possible_rates[i])) + hda_print1(sc, " %uHz", hdaudio_afg_possible_rates[i]); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 8, 16, false)) + if (hdaudio_afg_probe_encoding(sc, 8, 16, false)) hda_print1(sc, " 8/16"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, false)) + if (hdaudio_afg_probe_encoding(sc, 16, 16, false)) hda_print1(sc, " 16/16"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 20, 32, false)) + if (hdaudio_afg_probe_encoding(sc, 20, 32, false)) hda_print1(sc, " 20/32"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 24, 32, false)) + if (hdaudio_afg_probe_encoding(sc, 24, 32, false)) hda_print1(sc, " 24/32"); - if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 32, 32, false)) + if (hdaudio_afg_probe_encoding(sc, 32, 32, false)) hda_print1(sc, " 32/32"); if (sc->sc_audiodev.ad_nformats == 0) { - hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, true); + hdaudio_afg_probe_encoding(sc, 16, 16, true); hda_print1(sc, " 16/16*"); }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Thu Aug 19 18:06:38 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: more assoc dump fixes To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.25 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.26 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.25 Sun Aug 15 22:32:02 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Thu Aug 19 18:06:37 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.25 2010/08/15 22:32:02 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.26 2010/08/19 18:06:37 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.25 2010/08/15 22:32:02 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.26 2010/08/19 18:06:37 jmcneill Exp $"); #include #include @@ -120,8 +120,8 @@ static const char *hdaudio_afg_port_connectivity[] = { "Jack", "Unconnected", - "Fixed Function", - "Jack & Fixed Function" + "Built-In", + "Jack & Built-In" }; static const char *hdaudio_afg_default_device[] = { "Line Out", @@ -129,7 +129,7 @@ "HP Out", "CD", "SPDIF Out", - "Digital Other Out", + "Digital Out", "Modem Line Side", "Modem Handset Side", "Line In", @@ -137,7 +137,7 @@ "Mic In", "Telephony", "SPDIF In", - "Digital Other In", + "Digital In", "Reserved", "Other" }; @@ -792,9 +792,29 @@ hdaudio_afg_default_device[curdev]); for (curport = 0; curport < 4; curport++) { +bool devonport = false; if ((portmask & (1 << curport)) == 0) continue; +for (j = 0; j < HDAUDIO_MAXPINS; j++) { + if (as[i].as_dacs[j] == 0) + continue; + + w = hdaudio_afg_widget_lookup(sc, + as[i].as_pins[j]); + if (w == NULL) + continue; + conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config); + defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); + if (conn != curport || defdev != curdev) + continue; + + devonport = true; +} + +if (devonport == false) + continue; + hda_print1(sc, " [%s", hdaudio_afg_port_connectivity[curport]); for (j = 0; j < HDAUDIO_MAXPINS; j++) {
CVS commit: src/sys/dev/pci/hdaudio
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 @@ -30,7 +30,7 @@ */ #include -__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 #include @@ -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 @@ -60,7 +60,7 @@ */ #include -__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 #include @@ -79,6 +79,7 @@ #include #include #include +#include #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
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Sep 13 22:37:02 UTC 2010 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c hdaudio_ids.h Log Message: Add Conexant codec IDs To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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/hdaudio_ids.c diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.1 src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.2 --- src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.1 Thu Sep 2 01:55:31 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Mon Sep 13 22:37:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.c,v 1.1 2010/09/02 01:55:31 jmcneill Exp $ */ +/* $NetBSD: hdaudio_ids.c,v 1.2 2010/09/13 22:37:02 jmcneill Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.1 2010/09/02 01:55:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.2 2010/09/13 22:37:02 jmcneill Exp $"); #include #include @@ -150,6 +150,14 @@ { HDA_VENDOR_ANALOG_DEVICES, 0x989a, "AD1989A" }, { HDA_VENDOR_ANALOG_DEVICES, 0x989b, "AD1989B" }, { HDA_VENDOR_ANALOG_DEVICES, HDA_PRODUCT_ANY, "ADI" }, + /* Conexant */ + { HDA_VENDOR_CONEXANT, 0x5045, "CX20549" }, + { HDA_VENDOR_CONEXANT, 0x5047, "CX20551" }, + { HDA_VENDOR_CONEXANT, 0x5051, "CX20561" }, + { HDA_VENDOR_CONEXANT, 0x5066, "CX20582" }, + { HDA_VENDOR_CONEXANT, 0x5067, "CX20583" }, + { HDA_VENDOR_CONEXANT, 0x5069, "CX20585" }, + { HDA_VENDOR_CONEXANT, HDA_PRODUCT_ANY, "Conexant" }, /* CMedia */ { HDA_VENDOR_CMEDIA, 0x4980, "CMI9880" }, { HDA_VENDOR_CMEDIA, HDA_PRODUCT_ANY, "CMedia" }, Index: src/sys/dev/pci/hdaudio/hdaudio_ids.h diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.1 src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.2 --- src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.1 Thu Sep 2 01:55:31 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.h Mon Sep 13 22:37:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.h,v 1.1 2010/09/02 01:55:31 jmcneill Exp $ */ +/* $NetBSD: hdaudio_ids.h,v 1.2 2010/09/13 22:37:02 jmcneill Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -37,6 +37,7 @@ #define HDA_VENDOR_VIA 0x1106 #define HDA_VENDOR_SIGMATEL2 0x111d #define HDA_VENDOR_ANALOG_DEVICES 0x11d4 +#define HDA_VENDOR_CONEXANT 0x14f1 #define HDA_VENDOR_CMEDIA 0x434d #define HDA_VENDOR_INTEL 0x8086 #define HDA_VENDOR_SIGMATEL 0x8384
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Fri Jan 7 15:30:30 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudio_afg.c hdaudio_pci.c hdaudiovar.h Log Message: modularize hdaudio and hdafg drivers To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/hdaudio/hdaudio_afg.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdaudio_pci.c \ src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.8 src/sys/dev/pci/hdaudio/hdaudio.c:1.9 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.8 Thu Sep 2 01:55:31 2010 +++ src/sys/dev/pci/hdaudio/hdaudio.c Fri Jan 7 15:30:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.8 2010/09/02 01:55:31 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.9 2011/01/07 15:30:29 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.8 2010/09/02 01:55:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.9 2011/01/07 15:30:29 jmcneill Exp $"); #include #include @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -865,6 +866,46 @@ } int +hdaudio_rescan(struct hdaudio_softc *sc, const char *ifattr, const int *locs) +{ + struct hdaudio_codec *co; + struct hdaudio_function_group *fg; + unsigned int codec; + + if (!ifattr_match(ifattr, "hdaudiobus")) + return 0; + + for (codec = 0; codec < HDAUDIO_MAX_CODECS; codec++) { + co = &sc->sc_codec[codec]; + fg = co->co_fg; + if (!co->co_valid || fg == NULL) + continue; + if (fg->fg_device) + continue; + hdaudio_attach_fg(fg, NULL); + } + + return 0; +} + +void +hdaudio_childdet(struct hdaudio_softc *sc, device_t child) +{ + struct hdaudio_codec *co; + struct hdaudio_function_group *fg; + unsigned int codec; + + for (codec = 0; codec < HDAUDIO_MAX_CODECS; codec++) { + co = &sc->sc_codec[codec]; + fg = co->co_fg; + if (!co->co_valid || fg == NULL) + continue; + if (fg->fg_device == child) + fg->fg_device = NULL; + } +} + +int hdaudio_intr(struct hdaudio_softc *sc) { struct hdaudio_stream *st; @@ -1348,8 +1389,12 @@ prop_dictionary_t request, prop_dictionary_t response) { struct hdaudio_function_group *fg; + int (*infocb)(void *, prop_dictionary_t, prop_dictionary_t); + prop_dictionary_t fgrp_dict; + uint64_t info_fn; int16_t codecid, nid; void *fgrp_sc; + bool rv; int err; if (!prop_dictionary_get_int16(request, "codecid", &codecid) || @@ -1360,17 +1405,26 @@ if (fg == NULL) return ENODEV; fgrp_sc = device_private(fg->fg_device); + fgrp_dict = device_properties(fg->fg_device); switch (fg->fg_type) { case HDAUDIO_GROUP_TYPE_AFG: switch (cmd) { case HDAUDIO_FGRP_CODEC_INFO: - err = hdaudio_afg_codec_info(fgrp_sc, - request, response); + rv = prop_dictionary_get_uint64(fgrp_dict, + "codecinfo-callback", &info_fn); + if (!rv) +return ENXIO; + infocb = (void *)(uintptr_t)info_fn; + err = infocb(fgrp_sc, request, response); break; case HDAUDIO_FGRP_WIDGET_INFO: - err = hdaudio_afg_widget_info(fgrp_sc, - request, response); + rv = prop_dictionary_get_uint64(fgrp_dict, + "widgetinfo-callback", &info_fn); + if (!rv) +return ENXIO; + infocb = (void *)(uintptr_t)info_fn; + err = infocb(fgrp_sc, request, response); break; default: err = EINVAL; @@ -1452,3 +1506,43 @@ prop_object_release(request); return err; } + +MODULE(MODULE_CLASS_DRIVER, hdaudio, NULL); + +#ifdef _MODULE +#include "ioconf.c" +#endif + +static int +hdaudio_modcmd(modcmd_t cmd, void *opaque) +{ + int error = 0; +#ifdef _MODULE + int bmaj = -1, cmaj = -1; +#endif + + switch (cmd) { + case MODULE_CMD_INIT: +#ifdef _MODULE + error = config_init_component(cfdriver_ioconf_hdaudio, + cfattach_ioconf_hdaudio, cfdata_ioconf_hdaudio); + if (error) + return error; + error = devsw_attach("hdaudio", NULL, &bmaj, + &hdaudio_cdevsw, &cmaj); + if (error) + config_fini_component(cfdriver_ioconf_hdaudio, + cfattach_ioconf_hdaudio, cfdata_ioconf_hdaudio); +#endif + return error; + case MODULE_CMD_FINI: +#ifdef _MODULE + devsw_detach(NULL, &hdaudio_cdevsw); + error = config_fini_component(cfdriver_ioconf_hdaudio, + cfattach_ioconf_hdaudio, cfdata_ioconf_hdaudio); +#endif + return error; + default: + return ENOTTY; + } +} Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.27 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.28 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.27 Thu Sep 2 01:55:31 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Jan 7 15:30:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.27 2010/09/02 01:55:31 jmcnei
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Fri Jan 7 18:24:53 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: fix compilation when _MODULE is not defined To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.28 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.29 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.28 Fri Jan 7 15:30:29 2011 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Jan 7 18:24:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.28 2011/01/07 15:30:29 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.29 2011/01/07 18:24:53 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.28 2011/01/07 15:30:29 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.29 2011/01/07 18:24:53 jmcneill Exp $"); #include #include @@ -3841,7 +3841,7 @@ static int hdafg_modcmd(modcmd_t cmd, void *opaque) { - int error; + int error = 0; switch (cmd) { case MODULE_CMD_INIT:
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Fri Jan 14 03:16:38 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_afg.c Log Message: hda_error->hda_debug when tracing an adc assoc fails To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.29 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.30 --- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.29 Fri Jan 7 18:24:53 2011 +++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Jan 14 03:16:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_afg.c,v 1.29 2011/01/07 18:24:53 jmcneill Exp $ */ +/* $NetBSD: hdaudio_afg.c,v 1.30 2011/01/14 03:16:37 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.29 2011/01/07 18:24:53 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.30 2011/01/14 03:16:37 jmcneill Exp $"); #include #include @@ -1692,18 +1692,18 @@ continue; res = hdaudio_afg_assoc_trace_in(sc, j); if (!res) { - hda_error(sc, "disable assoc %d (%d) [trace failed]\n", + hda_debug(sc, "disable assoc %d (%d) [trace failed]\n", j, as[j].as_index); for (i = 0; i < HDAUDIO_MAXPINS; i++) { if (as[j].as_pins[i] == 0) continue; -hda_error(sc, " assoc %d pin%d: %02X\n", j, i, +hda_debug(sc, " assoc %d pin%d: %02X\n", j, i, as[j].as_pins[i]); } for (i = 0; i < HDAUDIO_MAXPINS; i++) { if (as[j].as_dacs[i] == 0) continue; -hda_error(sc, " assoc %d adc%d: %02X\n", j, i, +hda_debug(sc, " assoc %d adc%d: %02X\n", j, i, as[j].as_dacs[i]); }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Tue Sep 6 01:51:44 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c hdaudioreg.h Log Message: Add AC3 passthru support, currently untested. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdafg.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudioreg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.2 src/sys/dev/pci/hdaudio/hdafg.c:1.3 --- src/sys/dev/pci/hdaudio/hdafg.c:1.2 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Tue Sep 6 01:51:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.2 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.3 2011/09/06 01:51:44 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.2 2011/02/12 15:15:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.3 2011/09/06 01:51:44 jmcneill Exp $"); #include #include @@ -3041,7 +3041,7 @@ KASSERT(mode == AUMODE_PLAY || mode == AUMODE_RECORD); - dfmt = COP_DIGITAL_CONVCTRL1_DIGEN; /* TODO: AC3 */ + dfmt = COP_DIGITAL_CONVCTRL1_DIGEN; if (mode == AUMODE_PLAY) fmt = hdaudio_stream_param(sc->sc_audiodev.ad_playback, @@ -3216,7 +3216,7 @@ static bool hdafg_probe_encoding(struct hdafg_softc *sc, -u_int validbits, u_int precision, bool force) +u_int validbits, u_int precision, int encoding, bool force) { struct audio_format f; int i; @@ -3227,7 +3227,7 @@ memset(&f, 0, sizeof(f)); f.driver_data = NULL; f.mode = 0; - f.encoding = AUDIO_ENCODING_SLINEAR_LE; + f.encoding = encoding; f.validbits = validbits; f.precision = precision; f.channels = 0; @@ -3271,8 +3271,10 @@ hdafg_configure_encodings(struct hdafg_softc *sc) { struct hdaudio_assoc *as = sc->sc_assocs; + struct hdaudio_widget *w; struct audio_format f; - int nchan, i; + uint32_t stream_format; + int nchan, i, nid; sc->sc_pchan = sc->sc_rchan = 0; @@ -3295,20 +3297,43 @@ hdafg_possible_rates[i])) hda_print1(sc, " %uHz", hdafg_possible_rates[i]); - if (hdafg_probe_encoding(sc, 8, 16, false)) - hda_print1(sc, " 8/16"); - if (hdafg_probe_encoding(sc, 16, 16, false)) - hda_print1(sc, " 16/16"); - if (hdafg_probe_encoding(sc, 20, 32, false)) - hda_print1(sc, " 20/32"); - if (hdafg_probe_encoding(sc, 24, 32, false)) - hda_print1(sc, " 24/32"); - if (hdafg_probe_encoding(sc, 32, 32, false)) - hda_print1(sc, " 32/32"); + stream_format = sc->sc_p.stream_format; + for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) { + w = hdafg_widget_lookup(sc, nid); + if (w == NULL) + continue; + stream_format |= w->w_p.stream_format; + } + if (stream_format == 0) { + hda_print(sc, + "WARNING: unsupported stream format mask 0x%X, assuming PCM\n", + stream_format); + stream_format |= COP_STREAM_FORMAT_PCM; + } + + if (stream_format & COP_STREAM_FORMAT_PCM) { + int e = AUDIO_ENCODING_SLINEAR_LE; + if (hdafg_probe_encoding(sc, 8, 16, e, false)) + hda_print1(sc, " PCM8"); + if (hdafg_probe_encoding(sc, 16, 16, e, false)) + hda_print1(sc, " PCM16"); + if (hdafg_probe_encoding(sc, 20, 32, e, false)) + hda_print1(sc, " PCM20"); + if (hdafg_probe_encoding(sc, 24, 32, e, false)) + hda_print1(sc, " PCM24"); + if (hdafg_probe_encoding(sc, 32, 32, e, false)) + hda_print1(sc, " PCM32"); + } + + if (stream_format & COP_STREAM_FORMAT_AC3) { + int e = AUDIO_ENCODING_AC3; + if (hdafg_probe_encoding(sc, 16, 16, e, false)) + hda_print1(sc, " AC3"); + } if (sc->sc_audiodev.ad_nformats == 0) { - hdafg_probe_encoding(sc, 16, 16, true); - hda_print1(sc, " 16/16*"); + hdafg_probe_encoding(sc, 16, 16, AUDIO_ENCODING_SLINEAR_LE, true); + hda_print1(sc, " PCM16*"); } /* Index: src/sys/dev/pci/hdaudio/hdaudioreg.h diff -u src/sys/dev/pci/hdaudio/hdaudioreg.h:1.5 src/sys/dev/pci/hdaudio/hdaudioreg.h:1.6 --- src/sys/dev/pci/hdaudio/hdaudioreg.h:1.5 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdaudioreg.h Tue Sep 6 01:51:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudioreg.h,v 1.5 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdaudioreg.h,v 1.6 2011/09/06 01:51:44 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -183,6 +183,9 @@ #define COP_AWCAP_TYPE_VENDOR_DEFINED 0xf #define COP_SUPPORTED_PCM_SIZE_RATES 0x0a #define COP_SUPPORTED_STREAM_FORMATS 0x0b +#define COP_STREAM_FORMAT_PCM (1 << 0) +#define COP_STREAM_FORMAT_FLOAT32 (1 << 1) +#define COP_STREAM_FORMAT_AC3 (1 << 2) #define COP_PIN_CAPABILITIES 0x0c #define COP_PINCAP_IMPEDANCE_SENSE_CAPABLE (1 << 0) #define COP_PINCAP_TRIGGER_REQD (1 << 1)
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Tue Sep 6 10:48:29 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudioreg.h Log Message: For AC3, set the Non-PCM bit in the stream format structure used in the stream descriptors & codec config. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdaudioreg.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.14 src/sys/dev/pci/hdaudio/hdaudio.c:1.15 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.14 Mon Aug 29 14:47:09 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Tue Sep 6 10:48:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.14 2011/08/29 14:47:09 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.15 2011/09/06 10:48:28 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.14 2011/08/29 14:47:09 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.15 2011/09/06 10:48:28 jmcneill Exp $"); #include #include @@ -1070,6 +1070,15 @@ { uint16_t fmt = 0; + switch (param->encoding) { + case AUDIO_ENCODING_AC3: + fmt |= HDAUDIO_FMT_TYPE_NONPCM; + break; + default: + fmt |= HDAUDIO_FMT_TYPE_PCM; + break; + } + switch (param->sample_rate) { case 8000: fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) | Index: src/sys/dev/pci/hdaudio/hdaudioreg.h diff -u src/sys/dev/pci/hdaudio/hdaudioreg.h:1.6 src/sys/dev/pci/hdaudio/hdaudioreg.h:1.7 --- src/sys/dev/pci/hdaudio/hdaudioreg.h:1.6 Tue Sep 6 01:51:44 2011 +++ src/sys/dev/pci/hdaudio/hdaudioreg.h Tue Sep 6 10:48:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudioreg.h,v 1.6 2011/09/06 01:51:44 jmcneill Exp $ */ +/* $NetBSD: hdaudioreg.h,v 1.7 2011/09/06 10:48:28 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -123,6 +123,9 @@ #define HDAUDIO_SD_FIFOW(x) HDAUDIO_SD_REG(0x0e, x) #define HDAUDIO_SD_FIFOS(x) HDAUDIO_SD_REG(0x10, x) #define HDAUDIO_SD_FMT(x) HDAUDIO_SD_REG(0x12, x) +#define HDAUDIO_FMT_TYPE_MASK 0x8000 +#define HDAUDIO_FMT_TYPE_PCM 0x +#define HDAUDIO_FMT_TYPE_NONPCM 0x8000 #define HDAUDIO_FMT_BASE_MASK 0x4000 #define HDAUDIO_FMT_BASE_48 0x #define HDAUDIO_FMT_BASE_44 0x4000
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Tue Sep 6 11:14:17 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Set the /AUDIO digital converter control bit for non-PCM streams To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.3 src/sys/dev/pci/hdaudio/hdafg.c:1.4 --- src/sys/dev/pci/hdaudio/hdafg.c:1.3 Tue Sep 6 01:51:44 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Tue Sep 6 11:14:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.3 2011/09/06 01:51:44 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.4 2011/09/06 11:14:17 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.3 2011/09/06 01:51:44 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.4 2011/09/06 11:14:17 jmcneill Exp $"); #include #include @@ -3050,6 +3050,9 @@ fmt = hdaudio_stream_param(sc->sc_audiodev.ad_capture, &sc->sc_rparam); + if (fmt & HDAUDIO_FMT_TYPE_NONPCM) + dfmt |= COP_DIGITAL_CONVCTRL1_NAUDIO; + for (i = 0; i < sc->sc_nassocs; i++) { if (as[i].as_enable == false) continue;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Wed Sep 7 00:16:40 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: hdafg_stream_connect: if connecting a non-PCM stream, make sure only converters that support non-PCM formats are configured to decode it To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.4 src/sys/dev/pci/hdaudio/hdafg.c:1.5 --- src/sys/dev/pci/hdaudio/hdafg.c:1.4 Tue Sep 6 11:14:17 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Sep 7 00:16:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.4 2011/09/06 11:14:17 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.4 2011/09/06 11:14:17 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $"); #include #include @@ -3100,6 +3100,15 @@ if (as[i].as_activated == false) c = 0; + /* + * If a non-PCM stream is being connected, and the + * converter doesn't support non-PCM streams, then + * don't decode it + */ + if ((fmt & HDAUDIO_FMT_TYPE_NONPCM) && + !(w->w_p.stream_format & COP_STREAM_FORMAT_AC3)) +c = 0; + hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_CONVERTER_FORMAT, fmt); if (w->w_p.aw_cap & COP_AWCAP_DIGITAL) { @@ -3118,7 +3127,8 @@ } hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_CONVERTER_STREAM_CHANNEL, c); - chn += COP_AWCAP_CHANNEL_COUNT(w->w_p.aw_cap); + if (c != 0) +chn += COP_AWCAP_CHANNEL_COUNT(w->w_p.aw_cap); } for (j = 0; j < HDAUDIO_MAXPINS; j++) {
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Wed Sep 7 12:33:06 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Read/modify/write the digital converter control 1 register when setting up digital playback instead of clobbering existing state. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.5 src/sys/dev/pci/hdaudio/hdafg.c:1.6 --- src/sys/dev/pci/hdaudio/hdafg.c:1.5 Wed Sep 7 00:16:40 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Sep 7 12:33:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.6 2011/09/07 12:33:06 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.6 2011/09/07 12:33:06 jmcneill Exp $"); #include #include @@ -3041,8 +3041,6 @@ KASSERT(mode == AUMODE_PLAY || mode == AUMODE_RECORD); - dfmt = COP_DIGITAL_CONVCTRL1_DIGEN; - if (mode == AUMODE_PLAY) fmt = hdaudio_stream_param(sc->sc_audiodev.ad_playback, &sc->sc_pparam); @@ -3050,8 +3048,6 @@ fmt = hdaudio_stream_param(sc->sc_audiodev.ad_capture, &sc->sc_rparam); - if (fmt & HDAUDIO_FMT_TYPE_NONPCM) - dfmt |= COP_DIGITAL_CONVCTRL1_NAUDIO; for (i = 0; i < sc->sc_nassocs; i++) { if (as[i].as_enable == false) @@ -3112,6 +3108,13 @@ hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_CONVERTER_FORMAT, fmt); if (w->w_p.aw_cap & COP_AWCAP_DIGITAL) { +dfmt = hdaudio_command(sc->sc_codec, w->w_nid, +CORB_GET_DIGITAL_CONVERTER_CONTROL_1, 0); +dfmt |= COP_DIGITAL_CONVCTRL1_DIGEN; +if (fmt & HDAUDIO_FMT_TYPE_NONPCM) + dfmt |= COP_DIGITAL_CONVCTRL1_NAUDIO; +else + dfmt &= ~COP_DIGITAL_CONVCTRL1_NAUDIO; hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_DIGITAL_CONVERTER_CONTROL_1, dfmt); }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Wed Sep 7 13:07:22 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: build fix for previous To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.6 src/sys/dev/pci/hdaudio/hdafg.c:1.7 --- src/sys/dev/pci/hdaudio/hdafg.c:1.6 Wed Sep 7 12:33:06 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Sep 7 13:07:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.6 2011/09/07 12:33:06 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.7 2011/09/07 13:07:21 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.6 2011/09/07 12:33:06 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.7 2011/09/07 13:07:21 jmcneill Exp $"); #include #include @@ -3109,7 +3109,8 @@ CORB_SET_CONVERTER_FORMAT, fmt); if (w->w_p.aw_cap & COP_AWCAP_DIGITAL) { dfmt = hdaudio_command(sc->sc_codec, w->w_nid, -CORB_GET_DIGITAL_CONVERTER_CONTROL_1, 0); +CORB_GET_DIGITAL_CONVERTER_CONTROL, 0) & +0xff; dfmt |= COP_DIGITAL_CONVCTRL1_DIGEN; if (fmt & HDAUDIO_FMT_TYPE_NONPCM) dfmt |= COP_DIGITAL_CONVCTRL1_NAUDIO;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Wed Sep 7 20:34:59 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Enable non-PCM passthru for digital converters, and treat the "AC3 supported" flag to mean that the codec supports AC3 decoding for analog converters. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.7 src/sys/dev/pci/hdaudio/hdafg.c:1.8 --- src/sys/dev/pci/hdaudio/hdafg.c:1.7 Wed Sep 7 13:07:21 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Sep 7 20:34:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.7 2011/09/07 13:07:21 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.8 2011/09/07 20:34:58 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.7 2011/09/07 13:07:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.8 2011/09/07 20:34:58 jmcneill Exp $"); #include #include @@ -3098,12 +3098,16 @@ /* * If a non-PCM stream is being connected, and the - * converter doesn't support non-PCM streams, then - * don't decode it + * analog converter doesn't support non-PCM streams, + * then don't decode it */ - if ((fmt & HDAUDIO_FMT_TYPE_NONPCM) && - !(w->w_p.stream_format & COP_STREAM_FORMAT_AC3)) -c = 0; + if (!(w->w_p.aw_cap & COP_AWCAP_DIGITAL) && + !(w->w_p.stream_format & COP_STREAM_FORMAT_AC3) && + (fmt & HDAUDIO_FMT_TYPE_NONPCM)) { +hdaudio_command(sc->sc_codec, w->w_nid, +CORB_SET_CONVERTER_STREAM_CHANNEL, 0); +continue; + } hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_CONVERTER_FORMAT, fmt); @@ -3131,8 +3135,7 @@ } hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_CONVERTER_STREAM_CHANNEL, c); - if (c != 0) -chn += COP_AWCAP_CHANNEL_COUNT(w->w_p.aw_cap); + chn += COP_AWCAP_CHANNEL_COUNT(w->w_p.aw_cap); } for (j = 0; j < HDAUDIO_MAXPINS; j++) { @@ -3290,7 +3293,7 @@ struct hdaudio_assoc *as = sc->sc_assocs; struct hdaudio_widget *w; struct audio_format f; - uint32_t stream_format; + uint32_t stream_format, caps; int nchan, i, nid; sc->sc_pchan = sc->sc_rchan = 0; @@ -3315,11 +3318,13 @@ hda_print1(sc, " %uHz", hdafg_possible_rates[i]); stream_format = sc->sc_p.stream_format; + caps = 0; for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) { w = hdafg_widget_lookup(sc, nid); if (w == NULL) continue; stream_format |= w->w_p.stream_format; + caps |= w->w_p.aw_cap; } if (stream_format == 0) { hda_print(sc, @@ -3342,7 +3347,8 @@ hda_print1(sc, " PCM32"); } - if (stream_format & COP_STREAM_FORMAT_AC3) { + if ((stream_format & COP_STREAM_FORMAT_AC3) || + (caps & COP_AWCAP_DIGITAL)) { int e = AUDIO_ENCODING_AC3; if (hdafg_probe_encoding(sc, 16, 16, e, false)) hda_print1(sc, " AC3");
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Thu Oct 6 22:25:00 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c Log Message: Add HDMI/DP codec ID found on NVIDIA GTX 550 Ti To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudio_ids.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/hdaudio_ids.c diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.3 src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.4 --- src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.3 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Thu Oct 6 22:25:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.c,v 1.3 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdaudio_ids.c,v 1.4 2011/10/06 22:25:00 jmcneill Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.3 2011/02/12 15:15:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.4 2011/10/06 22:25:00 jmcneill Exp $"); #include #include @@ -59,6 +59,7 @@ static const struct hdaudio_id { { HDA_VENDOR_NVIDIA, 0x000b, "GT21x HDMI" }, { HDA_VENDOR_NVIDIA, 0x000c, "MCP89 HDMI" }, { HDA_VENDOR_NVIDIA, 0x000d, "GT240 HDMI" }, + { HDA_VENDOR_NVIDIA, 0x0015, "GT5xx HDMI/DP" }, /* ??? GTX 550 Ti */ { HDA_VENDOR_NVIDIA, 0x0067, "MCP67 HDMI" }, { HDA_VENDOR_NVIDIA, 0x8001, "MCP73 HDMI" }, { HDA_VENDOR_NVIDIA, HDA_PRODUCT_ANY, "NVIDIA" },
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Oct 24 02:08:23 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: ossaudio's SNDCTL_DSP_GETOSPACE will call AUDIO_SETINFO if the block size isn't a power of two, and since the block size is changing this tells audio(4) to halt output, reconfigure the device, then trigger output again. mplayer's oss driver uses SNDCTL_DSP_GETOSPACE a lot. Instead of simply rounding to 128 bytes as required by the hardware, change hdafg_round_blocksize to return one of 128, 256, 512, 1024, 2048, 4096, or 8192. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.8 src/sys/dev/pci/hdaudio/hdafg.c:1.9 --- src/sys/dev/pci/hdaudio/hdafg.c:1.8 Wed Sep 7 20:34:58 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Mon Oct 24 02:08:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.8 2011/09/07 20:34:58 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.9 2011/10/24 02:08:22 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.8 2011/09/07 20:34:58 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.9 2011/10/24 02:08:22 jmcneill Exp $"); #include #include @@ -3801,7 +3801,7 @@ hdafg_round_blocksize(void *opaque, int { struct hdaudio_audiodev *ad = opaque; struct hdaudio_stream *st; - int bufsize; + int bufsize, nblksize; st = (mode == AUMODE_PLAY) ? ad->ad_playback : ad->ad_capture; if (st == NULL) { @@ -3810,19 +3810,24 @@ hdafg_round_blocksize(void *opaque, int return 128; } - /* Multiple of 128 */ - blksize &= ~127; - if (blksize <= 0) + if (blksize > 8192) + blksize = 8192; + else if (blksize < 0) blksize = 128; + /* HD audio wants a multiple of 128, and OSS wants a power of 2 */ + for (nblksize = 128; nblksize < blksize; nblksize <<= 1) + ; + + /* Make sure there are enough BDL descriptors */ bufsize = st->st_data.dma_size; - if (bufsize > HDAUDIO_BDL_MAX * blksize) { + if (bufsize > HDAUDIO_BDL_MAX * nblksize) { blksize = bufsize / HDAUDIO_BDL_MAX; - if (blksize & 127) - blksize = (blksize + 127) & ~127; + for (nblksize = 128; nblksize < blksize; nblksize <<= 1) + ; } - return blksize; + return nblksize; } static int
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Oct 24 22:20:59 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c hdaudio_ids.h Log Message: add VMware codec ID To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/hdaudio/hdaudio_ids.c cvs rdiff -u -r1.2 -r1.3 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/hdaudio_ids.c diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.4 src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.5 --- src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.4 Thu Oct 6 22:25:00 2011 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Mon Oct 24 22:20:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.c,v 1.4 2011/10/06 22:25:00 jmcneill Exp $ */ +/* $NetBSD: hdaudio_ids.c,v 1.5 2011/10/24 22:20:59 jmcneill Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.4 2011/10/06 22:25:00 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.5 2011/10/24 22:20:59 jmcneill Exp $"); #include #include @@ -241,6 +241,9 @@ static const struct hdaudio_id { { HDA_VENDOR_SIGMATEL2, 0x76d4, "92HD83C1C5" }, { HDA_VENDOR_SIGMATEL2, 0x76d5, "92HD81B1C5" }, { HDA_VENDOR_SIGMATEL2, HDA_PRODUCT_ANY, "Sigmatel" }, + /* VMware */ + { HDA_VENDOR_VMWARE, 0x1975, "Virtual HDA" }, + { HDA_VENDOR_VMWARE, HDA_PRODUCT_ANY, "VMware" }, }; void Index: src/sys/dev/pci/hdaudio/hdaudio_ids.h diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.2 src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.3 --- src/sys/dev/pci/hdaudio/hdaudio_ids.h:1.2 Mon Sep 13 22:37:02 2010 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.h Mon Oct 24 22:20:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.h,v 1.2 2010/09/13 22:37:02 jmcneill Exp $ */ +/* $NetBSD: hdaudio_ids.h,v 1.3 2011/10/24 22:20:59 jmcneill Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -38,6 +38,7 @@ #define HDA_VENDOR_SIGMATEL2 0x111d #define HDA_VENDOR_ANALOG_DEVICES 0x11d4 #define HDA_VENDOR_CONEXANT 0x14f1 +#define HDA_VENDOR_VMWARE 0x15ad #define HDA_VENDOR_CMEDIA 0x434d #define HDA_VENDOR_INTEL 0x8086 #define HDA_VENDOR_SIGMATEL 0x8384
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Tue Oct 25 00:00:13 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: hdafg_halt_output: disable digital output To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.9 src/sys/dev/pci/hdaudio/hdafg.c:1.10 --- src/sys/dev/pci/hdaudio/hdafg.c:1.9 Mon Oct 24 02:08:22 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Tue Oct 25 00:00:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.9 2011/10/24 02:08:22 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.10 2011/10/25 00:00:13 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.9 2011/10/24 02:08:22 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.10 2011/10/25 00:00:13 jmcneill Exp $"); #include #include @@ -3840,6 +3840,34 @@ static int hdafg_halt_output(void *opaque) { struct hdaudio_audiodev *ad = opaque; + struct hdafg_softc *sc = ad->ad_sc; + struct hdaudio_assoc *as = ad->ad_sc->sc_assocs; + struct hdaudio_widget *w; + uint16_t dfmt; + int i, j; + + /* Disable digital outputs */ + for (i = 0; i < sc->sc_nassocs; i++) { + if (as[i].as_enable == false) + continue; + if (as[i].as_dir != HDAUDIO_PINDIR_OUT) + continue; + for (j = 0; j < HDAUDIO_MAXPINS; j++) { + if (as[i].as_dacs[j] == 0) +continue; + w = hdafg_widget_lookup(sc, as[i].as_dacs[j]); + if (w == NULL || w->w_enable == false) +continue; + if (w->w_p.aw_cap & COP_AWCAP_DIGITAL) { +dfmt = hdaudio_command(sc->sc_codec, w->w_nid, +CORB_GET_DIGITAL_CONVERTER_CONTROL, 0) & +0xff; +dfmt &= ~COP_DIGITAL_CONVCTRL1_DIGEN; +hdaudio_command(sc->sc_codec, w->w_nid, +CORB_SET_DIGITAL_CONVERTER_CONTROL_1, dfmt); + } + } + } hdaudio_stream_stop(ad->ad_playback);
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jakllsch Date: Fri Nov 4 15:32:34 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c Log Message: Don't attempt to reference a non-existent device. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.15 src/sys/dev/pci/hdaudio/hdaudio.c:1.16 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.15 Tue Sep 6 10:48:28 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Fri Nov 4 15:32:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.15 2011/09/06 10:48:28 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.16 2011/11/04 15:32:34 jakllsch Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.15 2011/09/06 10:48:28 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.16 2011/11/04 15:32:34 jakllsch Exp $"); #include #include @@ -1477,6 +1477,8 @@ hdaudio_dispatch_fgrp_ioctl(struct hdaud fg = hdaudioioctl_fgrp_lookup(sc, codecid, nid); if (fg == NULL) return ENODEV; + if (fg->fg_device == NULL) + return ENXIO; fgrp_sc = device_private(fg->fg_device); fgrp_dict = device_properties(fg->fg_device);
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: riastradh Date: Sat Jul 9 16:01:31 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c Log Message: Release mutex before unmapping DMA memory. Fixes a LOCKDEBUG panic triggered by `hdaudioctl set'. ok jmcneill To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.11 src/sys/dev/pci/hdaudio/hdaudio.c:1.12 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.11 Sun Feb 13 17:49:12 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sat Jul 9 16:01:31 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.11 2011/02/13 17:49:12 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.11 2011/02/13 17:49:12 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $"); #include #include @@ -1034,6 +1034,7 @@ hdaudio_stream_disestablish(struct hdaudio_stream *st) { struct hdaudio_softc *sc = st->st_host; + struct hdaudio_dma dma; KASSERT(sc->sc_stream_mask & (1 << st->st_shift)); @@ -1041,8 +1042,12 @@ sc->sc_stream_mask &= ~(1 << st->st_shift); st->st_intr = NULL; st->st_cookie = NULL; - hdaudio_dma_free(sc, &st->st_bdl); + dma = st->st_bdl; + st->st_bdl.dma_valid = false; mutex_exit(&sc->sc_stream_mtx); + + /* Can't bus_dmamem_unmap while holding a mutex. */ + hdaudio_dma_free(sc, &dma); } /*
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jakllsch Date: Sat Aug 13 16:08:23 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c Log Message: detach childern too To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.12 src/sys/dev/pci/hdaudio/hdaudio.c:1.13 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.12 Sat Jul 9 16:01:31 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sat Aug 13 16:08:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $ */ +/* $NetBSD: hdaudio.c,v 1.13 2011/08/13 16:08:23 jakllsch Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.13 2011/08/13 16:08:23 jakllsch Exp $"); #include #include @@ -866,9 +866,17 @@ int hdaudio_detach(struct hdaudio_softc *sc, int flags) { + int error; + /* Disable interrupts */ hdaudio_intr_disable(sc); + error = config_detach_children(sc->sc_dev, flags); + if (error != 0) { + hdaudio_intr_enable(sc); + return error; + } + mutex_destroy(&sc->sc_corb_mtx); mutex_destroy(&sc->sc_stream_mtx);
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jakllsch Date: Wed Feb 1 16:56:34 UTC 2012 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_pci.c Log Message: Set HDAUDIO_PCI_TCSEL to TC0 like Linux does. Fixes stalled audio on Lenovo X60 with coreboot firmware. Additionally, move snooping adjustment to be executed on resume too, as Linux does. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/hdaudio/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/hdaudio_pci.c diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.10 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.11 --- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.10 Thu Nov 24 03:35:59 2011 +++ src/sys/dev/pci/hdaudio/hdaudio_pci.c Wed Feb 1 16:56:34 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_pci.c,v 1.10 2011/11/24 03:35:59 mrg Exp $ */ +/* $NetBSD: hdaudio_pci.c,v 1.11 2012/02/01 16:56:34 jakllsch Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.10 2011/11/24 03:35:59 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.11 2012/02/01 16:56:34 jakllsch Exp $"); #include #include @@ -56,6 +56,7 @@ struct hdaudio_pci_softc { pcitag_t sc_tag; pci_chipset_tag_t sc_pc; void *sc_ih; + pcireg_t sc_id; }; static int hdaudio_pci_match(device_t, cfdata_t, void *); @@ -65,6 +66,7 @@ static int hdaudio_pci_rescan(device_t, static void hdaudio_pci_childdet(device_t, device_t); static int hdaudio_pci_intr(void *); +static void hdaudio_pci_reinit(struct hdaudio_pci_softc *); /* power management */ static bool hdaudio_pci_resume(device_t, const pmf_qual_t *); @@ -112,6 +114,7 @@ hdaudio_pci_attach(device_t parent, devi sc->sc_pc = pa->pa_pc; sc->sc_tag = pa->pa_tag; + sc->sc_id = pa->pa_id; sc->sc_hdaudio.sc_subsystem = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_SUBSYS_ID_REG); @@ -155,17 +158,7 @@ hdaudio_pci_attach(device_t parent, devi if (!pmf_device_register(self, NULL, hdaudio_pci_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); - switch (PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_NVIDIA: - /* enable snooping */ - csr = pci_conf_read(sc->sc_pc, sc->sc_tag, - HDAUDIO_NV_REG_SNOOP); - csr &= ~HDAUDIO_NV_SNOOP_MASK; - csr |= HDAUDIO_NV_SNOOP_ENABLE; - pci_conf_write(sc->sc_pc, sc->sc_tag, - HDAUDIO_NV_REG_SNOOP, csr); - break; - } + hdaudio_pci_reinit(sc); /* Attach bus-independent HD audio layer */ hdaudio_attach(self, &sc->sc_hdaudio); @@ -224,10 +217,36 @@ hdaudio_pci_intr(void *opaque) return hdaudio_intr(&sc->sc_hdaudio); } + +static void +hdaudio_pci_reinit(struct hdaudio_pci_softc *sc) +{ + pcireg_t val; + + /* stops playback static */ + val = pci_conf_read(sc->sc_pc, sc->sc_tag, HDAUDIO_PCI_TCSEL); + val &= ~7; + val |= 0; + pci_conf_write(sc->sc_pc, sc->sc_tag, HDAUDIO_PCI_TCSEL, val); + + switch (PCI_VENDOR(sc->sc_id)) { + case PCI_VENDOR_NVIDIA: + /* enable snooping */ + val = pci_conf_read(sc->sc_pc, sc->sc_tag, + HDAUDIO_NV_REG_SNOOP); + val &= ~HDAUDIO_NV_SNOOP_MASK; + val |= HDAUDIO_NV_SNOOP_ENABLE; + pci_conf_write(sc->sc_pc, sc->sc_tag, + HDAUDIO_NV_REG_SNOOP, val); + break; + } +} + static bool hdaudio_pci_resume(device_t self, const pmf_qual_t *qual) { struct hdaudio_pci_softc *sc = device_private(self); + hdaudio_pci_reinit(sc); return hdaudio_resume(&sc->sc_hdaudio); }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: nonaka Date: Sat Mar 3 05:41:45 UTC 2012 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c Log Message: Added Conexant 20671. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudio_ids.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/hdaudio_ids.c diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.5 src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.6 --- src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.5 Mon Oct 24 22:20:59 2011 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Sat Mar 3 05:41:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.c,v 1.5 2011/10/24 22:20:59 jmcneill Exp $ */ +/* $NetBSD: hdaudio_ids.c,v 1.6 2012/03/03 05:41:45 nonaka Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.5 2011/10/24 22:20:59 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.6 2012/03/03 05:41:45 nonaka Exp $"); #include #include @@ -158,6 +158,7 @@ static const struct hdaudio_id { { HDA_VENDOR_CONEXANT, 0x5066, "CX20582" }, { HDA_VENDOR_CONEXANT, 0x5067, "CX20583" }, { HDA_VENDOR_CONEXANT, 0x5069, "CX20585" }, + { HDA_VENDOR_CONEXANT, 0x506e, "CX20671" }, { HDA_VENDOR_CONEXANT, HDA_PRODUCT_ANY, "Conexant" }, /* CMedia */ { HDA_VENDOR_CMEDIA, 0x4980, "CMI9880" },
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: para Date: Sun Mar 11 19:39:36 UTC 2012 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: call kmem_free with the right address in hdafg_detach for sc_widgets the former code let to memory corruption To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.15 src/sys/dev/pci/hdaudio/hdafg.c:1.16 --- src/sys/dev/pci/hdaudio/hdafg.c:1.15 Wed Dec 21 02:16:57 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Sun Mar 11 19:39:36 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $"); #include #include @@ -3733,7 +3733,7 @@ static int hdafg_detach(device_t self, int flags) { struct hdafg_softc *sc = device_private(self); - struct hdaudio_widget *w = sc->sc_widgets; + struct hdaudio_widget *wl, *w = sc->sc_widgets; struct hdaudio_assoc *as = sc->sc_assocs; struct hdaudio_control *ctl = sc->sc_ctls; struct hdaudio_mixer *mx = sc->sc_mixers; @@ -3755,10 +3755,10 @@ hdafg_detach(device_t self, int flags) /* restore bios pin widget configuration */ for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) { - w = hdafg_widget_lookup(sc, nid); - if (w == NULL || w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) + wl = hdafg_widget_lookup(sc, nid); + if (wl == NULL || wl->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) continue; - hdafg_widget_setconfig(w, w->w_pin.biosconfig); + hdafg_widget_setconfig(wl, wl->w_pin.biosconfig); } if (w)
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Feb 13 17:49:12 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdaudio.c hdaudiovar.h Log Message: switch back to polling rirb, this will have to be revisited To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.10 src/sys/dev/pci/hdaudio/hdaudio.c:1.11 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.10 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Sun Feb 13 17:49:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.10 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdaudio.c,v 1.11 2011/02/13 17:49:12 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,13 +30,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.10 2011/02/12 15:15:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.11 2011/02/13 17:49:12 jmcneill Exp $"); #include #include #include #include -#include #include #include #include @@ -265,8 +264,8 @@ } } -static void -hdaudio_rirb_dequeue(struct hdaudio_softc *sc) +static uint32_t +hdaudio_rirb_dequeue(struct hdaudio_softc *sc, bool unsol) { uint16_t rirbwp; uint64_t *rirb = DMA_KERNADDR(&sc->sc_rirb); @@ -278,14 +277,17 @@ rirbwp = hda_read2(sc, HDAUDIO_MMIO_RIRBWP); while (--retry > 0 && (rirbwp & 0xff) == sc->sc_rirbrp) { + if (unsol) { +/* don't wait for more unsol events */ +hda_trace(sc, "unsol: rirb empty\n"); +return 0x; + } hda_delay(10); rirbwp = hda_read2(sc, HDAUDIO_MMIO_RIRBWP); } if (retry == 0) { - if (sc->sc_rirbpoll) -hda_error(sc, "RIRB timeout [poll]\n"); - sc->sc_rirbdata = 0x; - return; + hda_error(sc, "RIRB timeout\n"); + return 0x; } sc->sc_rirbrp++; @@ -298,7 +300,8 @@ bus_dmamap_sync(sc->sc_dmat, sc->sc_rirb.dma_map, 0, sc->sc_rirb.dma_size, BUS_DMASYNC_PREREAD); - hda_trace(sc, "rirb: response %08X %08X\n", + hda_trace(sc, "%s: response %08X %08X\n", + unsol ? "unsol" : "cmd ", entry.resp, entry.resp_ex); if (RIRB_UNSOL(&entry)) { @@ -306,8 +309,7 @@ continue; } - sc->sc_rirbdata = entry.resp; - return; + return entry.resp; } } @@ -316,28 +318,16 @@ uint32_t param) { struct hdaudio_softc *sc = co->co_host; - int error; + uint32_t result; mutex_enter(&sc->sc_corb_mtx); + hda_trace(sc, "cmd : request %08X %08X (%02X)\n", + control, param, nid); hdaudio_corb_enqueue(sc, co->co_addr, nid, control, param); - if (sc->sc_rirbpoll) { - hdaudio_rirb_dequeue(sc); - } else { - error = cv_timedwait_sig(&sc->sc_corb_cv, &sc->sc_corb_mtx, hz); - switch (error) { - case EWOULDBLOCK: - hda_error(sc, "cmd: %02X %02X (%02X) RIRB timeout\n", - control, param, nid); - break; - case EINTR: - hda_trace(sc, "cmd: %02X %02X (%02X) RIRB cancelled\n", - control, param, nid); - break; - } - } + result = hdaudio_rirb_dequeue(sc, false); mutex_exit(&sc->sc_corb_mtx); - return sc->sc_rirbdata; + return result; } static int @@ -642,13 +632,11 @@ hda_read4(sc, HDAUDIO_MMIO_INTSTS)); hda_write4(sc, HDAUDIO_MMIO_INTCTL, HDAUDIO_INTCTL_GIE | HDAUDIO_INTCTL_CIE); - sc->sc_rirbpoll = false; } static void hdaudio_intr_disable(struct hdaudio_softc *sc) { - sc->sc_rirbpoll = true; hda_write4(sc, HDAUDIO_MMIO_INTCTL, 0); } @@ -792,8 +780,6 @@ sc->sc_dev = dev; mutex_init(&sc->sc_corb_mtx, MUTEX_DEFAULT, IPL_AUDIO); mutex_init(&sc->sc_stream_mtx, MUTEX_DEFAULT, IPL_AUDIO); - cv_init(&sc->sc_corb_cv, "hdacodec"); - sc->sc_rirbpoll = true; hdaudio_init(sc); @@ -885,7 +871,6 @@ mutex_destroy(&sc->sc_corb_mtx); mutex_destroy(&sc->sc_stream_mtx); - cv_destroy(&sc->sc_corb_cv); hdaudio_dma_free(sc, &sc->sc_corb); hdaudio_dma_free(sc, &sc->sc_rirb); @@ -982,8 +967,7 @@ rirbsts = hda_read1(sc, HDAUDIO_MMIO_RIRBSTS); if (rirbsts & HDAUDIO_RIRBSTS_RINTFL) { mutex_enter(&sc->sc_corb_mtx); - hdaudio_rirb_dequeue(sc); - cv_signal(&sc->sc_corb_cv); + hdaudio_rirb_dequeue(sc, true); mutex_exit(&sc->sc_corb_mtx); } if (rirbsts & (HDAUDIO_RIRBSTS_RIRBOIS|HDAUDIO_RIRBSTS_RINTFL)) Index: src/sys/dev/pci/hdaudio/hdaudiovar.h diff -u src/sys/dev/pci/hdaudio/hdaudiovar.h:1.8 src/sys/dev/pci/hdaudio/hdaudiovar.h:1.9 --- src/sys/dev/pci/hdaudio/hdaudiovar.h:1.8 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdaudiovar.h Sun Feb 13 17:49:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudiovar.h,v 1.8 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdaudiovar.h,v 1.9 2011/02/13 17:49:12 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -158,12 +158,9 @@ uint32
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Sun Dec 11 15:13:58 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: PR# kern/45701: hdaudio stops working after suspend/resume and then detach/reattach restore BIOS pin widget config on detach, and selected pin widget config on resume To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.11 src/sys/dev/pci/hdaudio/hdafg.c:1.12 --- src/sys/dev/pci/hdaudio/hdafg.c:1.11 Wed Nov 23 23:07:36 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Sun Dec 11 15:13:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.11 2011/11/23 23:07:36 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.12 2011/12/11 15:13:58 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.11 2011/11/23 23:07:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.12 2011/12/11 15:13:58 jmcneill Exp $"); #include #include @@ -241,6 +241,7 @@ struct hdaudio_widget { } w_p; struct { uint32_t config; + uint32_t biosconfig; uint32_t cap; uint32_t ctrl; } w_pin; @@ -552,6 +553,36 @@ hdafg_widget_pin_dump(struct hdafg_softc } } +static void +hdafg_widget_setconfig(struct hdaudio_widget *w) +{ + struct hdafg_softc *sc = w->w_afg; + + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_1, w->w_pin.config & 0xff); + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_2, (w->w_pin.config >> 8) & 0xff); + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_3, (w->w_pin.config >> 16) & 0xff); + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_4, (w->w_pin.config >> 24) & 0xff); +} + +static void +hdafg_widget_setbiosconfig(struct hdaudio_widget *w) +{ + struct hdafg_softc *sc = w->w_afg; + + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_1, w->w_pin.biosconfig & 0xff); + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_2, (w->w_pin.biosconfig >> 8) & 0xff); + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_3, (w->w_pin.biosconfig >> 16) & 0xff); + hdaudio_command(sc->sc_codec, w->w_nid, + CORB_SET_CONFIGURATION_DEFAULT_4, (w->w_pin.biosconfig >> 24) & 0xff); +} + static uint32_t hdafg_widget_getconfig(struct hdaudio_widget *w) { @@ -593,6 +624,8 @@ hdafg_widget_pin_parse(struct hdaudio_wi w->w_pin.cap = hda_get_wparam(w, PIN_CAPABILITIES); w->w_pin.config = hdafg_widget_getconfig(w); + w->w_pin.biosconfig = hdaudio_command(sc->sc_codec, w->w_nid, + CORB_GET_CONFIGURATION_DEFAULT, 0); w->w_pin.ctrl = hdaudio_command(sc->sc_codec, w->w_nid, CORB_GET_PIN_WIDGET_CONTROL, 0); @@ -732,6 +765,7 @@ hdafg_widget_parse(struct hdaudio_widget break; case COP_AWCAP_TYPE_PIN_COMPLEX: hdafg_widget_pin_parse(w); + hdafg_widget_setconfig(w); break; } } @@ -3698,6 +3732,7 @@ hdafg_detach(device_t self, int flags) struct hdaudio_assoc *as = sc->sc_assocs; struct hdaudio_control *ctl = sc->sc_ctls; struct hdaudio_mixer *mx = sc->sc_mixers; + int nid; callout_halt(&sc->sc_jack_callout, NULL); callout_destroy(&sc->sc_jack_callout); @@ -3712,6 +3747,15 @@ hdafg_detach(device_t self, int flags) hdaudio_stream_disestablish(sc->sc_audiodev.ad_playback); if (sc->sc_audiodev.ad_capture) hdaudio_stream_disestablish(sc->sc_audiodev.ad_capture); + + /* restore bios pin widget configuration */ + for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) { + w = hdafg_widget_lookup(sc, nid); + if (w == NULL || w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) + continue; + hdafg_widget_setbiosconfig(w); + } + if (w) kmem_free(w, sc->sc_nwidgets * sizeof(*w)); if (as) @@ -3752,14 +3796,22 @@ static bool hdafg_resume(device_t self, const pmf_qual_t *qual) { struct hdafg_softc *sc = device_private(self); + struct hdaudio_widget *w; int nid; hdaudio_command(sc->sc_codec, sc->sc_nid, CORB_SET_POWER_STATE, COP_POWER_STATE_D0); hda_delay(100); - for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) + for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) { hdaudio_command(sc->sc_codec, nid, CORB_SET_POWER_STATE, COP_POWER_STATE_D0); + w = hdafg_widget_lookup(sc, nid); + + /* restore pin widget configuration */ + if (w == NULL || w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) + continue; + hdafg_widget_setconfig(w); + } hda_delay(1000); hdafg_commit(sc);
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Mon Dec 12 01:25:29 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: remove duplicated code. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.12 src/sys/dev/pci/hdaudio/hdafg.c:1.13 --- src/sys/dev/pci/hdaudio/hdafg.c:1.12 Sun Dec 11 10:13:58 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Sun Dec 11 20:25:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.12 2011/12/11 15:13:58 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.13 2011/12/12 01:25:29 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.12 2011/12/11 15:13:58 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.13 2011/12/12 01:25:29 christos Exp $"); #include #include @@ -554,33 +554,18 @@ hdafg_widget_pin_dump(struct hdafg_softc } static void -hdafg_widget_setconfig(struct hdaudio_widget *w) +hdafg_widget_setconfig(struct hdaudio_widget *w, uint32_t cfg) { struct hdafg_softc *sc = w->w_afg; hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_1, w->w_pin.config & 0xff); + CORB_SET_CONFIGURATION_DEFAULT_1, (cfg >> 0) & 0xff); hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_2, (w->w_pin.config >> 8) & 0xff); + CORB_SET_CONFIGURATION_DEFAULT_2, (cfg >> 8) & 0xff); hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_3, (w->w_pin.config >> 16) & 0xff); + CORB_SET_CONFIGURATION_DEFAULT_3, (cfg >> 16) & 0xff); hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_4, (w->w_pin.config >> 24) & 0xff); -} - -static void -hdafg_widget_setbiosconfig(struct hdaudio_widget *w) -{ - struct hdafg_softc *sc = w->w_afg; - - hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_1, w->w_pin.biosconfig & 0xff); - hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_2, (w->w_pin.biosconfig >> 8) & 0xff); - hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_3, (w->w_pin.biosconfig >> 16) & 0xff); - hdaudio_command(sc->sc_codec, w->w_nid, - CORB_SET_CONFIGURATION_DEFAULT_4, (w->w_pin.biosconfig >> 24) & 0xff); + CORB_SET_CONFIGURATION_DEFAULT_4, (cfg >> 24) & 0xff); } static uint32_t @@ -765,7 +750,7 @@ hdafg_widget_parse(struct hdaudio_widget break; case COP_AWCAP_TYPE_PIN_COMPLEX: hdafg_widget_pin_parse(w); - hdafg_widget_setconfig(w); + hdafg_widget_setconfig(w, w->w_pin.config); break; } } @@ -3753,7 +3738,7 @@ hdafg_detach(device_t self, int flags) w = hdafg_widget_lookup(sc, nid); if (w == NULL || w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) continue; - hdafg_widget_setbiosconfig(w); + hdafg_widget_setconfig(w, w->w_pin.biosconfig); } if (w) @@ -3810,7 +3795,7 @@ hdafg_resume(device_t self, const pmf_qu /* restore pin widget configuration */ if (w == NULL || w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) continue; - hdafg_widget_setconfig(w); + hdafg_widget_setconfig(w, w->w_pin.config); } hda_delay(1000);
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Mon Dec 19 12:19:27 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: for analog devices codecs, mark the analog beeper pin as a beep generator to help the parser. makes pcppi beep work again. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.13 src/sys/dev/pci/hdaudio/hdafg.c:1.14 --- src/sys/dev/pci/hdaudio/hdafg.c:1.13 Mon Dec 12 01:25:29 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Mon Dec 19 12:19:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.13 2011/12/12 01:25:29 christos Exp $ */ +/* $NetBSD: hdafg.c,v 1.14 2011/12/19 12:19:26 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.13 2011/12/12 01:25:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.14 2011/12/19 12:19:26 jmcneill Exp $"); #include #include @@ -675,15 +675,38 @@ hdafg_widget_getcaps(struct hdaudio_widg { struct hdafg_softc *sc = w->w_afg; uint32_t wcap, config; + bool pcbeep = false; wcap = hda_get_wparam(w, AUDIO_WIDGET_CAPABILITIES); config = hdafg_widget_getconfig(w); w->w_waspin = false; - if (sc->sc_has_beepgen == false && + switch (sc->sc_vendor) { + case HDA_VENDOR_ANALOG_DEVICES: + /* + * help the parser by marking the analog + * beeper as a beep generator + */ + if (w->w_nid == 0x1a && + COP_CFG_SEQUENCE(config) == 0x0 && + COP_CFG_DEFAULT_ASSOCIATION(config) == 0xf && + COP_CFG_PORT_CONNECTIVITY(config) == + COP_PORT_FIXED_FUNCTION && + COP_CFG_DEFAULT_DEVICE(config) == + COP_DEVICE_OTHER && + COP_CFG_CONNECTION_TYPE(config) == + COP_CONN_TYPE_ATAPI_INTERNAL && + COP_CFG_COLOR(config) == 0x0) { + pcbeep = true; + } + break; + } + + if (pcbeep || + (sc->sc_has_beepgen == false && COP_CFG_DEFAULT_DEVICE(config) == COP_DEVICE_SPEAKER && - (wcap & (COP_AWCAP_INAMP_PRESENT|COP_AWCAP_OUTAMP_PRESENT)) == 0) { + (wcap & (COP_AWCAP_INAMP_PRESENT|COP_AWCAP_OUTAMP_PRESENT)) == 0)) { wcap &= ~COP_AWCAP_TYPE_MASK; wcap |= (COP_AWCAP_TYPE_BEEP_GENERATOR << COP_AWCAP_TYPE_SHIFT); w->w_waspin = true;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jmcneill Date: Wed Dec 21 02:16:57 UTC 2011 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: relax the test for analog devices analog pcbeep widgets To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.14 src/sys/dev/pci/hdaudio/hdafg.c:1.15 --- src/sys/dev/pci/hdaudio/hdafg.c:1.14 Mon Dec 19 12:19:26 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Dec 21 02:16:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.14 2011/12/19 12:19:26 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.14 2011/12/19 12:19:26 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $"); #include #include @@ -694,10 +694,7 @@ hdafg_widget_getcaps(struct hdaudio_widg COP_CFG_PORT_CONNECTIVITY(config) == COP_PORT_FIXED_FUNCTION && COP_CFG_DEFAULT_DEVICE(config) == - COP_DEVICE_OTHER && - COP_CFG_CONNECTION_TYPE(config) == - COP_CONN_TYPE_ATAPI_INTERNAL && - COP_CFG_COLOR(config) == 0x0) { + COP_DEVICE_OTHER) { pcbeep = true; } break;
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: dholland Date: Wed Aug 29 18:52:32 UTC 2012 Modified Files: src/sys/dev/pci/hdaudio: hdafg_dd.c hdafg_dd.h Log Message: Fix rcsid. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/hdaudio/hdafg_dd.c \ src/sys/dev/pci/hdaudio/hdafg_dd.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/hdafg_dd.c diff -u src/sys/dev/pci/hdaudio/hdafg_dd.c:1.1 src/sys/dev/pci/hdaudio/hdafg_dd.c:1.2 --- src/sys/dev/pci/hdaudio/hdafg_dd.c:1.1 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdafg_dd.c Wed Aug 29 18:52:31 2012 @@ -1,4 +1,4 @@ -/* $Id: hdafg_dd.c,v 1.1 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdafg_dd.c,v 1.2 2012/08/29 18:52:31 dholland Exp $ */ /* * Copyright (c) 2011 Jared D. McNeill @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$Id: hdafg_dd.c,v 1.1 2011/02/12 15:15:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg_dd.c,v 1.2 2012/08/29 18:52:31 dholland Exp $"); #include #include Index: src/sys/dev/pci/hdaudio/hdafg_dd.h diff -u src/sys/dev/pci/hdaudio/hdafg_dd.h:1.1 src/sys/dev/pci/hdaudio/hdafg_dd.h:1.2 --- src/sys/dev/pci/hdaudio/hdafg_dd.h:1.1 Sat Feb 12 15:15:34 2011 +++ src/sys/dev/pci/hdaudio/hdafg_dd.h Wed Aug 29 18:52:32 2012 @@ -1,4 +1,4 @@ -/* $Id: hdafg_dd.h,v 1.1 2011/02/12 15:15:34 jmcneill Exp $ */ +/* $NetBSD: hdafg_dd.h,v 1.2 2012/08/29 18:52:32 dholland Exp $ */ /* * Copyright (c) 2011 Jared D. McNeill
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: njoly Date: Mon Jan 19 14:31:32 UTC 2015 Modified Files: src/sys/dev/pci/hdaudio: hdaudiodevs Log Message: Add Realtek ALC280. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/hdaudio/hdaudiodevs 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/hdaudiodevs diff -u src/sys/dev/pci/hdaudio/hdaudiodevs:1.1 src/sys/dev/pci/hdaudio/hdaudiodevs:1.2 --- src/sys/dev/pci/hdaudio/hdaudiodevs:1.1 Fri Sep 19 17:23:35 2014 +++ src/sys/dev/pci/hdaudio/hdaudiodevs Mon Jan 19 14:31:32 2015 @@ -1,4 +1,4 @@ -$NetBSD: hdaudiodevs,v 1.1 2014/09/19 17:23:35 christos Exp $ +$NetBSD: hdaudiodevs,v 1.2 2015/01/19 14:31:32 njoly Exp $ /* * Copyright (c) 2010 Jared D. McNeill @@ -70,6 +70,7 @@ product REALTEK ALC269 0x0269 ALC269 product REALTEK ALC270 0x0270 ALC270 product REALTEK ALC272 0x0272 ALC272 product REALTEK ALC275 0x0275 ALC275 +product REALTEK ALC280 0x0280 ALC280 product REALTEK ALC660_VD 0x0660 ALC660-VD product REALTEK ALC662 0x0662 ALC662 product REALTEK ALC663 0x0663 ALC663
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: njoly Date: Mon Jan 19 14:32:08 UTC 2015 Modified Files: src/sys/dev/pci/hdaudio: hdaudiodevs.h hdaudiodevs_data.h Log Message: Regen for Realtek ALC280. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudiodevs.h \ src/sys/dev/pci/hdaudio/hdaudiodevs_data.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/hdaudiodevs.h diff -u src/sys/dev/pci/hdaudio/hdaudiodevs.h:1.2 src/sys/dev/pci/hdaudio/hdaudiodevs.h:1.3 --- src/sys/dev/pci/hdaudio/hdaudiodevs.h:1.2 Sun Sep 21 14:31:03 2014 +++ src/sys/dev/pci/hdaudio/hdaudiodevs.h Mon Jan 19 14:32:08 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: hdaudiodevs.h,v 1.2 2014/09/21 14:31:03 christos Exp $ */ +/* $NetBSD: hdaudiodevs.h,v 1.3 2015/01/19 14:32:08 njoly Exp $ */ /* * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: hdaudiodevs,v 1.1 2014/09/19 17:23:35 christos Exp + * NetBSD: hdaudiodevs,v 1.2 2015/01/19 14:31:32 njoly Exp */ /* @@ -77,6 +77,7 @@ #define HDAUDIO_PRODUCT_REALTEK_ALC270 0x0270 /* ALC270 */ #define HDAUDIO_PRODUCT_REALTEK_ALC272 0x0272 /* ALC272 */ #define HDAUDIO_PRODUCT_REALTEK_ALC275 0x0275 /* ALC275 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC280 0x0280 /* ALC280 */ #define HDAUDIO_PRODUCT_REALTEK_ALC660_VD 0x0660 /* ALC660-VD */ #define HDAUDIO_PRODUCT_REALTEK_ALC662 0x0662 /* ALC662 */ #define HDAUDIO_PRODUCT_REALTEK_ALC663 0x0663 /* ALC663 */ Index: src/sys/dev/pci/hdaudio/hdaudiodevs_data.h diff -u src/sys/dev/pci/hdaudio/hdaudiodevs_data.h:1.2 src/sys/dev/pci/hdaudio/hdaudiodevs_data.h:1.3 --- src/sys/dev/pci/hdaudio/hdaudiodevs_data.h:1.2 Sun Sep 21 14:31:03 2014 +++ src/sys/dev/pci/hdaudio/hdaudiodevs_data.h Mon Jan 19 14:32:08 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: hdaudiodevs_data.h,v 1.2 2014/09/21 14:31:03 christos Exp $ */ +/* $NetBSD: hdaudiodevs_data.h,v 1.3 2015/01/19 14:32:08 njoly Exp $ */ /* * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: hdaudiodevs,v 1.1 2014/09/19 17:23:35 christos Exp + * NetBSD: hdaudiodevs,v 1.2 2015/01/19 14:31:32 njoly Exp */ /* @@ -98,320 +98,322 @@ static const uint16_t hdaudio_products[] 274, 0, HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC275, 281, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC280, 288, 0, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, + 295, 0, HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC662, - 298, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 305, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 312, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 319, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 326, 0, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, + 333, 0, HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC880, - 336, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 343, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 350, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 357, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 364, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 371, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 378, 0, - HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 385, 0, - HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, + HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 392, 0, + HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, + 399, 0, HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709, - 392, 0, + 399, 0, HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170A, - 392, 0, + 399, 0, HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170B, - 392, 0, + 399, 0, HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709_10CH_0, - 399, 406, 0, + 406, 413, 0, HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709_10CH_1, - 399, 406, 0, + 406,
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Wed Feb 11 00:37:25 UTC 2015 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c hdaudio.c hdaudiovar.h Log Message: Fix locking against myself problem: hdaudio_intr() -> mutex_enter(&sc->sc_corb_mtx); hdaudio_rirb_dequeue() -> hdaudio_rirb_unsol() -> hdafg_unsol() -> hdafg_assoc_dump_dd() -> hdaudio_command() -> mutex_enter(&sc->sc_corb_mtx); Should that be done differently? To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/hdaudio/hdafg.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/hdaudio/hdaudiovar.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.25 src/sys/dev/pci/hdaudio/hdafg.c:1.26 --- src/sys/dev/pci/hdaudio/hdafg.c:1.25 Tue Sep 23 09:29:30 2014 +++ src/sys/dev/pci/hdaudio/hdafg.c Tue Feb 10 19:37:25 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.25 2014/09/23 13:29:30 nat Exp $ */ +/* $NetBSD: hdafg.c,v 1.26 2015/02/11 00:37:25 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.25 2014/09/23 13:29:30 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.26 2015/02/11 00:37:25 christos Exp $"); #include #include @@ -836,21 +836,24 @@ hdafg_assoc_type_string(struct hdaudio_a } static void -hdafg_assoc_dump_dd(struct hdafg_softc *sc, struct hdaudio_assoc *as, int pin) +hdafg_assoc_dump_dd(struct hdafg_softc *sc, struct hdaudio_assoc *as, int pin, + int lock) { struct hdafg_dd_info hdi; struct hdaudio_widget *w; uint8_t elddata[256]; unsigned int elddatalen = 0, i; uint32_t res; + uint32_t (*cmd)(struct hdaudio_codec *, int, uint32_t, uint32_t) = + lock ? hdaudio_command : hdaudio_command_unlocked; w = hdafg_widget_lookup(sc, as->as_pins[pin]); if (w->w_pin.cap & COP_PINCAP_TRIGGER_REQD) { - hdaudio_command(sc->sc_codec, as->as_pins[pin], + (*cmd)(sc->sc_codec, as->as_pins[pin], CORB_SET_PIN_SENSE, 0); } - res = hdaudio_command(sc->sc_codec, as->as_pins[pin], + res = (*cmd)(sc->sc_codec, as->as_pins[pin], CORB_GET_PIN_SENSE, 0); #ifdef HDAFG_HDMI_DEBUG @@ -864,13 +867,13 @@ hdafg_assoc_dump_dd(struct hdafg_softc * if ((res & (COP_GET_PIN_SENSE_PRESENSE_DETECT|COP_GET_PIN_SENSE_ELD_VALID)) == (COP_GET_PIN_SENSE_PRESENSE_DETECT|COP_GET_PIN_SENSE_ELD_VALID)) { - res = hdaudio_command(sc->sc_codec, as->as_pins[pin], + res = (*cmd)(sc->sc_codec, as->as_pins[pin], CORB_GET_HDMI_DIP_SIZE, COP_DIP_ELD_SIZE); elddatalen = COP_DIP_BUFFER_SIZE(res); if (elddatalen == 0) elddatalen = sizeof(elddata); /* paranoid */ for (i = 0; i < elddatalen; i++) { - res = hdaudio_command(sc->sc_codec, as->as_pins[pin], + res = (*cmd)(sc->sc_codec, as->as_pins[pin], CORB_GET_HDMI_ELD_DATA, i); if (!(res & COP_ELD_VALID)) { hda_error(sc, "bad ELD size (%u/%u)\n", @@ -1089,7 +1092,7 @@ hdafg_assoc_dump(struct hdafg_softc *sc) for (j = 0; j < HDAUDIO_MAXPINS; j++) { if (as[i].as_pins[j] == 0) continue; -hdafg_assoc_dump_dd(sc, &as[i], j); +hdafg_assoc_dump_dd(sc, &as[i], j, 1); } } } @@ -4268,7 +4271,7 @@ hdafg_unsol(device_t self, uint8_t tag) for (j = 0; j < HDAUDIO_MAXPINS; j++) { if (as[i].as_pins[j] == 0) continue; -hdafg_assoc_dump_dd(sc, &as[i], j); +hdafg_assoc_dump_dd(sc, &as[i], j, 0); } } break; Index: src/sys/dev/pci/hdaudio/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.24 src/sys/dev/pci/hdaudio/hdaudio.c:1.25 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.24 Sun Sep 21 10:30:22 2014 +++ src/sys/dev/pci/hdaudio/hdaudio.c Tue Feb 10 19:37:25 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.24 2014/09/21 14:30:22 christos Exp $ */ +/* $NetBSD: hdaudio.c,v 1.25 2015/02/11 00:37:25 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.24 2014/09/21 14:30:22 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.25 2015/02/11 00:37:25 christos Exp $"); #include #include @@ -327,15 +327,25 @@ uint32_t hdaudio_command(struct hdaudio_codec *co, int nid, uint32_t control, uint32_t param) { + uint32_t result; + struct hdaudio_softc *sc = co->co_host; + mutex_enter(&sc->sc_corb_mtx); + result = hdaudio_command_unlocked(co, nid, control, param); + mutex_exit(&sc->sc_corb_mtx); + return result; +} + +uint32_t +hdaudio_command_unlocked(struct hdaudio_codec *co, int nid, uint32_t control, +uint32_t param) +{ struct hdaudio_softc *sc = co->co_host; uint32_t result; - mu
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Fri Sep 19 17:23:35 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: files.hdaudio hdafg.c hdaudio.c Added Files: src/sys/dev/pci/hdaudio: Makefile.hdaudiodevs hdaudio_verbose.c hdaudio_verbose.h hdaudiodevs Removed Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c hdaudio_ids.h Log Message: Pull out the device list and auto-generate it. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/hdaudio/Makefile.hdaudiodevs \ src/sys/dev/pci/hdaudio/hdaudio_verbose.c \ src/sys/dev/pci/hdaudio/hdaudio_verbose.h \ src/sys/dev/pci/hdaudio/hdaudiodevs cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/files.hdaudio cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/hdaudio/hdafg.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/hdaudio/hdaudio.c cvs rdiff -u -r1.8 -r0 src/sys/dev/pci/hdaudio/hdaudio_ids.c cvs rdiff -u -r1.3 -r0 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.5 src/sys/dev/pci/hdaudio/files.hdaudio:1.6 --- src/sys/dev/pci/hdaudio/files.hdaudio:1.5 Sat Feb 12 10:15:34 2011 +++ src/sys/dev/pci/hdaudio/files.hdaudio Fri Sep 19 13:23:35 2014 @@ -1,12 +1,12 @@ -# $NetBSD: files.hdaudio,v 1.5 2011/02/12 15:15:34 jmcneill Exp $ +# $NetBSD: files.hdaudio,v 1.6 2014/09/19 17:23:35 christos Exp $ # # Intel High Definition Audio (Revision 1.0) # define hdaudiobus {[nid = -1]} device hdaudio: hdaudiobus -file dev/pci/hdaudio/hdaudio.c hdaudio -file dev/pci/hdaudio/hdaudio_ids.c hdaudio +file dev/pci/hdaudio/hdaudio.c hdaudio +file dev/pci/hdaudio/hdaudio_verbose.c hdaudio & hdaudioverbose device hdafg: audiobus, auconv, aurateconv, mulaw attach hdafg at hdaudiobus Index: src/sys/dev/pci/hdaudio/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.21 src/sys/dev/pci/hdaudio/hdafg.c:1.22 --- src/sys/dev/pci/hdaudio/hdafg.c:1.21 Fri May 23 09:57:04 2014 +++ src/sys/dev/pci/hdaudio/hdafg.c Fri Sep 19 13:23:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $ */ +/* $NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $"); #include #include @@ -82,7 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1. #include "hdaudioreg.h" #include "hdaudio_mixer.h" #include "hdaudioio.h" -#include "hdaudio_ids.h" +#include "hdaudio_verbose.h" +#include "hdaudiodevs.h" #include "hdafg_dd.h" #include "hdmireg.h" @@ -685,7 +686,7 @@ hdafg_widget_getcaps(struct hdaudio_widg w->w_waspin = false; switch (sc->sc_vendor) { - case HDA_VENDOR_ANALOG_DEVICES: + case HDAUDIO_VENDOR_ANALOG: /* * help the parser by marking the analog * beeper as a beep generator @@ -3612,10 +3613,9 @@ hdafg_attach(device_t parent, device_t s 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)); + get_hdaudio_vendor(vendor, sizeof(vendor), sc->sc_vendor); + get_hdaudio_product(product, sizeof(product), sc->sc_vendor, + sc->sc_product); hda_print1(sc, ": %s %s%s\n", vendor, product, sc->sc_config ? " (custom configuration)" : ""); @@ -3965,10 +3965,10 @@ hdafg_getdev(void *opaque, struct audio_ struct hdaudio_audiodev *ad = opaque; struct hdafg_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)); + get_hdaudio_vendor(audiodev->name, sizeof(audiodev->name), + sc->sc_vendor); + get_hdaudio_product(audiodev->version, sizeof(audiodev->version), + sc->sc_vendor, sc->sc_product); snprintf(audiodev->config, sizeof(audiodev->config) - 1, "%02Xh", sc->sc_nid); Index: src/sys/dev/pci/hdaudio/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.22 src/sys/dev/pci/hdaudio/hdaudio.c:1.23 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.22 Fri Jul 25 04:10:38 2014 +++ src/sys/dev/pci/hdaudio/hdaudio.c Fri Sep 19 13:23:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $ */ +/* $NetBSD: hdaudio.c,v 1.23 2014/09/19 17:23:35 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.23
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Fri Sep 19 17:24:23 UTC 2014 Added Files: src/sys/dev/pci/hdaudio: devlist2h.awk Log Message: another devlist2h.awk, someone should merge them all so that they can generate efficient ids and not dup the code 10 times! To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/hdaudio/devlist2h.awk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/pci/hdaudio/devlist2h.awk diff -u /dev/null src/sys/dev/pci/hdaudio/devlist2h.awk:1.1 --- /dev/null Fri Sep 19 13:24:23 2014 +++ src/sys/dev/pci/hdaudio/devlist2h.awk Fri Sep 19 13:24:23 2014 @@ -0,0 +1,227 @@ +#! /usr/bin/awk -f +# $NetBSD: devlist2h.awk,v 1.1 2014/09/19 17:24:23 christos Exp $ +# +# Copyright (c) 1995, 1996 Christopher G. Demetriou +# All rights reserved. +# +# 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. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +#must display the following acknowledgement: +# This product includes software developed by Christopher G. Demetriou. +# 4. 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. +# +BEGIN { + nproducts = nvendors = blanklines = 0 + dfile="hdaudiodevs_data.h" + hfile="hdaudiodevs.h" +} +NR == 1 { + VERSION = $0 + gsub("\\$", "", VERSION) + gsub(/ $/, "", VERSION) + + if (os == "NetBSD") + printf("/*\t$NetBSD" "$\t*/\n\n") > dfile + else if (os == "FreeBSD") + printf("/*\t$FreeBSD" "$\t*/\n\n") > dfile + else if (os == "OpenBSD") + printf("/*\t$OpenBSD" "$\t*/\n\n") > dfile + else + printf("/* ??? */\n\n") > dfile + printf("/*\n") > dfile + printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > dfile + printf(" *\n") > dfile + printf(" * generated from:\n") > dfile + printf(" *\t%s\n", VERSION) > dfile + printf(" */\n") > dfile + + if (os == "NetBSD") + printf("/*\t$NetBSD" "$\t*/\n\n") > hfile + else if (os == "FreeBSD") + printf("/*\t$FreeBSD" "$\t*/\n\n") > hfile + else if (os == "OpenBSD") + printf("/*\t$OpenBSD" "$\t*/\n\n") > hfile + else + printf("/* ??? */\n\n") > hfile + printf("/*\n") > hfile + printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > hfile + printf(" *\n") > hfile + printf(" * generated from:\n") > hfile + printf(" *\t%s\n", VERSION) > hfile + printf(" */\n") > hfile + + next +} +NF > 0 && $1 == "vendor" { + nvendors++ + + vendorindex[$2] = nvendors; # record index for this name, for later. + vendors[nvendors, 1] = $2; # name + vendors[nvendors, 2] = $3; # id + printf("#define\tHDAUDIO_VENDOR_%s\t%s\t", vendors[nvendors, 1], + vendors[nvendors, 2]) > hfile + + i = 3; f = 4; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + printf("%s", $f) > hfile + if (f < NF) +printf(" ") > hfile + f++ + continue + } + vendors[nvendors, i] = $f + printf("%s", vendors[nvendors, i]) > hfile + if (f < NF) + printf(" ") > hfile + i++; f++; + } + if (oparen) + printf(")") > hfile + if (ocomment) + printf(" */") > hfile + printf("\n") > hfile + + next +} +NF > 0 && $1 == "product" { + nproducts++ + + products[nproducts, 1] = $2; # vendor name + products[nproducts, 2] = $3; # product id + products[nproducts, 3] = $4; # id + printf("#define\tHDAUDIO_PRODUCT_%s_%s\t%s\t", products[nproducts, 1], + products[nproducts, 2], products[nproducts, 3]) > hfile + + i=4; f = 5; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + printf("\t/* ") > hfile + oco
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Fri Sep 19 17:24:55 UTC 2014 Added Files: src/sys/dev/pci/hdaudio: hdaudiodevs.h hdaudiodevs_data.h Log Message: gen To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/hdaudio/hdaudiodevs.h \ src/sys/dev/pci/hdaudio/hdaudiodevs_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/pci/hdaudio/hdaudiodevs.h diff -u /dev/null src/sys/dev/pci/hdaudio/hdaudiodevs.h:1.1 --- /dev/null Fri Sep 19 13:24:55 2014 +++ src/sys/dev/pci/hdaudio/hdaudiodevs.h Fri Sep 19 13:24:55 2014 @@ -0,0 +1,252 @@ +/* $NetBSD: hdaudiodevs.h,v 1.1 2014/09/19 17:24:55 christos Exp $ */ + +/* + * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * generated from: + * NetBSD: hdaudiodevs,v 1.1 2014/09/19 17:23:35 christos Exp + */ + +/* + * Copyright (c) 2010 Jared D. McNeill + * 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. + */ + +/* The following is duplicated from pci except SIGMATEL* and CMEDIA */ +#define HDAUDIO_VENDOR_ATI 0x1002 /* ATI Technologies */ +#define HDAUDIO_VENDOR_NVIDIA 0x10de /* NVIDIA */ +#define HDAUDIO_VENDOR_REALTEK 0x10ec /* Realtek Semiconductor */ +#define HDAUDIO_VENDOR_VIATECH 0x1106 /* VIA TeCHnologies */ +#define HDAUDIO_VENDOR_SIGMATEL2 0x111d /* Sigmatel */ +#define HDAUDIO_VENDOR_ANALOG 0x11d4 /* Analog Devices */ +#define HDAUDIO_VENDOR_CONEXANT 0x14f1 /* Conexant Systems */ +#define HDAUDIO_VENDOR_VMWARE 0x15ad /* VMware */ +#define HDAUDIO_VENDOR_CMEDIA 0x434d /* C-Media Electronics */ +#define HDAUDIO_VENDOR_INTEL 0x8086 /* Intel */ +#define HDAUDIO_VENDOR_SIGMATEL 0x8384 /* Sigmatel */ + +/* ATI */ +#define HDAUDIO_PRODUCT_ATI_RS600_HDMI_1 0x7919 /* RS600 HDMI */ +#define HDAUDIO_PRODUCT_ATI_RS600_HDMI_2 0x793c /* RS600 HDMI */ +#define HDAUDIO_PRODUCT_ATI_RS690_780_HDMI 0x791a /* RS690/780 HDMI */ +#define HDAUDIO_PRODUCT_ATI_R6xx_HDMI 0xaa01 /* R6xx HDMI */ + +/* NVIDIA */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP77_78_HDMI_2 0x0002 /* MCP77/78 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP77_78_HDMI_3 0x0003 /* MCP77/78 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP77_78_HDMI_5 0x0005 /* MCP77/78 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP77_78_HDMI_6 0x0006 /* MCP77/78 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP79_7A_HDMI_7 0x0007 /* MCP79/7A HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_GT220_HDMI 0x000a /* GT220 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_GT21x_HDMI 0x000b /* GT21x HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP89_HDMI 0x000c /* MCP89 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_GT240_HDMI 0x000d /* GT240 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_GT5xx_HDMI_DP 0x0015 /* GT5xx HDMI/DP */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP67_HDMI 0x0067 /* MCP67 HDMI */ +#define HDAUDIO_PRODUCT_NVIDIA_MCP73_HDMI 0x8001 /* MCP73 HDMI */ + +/* Realtek */ +#define HDAUDIO_PRODUCT_REALTEK_ALC260 0x0260 /* ALC260 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC262 0x0262 /* ALC262 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC267 0x0267 /* ALC267 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC268 0x0268 /* ALC268 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC269 0x0269 /* ALC269 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC270 0x0270 /* ALC270 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC272 0x0272 /* ALC272 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC275 0x0275 /* ALC275 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC660_VD 0x0660 /* ALC660-VD */ +#define HDAUDIO_PRODUCT_REALTEK_ALC662 0x0662 /* ALC662 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC663 0x0663 /* ALC663 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC670 0x0670 /* ALC670 */ +#define HDAUDIO_PRODUCT_REALTEK_ALC861 0x0861 /*
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: nat Date: Sun Sep 21 10:41:23 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Enable sysbeep(4) to be heard on speakers on Toughbook mk1 and mk5 computers. Also on computers with SigmaTel STAC 9200(D), 9202(D) 9404(D), 9205(D) hdaudio controllers as well as Realtek ALC 231 hdaudio controllers reporting as ALC 269. Addresses PR 45778. Addresses PR 48495. This commit was approved by christos@ To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.22 src/sys/dev/pci/hdaudio/hdafg.c:1.23 --- src/sys/dev/pci/hdaudio/hdafg.c:1.22 Fri Sep 19 17:23:35 2014 +++ src/sys/dev/pci/hdaudio/hdafg.c Sun Sep 21 10:41:22 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $ */ +/* $NetBSD: hdafg.c,v 1.23 2014/09/21 10:41:22 nat Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.23 2014/09/21 10:41:22 nat Exp $"); #include #include @@ -339,6 +339,7 @@ static int hdafg_widget_info(void *, pro prop_dictionary_t); static int hdafg_codec_info(void *, prop_dictionary_t, prop_dictionary_t); +static void hdafg_enable_analog_beep(struct hdafg_softc *); CFATTACH_DECL2_NEW( hdafg, @@ -3688,6 +3689,9 @@ hdafg_attach(device_t parent, device_t s if (1) hdafg_widget_pin_dump(sc); hdafg_assoc_dump(sc); + hda_debug(sc, "enabling analog beep\n"); + hdafg_enable_analog_beep(sc); + hda_debug(sc, "configuring encodings\n"); sc->sc_audiodev.ad_sc = sc; hdafg_configure_encodings(sc); @@ -4361,3 +4365,61 @@ hdafg_modcmd(modcmd_t cmd, void *opaque) return ENOTTY; } } + +#define HDAFG_GET_ANACTRL 0xfe0 +#define HDAFG_SET_ANACTRL 0x7e0 +#define HDAFG_ANALOG_BEEP_EN __BIT(5) + +static void +hdafg_enable_analog_beep(struct hdafg_softc *sc) +{ + int nid; + uint32_t response; + + switch (sc->sc_vendor) { + case HDAUDIO_VENDOR_SIGMATEL: + switch (sc->sc_product) { + case HDAUDIO_PRODUCT_SIGMATEL_STAC9200: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9200D: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9202: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9202D: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9204: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9204D: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9205: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9205_1: + case HDAUDIO_PRODUCT_SIGMATEL_STAC9205D: + nid = 0x01; + + response = hdaudio_command(sc->sc_codec, nid, + HDAFG_GET_ANACTRL, 0x00); + hda_delay(100); + + response |= HDAFG_ANALOG_BEEP_EN; + + hdaudio_command(sc->sc_codec, nid, HDAFG_SET_ANACTRL, + response); + hda_delay(100); + break; + default: + break; + } + break; + case HDAUDIO_VENDOR_REALTEK: + switch (sc->sc_product) { + case HDAUDIO_PRODUCT_REALTEK_ALC269: + /* The Panasonic Toughbook CF19 - Mk 5 uses a Realtek + * ALC231 that identifies as an ALC269. + * This unmutes the PCBEEP on the speaker. + */ + nid = 0xf; + response = hdaudio_command(sc->sc_codec, nid, + CORB_SET_AMPLIFIER_GAIN_MUTE, 0x7100); + hda_delay(100); + break; + default: + break; + } + default: + break; + } +}
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: nat Date: Tue Sep 23 13:29:30 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Add missing defines for constants used in hdafg_enable_analog_beep. This commit was approved by christos@ To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.24 src/sys/dev/pci/hdaudio/hdafg.c:1.25 --- src/sys/dev/pci/hdaudio/hdafg.c:1.24 Sun Sep 21 14:30:22 2014 +++ src/sys/dev/pci/hdaudio/hdafg.c Tue Sep 23 13:29:30 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.24 2014/09/21 14:30:22 christos Exp $ */ +/* $NetBSD: hdafg.c,v 1.25 2014/09/23 13:29:30 nat Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.24 2014/09/21 14:30:22 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.25 2014/09/23 13:29:30 nat Exp $"); #include #include @@ -4369,6 +4369,10 @@ hdafg_modcmd(modcmd_t cmd, void *opaque) #define HDAFG_GET_ANACTRL 0xfe0 #define HDAFG_SET_ANACTRL 0x7e0 #define HDAFG_ANALOG_BEEP_EN __BIT(5) +#define HDAFG_ALC231_MONO_OUT_MIXER 0xf +#define HDAFG_STAC9200_AFG 0x1 +#define HDAFG_STAC9200_GET_ANACTRL_PAYLOAD 0x0 +#define HDAFG_ALC231_INPUT_BOTH_CHANNELS_UNMUTE 0x7100 static void hdafg_enable_analog_beep(struct hdafg_softc *sc) @@ -4388,10 +4392,11 @@ hdafg_enable_analog_beep(struct hdafg_so case HDAUDIO_PRODUCT_SIGMATEL_STAC9205: case HDAUDIO_PRODUCT_SIGMATEL_STAC9205_1: case HDAUDIO_PRODUCT_SIGMATEL_STAC9205D: - nid = 0x01; + nid = HDAFG_STAC9200_AFG; response = hdaudio_command(sc->sc_codec, nid, - HDAFG_GET_ANACTRL, 0x00); + HDAFG_GET_ANACTRL, + HDAFG_STAC9200_GET_ANACTRL_PAYLOAD); hda_delay(100); response |= HDAFG_ANALOG_BEEP_EN; @@ -4411,9 +4416,10 @@ hdafg_enable_analog_beep(struct hdafg_so * ALC231 that identifies as an ALC269. * This unmutes the PCBEEP on the speaker. */ - nid = 0xf; + nid = HDAFG_ALC231_MONO_OUT_MIXER; response = hdaudio_command(sc->sc_codec, nid, - CORB_SET_AMPLIFIER_GAIN_MUTE, 0x7100); + CORB_SET_AMPLIFIER_GAIN_MUTE, + HDAFG_ALC231_INPUT_BOTH_CHANNELS_UNMUTE); hda_delay(100); break; default:
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: nonaka Date: Tue Oct 28 02:49:52 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_pci.c Log Message: disestalish interrupt and unmap register when attach failed. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/hdaudio/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/hdaudio_pci.c diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.13 --- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12 Sat Mar 29 19:28:25 2014 +++ src/sys/dev/pci/hdaudio/hdaudio_pci.c Tue Oct 28 02:49:52 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_pci.c,v 1.12 2014/03/29 19:28:25 christos Exp $ */ +/* $NetBSD: hdaudio_pci.c,v 1.13 2014/10/28 02:49:52 nonaka Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.12 2014/03/29 19:28:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.13 2014/10/28 02:49:52 nonaka Exp $"); #include #include @@ -162,7 +162,17 @@ hdaudio_pci_attach(device_t parent, devi hdaudio_pci_reinit(sc); /* Attach bus-independent HD audio layer */ - hdaudio_attach(self, &sc->sc_hdaudio); + if (hdaudio_attach(self, &sc->sc_hdaudio)) { + pci_intr_disestablish(sc->sc_pc, sc->sc_ih); + sc->sc_ih = NULL; + bus_space_unmap(sc->sc_hdaudio.sc_memt, +sc->sc_hdaudio.sc_memh, +sc->sc_hdaudio.sc_memsize); + sc->sc_hdaudio.sc_memvalid = false; + csr = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG); + csr &= ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE); + pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG, csr); + } } static int
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: nonaka Date: Sun Nov 9 20:14:01 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: files.hdaudio Log Message: defflag HDAUDIOVERBOSE. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/files.hdaudio 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.6 src/sys/dev/pci/hdaudio/files.hdaudio:1.7 --- src/sys/dev/pci/hdaudio/files.hdaudio:1.6 Fri Sep 19 17:23:35 2014 +++ src/sys/dev/pci/hdaudio/files.hdaudio Sun Nov 9 20:14:01 2014 @@ -1,8 +1,10 @@ -# $NetBSD: files.hdaudio,v 1.6 2014/09/19 17:23:35 christos Exp $ +# $NetBSD: files.hdaudio,v 1.7 2014/11/09 20:14:01 nonaka Exp $ # # Intel High Definition Audio (Revision 1.0) # +defflag HDAUDIOVERBOSE + define hdaudiobus {[nid = -1]} device hdaudio: hdaudiobus file dev/pci/hdaudio/hdaudio.c hdaudio
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jakllsch Date: Tue Dec 17 17:13:46 UTC 2013 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c Log Message: Add an ID for VIA VT1705. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdaudio_ids.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/hdaudio_ids.c diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.6 src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.7 --- src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.6 Sat Mar 3 05:41:45 2012 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Tue Dec 17 17:13:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.c,v 1.6 2012/03/03 05:41:45 nonaka Exp $ */ +/* $NetBSD: hdaudio_ids.c,v 1.7 2013/12/17 17:13:46 jakllsch Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.6 2012/03/03 05:41:45 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.7 2013/12/17 17:13:46 jakllsch Exp $"); #include #include @@ -134,6 +134,7 @@ static const struct hdaudio_id { { HDA_VENDOR_VIA, 0x4438, "VT2002P" }, { HDA_VENDOR_VIA, 0x0448, "VT1812" }, { HDA_VENDOR_VIA, 0x0440, "VT1818S" }, + { HDA_VENDOR_VIA, 0x4760, "VT1705" }, { HDA_VENDOR_VIA, HDA_PRODUCT_ANY, "VIA" }, /* Analog Devices */ { HDA_VENDOR_ANALOG_DEVICES, 0x184a, "AD1884A" },
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: jakllsch Date: Fri May 9 20:10:49 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Enable AUDIO_PROP_MMAP in hdafg(4). Addresses PR#48792 and PR#35961. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.19 src/sys/dev/pci/hdaudio/hdafg.c:1.20 --- src/sys/dev/pci/hdaudio/hdafg.c:1.19 Tue Mar 25 16:19:14 2014 +++ src/sys/dev/pci/hdaudio/hdafg.c Fri May 9 20:10:49 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.19 2014/03/25 16:19:14 christos Exp $ */ +/* $NetBSD: hdafg.c,v 1.20 2014/05/09 20:10:49 jakllsch Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.19 2014/03/25 16:19:14 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.20 2014/05/09 20:10:49 jakllsch Exp $"); #include #include @@ -4178,7 +4178,7 @@ static int hdafg_get_props(void *opaque) { struct hdaudio_audiodev *ad = opaque; - int props = 0; + int props = AUDIO_PROP_MMAP; if (ad->ad_playback) props |= AUDIO_PROP_PLAYBACK; @@ -4189,8 +4189,6 @@ hdafg_get_props(void *opaque) props |= AUDIO_PROP_INDEPENDENT; } - /* TODO: AUDIO_PROP_MMAP */ - return props; }
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Wed Oct 16 17:43:33 UTC 2013 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: move all the unused stuff to ifdef notyet To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/hdaudio/hdafg.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.16 src/sys/dev/pci/hdaudio/hdafg.c:1.17 --- src/sys/dev/pci/hdaudio/hdafg.c:1.16 Sun Mar 11 15:39:36 2012 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Oct 16 13:43:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $ */ +/* $NetBSD: hdafg.c,v 1.17 2013/10/16 17:43:33 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.17 2013/10/16 17:43:33 christos Exp $"); #include #include @@ -2978,7 +2978,7 @@ hdafg_commit(struct hdafg_softc *sc) { struct hdaudio_widget *w; uint32_t gdata, gmask, gdir; - int commitgpio, numgpio; + int commitgpio; int i; /* Commit controls */ @@ -3000,10 +3000,10 @@ hdafg_commit(struct hdafg_softc *sc) } gdata = gmask = gdir = commitgpio = 0; - numgpio = COP_GPIO_COUNT_NUM_GPIO(sc->sc_p.gpio_cnt); +#ifdef notyet + int numgpio = COP_GPIO_COUNT_NUM_GPIO(sc->sc_p.gpio_cnt); hda_trace(sc, "found %d GPIOs\n", numgpio); -#if notyet for (i = 0; i < numgpio && i < 8; i++) { if (commitgpio == 0) commitgpio = 1; @@ -3199,6 +3199,7 @@ hdafg_stream_intr(struct hdaudio_stream { struct hdaudio_audiodev *ad = st->st_cookie; int handled = 0; +/*###3202 [cc] error: variable 'sts' set but not used [-Werror=unused-but-set-variable]%%%*/ uint8_t sts; sts = hda_read1(ad->ad_sc->sc_host, HDAUDIO_SD_STS(st->st_shift));
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: christos Date: Wed Oct 16 18:13:00 UTC 2013 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c hdaudio.c Log Message: move debugging code inside debugging ifdef. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/hdaudio/hdafg.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/hdaudio/hdaudio.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/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.17 src/sys/dev/pci/hdaudio/hdafg.c:1.18 --- src/sys/dev/pci/hdaudio/hdafg.c:1.17 Wed Oct 16 13:43:33 2013 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Oct 16 14:13:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.17 2013/10/16 17:43:33 christos Exp $ */ +/* $NetBSD: hdafg.c,v 1.18 2013/10/16 18:13:00 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.17 2013/10/16 17:43:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18 2013/10/16 18:13:00 christos Exp $"); #include #include @@ -532,7 +532,7 @@ static void hdafg_widget_pin_dump(struct hdafg_softc *sc) { struct hdaudio_widget *w; - int i, conn, color, defdev; + int i, conn; for (i = sc->sc_startnode; i < sc->sc_endnode; i++) { w = hdafg_widget_lookup(sc, i); @@ -541,14 +541,16 @@ hdafg_widget_pin_dump(struct hdafg_softc if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) continue; conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config); - color = COP_CFG_COLOR(w->w_pin.config); - defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); if (conn != 1) { +#ifdef HDAUDIO_DEBUG + int color = COP_CFG_COLOR(w->w_pin.config); + int defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); hda_trace(sc, "io %02X: %s (%s, %s)\n", w->w_nid, hdafg_default_device[defdev], hdafg_color[color], hdafg_port_connectivity[conn]); +#endif } } } @@ -975,7 +977,7 @@ hdafg_assoc_dump(struct hdafg_softc *sc) { struct hdaudio_assoc *as = sc->sc_assocs; struct hdaudio_widget *w; - uint32_t conn, color, defdev, curdev, curport; + uint32_t conn, defdev, curdev, curport; int maxassocs = sc->sc_nassocs; int i, j; @@ -1053,7 +1055,6 @@ hdafg_assoc_dump(struct hdafg_softc *sc) if (w == NULL) continue; conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config); - color = COP_CFG_COLOR(w->w_pin.config); defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config); if (conn != curport || defdev != curdev) continue; @@ -1063,8 +1064,12 @@ hdafg_assoc_dump(struct hdafg_softc *sc) else hda_trace1(sc, " "); firstport = false; +#ifdef HDAUDIO_DEBUG + int color = + COP_CFG_COLOR(w->w_pin.config); hda_trace1(sc, "%s", hdafg_color[color]); +#endif hda_trace1(sc, "(%02X)", w->w_nid); } hda_print1(sc, "]"); @@ -3199,10 +3204,8 @@ hdafg_stream_intr(struct hdaudio_stream { struct hdaudio_audiodev *ad = st->st_cookie; int handled = 0; -/*###3202 [cc] error: variable 'sts' set but not used [-Werror=unused-but-set-variable]%%%*/ - uint8_t sts; - sts = hda_read1(ad->ad_sc->sc_host, HDAUDIO_SD_STS(st->st_shift)); + (void)hda_read1(ad->ad_sc->sc_host, HDAUDIO_SD_STS(st->st_shift)); hda_write1(ad->ad_sc->sc_host, HDAUDIO_SD_STS(st->st_shift), HDAUDIO_STS_DESE | HDAUDIO_STS_FIFOE | HDAUDIO_STS_BCIS); Index: src/sys/dev/pci/hdaudio/hdaudio.c diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.18 src/sys/dev/pci/hdaudio/hdaudio.c:1.19 --- src/sys/dev/pci/hdaudio/hdaudio.c:1.18 Wed Nov 23 22:35:59 2011 +++ src/sys/dev/pci/hdaudio/hdaudio.c Wed Oct 16 14:13:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.18 2011/11/24 03:35:59 mrg Exp $ */ +/* $NetBSD: hdaudio.c,v 1.19 2013/10/16 18:13:00 christos Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.18 2011/11/24 03:35:59 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.19 2013/10/16 18:13:00 christos Exp $"); #include #include @@ -694,9 +694,6 @@ hdaudio_attach_fg(struct hdaudio_functio static void hdaudio_codec_attach(struct hdaudio_codec *co) { -#ifdef HDAUDIO_DEBUG - struct hdaudio_softc *sc = co->co_host; -#endif struct hdaudio_function_group *fg; uint32_t vid, rid, snc, fgrp; int starting_node, num_nodes, nid; @@ -705,7 +702,6 @@ hdaudio_codec_attach(struct hdaudio_code return; vid = hdaudio_command(co, 0, CORB_GET_PARAMETER, COP_VENDOR_ID); - rid = hdaudio_command(co, 0, CORB_GET_PARAMETER, COP_REVISION_ID); snc = hdaudio_command(co, 0, CORB_GET_PARAMETER, COP_SUBORDINATE_NODE_COUNT); @@ -714,6 +710,9 @@ hdaudio_codec_attach(struct hdaudio_code return; #ifdef HDAUDIO_DEBUG + struct hdaudio_softc *sc = co->co_host; + uint32_t rid = hdaudio_command(co, 0, CORB_GET_PARAMETER, + COP_RE
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: njoly Date: Mon Apr 7 21:35:41 UTC 2014 Modified Files: src/sys/dev/pci/hdaudio: hdaudio_ids.c Log Message: Use 0x prefix when printing hexadecimal numbers. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/hdaudio/hdaudio_ids.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/hdaudio_ids.c diff -u src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.7 src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.8 --- src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.7 Tue Dec 17 17:13:46 2013 +++ src/sys/dev/pci/hdaudio/hdaudio_ids.c Mon Apr 7 21:35:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio_ids.c,v 1.7 2013/12/17 17:13:46 jakllsch Exp $ */ +/* $NetBSD: hdaudio_ids.c,v 1.8 2014/04/07 21:35:41 njoly Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.7 2013/12/17 17:13:46 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.8 2014/04/07 21:35:41 njoly Exp $"); #include #include @@ -267,7 +267,7 @@ hdaudio_id2name(uint16_t vendor, uint16_ if (name) snprintf(buf, len - 1, "%s", name); else if (product == HDA_PRODUCT_ANY) - snprintf(buf, len - 1, "vendor %04x", vendor); + snprintf(buf, len - 1, "vendor 0x%04x", vendor); else - snprintf(buf, len - 1, "product %04x", product); + snprintf(buf, len - 1, "product 0x%04x", product); }