Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/hdaudio sync with bsd-hdaudio r15:



details:   https://anonhg.NetBSD.org/src/rev/4115aaa0f667
branches:  trunk
changeset: 761963:4115aaa0f667
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Feb 12 15:15:34 2011 +0000

description:
sync with bsd-hdaudio r15:
 - fix an off-by-one in block size calculation
 - add register definitions from HDA034-A2, HDA035-A, HDA036-A
 - rename hdaudio_afg_* symbols to hdafg_*
 - add experimental HDMI and DisplayPort support code (needs help from DRM)
 - don't poll the RIRB unless cold
 - add support for unsolicited messages
 - 'hdaudioctl graph' works again
 - print each assoc's widget tree when boot -x

diffstat:

 sys/dev/pci/hdaudio/ceareg.h         |    64 +
 sys/dev/pci/hdaudio/eldreg.h         |    80 ++
 sys/dev/pci/hdaudio/files.hdaudio    |     3 +-
 sys/dev/pci/hdaudio/hdafg.c          |  1163 +++++++++++++++++++++------------
 sys/dev/pci/hdaudio/hdafg_dd.c       |   118 +++
 sys/dev/pci/hdaudio/hdafg_dd.h       |    49 +
 sys/dev/pci/hdaudio/hdaudio.c        |   113 ++-
 sys/dev/pci/hdaudio/hdaudio_config.h |    45 +
 sys/dev/pci/hdaudio/hdaudio_ids.c    |     8 +-
 sys/dev/pci/hdaudio/hdaudio_pci.c    |    12 +-
 sys/dev/pci/hdaudio/hdaudioreg.h     |    69 +-
 sys/dev/pci/hdaudio/hdaudiovar.h     |    18 +-
 sys/dev/pci/hdaudio/hdmireg.h        |    59 +
 13 files changed, 1348 insertions(+), 453 deletions(-)

diffs (truncated from 3601 to 300 lines):

