summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-11-05 04:26:23 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-11-05 04:26:23 +0000
commit8d75786db53368264d7b3f2d458c08c9ee315ca6 (patch)
treef68e69e52e9dfcd2eb1aca40d59c07e923abcdd1
parent40829404c0c5618a042b410b040b76a6c3560b6b (diff)
some driver cleanup, ANSI/KNF and more consistency between the drivers.
ok joris@
-rw-r--r--sys/arch/macppc/dev/aoa.c46
-rw-r--r--sys/arch/macppc/dev/daca.c55
-rw-r--r--sys/arch/macppc/dev/snapper.c50
-rw-r--r--sys/arch/macppc/dev/tumbler.c26
4 files changed, 65 insertions, 112 deletions
diff --git a/sys/arch/macppc/dev/aoa.c b/sys/arch/macppc/dev/aoa.c
index 3c9edf466e2..c15d8aeb1a8 100644
--- a/sys/arch/macppc/dev/aoa.c
+++ b/sys/arch/macppc/dev/aoa.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: aoa.c,v 1.1 2005/10/31 00:04:54 joris Exp $ */
-/* $Id: aoa.c,v 1.1 2005/10/31 00:04:54 joris Exp $ */
+/* $OpenBSD: aoa.c,v 1.2 2005/11/05 04:26:22 brad Exp $ */
+/* $Id: aoa.c,v 1.2 2005/11/05 04:26:22 brad Exp $ */
/*-
* Copyright (c) 2005 Tsubai Masanari. All rights reserved.
@@ -38,9 +38,9 @@
#include <dev/audio_if.h>
#include <dev/ofw/openfirm.h>
+#include <macppc/dev/dbdma.h>
#include <machine/autoconf.h>
-#include <macppc/dev/dbdma.h>
#include <macppc/dev/i2svar.h>
@@ -50,14 +50,12 @@
# define DPRINTF while (0) printf
#endif
-#define aoa_softc i2s_softc /* XXX */
+/* XXX */
+#define aoa_softc i2s_softc
+int aoa_getdev(void *, struct audio_device *);
int aoa_match(struct device *, void *, void *);
void aoa_attach(struct device *, struct device *, void *);
-
-/* XXX */
-int aoa_getdev(void *, struct audio_device *);
-
void aoa_set_volume(struct aoa_softc *, int, int);
struct cfattach aoa_ca = {
@@ -104,43 +102,37 @@ struct audio_device aoa_device = {
};
int
-aoa_match(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
+aoa_match(struct device *parent, void *match, void *aux)
{
struct confargs *ca = aux;
int soundbus, soundchip;
char compat[32];
if (strcmp(ca->ca_name, "i2s") != 0)
- return 0;
+ return (0);
if ((soundbus = OF_child(ca->ca_node)) == 0 ||
(soundchip = OF_child(soundbus)) == 0)
- return 0;
+ return (0);
bzero(compat, sizeof compat);
OF_getprop(soundchip, "compatible", compat, sizeof compat);
if (strcmp(compat, "AOAKeylargo") == 0)
- return 1;
+ return (1);
if (strcmp(compat, "AOAK2") == 0)
- return 1;
+ return (1);
if (strcmp(compat, "AOAbase") == 0)
- return 1;
+ return (1);
- return 0;
+ return (0);
}
void
-aoa_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
+aoa_attach(struct device *parent, struct device *self, void *aux)
{
struct aoa_softc *sc = (struct aoa_softc *)self;
- /* "set volume" callback */
sc->sc_setvolume = aoa_set_volume;
i2s_attach(parent, sc, aux);
@@ -148,18 +140,14 @@ aoa_attach(parent, self, aux)
}
int
-aoa_getdev(h, retp)
- void *h;
- struct audio_device *retp;
+aoa_getdev(void *h, struct audio_device *retp)
{
*retp = aoa_device;
- return 0;
+ return (0);
}
void
-aoa_set_volume(sc, left, right)
- struct aoa_softc *sc;
- int left, right;
+aoa_set_volume(struct aoa_softc *sc, int left, int right)
{
printf("aoa_set_volume() not supported yet\n");
}
diff --git a/sys/arch/macppc/dev/daca.c b/sys/arch/macppc/dev/daca.c
index 9d67508ea06..0d7afbc4d38 100644
--- a/sys/arch/macppc/dev/daca.c
+++ b/sys/arch/macppc/dev/daca.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: daca.c,v 1.1 2005/10/30 23:55:03 joris Exp $ */
-/* $Id: daca.c,v 1.1 2005/10/30 23:55:03 joris Exp $ */
+/* $OpenBSD: daca.c,v 1.2 2005/11/05 04:26:22 brad Exp $ */
+/* $Id: daca.c,v 1.2 2005/11/05 04:26:22 brad Exp $ */
/*-
* Copyright (c) 2002,2003 Tsubai Masanari. All rights reserved.
@@ -30,12 +30,9 @@
#include <sys/param.h>
#include <sys/audioio.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/systm.h>
-#include <dev/auconv.h>
#include <dev/audio_if.h>
-#include <dev/mulaw.h>
#include <dev/ofw/openfirm.h>
#include <macppc/dev/dbdma.h>
@@ -49,7 +46,12 @@
# define DPRINTF while (0) printf
#endif
-#define daca_softc i2s_softc /* XXX */
+/* XXX */
+#define daca_softc i2s_softc
+
+/* XXX */
+int ki2c_write(struct device *, int, int, const void *, int);
+int ki2c_writereg(struct device *, int, u_int);
int daca_getdev(void *, struct audio_device *);
int daca_match(struct device *, void *, void *);
@@ -58,10 +60,6 @@ void daca_defer(struct device *);
void daca_init(struct daca_softc *);
void daca_set_volume(struct daca_softc *, int, int);
-/* XXX */
-int ki2c_write(struct device *, int, int, const void *, int);
-int ki2c_writereg(struct device *, int, u_int);
-
struct cfattach daca_ca = {
sizeof(struct daca_softc), daca_match, daca_attach
};
@@ -90,7 +88,7 @@ struct audio_hw_if daca_hw_if = {
i2s_set_port,
i2s_get_port,
i2s_query_devinfo,
- i2s_allocm,
+ i2s_allocm, /* allocm */
NULL,
i2s_round_buffersize,
i2s_mappage,
@@ -111,41 +109,35 @@ struct audio_device daca_device = {
#define DEQ_GCFG 0x03 /* Global configuration (8) */
int
-daca_match(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
+daca_match(struct device *parent, void *match, void *aux)
{
struct confargs *ca = aux;
int soundbus, soundchip;
char compat[32];
if (strcmp(ca->ca_name, "i2s") != 0)
- return 0;
+ return (0);
if ((soundbus = OF_child(ca->ca_node)) == 0 ||
(soundchip = OF_child(soundbus)) == 0)
- return 0;
+ return (0);
bzero(compat, sizeof compat);
OF_getprop(soundchip, "compatible", compat, sizeof compat);
if (strcmp(compat, "daca") != 0)
- return 0;
+ return (0);
- return 1;
+ return (1);
}
#define DEQaddr 0x9a
void
-daca_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
+daca_attach(struct device *parent,struct device *self, void *aux)
{
struct daca_softc *sc = (struct daca_softc *)self;
- /* "set volume" callback */
sc->sc_setvolume = daca_set_volume;
i2s_attach(parent, sc, aux);
@@ -158,18 +150,19 @@ daca_defer(struct device *dev)
struct daca_softc *sc = (struct daca_softc *)dev;
struct device *dv;
- TAILQ_FOREACH(dv, &alldevs, dv_list) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list)
if (strncmp(dv->dv_xname, "ki2c", 4) == 0 &&
strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
sc->sc_i2c = dv;
- }
-
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
return;
}
+ /* XXX If i2c has failed to attach, what should we do? */
+
audio_attach_mi(&daca_hw_if, sc, &sc->sc_dev);
+
daca_init(sc);
}
@@ -181,18 +174,14 @@ daca_init(struct daca_softc *sc)
}
int
-daca_getdev(h, retp)
- void *h;
- struct audio_device *retp;
+daca_getdev(void *h, struct audio_device *retp)
{
*retp = daca_device;
- return 0;
+ return (0);
}
void
-daca_set_volume(sc, left, right)
- struct daca_softc *sc;
- int left, right;
+daca_set_volume(struct daca_softc *sc, int left, int right)
{
u_int16_t data;
diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c
index c608027f15e..7012502cfb3 100644
--- a/sys/arch/macppc/dev/snapper.c
+++ b/sys/arch/macppc/dev/snapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snapper.c,v 1.24 2005/10/31 01:16:29 brad Exp $ */
+/* $OpenBSD: snapper.c,v 1.25 2005/11/05 04:26:22 brad Exp $ */
/* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -35,26 +35,20 @@
#include <sys/param.h>
#include <sys/audioio.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/systm.h>
-#include <dev/auconv.h>
#include <dev/audio_if.h>
-#include <dev/mulaw.h>
#include <dev/ofw/openfirm.h>
#include <macppc/dev/dbdma.h>
-#include <uvm/uvm_extern.h>
-
#include <machine/autoconf.h>
-#include <machine/pio.h>
#include <macppc/dev/i2svar.h>
#ifdef SNAPPER_DEBUG
-# define DPRINTF(x) printf x
+# define DPRINTF printf
#else
-# define DPRINTF(x)
+# define DPRINTF while (0) printf
#endif
/* XXX */
@@ -285,36 +279,30 @@ struct tas3004_reg {
};
int
-snapper_match(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
+snapper_match(struct device *parent, void *match, void *aux)
{
struct confargs *ca = aux;
int soundbus, soundchip;
char compat[32];
if (strcmp(ca->ca_name, "i2s") != 0)
- return 0;
+ return (0);
if ((soundbus = OF_child(ca->ca_node)) == 0 ||
(soundchip = OF_child(soundbus)) == 0)
- return 0;
+ return (0);
bzero(compat, sizeof compat);
OF_getprop(soundchip, "compatible", compat, sizeof compat);
if (strcmp(compat, "snapper") != 0)
- return 0;
+ return (0);
- return 1;
+ return (1);
}
void
-snapper_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
+snapper_attach(struct device *parent, struct device *self, void *aux)
{
struct snapper_softc *sc = (struct snapper_softc *)self;
@@ -350,9 +338,7 @@ snapper_defer(struct device *dev)
}
void
-snapper_set_volume(sc, left, right)
- struct snapper_softc *sc;
- int left, right;
+snapper_set_volume(struct snapper_softc *sc, int left, int right)
{
u_char vol[6];
@@ -472,10 +458,7 @@ const char tas3004_regsize[] = {
#define DEQaddr 0x6a
int
-tas3004_write(sc, reg, data)
- struct snapper_softc *sc;
- u_int reg;
- const void *data;
+tas3004_write(struct snapper_softc *sc, u_int reg, const void *data)
{
int size;
@@ -484,17 +467,16 @@ tas3004_write(sc, reg, data)
KASSERT(size > 0);
if (ki2c_write(sc->sc_i2c, DEQaddr, reg, data, size))
- return -1;
+ return (-1);
- return 0;
+ return (0);
}
#define DEQ_WRITE(sc, reg, addr) \
if (tas3004_write(sc, reg, addr)) goto err
int
-tas3004_init(sc)
- struct snapper_softc *sc;
+tas3004_init(struct snapper_softc *sc)
{
deq_reset(sc);
@@ -526,10 +508,10 @@ tas3004_init(sc)
DEQ_WRITE(sc, DEQ_RLB_GAIN, tas3004_initdata.RLB_GAIN);
DEQ_WRITE(sc, DEQ_ACR, tas3004_initdata.ACR);
- return 0;
+ return (0);
err:
printf("%s: tas3004_init failed\n", sc->sc_dev.dv_xname);
- return -1;
+ return (-1);
}
void
diff --git a/sys/arch/macppc/dev/tumbler.c b/sys/arch/macppc/dev/tumbler.c
index 5235a86665e..71e3bf7b7ec 100644
--- a/sys/arch/macppc/dev/tumbler.c
+++ b/sys/arch/macppc/dev/tumbler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tumbler.c,v 1.2 2005/10/31 01:20:46 brad Exp $ */
+/* $OpenBSD: tumbler.c,v 1.3 2005/11/05 04:26:22 brad Exp $ */
/*-
* Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved.
@@ -34,19 +34,13 @@
#include <sys/param.h>
#include <sys/audioio.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/systm.h>
-#include <dev/auconv.h>
#include <dev/audio_if.h>
-#include <dev/mulaw.h>
#include <dev/ofw/openfirm.h>
#include <macppc/dev/dbdma.h>
-#include <uvm/uvm_extern.h>
-
#include <machine/autoconf.h>
-#include <machine/pio.h>
#include <macppc/dev/i2svar.h>
@@ -271,19 +265,19 @@ tumbler_match(struct device *parent, void *match, void *aux)
char compat[32];
if (strcmp(ca->ca_name, "i2s") != 0)
- return 0;
+ return (0);
if ((soundbus = OF_child(ca->ca_node)) == 0 ||
(soundchip = OF_child(soundbus)) == 0)
- return 0;
+ return (0);
bzero(compat, sizeof compat);
OF_getprop(soundchip, "compatible", compat, sizeof compat);
if (strcmp(compat, "tumbler") != 0)
- return 0;
+ return (0);
- return 1;
+ return (1);
}
void
@@ -430,9 +424,9 @@ tas3001_write(struct tumbler_softc *sc, u_int reg, const void *data)
KASSERT(size > 0);
if (ki2c_write(sc->sc_i2c, DEQaddr, reg, data, size))
- return -1;
+ return (-1);
- return 0;
+ return (0);
}
#define DEQ_WRITE(sc, reg, addr) \
@@ -464,10 +458,10 @@ tas3001_init(struct tumbler_softc *sc)
DEQ_WRITE(sc, DEQ_MIXER1, tas3001_initdata.MIXER1);
DEQ_WRITE(sc, DEQ_MIXER2, tas3001_initdata.MIXER2);
- return 0;
+ return (0);
err:
printf("%s: tas3001_init: error\n", sc->sc_dev.dv_xname);
- return -1;
+ return (-1);
}
void
@@ -496,5 +490,5 @@ int
tumbler_getdev(void *h, struct audio_device *retp)
{
*retp = tumbler_device;
- return 0;
+ return (0);
}