Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-audiomp3]: src/sys port the am7930 drivers to audiomp. sparc a...
details: https://anonhg.NetBSD.org/src/rev/0f70daeb74eb
branches: jmcneill-audiomp3
changeset: 771335:0f70daeb74eb
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Nov 20 10:56:18 2011 +0000
description:
port the am7930 drivers to audiomp. sparc and pmax GENERIC builds,
but i am unable to test these drivers.
diffstat:
sys/arch/sparc/dev/audioamd.c | 17 +++++++++-
sys/dev/ic/am7930.c | 13 +++++---
sys/dev/ic/am7930var.h | 5 ++-
sys/dev/tc/bba.c | 65 +++++++++++++++++++++++++-----------------
4 files changed, 65 insertions(+), 35 deletions(-)
diffs (truncated from 330 to 300 lines):
diff -r 11908e0f5a95 -r 0f70daeb74eb sys/arch/sparc/dev/audioamd.c
--- a/sys/arch/sparc/dev/audioamd.c Sun Nov 20 10:48:54 2011 +0000
+++ b/sys/arch/sparc/dev/audioamd.c Sun Nov 20 10:56:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audioamd.c,v 1.26 2011/06/04 01:27:57 tsutsui Exp $ */
+/* $NetBSD: audioamd.c,v 1.26.4.1 2011/11/20 10:56:18 mrg Exp $ */
/* NetBSD: am7930_sparc.c,v 1.44 1999/03/14 22:29:00 jonathan Exp */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audioamd.c,v 1.26 2011/06/04 01:27:57 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audioamd.c,v 1.26.4.1 2011/11/20 10:56:18 mrg Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -148,6 +148,7 @@
int audioamd_start_output(void *, void *, int, void (*)(void *), void *);
int audioamd_start_input(void *, void *, int, void (*)(void *), void *);
int audioamd_getdev(void *, struct audio_device *);
+void audioamd_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread);
const struct audio_hw_if sa_hw_if = {
am7930_open,
@@ -177,6 +178,8 @@
0,
0,
0,
+ 0,
+ audioamd_get_locks,
};
struct audio_device audioamd_device = {
@@ -558,4 +561,14 @@
return 0;
}
+void
+audioamd_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+ struct audioamd_softc *asc = opaque;
+ struct am7930_softc *sc = &asc->sc_am7930;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
+
#endif /* NAUDIO > 0 */
diff -r 11908e0f5a95 -r 0f70daeb74eb sys/dev/ic/am7930.c
--- a/sys/dev/ic/am7930.c Sun Nov 20 10:48:54 2011 +0000
+++ b/sys/dev/ic/am7930.c Sun Nov 20 10:56:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: am7930.c,v 1.50 2007/10/19 11:59:46 ad Exp $ */
+/* $NetBSD: am7930.c,v 1.50.56.1 2011/11/20 10:56:18 mrg Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.50 2007/10/19 11:59:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.50.56.1 2011/11/20 10:56:18 mrg Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -190,6 +190,9 @@
AM7930_MCR4_INT_ENABLE);
}
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+ /* We used to take splaudio() in commit_settings */
+ mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_VM);
}
int
@@ -288,7 +291,7 @@
struct am7930_softc *sc;
uint16_t ger, gr, gx, stgr;
uint8_t mmr2, mmr3;
- int s, level;
+ int level;
DPRINTF(("sa_commit.\n"));
sc = addr;
@@ -304,7 +307,7 @@
gr = gx_coeff[level];
}
- s = splaudio();
+ mutex_enter(&sc->sc_intr_lock);
mmr2 = AM7930_IREAD(sc, AM7930_IREG_MAP_MMR2);
if (sc->sc_out_port == AUDIOAMD_SPEAKER_VOL)
@@ -329,7 +332,7 @@
AM7930_IWRITE16(sc, AM7930_IREG_MAP_GR, gr);
AM7930_IWRITE16(sc, AM7930_IREG_MAP_GER, ger);
- splx(s);
+ mutex_exit(&sc->sc_intr_lock);
return 0;
}
diff -r 11908e0f5a95 -r 0f70daeb74eb sys/dev/ic/am7930var.h
--- a/sys/dev/ic/am7930var.h Sun Nov 20 10:48:54 2011 +0000
+++ b/sys/dev/ic/am7930var.h Sun Nov 20 10:56:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: am7930var.h,v 1.12 2011/06/04 01:27:57 tsutsui Exp $ */
+/* $NetBSD: am7930var.h,v 1.12.4.1 2011/11/20 10:56:18 mrg Exp $ */
struct am7930_softc;
@@ -24,6 +24,9 @@
uint8_t sc_mic_mute;
struct am7930_glue *sc_glue;
+
+ kmutex_t sc_lock;
+ kmutex_t sc_intr_lock;
};
extern int am7930debug;
diff -r 11908e0f5a95 -r 0f70daeb74eb sys/dev/tc/bba.c
--- a/sys/dev/tc/bba.c Sun Nov 20 10:48:54 2011 +0000
+++ b/sys/dev/tc/bba.c Sun Nov 20 10:56:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bba.c,v 1.38 2011/06/04 01:27:57 tsutsui Exp $ */
+/* $NetBSD: bba.c,v 1.38.4.1 2011/11/20 10:56:19 mrg Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -29,13 +29,13 @@
/* maxine/alpha baseboard audio (bba) */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bba.c,v 1.38 2011/06/04 01:27:57 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bba.c,v 1.38.4.1 2011/11/20 10:56:19 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/bus.h>
#include <machine/autoconf.h>
@@ -111,10 +111,10 @@
static stream_filter_factory_t bba_output_conv;
static stream_filter_factory_t bba_input_conv;
-static int bba_output_conv_fetch_to(stream_fetcher_t *, audio_stream_t *,
- int);
-static int bba_input_conv_fetch_to(stream_fetcher_t *, audio_stream_t *,
- int);
+static int bba_output_conv_fetch_to(struct audio_softc *, stream_fetcher_t *,
+ audio_stream_t *, int);
+static int bba_input_conv_fetch_to(struct audio_softc *, stream_fetcher_t *,
+ audio_stream_t *, int);
struct am7930_glue bba_glue = {
bba_codec_iread,
@@ -136,8 +136,8 @@
static int bba_halt_output(void *);
static int bba_halt_input(void *);
static int bba_getdev(void *, struct audio_device *);
-static void *bba_allocm(void *, int, size_t, struct malloc_type *, int);
-static void bba_freem(void *, void *, struct malloc_type *);
+static void *bba_allocm(void *, int, size_t);
+static void bba_freem(void *, void *, size_t);
static size_t bba_round_buffersize(void *, int, size_t);
static int bba_get_props(void *);
static paddr_t bba_mappage(void *, void *, off_t, int);
@@ -147,6 +147,8 @@
static int bba_trigger_input(void *, void *, void *, int,
void (*)(void *), void *,
const audio_params_t *);
+static void bba_get_locks(void *opaque, kmutex_t **intr,
+ kmutex_t **thread);
static const struct audio_hw_if sa_hw_if = {
am7930_open,
@@ -176,6 +178,8 @@
bba_trigger_output, /* md */
bba_trigger_input, /* md */
0,
+ 0,
+ bba_get_locks,
};
static struct audio_device bba_device = {
@@ -288,8 +292,7 @@
static void *
-bba_allocm(void *addr, int direction, size_t size,
- struct malloc_type *pool, int flags)
+bba_allocm(void *addr, int direction, size_t size)
{
struct am7930_softc *asc;
struct bba_softc *sc;
@@ -297,30 +300,28 @@
int rseg;
void *kva;
struct bba_mem *m;
- int w;
int state;
DPRINTF(("bba_allocm: size = %zu\n", size));
asc = addr;
sc = addr;
state = 0;
- w = (flags & M_NOWAIT) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK;
if (bus_dmamem_alloc(sc->sc_dmat, size, BBA_DMABUF_ALIGN,
- BBA_DMABUF_BOUNDARY, &seg, 1, &rseg, w)) {
+ BBA_DMABUF_BOUNDARY, &seg, 1, &rseg, BUS_DMA_WAITOK)) {
aprint_error_dev(asc->sc_dev, "can't allocate DMA buffer\n");
goto bad;
}
state |= 1;
if (bus_dmamem_map(sc->sc_dmat, &seg, rseg, size,
- &kva, w | BUS_DMA_COHERENT)) {
+ &kva, BUS_DMA_WAITOK | BUS_DMA_COHERENT)) {
aprint_error_dev(asc->sc_dev, "can't map DMA buffer\n");
goto bad;
}
state |= 2;
- m = malloc(sizeof(struct bba_mem), pool, flags);
+ m = kmem_alloc(sizeof(struct bba_mem), KM_SLEEP);
if (m == NULL)
goto bad;
m->addr = seg.ds_addr;
@@ -341,7 +342,7 @@
static void
-bba_freem(void *addr, void *ptr, struct malloc_type *pool)
+bba_freem(void *addr, void *ptr, size_t size)
{
struct bba_softc *sc;
struct bba_mem **mp, *m;
@@ -364,7 +365,7 @@
seg.ds_addr = m->addr;
seg.ds_len = m->size;
bus_dmamem_free(sc->sc_dmat, &seg, 1);
- free(m, pool);
+ kmem_free(m, sizeof(struct bba_mem));
}
@@ -573,16 +574,26 @@
return 1;
}
+static void
+bba_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+ struct bba_softc *bsc = opaque;
+ struct am7930_softc *sc = &bsc->sc_am7930;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
+
static int
bba_intr(void *addr)
{
struct bba_softc *sc;
struct bba_dma_state *d;
tc_addr_t nphys;
- int s, mask;
+ int mask;
sc = addr;
- s = splaudio();
+ mutex_enter(&sc->sc_am7930.sc_intr_lock);
mask = bus_space_read_4(sc->sc_bst, sc->sc_bsh, IOASIC_INTR);
@@ -605,7 +616,7 @@
(*d->intr)(d->intr_arg);
}
- splx(s);
+ mutex_exit(&sc->sc_am7930.sc_intr_lock);
return 0;
}
@@ -649,14 +660,14 @@
}
static int
-bba_input_conv_fetch_to(stream_fetcher_t *self, audio_stream_t *dst,
- int max_used)
+bba_input_conv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
Home |
Main Index |
Thread Index |
Old Index