diff -r adf67e9274b9 -r 4115aaa0f667 sys/dev/pci/hdaudio/ceareg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/hdaudio/ceareg.h      Sat Feb 12 15:15:34 2011 +0000
@@ -0,0 +1,64 @@
+/* $NetBSD: ceareg.h,v 1.1 2011/02/12 15:15:34 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * 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. 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 _CEAREG_H
+#define _CEAREG_H
+
+/* short audio descriptor */
+struct cea_sad {
+       uint8_t flags1;
+       uint8_t sample_rates;
+       uint8_t flags2;
+} __packed;
+
+#define        CEA_AUDIO_FORMAT(desc)  (((desc)->flags1 >> 3) & 0x0f)
+#define         CEA_AUDIO_FORMAT_LPCM          1
+#define         CEA_AUDIO_FORMAT_AC3           2
+#define         CEA_AUDIO_FORMAT_MPEG1_L12     3
+#define         CEA_AUDIO_FORMAT_MPEG1_L3      4
+#define         CEA_AUDIO_FORMAT_MPEG2         5
+#define         CEA_AUDIO_FORMAT_AAC           6
+#define         CEA_AUDIO_FORMAT_DTS           7
+#define         CEA_AUDIO_FORMAT_ATRAC         8
+#define        CEA_MAX_CHANNELS(desc)  ((((desc)->flags1 >> 0) & 0x07) + 1)
+#define        CEA_SAMPLE_RATE(desc)   ((desc)->sample_rates)
+#define         CEA_SAMPLE_RATE_192K           0x40
+#define         CEA_SAMPLE_RATE_176K           0x20
+#define         CEA_SAMPLE_RATE_96K            0x10
+#define         CEA_SAMPLE_RATE_88K            0x08
+#define         CEA_SAMPLE_RATE_48K            0x04
+#define         CEA_SAMPLE_RATE_44K            0x02
+#define         CEA_SAMPLE_RATE_32K            0x01
+/* uncompressed */
+#define        CEA_PRECISION(desc)     ((desc)->flags2 & 0x07)
+#define         CEA_PRECISION_24BIT            0x4
+#define         CEA_PRECISION_20BIT            0x2
+#define         CEA_PRECISION_16BIT            0x1
+/* compressed */
+#define        CEA_MAX_BITRATE(desc)   ((uint32_t)(desc)->flags2 * 8000)
+
+#endif /* !_CEAREG_H */
diff -r adf67e9274b9 -r 4115aaa0f667 sys/dev/pci/hdaudio/eldreg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/hdaudio/eldreg.h      Sat Feb 12 15:15:34 2011 +0000
@@ -0,0 +1,80 @@
+/* $NetBSD: eldreg.h,v 1.1 2011/02/12 15:15:34 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * 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. 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 _ELDREG_H
+#define _ELDREG_H
+
+#define        ELD_MAX_NBYTES          80      /* version 2; 15 SAD count */
+
+struct eld_header_block {
+       uint8_t flags;                  /* ver */
+       uint8_t reserved1;
+       uint8_t baseline_eld_len;       /* dword count */
+       uint8_t reserved2;
+} __packed;
+
+struct eld_baseline_block {
+       struct eld_header_block header;
+       uint8_t flags[4];               /* cea_edid_ver, mnl,
+                                        * sad_count, conn_type, s_ai, hdcp,
+                                        * aud_synch_delay,
+                                        * rlrc, flrc, rc, rlr, fc, lfe, flr
+                                        */
+       uint64_t port_id;
+       uint16_t vendor;
+       uint16_t product;
+       /* monitor name string, CEA SADs, vendor data ... */
+} __packed;
+
+#define        ELD_VER(block)          (((block)->header.flags >> 3) & 0x1f)
+#define         ELD_VER_2               0x02
+#define         ELD_VER_UNCONF          0x1f
+#define ELD_CEA_EDID_VER(block)        (((block)->flags[0] >> 5) & 0x07)
+#define         ELD_CEA_EDID_VER_NONE   0x0
+#define         ELD_CEA_EDID_VER_861    0x1
+#define         ELD_CEA_EDID_VER_861A   0x2
+#define         ELD_CEA_EDID_VER_861BCD 0x3
+#define        ELD_MNL(block)          (((block)->flags[0] >> 0) & 0x1f)
+#define        ELD_SAD_COUNT(block)    (((block)->flags[1] >> 4) & 0x0f)
+#define        ELD_CONN_TYPE(block)    (((block)->flags[1] >> 2) & 0x03)
+#define         ELD_CONN_TYPE_HDMI      0x0
+#define        ELD_S_AI(block)         (((block)->flags[1] >> 1) & 0x01)
+#define        ELD_HDCP(block)         (((block)->flags[1] >> 0) & 0x01)
+#define        ELD_AUDIO_DELAY(block)  ((block)->flags[2])
+#define         ELD_AUDIO_DELAY_NONE    0x00
+#define  ELD_AUDIO_DELAY_MS(x)  ((x) * 2)
+#define         ELD_AUDIO_DELAY_MS_MAX  500
+#define        ELD_SPEAKER(block)      ((block)->flags[3])
+#define         ELD_SPEAKER_RLRC        0x40
+#define         ELD_SPEAKER_FLRC        0x20
+#define         ELD_SPEAKER_RC          0x10
+#define         ELD_SPEAKER_RLR         0x08
+#define         ELD_SPEAKER_FC          0x04
+#define         ELD_SPEAKER_LFE         0x02
+#define         ELD_SPEAKER_FLR         0x01
+
+#endif /* !_ELDREG_H */
diff -r adf67e9274b9 -r 4115aaa0f667 sys/dev/pci/hdaudio/files.hdaudio
--- a/sys/dev/pci/hdaudio/files.hdaudio Sat Feb 12 15:01:00 2011 +0000
+++ b/sys/dev/pci/hdaudio/files.hdaudio Sat Feb 12 15:15:34 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hdaudio,v 1.4 2011/02/12 15:01:00 jmcneill Exp $
+# $NetBSD: files.hdaudio,v 1.5 2011/02/12 15:15:34 jmcneill Exp $
 
 #
 # Intel High Definition Audio (Revision 1.0)
@@ -11,6 +11,7 @@
 device hdafg: audiobus, auconv, aurateconv, mulaw
 attach hdafg at hdaudiobus
 file   dev/pci/hdaudio/hdafg.c         hdafg
+file   dev/pci/hdaudio/hdafg_dd.c      hdafg
 
 #  hdaudio@pci
 attach hdaudio at pci with hdaudio_pci
diff -r adf67e9274b9 -r 4115aaa0f667 sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c       Sat Feb 12 15:01:00 2011 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c       Sat Feb 12 15:15:34 2011 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: hdafg.c,v 1.1 2011/02/12 15:01:00 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.2 2011/02/12 15:15:34 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
- * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * Copyright (c) 2009-2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.1 2011/02/12 15:01:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.2 2011/02/12 15:15:34 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -76,28 +76,30 @@
 #include <dev/audio_if.h>
 #include <dev/auconv.h>
 
