diff options
| author | 2003-01-30 01:23:24 +0000 | |
|---|---|---|
| committer | 2003-01-30 01:23:24 +0000 | |
| commit | 4de9670d0eb3231ec30bcd41b06c752263ffd54b (patch) | |
| tree | c07c8f00c283b9cf1bc2737419b9b8844df9466c /sys | |
| parent | check the uvm_fault_wire() for failure, just like other calls; art@ ok (diff) | |
| download | wireguard-openbsd-4de9670d0eb3231ec30bcd41b06c752263ffd54b.tar.xz wireguard-openbsd-4de9670d0eb3231ec30bcd41b06c752263ffd54b.zip | |
Check the codec revision... if it's >=CS4215E or >=AD1849K (same value
strangely =) the make ulinear (native) and slinear (emulated) available.
Also, while here, make ulinear_le:16 available via emulation.
(Btw, the LASI docs say that the format code for ulinear is a
reserved value... Probably just wasn't available in the early CS4215/AD1849's)
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arch/hppa/gsc/harmony.c | 100 | ||||
| -rw-r--r-- | sys/arch/hppa/gsc/harmonyreg.h | 9 | ||||
| -rw-r--r-- | sys/arch/hppa/gsc/harmonyvar.h | 4 |
3 files changed, 94 insertions, 19 deletions
diff --git a/sys/arch/hppa/gsc/harmony.c b/sys/arch/hppa/gsc/harmony.c index d86752d7473..fc8e8edc487 100644 --- a/sys/arch/hppa/gsc/harmony.c +++ b/sys/arch/hppa/gsc/harmony.c @@ -1,4 +1,4 @@ -/* $OpenBSD: harmony.c,v 1.11 2003/01/29 00:52:23 mickey Exp $ */ +/* $OpenBSD: harmony.c,v 1.12 2003/01/30 01:23:24 jason Exp $ */ /* * Copyright (c) 2003 Jason L. Wright (jason@thought.net) @@ -150,6 +150,7 @@ harmony_attach(parent, self, aux) { struct harmony_softc *sc = (struct harmony_softc *)self; struct gsc_attach_args *ga = aux; + u_int8_t rev; u_int32_t cntl; int i; @@ -227,8 +228,11 @@ harmony_attach(parent, self, aux) harmony_reset_codec(sc); cntl = READ_REG(sc, HARMONY_CNTL); - printf(": rev %d\n", - (cntl & CNTL_CODEC_REV_MASK) >> CNTL_CODEC_REV_SHIFT); + rev = (cntl & CNTL_CODEC_REV_MASK) >> CNTL_CODEC_REV_SHIFT; + printf(": rev %u\n", rev); + + if ((rev & CS4215_REV_VER) >= CS4215_REV_VER_E) + sc->sc_hasulinear8 = 1; audio_attach_mi(&harmony_sa_hw_if, sc, &sc->sc_dv); } @@ -325,6 +329,7 @@ harmony_close(void *vsc) int harmony_query_encoding(void *vsc, struct audio_encoding *fp) { + struct harmony_softc *sc = vsc; int err = 0; switch (fp->index) { @@ -358,6 +363,30 @@ harmony_query_encoding(void *vsc, struct audio_encoding *fp) fp->precision = 16; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; + case 5: + strcpy(fp->name, AudioEulinear_le); + fp->encoding = AUDIO_ENCODING_ULINEAR_LE; + fp->precision = 16; + fp->flags = AUDIO_ENCODINGFLAG_EMULATED; + break; + case 6: + if (sc->sc_hasulinear8) { + strcpy(fp->name, AudioEulinear); + fp->encoding = AUDIO_ENCODING_ULINEAR; + fp->precision = 8; + fp->flags = 0; + break; + } + /*FALLTHROUGH*/ + case 7: + if (sc->sc_hasulinear8) { + strcpy(fp->name, AudioEslinear); + fp->encoding = AUDIO_ENCODING_SLINEAR; + fp->precision = 8; + fp->flags = AUDIO_ENCODINGFLAG_EMULATED; + break; + } + /*FALLTHROUGH*/ default: err = EINVAL; } @@ -385,24 +414,62 @@ harmony_set_params(void *vsc, int setmode, int usemode, bits = CNTL_FORMAT_ALAW; break; case AUDIO_ENCODING_SLINEAR_BE: - if (p->precision != 16) + if (p->precision == 8) { + bits = CNTL_FORMAT_ULINEAR8; + rswcode = pswcode = change_sign8; + break; + } + if (p->precision == 16) { + bits = CNTL_FORMAT_SLINEAR16BE; + break; + } + return (EINVAL); + case AUDIO_ENCODING_ULINEAR: + if (p->precision != 8) return (EINVAL); - bits = CNTL_FORMAT_SLINEAR16BE; + bits = CNTL_FORMAT_ULINEAR8; break; - - /* emulated formats */ - case AUDIO_ENCODING_SLINEAR_LE: - if (p->precision != 16) + case AUDIO_ENCODING_SLINEAR: + if (p->precision != 8) return (EINVAL); - bits = CNTL_FORMAT_SLINEAR16BE; - rswcode = pswcode = swap_bytes; + bits = CNTL_FORMAT_ULINEAR8; + rswcode = pswcode = change_sign8; break; + case AUDIO_ENCODING_SLINEAR_LE: + if (p->precision == 8) { + bits = CNTL_FORMAT_ULINEAR8; + rswcode = pswcode = change_sign8; + break; + } + if (p->precision == 16) { + bits = CNTL_FORMAT_SLINEAR16BE; + rswcode = pswcode = swap_bytes; + break; + } + return (EINVAL); case AUDIO_ENCODING_ULINEAR_BE: - if (p->precision != 16) - return (EINVAL); - bits = CNTL_FORMAT_SLINEAR16BE; - rswcode = pswcode = change_sign16_be; - break; + if (p->precision == 8) { + bits = CNTL_FORMAT_ULINEAR8; + break; + } + if (p->precision == 16) { + bits = CNTL_FORMAT_SLINEAR16BE; + rswcode = pswcode = change_sign16_be; + break; + } + return (EINVAL); + case AUDIO_ENCODING_ULINEAR_LE: + if (p->precision == 8) { + bits = CNTL_FORMAT_ULINEAR8; + break; + } + if (p->precision == 16) { + bits = CNTL_FORMAT_SLINEAR16BE; + pswcode = change_sign16_swap_bytes_le; + rswcode = swap_bytes_change_sign16_le; + break; + } + return (EINVAL); default: return (EINVAL); } @@ -463,6 +530,7 @@ harmony_commit_settings(void *vsc) quietchar = 0x55; break; case CNTL_FORMAT_SLINEAR16BE: + case CNTL_FORMAT_ULINEAR8: default: quietchar = 0; break; diff --git a/sys/arch/hppa/gsc/harmonyreg.h b/sys/arch/hppa/gsc/harmonyreg.h index fbf3e2ce4e5..6dbc6a198f0 100644 --- a/sys/arch/hppa/gsc/harmonyreg.h +++ b/sys/arch/hppa/gsc/harmonyreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: harmonyreg.h,v 1.1 2003/01/27 08:12:32 jason Exp $ */ +/* $OpenBSD: harmonyreg.h,v 1.2 2003/01/30 01:23:24 jason Exp $ */ /* * Copyright (c) 2003 Jason L. Wright (jason@thought.net) @@ -81,6 +81,7 @@ #define CNTL_FORMAT_SLINEAR16BE 0x00000000 /* 16 bit signed linear be */ #define CNTL_FORMAT_ULAW 0x00000040 /* 8 bit ulaw */ #define CNTL_FORMAT_ALAW 0x00000080 /* 8 bit alaw */ +#define CNTL_FORMAT_ULINEAR8 0x000000c0 /* 8 bit unsigned linear */ #define CNTL_CHANS_MASK 0x00000020 /* number of channels: */ #define CNTL_CHANS_MONO 0x00000000 /* mono */ #define CNTL_CHANS_STEREO 0x00000020 /* stereo */ @@ -137,3 +138,9 @@ /* HARMONY_DIAG */ #define DIAG_CO 0x00000001 /* sclk from codec */ + +/* CS4215_REV */ +#define CS4215_REV_VER 0x0f +#define CS4215_REV_VER_C 0x00 /* CS4215 rev C */ +#define CS4215_REV_VER_D 0x01 /* CS4215 rev D */ +#define CS4215_REV_VER_E 0x02 /* CS4215 rev E/AD1849K */ diff --git a/sys/arch/hppa/gsc/harmonyvar.h b/sys/arch/hppa/gsc/harmonyvar.h index de1466a34a9..4054d5474c7 100644 --- a/sys/arch/hppa/gsc/harmonyvar.h +++ b/sys/arch/hppa/gsc/harmonyvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: harmonyvar.h,v 1.1 2003/01/28 04:20:49 jason Exp $ */ +/* $OpenBSD: harmonyvar.h,v 1.2 2003/01/30 01:23:24 jason Exp $ */ /* * Copyright (c) 2003 Jason L. Wright (jason@thought.net) @@ -99,7 +99,7 @@ struct harmony_softc { int sc_playing, sc_capturing; struct harmony_channel sc_playback, sc_capture; struct harmony_volume sc_monitor_lvl, sc_input_lvl, sc_output_lvl; - int sc_in_port, sc_out_port; + int sc_in_port, sc_out_port, sc_hasulinear8; }; #define READ_REG(sc, reg) \ |
