summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/audio.c75
-rw-r--r--sys/dev/audio_if.h6
-rw-r--r--sys/dev/bluetooth/btsco.c7
-rw-r--r--sys/dev/ic/ac97.c4
-rw-r--r--sys/dev/isa/ad1848.c9
-rw-r--r--sys/dev/isa/ess.c23
-rw-r--r--sys/dev/isa/gus.c8
-rw-r--r--sys/dev/isa/sbdsp.c34
-rw-r--r--sys/dev/pci/auacer.c24
-rw-r--r--sys/dev/pci/auglx.c26
-rw-r--r--sys/dev/pci/auich.c27
-rw-r--r--sys/dev/pci/auixp.c26
-rw-r--r--sys/dev/pci/autri.c6
-rw-r--r--sys/dev/pci/auvia.c28
-rw-r--r--sys/dev/pci/azalia.c8
-rw-r--r--sys/dev/pci/cmpci.c9
-rw-r--r--sys/dev/pci/cs4280.c7
-rw-r--r--sys/dev/pci/cs4281.c7
-rw-r--r--sys/dev/pci/eap.c24
-rw-r--r--sys/dev/pci/emuxki.c7
-rw-r--r--sys/dev/pci/envy.c8
-rw-r--r--sys/dev/pci/esa.c31
-rw-r--r--sys/dev/pci/eso.c8
-rw-r--r--sys/dev/pci/fms.c28
-rw-r--r--sys/dev/pci/maestro.c21
-rw-r--r--sys/dev/pci/neo.c25
-rw-r--r--sys/dev/pci/sv.c25
-rw-r--r--sys/dev/pci/yds.c24
-rw-r--r--sys/dev/sbus/cs4231.c8
-rw-r--r--sys/dev/usb/uaudio.c30
30 files changed, 393 insertions, 180 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index e3244dc6997..91fdddd069e 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.107 2009/11/09 17:53:39 nicm Exp $ */
+/* $OpenBSD: audio.c,v 1.108 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
@@ -100,8 +100,6 @@ int audiodebug = 0;
#define ROUNDSIZE(x) x &= -16 /* round to nice boundary */
-#define AUDIO_BPS(bits) ((bits) <= 8 ? 1 : (((bits) <= 16) ? 2 : 4))
-
int audio_blk_ms = AUDIO_BLK_MS;
int audiosetinfo(struct audio_softc *, struct audio_info *);
@@ -218,7 +216,7 @@ int au_portof(struct audio_softc *, char *);
/* The default audio mode: 8 kHz mono ulaw */
struct audio_params audio_default =
- { 8000, AUDIO_ENCODING_ULAW, 8, 1, 0, 1 };
+ { 8000, AUDIO_ENCODING_ULAW, 8, 1, 1, 1, 0, 1 };
struct cfattach audio_ca = {
sizeof(struct audio_softc), audioprobe, audioattach,
@@ -568,8 +566,8 @@ audio_printsc(struct audio_softc *sc)
void
audio_print_params(char *s, struct audio_params *p)
{
- printf("audio: %s sr=%ld, enc=%d, chan=%d, prec=%d\n", s,
- p->sample_rate, p->encoding, p->channels, p->precision);
+ printf("audio: %s sr=%ld, enc=%d, chan=%d, prec=%d bps=%d\n", s,
+ p->sample_rate, p->encoding, p->channels, p->precision, p->bps);
}
#endif
@@ -891,7 +889,7 @@ audio_initbufs(struct audio_softc *sc)
sc->sc_pnintr = 0;
sc->sc_pblktime = (u_long)(
(u_long)sc->sc_pr.blksize * 100000 /
- (u_long)(AUDIO_BPS(sc->sc_pparams.precision) *
+ (u_long)(sc->sc_pparams.bps *
sc->sc_pparams.channels *
sc->sc_pparams.sample_rate)) * 10;
DPRINTF(("audio: play blktime = %lu for %d\n",
@@ -899,7 +897,7 @@ audio_initbufs(struct audio_softc *sc)
sc->sc_rnintr = 0;
sc->sc_rblktime = (u_long)(
(u_long)sc->sc_rr.blksize * 100000 /
- (u_long)(AUDIO_BPS(sc->sc_rparams.precision) *
+ (u_long)(sc->sc_rparams.bps *
sc->sc_rparams.channels *
sc->sc_rparams.sample_rate)) * 10;
DPRINTF(("audio: record blktime = %lu for %d\n",
@@ -1041,11 +1039,15 @@ audio_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
ai.record.encoding = sc->sc_rparams.encoding;
ai.record.channels = sc->sc_rparams.channels;
ai.record.precision = sc->sc_rparams.precision;
+ ai.record.bps = sc->sc_rparams.bps;
+ ai.record.msb = sc->sc_rparams.msb;
ai.record.pause = 0;
ai.play.sample_rate = sc->sc_pparams.sample_rate;
- ai.play.encoding = sc->sc_pparams.encoding;
+ ai.play.encoding = sc->sc_pparams.encoding;
ai.play.channels = sc->sc_pparams.channels;
ai.play.precision = sc->sc_pparams.precision;
+ ai.play.bps = sc->sc_pparams.bps;
+ ai.play.msb = sc->sc_pparams.msb;
ai.play.pause = 0;
ai.mode = mode;
sc->sc_rr.blkset = sc->sc_pr.blkset = 0; /* Block sizes not set yet */
@@ -1351,7 +1353,7 @@ audio_set_blksize(struct audio_softc *sc, int mode, int fpb) {
rb = &sc->sc_rr;
}
- fs = parm->channels * AUDIO_BPS(parm->precision);
+ fs = parm->channels * parm->bps;
bs = fpb * fs;
maxbs = rb->bufsize / 2;
if (bs > maxbs)
@@ -1387,7 +1389,7 @@ void
audio_fill_silence(struct audio_params *params, u_char *start, u_char *p, int n)
{
size_t rounderr;
- int i, samplesz, nsamples;
+ int i, nsamples;
u_char auzero[4] = {0, 0, 0, 0};
/*
@@ -1395,11 +1397,10 @@ audio_fill_silence(struct audio_params *params, u_char *start, u_char *p, int n)
* beginning of the sample, so we overwrite partially written
* ones.
*/
- samplesz = AUDIO_BPS(params->precision);
- rounderr = (p - start) % samplesz;
+ rounderr = (p - start) % params->bps;
p -= rounderr;
n += rounderr;
- nsamples = n / samplesz;
+ nsamples = n / params->bps;
switch (params->encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
@@ -1412,10 +1413,16 @@ audio_fill_silence(struct audio_params *params, u_char *start, u_char *p, int n)
auzero[0] = 0x55;
break;
case AUDIO_ENCODING_ULINEAR_LE:
- auzero[samplesz - 1] = 0x80;
+ if (params->msb == 1)
+ auzero[params->bps - 1] = 0x80;
+ else
+ auzero[params->bps - 1] = 1 << ((params->precision + 7) % NBBY);
break;
case AUDIO_ENCODING_ULINEAR_BE:
- auzero[0] = 0x80;
+ if (params->msb == 1)
+ auzero[0] = 0x80;
+ else
+ auzero[0] = 1 << ((params->precision + 7) % NBBY);
break;
case AUDIO_ENCODING_MPEG_L1_STREAM:
case AUDIO_ENCODING_MPEG_L1_PACKETS:
@@ -1430,7 +1437,7 @@ audio_fill_silence(struct audio_params *params, u_char *start, u_char *p, int n)
break;
}
while (--nsamples >= 0) {
- for (i = 0; i < samplesz; i++)
+ for (i = 0; i < params->bps; i++)
*p++ = auzero[i];
}
}
@@ -1617,18 +1624,18 @@ audio_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
* original formula:
* sc->sc_rr.drops /
* sc->sc_rparams.factor /
- * (sc->sc_rparams.channels * AUDIO_BPS(sc->sc_rparams.precision))
+ * (sc->sc_rparams.channels * sc->sc_rparams.bps)
*/
case AUDIO_RERROR:
*(int *)addr = sc->sc_rr.drops /
(sc->sc_rparams.factor * sc->sc_rparams.channels *
- AUDIO_BPS(sc->sc_rparams.precision));
+ sc->sc_rparams.bps);
break;
case AUDIO_PERROR:
*(int *)addr = sc->sc_pr.drops /
(sc->sc_pparams.factor * sc->sc_pparams.channels *
- AUDIO_BPS(sc->sc_pparams.precision));
+ sc->sc_pparams.bps);
break;
/*
@@ -2603,6 +2610,22 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
rp.precision = r->precision;
nr++;
}
+ if (p->bps != ~0) {
+ pp.bps = p->bps;
+ np++;
+ }
+ if (r->bps != ~0) {
+ rp.bps = r->bps;
+ nr++;
+ }
+ if (p->msb != ~0) {
+ pp.msb = p->msb;
+ np++;
+ }
+ if (r->msb != ~0) {
+ rp.msb = r->msb;
+ nr++;
+ }
if (p->channels != ~0) {
pp.channels = p->channels;
np++;
@@ -2669,11 +2692,15 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
pp.encoding = rp.encoding;
pp.channels = rp.channels;
pp.precision = rp.precision;
+ pp.bps = rp.bps;
+ pp.msb = rp.msb;
} else if (setmode == AUMODE_PLAY) {
rp.sample_rate = pp.sample_rate;
rp.encoding = pp.encoding;
rp.channels = pp.channels;
rp.precision = pp.precision;
+ rp.bps = pp.bps;
+ rp.msb = pp.msb;
}
}
sc->sc_rparams = rp;
@@ -2711,7 +2738,7 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
if (r->block_size == ~0 || r->block_size == 0) {
fpb = rp.sample_rate * audio_blk_ms / 1000;
} else {
- fs = rp.channels * AUDIO_BPS(rp.precision);
+ fs = rp.channels * rp.bps;
fpb = (r->block_size * rp.factor) / fs;
}
if (sc->sc_rr.blkset == 0)
@@ -2721,7 +2748,7 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
if (p->block_size == ~0 || p->block_size == 0) {
fpb = pp.sample_rate * audio_blk_ms / 1000;
} else {
- fs = pp.channels * AUDIO_BPS(pp.precision);
+ fs = pp.channels * pp.bps;
fpb = (p->block_size * pp.factor) / fs;
}
if (sc->sc_pr.blkset == 0)
@@ -2894,6 +2921,10 @@ audiogetinfo(struct audio_softc *sc, struct audio_info *ai)
r->channels = sc->sc_rparams.channels;
p->precision = sc->sc_pparams.precision;
r->precision = sc->sc_rparams.precision;
+ p->bps = sc->sc_pparams.bps;
+ r->bps = sc->sc_rparams.bps;
+ p->msb = sc->sc_pparams.msb;
+ r->msb = sc->sc_rparams.msb;
p->encoding = sc->sc_pparams.encoding;
r->encoding = sc->sc_rparams.encoding;
diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h
index 1e3164f6861..5557edd3067 100644
--- a/sys/dev/audio_if.h
+++ b/sys/dev/audio_if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio_if.h,v 1.26 2008/04/21 00:32:42 jakemsr Exp $ */
+/* $OpenBSD: audio_if.h,v 1.27 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: audio_if.h,v 1.24 1998/01/10 14:07:25 tv Exp $ */
/*
@@ -38,6 +38,8 @@
#ifndef _SYS_DEV_AUDIO_IF_H_
#define _SYS_DEV_AUDIO_IF_H_
+#define AUDIO_BPS(bits) (bits) <= 8 ? 1 : ((bits) <= 16 ? 2 : 4)
+
/*
* Generic interface to hardware driver.
*/
@@ -52,6 +54,8 @@ struct audio_params {
u_long sample_rate; /* sample rate */
u_int encoding; /* mu-law, linear, etc */
u_int precision; /* bits/sample */
+ u_int bps; /* bytes/sample */
+ u_int msb; /* data alignment */
u_int channels; /* mono(1), stereo(2) */
/* Software en/decode functions, set if SW coding required by HW */
void (*sw_code)(void *, u_char *, int);
diff --git a/sys/dev/bluetooth/btsco.c b/sys/dev/bluetooth/btsco.c
index c0f2df5c0bb..513823652cf 100644
--- a/sys/dev/bluetooth/btsco.c
+++ b/sys/dev/bluetooth/btsco.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btsco.c,v 1.4 2008/11/25 18:29:27 todd Exp $ */
+/* $OpenBSD: btsco.c,v 1.5 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: btsco.c,v 1.22 2008/08/06 15:01:23 plunky Exp $ */
/*-
@@ -732,10 +732,11 @@ btsco_query_encoding(void *hdl, struct audio_encoding *ae)
ae->precision = 16;
ae->flags = 0;
break;
-
default:
err = EINVAL;
}
+ ae->bps = AUDIO_BPS(ae->precision);
+ ae->msb = 1;
return err;
}
@@ -769,6 +770,8 @@ btsco_set_params(void *hdl, int setmode, int usemode,
p->sample_rate = 8000;
p->encoding = AUDIO_ENCODING_SLINEAR_LE;
p->precision = 16;
+ p->bps = 2;
+ p->msb = 1;
p->channels = 1;
}
return 0;
diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c
index f90c3cd3cbb..d86cd54d70c 100644
--- a/sys/dev/ic/ac97.c
+++ b/sys/dev/ic/ac97.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ac97.c,v 1.72 2010/02/25 21:22:42 ratchov Exp $ */
+/* $OpenBSD: ac97.c,v 1.73 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999, 2000 Constantine Sapuntzakis
@@ -76,6 +76,8 @@ const struct audio_params ac97_audio_default = {
48000, /* sample_rate */
AUDIO_ENCODING_SLINEAR_LE, /* encoding */
16, /* precision */
+ 2, /* bps */
+ 1, /* msb */
2, /* channels */
NULL, /* sw_code */
1 /* factor */
diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c
index 815928a44f6..5d46684d965 100644
--- a/sys/dev/isa/ad1848.c
+++ b/sys/dev/isa/ad1848.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ad1848.c,v 1.34 2010/06/30 11:21:35 jakemsr Exp $ */
+/* $OpenBSD: ad1848.c,v 1.35 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: ad1848.c,v 1.45 1998/01/30 02:02:38 augustss Exp $ */
/*
@@ -1014,6 +1014,9 @@ ad1848_query_encoding(addr, fp)
return EINVAL;
/*NOTREACHED*/
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
@@ -1101,6 +1104,10 @@ ad1848_set_params(addr, setmode, usemode, p, r)
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = 1;
+ r->msb = 1;
sc->format_bits = bits;
sc->channels = p->channels;
diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c
index fd54aa49b50..c285986ee03 100644
--- a/sys/dev/isa/ess.c
+++ b/sys/dev/isa/ess.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ess.c,v 1.15 2010/06/30 20:39:02 blambert Exp $ */
+/* $OpenBSD: ess.c,v 1.16 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: ess.c,v 1.44.4.1 1999/06/21 01:18:00 thorpej Exp $ */
/*
@@ -1141,52 +1141,55 @@ ess_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
@@ -1266,6 +1269,8 @@ ess_set_params(addr, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
if (usemode == AUMODE_RECORD)
diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
index f71de03e445..b370c587cf0 100644
--- a/sys/dev/isa/gus.c
+++ b/sys/dev/isa/gus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gus.c,v 1.33 2009/08/26 22:29:09 jasper Exp $ */
+/* $OpenBSD: gus.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
@@ -1573,6 +1573,9 @@ gus_set_params(addr, setmode, usemode, p, r)
r->sw_code = p->sw_code = swap_bytes;
break;
}
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
return 0;
}
@@ -3310,6 +3313,9 @@ gus_query_encoding(addr, fp)
return(EINVAL);
/*NOTREACHED*/
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
index e2f0176e97b..32d63f06567 100644
--- a/sys/dev/isa/sbdsp.c
+++ b/sys/dev/isa/sbdsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbdsp.c,v 1.30 2010/04/03 23:22:42 jakemsr Exp $ */
+/* $OpenBSD: sbdsp.c,v 1.31 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -451,7 +451,7 @@ sbdsp_query_encoding(addr, fp)
struct audio_encoding *fp;
{
struct sbdsp_softc *sc = addr;
- int emul;
+ int emul, found = 0;
emul = ISSB16CLASS(sc) ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
@@ -461,27 +461,35 @@ sbdsp_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return 0;
+ found = 1;
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ found = 1;
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ found = 1;
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = emul;
- return 0;
+ found = 1;
+ break;
}
- if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ)
+ if (found) {
+ fp->bps = 1;
+ fp->msb = 1;
+ return 0;
+ } else if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ)
return EINVAL;
switch(fp->index) {
@@ -490,28 +498,30 @@ sbdsp_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return 0;
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = emul;
- return 0;
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
default:
return EINVAL;
}
+ fp->bps = 2;
+ fp->msb = 1;
return 0;
}
@@ -737,6 +747,8 @@ sbdsp_set_params(addr, setmode, usemode, play, rec)
p->sw_code = swcode;
p->factor = factor;
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
DPRINTF(("sbdsp_set_params: model=%d, mode=%d, rate=%ld, prec=%d, chan=%d, enc=%d -> tc=%02x, cmd=%02x, bmode=%02x, cmdchan=%02x, swcode=%p, factor=%d\n",
sc->sc_model, mode, p->sample_rate, p->precision, p->channels,
p->encoding, tc, m->cmd, bmode, m->cmdchan, swcode, factor));
diff --git a/sys/dev/pci/auacer.c b/sys/dev/pci/auacer.c
index c81adfe8b21..f36d9a3957d 100644
--- a/sys/dev/pci/auacer.c
+++ b/sys/dev/pci/auacer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auacer.c,v 1.6 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: auacer.c,v 1.7 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: auacer.c,v 1.3 2004/11/10 04:20:26 kent Exp $ */
/*-
@@ -461,52 +461,56 @@ auacer_query_encoding(void *v, struct audio_encoding *aep)
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+
+ return (0);
}
int
@@ -646,6 +650,8 @@ auacer_set_params(void *v, int setmode, int usemode, struct audio_params *play,
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
if (AC97_IS_FIXED_RATE(sc->codec_if))
p->sample_rate = AC97_SINGLE_RATE;
diff --git a/sys/dev/pci/auglx.c b/sys/dev/pci/auglx.c
index b5159624a08..6e22cb94258 100644
--- a/sys/dev/pci/auglx.c
+++ b/sys/dev/pci/auglx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auglx.c,v 1.3 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: auglx.c,v 1.4 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
@@ -497,52 +497,56 @@ auglx_query_encoding(void *v, struct audio_encoding *aep)
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return 0;
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
default:
return EINVAL;
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+
+ return 0;
}
@@ -725,6 +729,8 @@ auglx_set_params(void *v, int setmode, int usemode, struct audio_params *play,
default:
return EINVAL;
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
orate = adj_rate = play->sample_rate;
@@ -900,6 +906,8 @@ auglx_set_params(void *v, int setmode, int usemode, struct audio_params *play,
default:
return EINVAL;
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
orate = rec->sample_rate;
error = ac97_set_rate(sc->codec_if, AC97_REG_PCM_LR_ADC_RATE,
diff --git a/sys/dev/pci/auich.c b/sys/dev/pci/auich.c
index c2b0db58dea..abbc9533477 100644
--- a/sys/dev/pci/auich.c
+++ b/sys/dev/pci/auich.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auich.c,v 1.82 2010/06/07 23:35:24 ratchov Exp $ */
+/* $OpenBSD: auich.c,v 1.83 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2000,2001 Michael Shalayeff
@@ -685,6 +685,8 @@ auich_query_encoding(v, aep)
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
+ aep->bps = 2;
+ aep->msb = 1;
return (0);
default:
return (EINVAL);
@@ -696,52 +698,55 @@ auich_query_encoding(v, aep)
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+ return (0);
}
}
@@ -960,6 +965,8 @@ auich_set_params(v, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
orate = adj_rate = play->sample_rate;
if (sc->sc_ac97rate != 0)
@@ -1145,6 +1152,8 @@ auich_set_params(v, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
orate = rec->sample_rate;
if (sc->sc_ac97rate != 0)
diff --git a/sys/dev/pci/auixp.c b/sys/dev/pci/auixp.c
index 2564d52164b..9b7782986d8 100644
--- a/sys/dev/pci/auixp.c
+++ b/sys/dev/pci/auixp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auixp.c,v 1.24 2009/10/12 19:43:52 jakemsr Exp $ */
+/* $OpenBSD: auixp.c,v 1.25 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */
/*
@@ -233,52 +233,56 @@ auixp_query_encoding(void *hdl, struct audio_encoding *aep)
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+
+ return (0);
}
@@ -545,6 +549,8 @@ auixp_set_params(void *hdl, int setmode, int usemode,
default:
return (EINVAL);
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
temprate = play->sample_rate;
error = ac97_set_rate(co->codec_if,
@@ -601,6 +607,8 @@ auixp_set_params(void *hdl, int setmode, int usemode,
default:
return (EINVAL);
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
error = ac97_set_rate(co->codec_if, AC97_REG_PCM_LR_ADC_RATE,
&rec->sample_rate);
diff --git a/sys/dev/pci/autri.c b/sys/dev/pci/autri.c
index 9419bb45263..5389362351a 100644
--- a/sys/dev/pci/autri.c
+++ b/sys/dev/pci/autri.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autri.c,v 1.24 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: autri.c,v 1.25 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
@@ -992,6 +992,8 @@ autri_query_encoding(addr, fp)
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return 0;
}
@@ -1047,6 +1049,8 @@ autri_set_params(addr, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
return 0;
diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c
index 0a785295abd..ad07c927e08 100644
--- a/sys/dev/pci/auvia.c
+++ b/sys/dev/pci/auvia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auvia.c,v 1.44 2008/10/25 22:30:43 jakemsr Exp $ */
+/* $OpenBSD: auvia.c,v 1.45 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: auvia.c,v 1.28 2002/11/04 16:38:49 kent Exp $ */
/*-
@@ -503,6 +503,8 @@ auvia_query_encoding(void *addr, struct audio_encoding *fp)
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
+ fp->bps = 2;
+ fp->msb = 1;
return (0);
default:
return (EINVAL);
@@ -514,54 +516,59 @@ auvia_query_encoding(void *addr, struct audio_encoding *fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
}
+
void
auvia_set_params_sub(struct auvia_softc *sc, struct auvia_softc_chan *ch,
struct audio_params *p)
@@ -740,6 +747,9 @@ auvia_set_params(void *addr, int setmode, int usemode,
return (EINVAL);
}
auvia_set_params_sub(sc, ch, p);
+
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
return 0;
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 72c6c041fce..4e003915e44 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.173 2010/06/27 21:47:07 jakemsr Exp $ */
+/* $OpenBSD: azalia.c,v 1.174 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -3871,6 +3871,8 @@ azalia_get_default_params(void *addr, int mode, struct audio_params *params)
params->sample_rate = 48000;
params->encoding = AUDIO_ENCODING_SLINEAR_LE;
params->precision = 16;
+ params->bps = 2;
+ params->msb = 1;
params->channels = 2;
params->sw_code = NULL;
params->factor = 1;
@@ -4008,6 +4010,8 @@ azalia_set_params_sub(codec_t *codec, int mode, audio_params_t *par)
}
}
par->sw_code = swcode;
+ par->bps = AUDIO_BPS(par->precision);
+ par->msb = 1;
return (0);
}
@@ -4377,6 +4381,8 @@ azalia_create_encodings(codec_t *this)
this->encs[i].index = i;
this->encs[i].encoding = encs[i] & 0xff;
this->encs[i].precision = encs[i] >> 8;
+ this->encs[i].bps = AUDIO_BPS(encs[i] >> 8);
+ this->encs[i].msb = 1;
this->encs[i].flags = 0;
switch (this->encs[i].encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
diff --git a/sys/dev/pci/cmpci.c b/sys/dev/pci/cmpci.c
index eb15bdfb63d..53344a42e93 100644
--- a/sys/dev/pci/cmpci.c
+++ b/sys/dev/pci/cmpci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmpci.c,v 1.25 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: cmpci.c,v 1.26 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: cmpci.c,v 1.25 2004/10/26 06:32:20 xtraeme Exp $ */
/*
@@ -629,6 +629,9 @@ cmpci_query_encoding(void *handle, struct audio_encoding *fp)
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return 0;
}
@@ -638,6 +641,8 @@ cmpci_get_default_params(void *addr, int mode, struct audio_params *params)
params->sample_rate = 48000;
params->encoding = AUDIO_ENCODING_SLINEAR_LE;
params->precision = 16;
+ params->bps = 2;
+ params->msb = 1;
params->channels = 2;
params->sw_code = NULL;
params->factor = 1;
@@ -858,6 +863,8 @@ cmpci_set_params(void *handle, int setmode, int usemode,
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
if (mode & AUMODE_PLAY) {
if (sc->sc_play_channel == 1) {
cmpci_reg_partial_write_4(sc,
diff --git a/sys/dev/pci/cs4280.c b/sys/dev/pci/cs4280.c
index 9aee12b604d..8d278d9e9b8 100644
--- a/sys/dev/pci/cs4280.c
+++ b/sys/dev/pci/cs4280.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cs4280.c,v 1.33 2009/01/20 20:00:06 grange Exp $ */
+/* $OpenBSD: cs4280.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $ */
/*
@@ -1106,6 +1106,9 @@ cs4280_query_encoding(addr, fp)
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
@@ -1199,6 +1202,8 @@ cs4280_set_params(addr, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
/* set sample rate */
diff --git a/sys/dev/pci/cs4281.c b/sys/dev/pci/cs4281.c
index 3f2f658ccee..43e3147e948 100644
--- a/sys/dev/pci/cs4281.c
+++ b/sys/dev/pci/cs4281.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cs4281.c,v 1.22 2008/10/25 22:30:43 jakemsr Exp $ */
+/* $OpenBSD: cs4281.c,v 1.23 2010/07/15 03:43:11 jakemsr Exp $ */
/* $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $ */
/*
@@ -494,6 +494,9 @@ cs4281_query_encoding(addr, fp)
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
@@ -558,6 +561,8 @@ cs4281_set_params(addr, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
/* set sample rate */
diff --git a/sys/dev/pci/eap.c b/sys/dev/pci/eap.c
index 799dd2d2675..148642476f0 100644
--- a/sys/dev/pci/eap.c
+++ b/sys/dev/pci/eap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eap.c,v 1.39 2010/06/20 10:22:25 ratchov Exp $ */
+/* $OpenBSD: eap.c,v 1.40 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: eap.c,v 1.46 2001/09/03 15:07:37 reinoud Exp $ */
/*
@@ -765,52 +765,56 @@ eap_query_encoding(void *addr, struct audio_encoding *fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
void
@@ -904,6 +908,8 @@ eap_set_params(void *addr, int setmode, int usemode,
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
if (!sc->sc_1371) {
diff --git a/sys/dev/pci/emuxki.c b/sys/dev/pci/emuxki.c
index f190ed1315b..a61798e95ca 100644
--- a/sys/dev/pci/emuxki.c
+++ b/sys/dev/pci/emuxki.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emuxki.c,v 1.33 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: emuxki.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: emuxki.c,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */
/*-
@@ -2145,6 +2145,9 @@ emuxki_query_encoding(void *addr, struct audio_encoding *fp)
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
@@ -2234,6 +2237,8 @@ emuxki_set_vparms(struct emuxki_voice *voice, struct audio_params *p)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
return (emuxki_voice_set_audioparms(voice, p->channels == 2,
b16, p->sample_rate));
diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c
index 39d483694d7..d328ba6d8d1 100644
--- a/sys/dev/pci/envy.c
+++ b/sys/dev/pci/envy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: envy.c,v 1.36 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: envy.c,v 1.37 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -1542,6 +1542,8 @@ envy_query_encoding(void *self, struct audio_encoding *enc)
strlcpy(enc->name, AudioEslinear_le, sizeof(enc->name));
enc->encoding = AUDIO_ENCODING_SLINEAR_LE;
enc->precision = 24;
+ enc->bps = 4;
+ enc->msb = 1;
enc->flags = 0;
return 0;
}
@@ -1577,11 +1579,15 @@ envy_set_params(void *self, int setmode, int usemode,
if (setmode & AUMODE_PLAY) {
p->encoding = AUDIO_ENCODING_SLINEAR;
p->precision = 24;
+ p->bps = 4;
+ p->msb = 1;
p->channels = sc->isht ? sc->card->noch : ENVY_PCHANS;
}
if (setmode & AUMODE_RECORD) {
r->encoding = AUDIO_ENCODING_SLINEAR;
r->precision = 24;
+ r->bps = 4;
+ r->msb = 1;
r->channels = sc->isht ? sc->card->nich : ENVY_RCHANS;
}
return 0;
diff --git a/sys/dev/pci/esa.c b/sys/dev/pci/esa.c
index 57da8a0753c..1f9413cdbbf 100644
--- a/sys/dev/pci/esa.c
+++ b/sys/dev/pci/esa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esa.c,v 1.18 2009/11/13 02:22:19 deraadt Exp $ */
+/* $OpenBSD: esa.c,v 1.19 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */
/*
@@ -165,19 +165,20 @@ int esa_suspend(struct esa_softc *);
int esa_resume(struct esa_softc *);
static audio_encoding_t esa_encoding[] = {
- { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 0 },
- { 1, AudioEmulaw, AUDIO_ENCODING_ULAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED },
- { 2, AudioEalaw, AUDIO_ENCODING_ALAW, 8, AUDIO_ENCODINGFLAG_EMULATED },
- { 3, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8,
- AUDIO_ENCODINGFLAG_EMULATED }, /* XXX: Are you sure? */
- { 4, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 0 },
- { 5, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16,
- AUDIO_ENCODINGFLAG_EMULATED },
- { 6, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16,
- AUDIO_ENCODINGFLAG_EMULATED },
- { 7, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16,
- AUDIO_ENCODINGFLAG_EMULATED }
+ { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 1, 1, 0 },
+ { 1, AudioEmulaw, AUDIO_ENCODING_ULAW, 8, 1, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 2, AudioEalaw, AUDIO_ENCODING_ALAW, 8, 1, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 3, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 1, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 4, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 2, 1, 0 },
+ { 5, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16, 2, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 6, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, 2, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 7, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16, 2, 1,
+ AUDIO_ENCODINGFLAG_EMULATED }
};
#define ESA_NENCODINGS 8
@@ -336,6 +337,8 @@ esa_set_params(void *hdl, int setmode, int usemode, struct audio_params *play,
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
ch->mode = *p;
}
diff --git a/sys/dev/pci/eso.c b/sys/dev/pci/eso.c
index e92805052cf..7edba2c8865 100644
--- a/sys/dev/pci/eso.c
+++ b/sys/dev/pci/eso.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eso.c,v 1.31 2010/05/23 11:41:07 deraadt Exp $ */
+/* $OpenBSD: eso.c,v 1.32 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: eso.c,v 1.48 2006/12/18 23:13:39 kleink Exp $ */
/*
@@ -676,6 +676,8 @@ eso_query_encoding(void *hdl, struct audio_encoding *fp)
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return (0);
}
@@ -686,6 +688,8 @@ eso_get_default_params(void *addr, int mode, struct audio_params *params)
params->sample_rate = 48000;
params->encoding = AUDIO_ENCODING_ULINEAR_LE;
params->precision = 16;
+ params->bps = 2;
+ params->msb = 1;
params->channels = 2;
params->sw_code = NULL;
params->factor = 1;
@@ -746,6 +750,8 @@ eso_set_params(void *hdl, int setmode, int usemode,
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
/*
* We'll compute both possible sample rate dividers and pick
diff --git a/sys/dev/pci/fms.c b/sys/dev/pci/fms.c
index 3f1bcb650b6..ec021d39fca 100644
--- a/sys/dev/pci/fms.c
+++ b/sys/dev/pci/fms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fms.c,v 1.21 2010/04/04 00:50:36 jakemsr Exp $ */
+/* $OpenBSD: fms.c,v 1.22 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: fms.c,v 1.5.4.1 2000/06/30 16:27:50 simonb Exp $ */
/*-
@@ -463,52 +463,56 @@ fms_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 1:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return 0;
+ break;
case 2:
strlcpy(fp->name, AudioEulinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return 0;
+ break;
case 3:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 4:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 5:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 6:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 7:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return 0;
}
void
@@ -582,6 +586,9 @@ fms_set_params(addr, setmode, usemode, play, rec)
default:
return EINVAL;
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
+
for (i = 0; i < 10 && play->sample_rate > fms_rates[i].limit;
i++)
;
@@ -623,6 +630,9 @@ fms_set_params(addr, setmode, usemode, play, rec)
default:
return EINVAL;
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
+
for (i = 0; i < 10 && rec->sample_rate > fms_rates[i].limit;
i++)
;
diff --git a/sys/dev/pci/maestro.c b/sys/dev/pci/maestro.c
index 63036064786..dea2b251000 100644
--- a/sys/dev/pci/maestro.c
+++ b/sys/dev/pci/maestro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: maestro.c,v 1.28 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: maestro.c,v 1.29 2010/07/15 03:43:11 jakemsr Exp $ */
/* $FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro.c,v 1.3 2000/11/21 12:22:11 julian Exp $ */
/*
* FreeBSD's ESS Agogo/Maestro driver
@@ -974,18 +974,18 @@ maestro_query_devinfo(self, cp)
}
struct audio_encoding maestro_tab[] = {
- {0, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 0},
- {1, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 0},
- {2, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 0},
- {3, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16,
+ {0, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 2, 1, 0},
+ {1, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 1, 1, 0},
+ {2, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 1, 1, 0},
+ {3, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, 2, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {4, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16,
+ {4, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16, 2, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {5, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16,
+ {5, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16, 2, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {6, AudioEmulaw, AUDIO_ENCODING_ULAW, 8,
+ {6, AudioEmulaw, AUDIO_ENCODING_ULAW, 8, 1, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {7, AudioEalaw, AUDIO_ENCODING_ALAW, 8,
+ {7, AudioEalaw, AUDIO_ENCODING_ALAW, 8, 1, 1,
AUDIO_ENCODINGFLAG_EMULATED}
};
@@ -1117,6 +1117,9 @@ maestro_set_params(hdl, setmode, usemode, play, rec)
else if (play->encoding != AUDIO_ENCODING_SLINEAR_LE)
return (EINVAL);
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
+
maestro_set_speed(&sc->play, &play->sample_rate);
return (0);
}
diff --git a/sys/dev/pci/neo.c b/sys/dev/pci/neo.c
index f67cc61505d..496d07b496d 100644
--- a/sys/dev/pci/neo.c
+++ b/sys/dev/pci/neo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neo.c,v 1.23 2008/10/25 22:30:43 jakemsr Exp $ */
+/* $OpenBSD: neo.c,v 1.24 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
@@ -782,52 +782,56 @@ neo_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
void
@@ -916,9 +920,10 @@ neo_set_params(addr, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
-
return (0);
}
diff --git a/sys/dev/pci/sv.c b/sys/dev/pci/sv.c
index 78882cca0e2..6d608fadf46 100644
--- a/sys/dev/pci/sv.c
+++ b/sys/dev/pci/sv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sv.c,v 1.26 2009/06/23 06:39:48 jsg Exp $ */
+/* $OpenBSD: sv.c,v 1.27 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1998 Constantine Paul Sapuntzakis
@@ -611,52 +611,56 @@ sv_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
int
@@ -720,6 +724,9 @@ sv_set_params(addr, setmode, usemode, p, r)
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
/* Set the encoding */
reg = sv_read_indirect(sc, SV_DMA_DATA_FORMAT);
diff --git a/sys/dev/pci/yds.c b/sys/dev/pci/yds.c
index 8c9b600a312..fd5addc3d6c 100644
--- a/sys/dev/pci/yds.c
+++ b/sys/dev/pci/yds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yds.c,v 1.33 2010/04/06 22:28:07 tedu Exp $ */
+/* $OpenBSD: yds.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */
/*
@@ -1140,52 +1140,56 @@ yds_query_encoding(addr, fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
void
@@ -1263,6 +1267,8 @@ yds_set_params(addr, setmode, usemode, play, rec)
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
return 0;
diff --git a/sys/dev/sbus/cs4231.c b/sys/dev/sbus/cs4231.c
index 4a74570aa19..358b6deeec5 100644
--- a/sys/dev/sbus/cs4231.c
+++ b/sys/dev/sbus/cs4231.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cs4231.c,v 1.29 2008/04/21 00:32:43 jakemsr Exp $ */
+/* $OpenBSD: cs4231.c,v 1.30 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -547,6 +547,9 @@ cs4231_query_encoding(void *vsc, struct audio_encoding *fp)
default:
err = EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (err);
}
@@ -635,6 +638,9 @@ cs4231_set_params(void *vsc, int setmode, int usemode,
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
sc->sc_format_bits = bits;
sc->sc_channels = p->channels;
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index 5d64bf555d4..ed5959e33fb 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.73 2009/12/04 20:50:59 jakemsr Exp $ */
+/* $OpenBSD: uaudio.c,v 1.74 2010/07/15 03:43:12 jakemsr Exp $ */
/* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */
/*
@@ -531,52 +531,56 @@ uaudio_query_encoding(void *addr, struct audio_encoding *fp)
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = flags&HAS_8U ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = flags&HAS_MULAW ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = flags&HAS_ALAW ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = flags&HAS_8 ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
const usb_interface_descriptor_t *
@@ -2221,6 +2225,8 @@ uaudio_get_default_params(void *addr, int mode, struct audio_params *p)
p->sample_rate = 44100;
p->encoding = AUDIO_ENCODING_SLINEAR_LE;
p->precision = 16;
+ p->bps = 2;
+ p->msb = 1;
p->channels = 2;
p->sw_code = NULL;
p->factor = 1;
@@ -2249,6 +2255,9 @@ uaudio_get_default_params(void *addr, int mode, struct audio_params *p)
}
uaudio_match_alt(sc, p, mode, p->encoding, p->precision);
+
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
int
@@ -3248,6 +3257,9 @@ uaudio_set_params(void *addr, int setmode, int usemode,
p->sw_code = swcode;
p->factor = factor;
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
+
if (mode == AUMODE_PLAY)
paltidx = i;
else