[Midnightbsd-cvs] src [10066] trunk/sys/dev: sync up
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun May 27 19:10:16 EDT 2018
Revision: 10066
http://svnweb.midnightbsd.org/src/?rev=10066
Author: laffer1
Date: 2018-05-27 19:10:16 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync up
Modified Paths:
--------------
trunk/sys/dev/sn/if_sn.c
trunk/sys/dev/sn/if_sn_isa.c
trunk/sys/dev/sn/if_sn_pccard.c
trunk/sys/dev/sn/if_snreg.h
trunk/sys/dev/sn/if_snvar.h
trunk/sys/dev/sn/ositech.h
trunk/sys/dev/snc/dp83932.c
trunk/sys/dev/snc/dp83932reg.h
trunk/sys/dev/snc/dp83932subr.c
trunk/sys/dev/snc/dp83932subr.h
trunk/sys/dev/snc/dp83932var.h
trunk/sys/dev/snc/if_snc.c
trunk/sys/dev/snc/if_snc_cbus.c
trunk/sys/dev/snc/if_snc_pccard.c
trunk/sys/dev/snc/if_sncreg.h
trunk/sys/dev/snc/if_sncvar.h
Added Paths:
-----------
trunk/sys/dev/sound/macio/onyx.c
Modified: trunk/sys/dev/sn/if_sn.c
===================================================================
--- trunk/sys/dev/sn/if_sn.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/sn/if_sn.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1996 Gardner Buchanan <gbuchanan at shl.com>
* All rights reserved.
@@ -30,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sn/if_sn.c 250460 2013-05-10 16:41:26Z eadler $");
/*
* This is a driver for SMC's 9000 series of Ethernet adapters.
@@ -201,7 +202,6 @@
}
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = snstart;
ifp->if_ioctl = snioctl;
@@ -444,7 +444,7 @@
/*
* Wait a short amount of time to see if the allocation request
* completes. Otherwise, I enable the interrupt and wait for
- * completion asyncronously.
+ * completion asynchronously.
*/
time_out = MEMORY_WAIT_TIME;
Modified: trunk/sys/dev/sn/if_sn_isa.c
===================================================================
--- trunk/sys/dev/sn/if_sn_isa.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/sn/if_sn_isa.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 M. Warner Losh
* All rights reserved.
@@ -25,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sn/if_sn_isa.c 147797 2005-07-06 15:59:47Z imp $");
#include <sys/param.h>
#include <sys/kernel.h>
Modified: trunk/sys/dev/sn/if_sn_pccard.c
===================================================================
--- trunk/sys/dev/sn/if_sn_pccard.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/sn/if_sn_pccard.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 M. Warner Losh <imp at village.org>
* All rights reserved.
@@ -30,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sn/if_sn_pccard.c 199414 2009-11-17 18:22:14Z jhb $");
#include <sys/param.h>
#include <sys/bus.h>
Modified: trunk/sys/dev/sn/if_snreg.h
===================================================================
--- trunk/sys/dev/sn/if_snreg.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/sn/if_snreg.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1996 Gardner Buchanan <gbuchanan at shl.com>
* All rights reserved.
@@ -28,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sn/if_snreg.h 150459 2005-09-22 05:56:32Z imp $
*/
/*
Modified: trunk/sys/dev/sn/if_snvar.h
===================================================================
--- trunk/sys/dev/sn/if_snvar.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/sn/if_snvar.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 M. Warner Losh <imp at village.org>
* All rights reserved.
@@ -22,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sn/if_snvar.h 199559 2009-11-19 22:06:40Z jhb $
*/
#ifndef _IF_SNVAR_H
Modified: trunk/sys/dev/sn/ositech.h
===================================================================
--- trunk/sys/dev/sn/ositech.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/sn/ositech.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
This file contains the firmware of Seven of Diamonds from OSITECH.
(Special thanks to Kevin MacPherson of OSITECH)
@@ -26,7 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-$MidnightBSD$
+$FreeBSD: stable/10/sys/dev/sn/ositech.h 147955 2005-07-13 14:49:06Z imp $
*/
Modified: trunk/sys/dev/snc/dp83932.c
===================================================================
--- trunk/sys/dev/snc/dp83932.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/dp83932.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/snc/dp83932.c 243857 2012-12-04 09:32:43Z glebius $ */
/* $NecBSD: dp83932.c,v 1.5 1999/07/29 05:08:44 kmatsuda Exp $ */
/* $NetBSD: if_snc.c,v 1.18 1998/04/25 21:27:40 scottr Exp $ */
@@ -174,7 +175,6 @@
ifp->if_start = sncstart;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_init = sncinit;
- ifp->if_mtu = ETHERMTU;
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
/* Initialize media goo. */
Modified: trunk/sys/dev/snc/dp83932reg.h
===================================================================
--- trunk/sys/dev/snc/dp83932reg.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/dp83932reg.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/snc/dp83932reg.h 139749 2005-01-06 01:43:34Z imp $ */
/* $NecBSD: dp83932reg.h,v 1.2 1999/02/12 05:50:13 kmatsuda Exp $ */
/* $NetBSD: if_snreg.h,v 1.4 1997/06/15 20:20:12 scottr Exp $ */
Modified: trunk/sys/dev/snc/dp83932subr.c
===================================================================
--- trunk/sys/dev/snc/dp83932subr.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/dp83932subr.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $NecBSD: dp83932subr.c,v 1.5.6.2 1999/10/09 05:47:23 kmatsuda Exp $ */
/* $NetBSD$ */
@@ -33,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/snc/dp83932subr.c 242871 2012-11-10 14:58:06Z nyan $");
/*
* Routines of NEC PC-9801-83, 84, 103, 104, PC-9801N-25 and PC-9801N-J02, J02R
* Ethernet interface for NetBSD/pc98, ported by Kouichi Matsuda.
Modified: trunk/sys/dev/snc/dp83932subr.h
===================================================================
--- trunk/sys/dev/snc/dp83932subr.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/dp83932subr.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/snc/dp83932subr.h 139749 2005-01-06 01:43:34Z imp $ */
/* $NecBSD: dp83932subr.h,v 1.5 1999/02/02 00:47:25 kmatsuda Exp $ */
/* $NetBSD$ */
Modified: trunk/sys/dev/snc/dp83932var.h
===================================================================
--- trunk/sys/dev/snc/dp83932var.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/dp83932var.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/snc/dp83932var.h 181298 2008-08-04 19:19:18Z jhb $ */
/* $NecBSD: dp83932var.h,v 1.3 1999/01/24 01:39:51 kmatsuda Exp $ */
/* $NetBSD: if_snvar.h,v 1.12 1998/05/01 03:42:47 scottr Exp $ */
Modified: trunk/sys/dev/snc/if_snc.c
===================================================================
--- trunk/sys/dev/snc/if_snc.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/if_snc.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1995, David Greenman
* All rights reserved.
@@ -27,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/snc/if_snc.c 242871 2012-11-10 14:58:06Z nyan $");
/*
* National Semiconductor DP8393X SONIC Driver
Modified: trunk/sys/dev/snc/if_snc_cbus.c
===================================================================
--- trunk/sys/dev/snc/if_snc_cbus.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/if_snc_cbus.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1995, David Greenman
* All rights reserved.
@@ -27,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/snc/if_snc_cbus.c 242871 2012-11-10 14:58:06Z nyan $");
/*
* National Semiconductor DP8393X SONIC Driver
Modified: trunk/sys/dev/snc/if_snc_pccard.c
===================================================================
--- trunk/sys/dev/snc/if_snc_pccard.c 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/if_snc_pccard.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1995, David Greenman
* All rights reserved.
@@ -27,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/snc/if_snc_pccard.c 181393 2008-08-07 20:55:20Z imp $");
/*
* National Semiconductor DP8393X SONIC Driver
Modified: trunk/sys/dev/snc/if_sncreg.h
===================================================================
--- trunk/sys/dev/snc/if_sncreg.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/if_sncreg.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/snc/if_sncreg.h 179442 2008-05-30 21:48:05Z jhb $ */
/* $NecBSD: if_snreg.h,v 1.3 1999/01/24 01:39:52 kmatsuda Exp $ */
/* $NetBSD$ */
Modified: trunk/sys/dev/snc/if_sncvar.h
===================================================================
--- trunk/sys/dev/snc/if_sncvar.h 2018-05-27 23:06:34 UTC (rev 10065)
+++ trunk/sys/dev/snc/if_sncvar.h 2018-05-27 23:10:16 UTC (rev 10066)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1995, David Greenman
* All rights reserved.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/snc/if_sncvar.h 194023 2009-06-11 17:14:28Z avg $
*/
/*
Added: trunk/sys/dev/sound/macio/onyx.c
===================================================================
--- trunk/sys/dev/sound/macio/onyx.c (rev 0)
+++ trunk/sys/dev/sound/macio/onyx.c 2018-05-27 23:10:16 UTC (rev 10066)
@@ -0,0 +1,316 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright 2012 by Andreas Tobler. 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 ``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.
+ *
+ * $FreeBSD: stable/10/sys/dev/sound/macio/onyx.c 239401 2012-08-19 19:40:33Z andreast $
+ */
+
+/*
+ * Apple PCM3052 aka Onyx audio codec.
+ *
+ * Datasheet: http://www.ti.com/product/pcm3052a
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <sys/malloc.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <machine/dbdma.h>
+#include <machine/intr_machdep.h>
+#include <machine/resource.h>
+#include <machine/bus.h>
+#include <machine/pio.h>
+#include <sys/rman.h>
+
+#include <dev/iicbus/iicbus.h>
+#include <dev/iicbus/iiconf.h>
+#include <dev/ofw/ofw_bus.h>
+
+#ifdef HAVE_KERNEL_OPTION_HEADERS
+#include "opt_snd.h"
+#endif
+
+#include <dev/sound/pcm/sound.h>
+
+#include "mixer_if.h"
+
+extern kobj_class_t i2s_mixer_class;
+extern device_t i2s_mixer;
+
+struct onyx_softc
+{
+ device_t sc_dev;
+ uint32_t sc_addr;
+};
+
+static int onyx_probe(device_t);
+static int onyx_attach(device_t);
+static int onyx_init(struct snd_mixer *m);
+static int onyx_uninit(struct snd_mixer *m);
+static int onyx_reinit(struct snd_mixer *m);
+static int onyx_set(struct snd_mixer *m, unsigned dev, unsigned left,
+ unsigned right);
+static u_int32_t onyx_setrecsrc(struct snd_mixer *m, u_int32_t src);
+
+static device_method_t onyx_methods[] = {
+ /* Device interface. */
+ DEVMETHOD(device_probe, onyx_probe),
+ DEVMETHOD(device_attach, onyx_attach),
+ { 0, 0 }
+};
+
+static driver_t onyx_driver = {
+ "onyx",
+ onyx_methods,
+ sizeof(struct onyx_softc)
+};
+static devclass_t onyx_devclass;
+
+DRIVER_MODULE(onyx, iicbus, onyx_driver, onyx_devclass, 0, 0);
+MODULE_VERSION(onyx, 1);
+MODULE_DEPEND(onyx, iicbus, 1, 1, 1);
+
+static kobj_method_t onyx_mixer_methods[] = {
+ KOBJMETHOD(mixer_init, onyx_init),
+ KOBJMETHOD(mixer_uninit, onyx_uninit),
+ KOBJMETHOD(mixer_reinit, onyx_reinit),
+ KOBJMETHOD(mixer_set, onyx_set),
+ KOBJMETHOD(mixer_setrecsrc, onyx_setrecsrc),
+ KOBJMETHOD_END
+};
+
+MIXER_DECLARE(onyx_mixer);
+
+#define PCM3052_IICADDR 0x8C /* Hard-coded I2C slave addr */
+
+/*
+ * PCM3052 registers.
+ * Numbering in decimal as used in the data sheet.
+ */
+#define PCM3052_REG_LEFT_ATTN 65
+#define PCM3052_REG_RIGHT_ATTN 66
+#define PCM3052_REG_CONTROL 67
+#define PCM3052_MRST (1 << 7)
+#define PCM3052_SRST (1 << 6)
+#define PCM3052_REG_DAC_CONTROL 68
+#define PCM3052_OVR1 (1 << 6)
+#define PCM3052_MUTE_L (1 << 1)
+#define PCM3052_MUTE_R (1 << 0)
+#define PCM3052_REG_DAC_DEEMPH 69
+#define PCM3052_REG_DAC_FILTER 70
+#define PCM3052_DAC_FILTER_ALWAYS (1 << 2)
+#define PCM3052_REG_OUT_PHASE 71
+#define PCM3052_REG_ADC_CONTROL 72
+#define PCM3052_REG_ADC_HPF_BP 75
+#define PCM3052_HPF_ALWAYS (1 << 2)
+#define PCM3052_REG_INFO_1 77
+#define PCM3052_REG_INFO_2 78
+#define PCM3052_REG_INFO_3 79
+#define PCM3052_REG_INFO_4 80
+
+struct onyx_reg {
+ u_char LEFT_ATTN;
+ u_char RIGHT_ATTN;
+ u_char CONTROL;
+ u_char DAC_CONTROL;
+ u_char DAC_DEEMPH;
+ u_char DAC_FILTER;
+ u_char OUT_PHASE;
+ u_char ADC_CONTROL;
+ u_char ADC_HPF_BP;
+ u_char INFO_1;
+ u_char INFO_2;
+ u_char INFO_3;
+ u_char INFO_4;
+};
+
+static const struct onyx_reg onyx_initdata = {
+ 0x80, /* LEFT_ATTN, Mute default */
+ 0x80, /* RIGHT_ATTN, Mute default */
+ PCM3052_MRST | PCM3052_SRST, /* CONTROL */
+ 0, /* DAC_CONTROL */
+ 0, /* DAC_DEEMPH */
+ PCM3052_DAC_FILTER_ALWAYS, /* DAC_FILTER */
+ 0, /* OUT_PHASE */
+ (-1 /* dB */ + 8) & 0xf, /* ADC_CONTROL */
+ PCM3052_HPF_ALWAYS, /* ADC_HPF_BP */
+ (1 << 2), /* INFO_1 */
+ 2, /* INFO_2, */
+ 0, /* INFO_3, CLK 0 (level II),
+ SF 0 (44.1 kHz) */
+ 1 /* INFO_4, VALIDL/R 0,
+ WL 24-bit depth */
+};
+
+static int
+onyx_write(struct onyx_softc *sc, uint8_t reg, const uint8_t value)
+{
+ u_int size;
+ uint8_t buf[16];
+
+ struct iic_msg msg[] = {
+ { sc->sc_addr, IIC_M_WR, 0, buf }
+ };
+
+ size = 1;
+ msg[0].len = size + 1;
+ buf[0] = reg;
+ buf[1] = value;
+
+ iicbus_transfer(sc->sc_dev, msg, 1);
+
+ return (0);
+}
+
+static int
+onyx_probe(device_t dev)
+{
+ const char *name, *compat;
+
+ name = ofw_bus_get_name(dev);
+ if (name == NULL)
+ return (ENXIO);
+
+ if (strcmp(name, "codec") == 0) {
+ if (iicbus_get_addr(dev) != PCM3052_IICADDR)
+ return (ENXIO);
+ } else if (strcmp(name, "codec") == 0) {
+ compat = ofw_bus_get_compat(dev);
+ if (compat == NULL || strcmp(compat, "pcm3052") != 0)
+ return (ENXIO);
+ } else
+ return (ENXIO);
+
+ device_set_desc(dev, "Texas Instruments PCM3052 Audio Codec");
+ return (0);
+}
+
+static int
+onyx_attach(device_t dev)
+{
+ struct onyx_softc *sc;
+
+ sc = device_get_softc(dev);
+ sc->sc_dev = dev;
+ sc->sc_addr = iicbus_get_addr(dev);
+
+ i2s_mixer_class = &onyx_mixer_class;
+ i2s_mixer = dev;
+
+ return (0);
+}
+
+static int
+onyx_init(struct snd_mixer *m)
+{
+ struct onyx_softc *sc;
+ u_int x = 0;
+
+ sc = device_get_softc(mix_getdevinfo(m));
+
+ onyx_write(sc, PCM3052_REG_LEFT_ATTN, onyx_initdata.LEFT_ATTN);
+ onyx_write(sc, PCM3052_REG_RIGHT_ATTN, onyx_initdata.RIGHT_ATTN);
+ onyx_write(sc, PCM3052_REG_CONTROL, onyx_initdata.CONTROL);
+ onyx_write(sc, PCM3052_REG_DAC_CONTROL,
+ onyx_initdata.DAC_CONTROL);
+ onyx_write(sc, PCM3052_REG_DAC_DEEMPH, onyx_initdata.DAC_DEEMPH);
+ onyx_write(sc, PCM3052_REG_DAC_FILTER, onyx_initdata.DAC_FILTER);
+ onyx_write(sc, PCM3052_REG_OUT_PHASE, onyx_initdata.OUT_PHASE);
+ onyx_write(sc, PCM3052_REG_ADC_CONTROL,
+ onyx_initdata.ADC_CONTROL);
+ onyx_write(sc, PCM3052_REG_ADC_HPF_BP, onyx_initdata.ADC_HPF_BP);
+ onyx_write(sc, PCM3052_REG_INFO_1, onyx_initdata.INFO_1);
+ onyx_write(sc, PCM3052_REG_INFO_2, onyx_initdata.INFO_2);
+ onyx_write(sc, PCM3052_REG_INFO_3, onyx_initdata.INFO_3);
+ onyx_write(sc, PCM3052_REG_INFO_4, onyx_initdata.INFO_4);
+
+ x |= SOUND_MASK_VOLUME;
+ mix_setdevs(m, x);
+
+ return (0);
+}
+
+static int
+onyx_uninit(struct snd_mixer *m)
+{
+ return (0);
+}
+
+static int
+onyx_reinit(struct snd_mixer *m)
+{
+ return (0);
+}
+
+static int
+onyx_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
+{
+ struct onyx_softc *sc;
+ struct mtx *mixer_lock;
+ int locked;
+ uint8_t l, r;
+
+ sc = device_get_softc(mix_getdevinfo(m));
+ mixer_lock = mixer_get_lock(m);
+ locked = mtx_owned(mixer_lock);
+
+ switch (dev) {
+ case SOUND_MIXER_VOLUME:
+
+ /*
+ * We need to unlock the mixer lock because iicbus_transfer()
+ * may sleep. The mixer lock itself is unnecessary here
+ * because it is meant to serialize hardware access, which
+ * is taken care of by the I2C layer, so this is safe.
+ */
+ if (left > 100 || right > 100)
+ return (0);
+
+ l = left + 128;
+ r = right + 128;
+
+ if (locked)
+ mtx_unlock(mixer_lock);
+
+ onyx_write(sc, PCM3052_REG_LEFT_ATTN, l);
+ onyx_write(sc, PCM3052_REG_RIGHT_ATTN, r);
+
+ if (locked)
+ mtx_lock(mixer_lock);
+
+ return (left | (right << 8));
+ }
+
+ return (0);
+}
+
+static u_int32_t
+onyx_setrecsrc(struct snd_mixer *m, u_int32_t src)
+{
+ return (0);
+}
Property changes on: trunk/sys/dev/sound/macio/onyx.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list