Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys rename hdaudio_afg.c to hdafg.c
details: https://anonhg.NetBSD.org/src/rev/adf67e9274b9
branches: trunk
changeset: 761962:adf67e9274b9
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Feb 12 15:01:00 2011 +0000
description:
rename hdaudio_afg.c to hdafg.c
diffstat:
sys/dev/pci/hdaudio/files.hdaudio | 4 +-
sys/dev/pci/hdaudio/hdafg.c | 3862 +++++++++++++++++++++++++++++++++++++
sys/dev/pci/hdaudio/hdaudio_afg.c | 3862 -------------------------------------
sys/modules/hdafg/Makefile | 4 +-
4 files changed, 3866 insertions(+), 3866 deletions(-)
diffs (truncated from 7768 to 300 lines):
diff -r 312bf22a441f -r adf67e9274b9 sys/dev/pci/hdaudio/files.hdaudio
--- a/sys/dev/pci/hdaudio/files.hdaudio Sat Feb 12 14:49:54 2011 +0000
+++ b/sys/dev/pci/hdaudio/files.hdaudio Sat Feb 12 15:01:00 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hdaudio,v 1.3 2010/09/02 01:55:31 jmcneill Exp $
+# $NetBSD: files.hdaudio,v 1.4 2011/02/12 15:01:00 jmcneill Exp $
#
# Intel High Definition Audio (Revision 1.0)
@@ -10,7 +10,7 @@
device hdafg: audiobus, auconv, aurateconv, mulaw
attach hdafg at hdaudiobus
-file dev/pci/hdaudio/hdaudio_afg.c hdafg
+file dev/pci/hdaudio/hdafg.c hdafg
# hdaudio@pci
attach hdaudio at pci with hdaudio_pci
diff -r 312bf22a441f -r adf67e9274b9 sys/dev/pci/hdaudio/hdafg.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c Sat Feb 12 15:01:00 2011 +0000
@@ -0,0 +1,3862 @@
+/* $NetBSD: hdafg.c,v 1.1 2011/02/12 15:01:00 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
+ * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Precedence Technologies Ltd
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Widget parsing from FreeBSD hdac.c:
+ *
+ * Copyright (c) 2006 Stephane E. Potvin <sepotvin%videotron.ca@localhost>
+ * Copyright (c) 2006 Ariff Abdullah <ariff%FreeBSD.org@localhost>
+ * Copyright (c) 2008 Alexander Motin <mav%FreeBSD.org@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. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.1 2011/02/12 15:01:00 jmcneill Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/conf.h>
+#include <sys/bus.h>
+#include <sys/kmem.h>
+#include <sys/module.h>
+
+#include <sys/audioio.h>
+#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>
+
+#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;
+#else
+static int hdaudio_afg_debug = 0;
+#endif
+
+#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
+#define HDAUDIO_MIXER_CLASS_RECORD 2
+#define HDAUDIO_MIXER_CLASS_LAST HDAUDIO_MIXER_CLASS_RECORD
+
+#define HDAUDIO_GPIO_MASK 0
+#define HDAUDIO_GPIO_DIR 1
+#define HDAUDIO_GPIO_DATA 2
+
+#define HDAUDIO_UNSOLTAG_EVENT_HP 0x00
+
+#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[] = {
+ "Jack",
+ "Unconnected",
+ "Built-In",
+ "Jack & Built-In"
+};
+static const char *hdaudio_afg_default_device[] = {
+ "Line Out",
+ "Speaker",
+ "HP Out",
+ "CD",
+ "SPDIF Out",
+ "Digital Out",
+ "Modem Line Side",
+ "Modem Handset Side",
+ "Line In",
+ "AUX",
+ "Mic In",
+ "Telephony",
+ "SPDIF In",
+ "Digital In",
+ "Reserved",
+ "Other"
+};
+static const char *hdaudio_afg_color[] = {
+ "Unknown",
+ "Black",
+ "Grey",
+ "Blue",
+ "Green",
+ "Red",
+ "Orange",
+ "Yellow",
+ "Purple",
+ "Pink",
+ "ReservedA",
+ "ReservedB",
+ "ReservedC",
+ "ReservedD",
+ "White",
+ "Other"
+};
+
+#define HDAUDIO_MAXFORMATS 24
+#define HDAUDIO_MAXCONNECTIONS 32
+#define HDAUDIO_MAXPINS 16
+#define HDAUDIO_PARSE_MAXDEPTH 10
+
+#define HDAUDIO_AMP_VOL_DEFAULT (-1)
+#define HDAUDIO_AMP_MUTE_DEFAULT (0xffffffff)
+#define HDAUDIO_AMP_MUTE_NONE 0
+#define HDAUDIO_AMP_MUTE_LEFT (1 << 0)
+#define HDAUDIO_AMP_MUTE_RIGHT (1 << 1)
+#define HDAUDIO_AMP_MUTE_ALL (HDAUDIO_AMP_MUTE_LEFT | HDAUDIO_AMP_MUTE_RIGHT)
+#define HDAUDIO_AMP_LEFT_MUTED(x) ((x) & HDAUDIO_AMP_MUTE_LEFT)
+#define HDAUDIO_AMP_RIGHT_MUTED(x) (((x) & HDAUDIO_AMP_MUTE_RIGHT) >> 1)
+
+#define HDAUDIO_ADC_MONITOR 1
+
+enum hdaudio_pindir {
+ HDAUDIO_PINDIR_NONE = 0,
+ HDAUDIO_PINDIR_OUT = 1,
+ HDAUDIO_PINDIR_IN = 2,
+ HDAUDIO_PINDIR_INOUT = 3,
+};
+
+#define hda_get_param(sc, cop) \
+ hdaudio_command((sc)->sc_codec, (sc)->sc_nid, \
+ CORB_GET_PARAMETER, COP_##cop)
+#define hda_get_wparam(w, cop) \
+ hdaudio_command((w)->w_afg->sc_codec, (w)->w_nid, \
+ CORB_GET_PARAMETER, COP_##cop)
+
+struct hdaudio_assoc {
+ bool as_enable;
+ bool as_activated;
+ u_char as_index;
+ enum hdaudio_pindir as_dir;
+ u_char as_pincnt;
+ u_char as_fakeredir;
+ bool as_digital;
+ int as_hpredir;
+ int as_pins[HDAUDIO_MAXPINS];
+ int as_dacs[HDAUDIO_MAXPINS];
+};
+
+struct hdaudio_widget {
+ struct hdaudio_afg_softc *w_afg;
+ char w_name[32];
+ int w_nid;
+ bool w_enable;
+ bool w_waspin;
+ int w_selconn;
+ int w_bindas;
+ int w_bindseqmask;
+ int w_pflags;
+ int w_audiodev;
+ uint32_t w_audiomask;
+
+ int w_nconns;
+ int w_conns[HDAUDIO_MAXCONNECTIONS];
+ bool w_connsenable[HDAUDIO_MAXCONNECTIONS];
+
+ int w_type;
+ struct {
+ uint32_t aw_cap;
+ uint32_t pcm_size_rate;
+ uint32_t stream_format;
+ uint32_t outamp_cap;
+ uint32_t inamp_cap;
+ uint32_t eapdbtl;
+ } w_p;
+ struct {
+ uint32_t config;
+ uint32_t cap;
+ uint32_t ctrl;
+ } w_pin;
+};
+
+struct hdaudio_control {
+ struct hdaudio_widget *ctl_widget, *ctl_childwidget;
+ bool ctl_enable;
+ int ctl_index;
+ enum hdaudio_pindir ctl_dir, ctl_ndir;
+ int ctl_mute, ctl_step, ctl_size, ctl_offset;
+ int ctl_left, ctl_right, ctl_forcemute;
+ uint32_t ctl_muted;
+ uint32_t ctl_audiomask, ctl_paudiomask;
+};
+
+#define HDAUDIO_CONTROL_GIVE(ctl) ((ctl)->ctl_step ? 1 : 0)
+
+struct hdaudio_mixer {
+ struct hdaudio_control *mx_ctl;
+ mixer_devinfo_t mx_di;
+};
+
+struct hdaudio_audiodev {
+ struct hdaudio_afg_softc *ad_sc;
+ device_t ad_audiodev;
+ struct audio_encoding_set *ad_encodings;
+ int ad_nformats;
+ struct audio_format ad_formats[HDAUDIO_MAXFORMATS];
+
+ struct hdaudio_stream *ad_playback;
+ void (*ad_playbackintr)(void *);
+ void *ad_playbackintrarg;
+ int ad_playbacknid[HDAUDIO_MAXPINS];
+ struct hdaudio_assoc *ad_playbackassoc;
+ struct hdaudio_stream *ad_capture;
+ void (*ad_captureintr)(void *);
+ void *ad_captureintrarg;
+ int ad_capturenid[HDAUDIO_MAXPINS];
+ struct hdaudio_assoc *ad_captureassoc;
+};
+
+struct hdaudio_afg_softc {
Home |
Main Index |
Thread Index |
Old Index