-#include <dev/pci/hdaudio/hdaudiovar.h>
-#include <dev/pci/hdaudio/hdaudioreg.h>
-#include <dev/pci/hdaudio/hdaudio_mixer.h>
-#include <dev/pci/hdaudio/hdaudioio.h>
-#include <dev/pci/hdaudio/hdaudio_ids.h>
+#include "hdaudio_config.h"
+
+#include "hdaudiovar.h"
+#include "hdaudioreg.h"
+#include "hdaudio_mixer.h"
+#include "hdaudioio.h"
+#include "hdaudio_ids.h"
+#include "hdafg_dd.h"
+#include "hdmireg.h"
 
 #ifndef AUFMT_SURROUND_7_1
 #define        AUFMT_SURROUND_7_1 (AUFMT_DOLBY_5_1|AUFMT_SIDE_LEFT|AUFMT_SIDE_RIGHT)
 #endif
 
-/* #define     HDAUDIO_AFG_DEBUG       1 */
-
-#if defined(HDAUDIO_AFG_DEBUG)
-static int hdaudio_afg_debug = HDAUDIO_AFG_DEBUG;
+#if defined(HDAFG_DEBUG)
+static int hdafg_debug = HDAFG_DEBUG;
 #else
-static int hdaudio_afg_debug = 0;
+static int hdafg_debug = 0;
 #endif
 
 #define        hda_debug(sc, ...)              \
-       if (hdaudio_afg_debug) hda_print(sc, __VA_ARGS__)
+       if (hdafg_debug) hda_print(sc, __VA_ARGS__)
 #define        hda_debug1(sc, ...)             \
-       if (hdaudio_afg_debug) hda_print1(sc, __VA_ARGS__)
+       if (hdafg_debug) hda_print1(sc, __VA_ARGS__)
 
 #define HDAUDIO_MIXER_CLASS_OUTPUTS    0
 #define        HDAUDIO_MIXER_CLASS_INPUTS      1
@@ -108,24 +110,25 @@
 #define        HDAUDIO_GPIO_DIR        1
 #define        HDAUDIO_GPIO_DATA       2
 
-#define        HDAUDIO_UNSOLTAG_EVENT_HP       0x00
+#define        HDAUDIO_UNSOLTAG_EVENT_HP       0x01
+#define        HDAUDIO_UNSOLTAG_EVENT_DD       0x02
 
 #define        HDAUDIO_HP_SENSE_PERIOD         hz
 
-const u_int hdaudio_afg_possible_rates[] = {
+const u_int hdafg_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[] = {
+static const char *hdafg_mixer_names[] = HDAUDIO_DEVICE_NAMES;
+
+static const char *hdafg_port_connectivity[] = {
        "Jack",
        "Unconnected",
        "Built-In",
        "Jack & Built-In"
 };
-static const char *hdaudio_afg_default_device[] = {
+static const char *hdafg_default_device[] = {
        "Line Out",
        "Speaker",
        "HP Out",
@@ -143,7 +146,7 @@
        "Reserved",
        "Other"
 };
-static const char *hdaudio_afg_color[] = {
+static const char *hdafg_color[] = {
        "Unknown",
        "Black",
        "Grey",
@@ -199,14 +202,19 @@
        enum hdaudio_pindir     as_dir;
        u_char                  as_pincnt;
        u_char                  as_fakeredir;
-       bool                    as_digital;
+       int                     as_digital;
+#define        HDAFG_AS_ANALOG         0
+#define        HDAFG_AS_SPDIF          1
+#define        HDAFG_AS_HDMI           2
+#define        HDAFG_AS_DISPLAYPORT    3
+       bool                    as_displaydev;
        int                     as_hpredir;
        int                     as_pins[HDAUDIO_MAXPINS];
        int                     as_dacs[HDAUDIO_MAXPINS];
 };
 
 struct hdaudio_widget {
-       struct hdaudio_afg_softc        *w_afg;
+       struct hdafg_softc      *w_afg;
        char                            w_name[32];
        int                             w_nid;
        bool                            w_enable;
@@ -257,7 +265,7 @@
 };



Home | Main Index | Thread Index | Old Index