summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1999-09-30 22:13:53 +0000
committerkstailey <kstailey@cvs.openbsd.org>1999-09-30 22:13:53 +0000
commit364f2dadf3054e5812ecc352689f96ed5d1ab7a9 (patch)
tree42226f36447eb0218c44e6bfa9d70b3f7aeb671b /sys
parent96395e54e4a2bfd204324953df27b76dba4ddf07 (diff)
Sync w/NetBSD. Add support for ES18[67][89] - Nonaka Kimihiro + muting control fix
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isa/ess.c107
-rw-r--r--sys/dev/isa/essreg.h8
-rw-r--r--sys/dev/isa/essvar.h8
3 files changed, 89 insertions, 34 deletions
diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c
index f623751350d..54c8e89c94e 100644
--- a/sys/dev/isa/ess.c
+++ b/sys/dev/isa/ess.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ess.c,v 1.1 1999/06/22 16:20:03 niklas Exp $ */
-/* $NetBSD: ess.c,v 1.44 1999/03/19 12:40:21 mycroft Exp $ */
+/* $OpenBSD: ess.c,v 1.2 1999/09/30 22:13:52 kstailey Exp $ */
+/* $NetBSD: ess.c,v 1.44.4.1 1999/06/21 01:18:00 thorpej Exp $ */
/*
* Copyright 1997
@@ -174,7 +174,7 @@ u_int ess_srtotc __P((u_int));
u_int ess_srtofc __P((u_int));
u_char ess_get_dsp_status __P((struct ess_softc *));
u_char ess_dsp_read_ready __P((struct ess_softc *));
-u_char ess_dsp_write_ready __P((struct ess_softc *sc));
+u_char ess_dsp_write_ready __P((struct ess_softc *));
int ess_rdsp __P((struct ess_softc *));
int ess_wdsp __P((struct ess_softc *, u_char));
u_char ess_read_x_reg __P((struct ess_softc *, u_char));
@@ -185,13 +185,18 @@ u_char ess_read_mix_reg __P((struct ess_softc *, u_char));
void ess_write_mix_reg __P((struct ess_softc *, u_char, u_char));
void ess_clear_mreg_bits __P((struct ess_softc *, u_char, u_char));
void ess_set_mreg_bits __P((struct ess_softc *, u_char, u_char));
+void ess_read_multi_mix_reg __P((struct ess_softc *, u_char, u_int8_t *, bus_size_t));
static char *essmodel[] = {
"unsupported",
"1888",
"1887",
"888",
- "1788"
+ "1788",
+ "1869",
+ "1879",
+ "1868",
+ "1878",
};
struct audio_device ess_device = {
@@ -280,7 +285,7 @@ ess_printsc(sc)
sc->sc_audio1.drq, sc->sc_audio1.irq, sc->sc_audio1.nintr,
sc->sc_audio1.intr, sc->sc_audio1.arg);
- if (sc->sc_model != ESS_1788) {
+ if (!ESS_USE_AUDIO1(sc->sc_model)) {
printf("audio2: dmachan %d irq %d nintr %lu intr %p arg %p\n",
sc->sc_audio2.drq, sc->sc_audio2.irq, sc->sc_audio2.nintr,
sc->sc_audio2.intr, sc->sc_audio2.arg);
@@ -512,7 +517,7 @@ ess_config_irq(sc)
}
ess_write_x_reg(sc, ESS_XCMD_IRQ_CTRL, v);
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
return;
if (sc->sc_audio2.polled) {
@@ -557,7 +562,7 @@ ess_config_drq(sc)
/* Set DRQ1 */
ess_write_x_reg(sc, ESS_XCMD_DRQ_CTRL, v);
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
return;
/* Configure DRQ2 */
@@ -617,10 +622,12 @@ ess_identify(sc)
u_char reg1;
u_char reg2;
u_char reg3;
+ u_int8_t ident[4];
sc->sc_model = ESS_UNSUPPORTED;
sc->sc_version = 0;
+ memset(ident, 0, sizeof(ident));
/*
* 1. Check legacy ID bytes. These should be 0x68 0x8n, where
@@ -681,6 +688,21 @@ ess_identify(sc)
if (ess_read_mix_reg(sc, ESS_MREG_SAMPLE_RATE) != reg2) {
/* If we got this far before failing, it's a 1788. */
sc->sc_model = ESS_1788;
+
+ /*
+ * Identify ESS model for ES18[67]8.
+ */
+ ess_read_multi_mix_reg(sc, 0x40, ident, sizeof(ident));
+ if(ident[0] == 0x18) {
+ switch(ident[1]) {
+ case 0x68:
+ sc->sc_model = ESS_1868;
+ break;
+ case 0x78:
+ sc->sc_model = ESS_1878;
+ break;
+ }
+ }
} else {
/*
* 4. Determine if we can change bit 5 in mixer register 0x64.
@@ -701,6 +723,21 @@ ess_identify(sc)
* Restore the original value of mixer register 0x64.
*/
ess_write_mix_reg(sc, ESS_MREG_VOLUME_CTRL, reg1);
+
+ /*
+ * Identify ESS model for ES18[67]9.
+ */
+ ess_read_multi_mix_reg(sc, 0x40, ident, sizeof(ident));
+ if(ident[0] == 0x18) {
+ switch(ident[1]) {
+ case 0x69:
+ sc->sc_model = ESS_1869;
+ break;
+ case 0x79:
+ sc->sc_model = ESS_1879;
+ break;
+ }
+ }
} else {
/*
* 5. Determine if we can change the value of mixer
@@ -789,7 +826,7 @@ essmatch(sc)
}
if (!isa_drq_isfree(sc->sc_isa, sc->sc_audio1.drq))
return (0);
- if (sc->sc_model != ESS_1788) {
+ if (!ESS_USE_AUDIO1(sc->sc_model)) {
if (!ESS_DRQ2_VALID(sc->sc_audio2.drq)) {
printf("ess: play drq %d invalid\n", sc->sc_audio2.drq);
return (0);
@@ -819,7 +856,7 @@ essmatch(sc)
printf("ess: record irq %d invalid\n", sc->sc_audio1.irq);
return (0);
}
- if (sc->sc_model != ESS_1788) {
+ if (!ESS_USE_AUDIO1(sc->sc_model)) {
if (sc->sc_audio2.irq != -1 &&
!ESS_IRQ2_VALID(sc->sc_audio2.irq)) {
printf("ess: play irq %d invalid\n", sc->sc_audio2.irq);
@@ -860,9 +897,6 @@ essattach(sc)
printf(": ESS Technology ES%s [version 0x%04x]\n",
essmodel[sc->sc_model], sc->sc_version);
-
- sc->sc_audio1.irq = -1;
- sc->sc_audio2.irq = -1;
sc->sc_audio1.polled = sc->sc_audio1.irq == -1;
if (!sc->sc_audio1.polled) {
@@ -880,7 +914,7 @@ essattach(sc)
return;
}
- if (sc->sc_model != ESS_1788) {
+ if (!ESS_USE_AUDIO1(sc->sc_model)) {
sc->sc_audio2.polled = sc->sc_audio2.irq == -1;
if (!sc->sc_audio2.polled) {
sc->sc_audio2.ih = isa_intr_establish(sc->sc_ic,
@@ -913,11 +947,11 @@ essattach(sc)
* Set volume of Audio 1 to zero and disable Audio 1 DAC input
* to playback mixer, since playback is always through Audio 2.
*/
- if (sc->sc_model != ESS_1788)
+ if (!ESS_USE_AUDIO1(sc->sc_model))
ess_write_mix_reg(sc, ESS_MREG_VOLUME_VOICE, 0);
ess_wdsp(sc, ESS_ACMD_DISABLE_SPKR);
- if (sc->sc_model == ESS_1788) {
+ if (ESS_USE_AUDIO1(sc->sc_model)) {
ess_write_mix_reg(sc, ESS_MREG_ADC_SOURCE, ESS_SOURCE_MIC);
sc->in_port = ESS_SOURCE_MIC;
sc->ndevs = ESS_1788_NDEVS;
@@ -970,7 +1004,7 @@ essattach(sc)
sprintf(ess_device.name, "ES%s", essmodel[sc->sc_model]);
sprintf(ess_device.version, "0x%04x", sc->sc_version);
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
audio_attach_mi(&ess_1788_hw_if, sc, &sc->sc_dev);
else
audio_attach_mi(&ess_1888_hw_if, sc, &sc->sc_dev);
@@ -1231,7 +1265,7 @@ ess_set_params(addr, setmode, usemode, play, rec)
ess_write_x_reg(sc, ESS_XCMD_SAMPLE_RATE, ess_srtotc(rate));
ess_write_x_reg(sc, ESS_XCMD_FILTER_CLOCK, ess_srtofc(rate));
- if (sc->sc_model != ESS_1788) {
+ if (!ESS_USE_AUDIO1(sc->sc_model)) {
ess_write_mix_reg(sc, ESS_MREG_SAMPLE_RATE, ess_srtotc(rate));
ess_write_mix_reg(sc, ESS_MREG_FILTER_CLOCK, ess_srtofc(rate));
}
@@ -1686,7 +1720,7 @@ ess_set_port(addr, cp)
return (0);
case ESS_RECORD_SOURCE:
- if (sc->sc_model == ESS_1788) {
+ if (ESS_USE_AUDIO1(sc->sc_model)) {
if (cp->type == AUDIO_MIXER_ENUM)
return (ess_set_in_port(sc, cp->un.ord));
else
@@ -1714,7 +1748,7 @@ ess_set_port(addr, cp)
return (0);
}
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
return (EINVAL);
switch (cp->dev) {
@@ -1808,7 +1842,7 @@ ess_get_port(addr, cp)
return (0);
case ESS_RECORD_SOURCE:
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
cp->un.ord = sc->in_port;
else
cp->un.mask = sc->in_mask;
@@ -1820,7 +1854,7 @@ ess_get_port(addr, cp)
return (0);
}
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
return (EINVAL);
switch (cp->dev) {
@@ -1887,7 +1921,7 @@ ess_query_devinfo(addr, dip)
case ESS_MIC_PLAY_VOL:
dip->mixer_class = ESS_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
dip->next = AUDIO_MIXER_LAST;
else
dip->next = ESS_MIC_PREAMP;
@@ -1978,7 +2012,7 @@ ess_query_devinfo(addr, dip)
dip->mixer_class = ESS_RECORD_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNsource);
- if (sc->sc_model == ESS_1788) {
+ if (ESS_USE_AUDIO1(sc->sc_model)) {
/*
* The 1788 doesn't use the input mixer control that
* the 1888 uses, because it's a pain when you only
@@ -2025,7 +2059,7 @@ ess_query_devinfo(addr, dip)
case ESS_RECORD_MONITOR:
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNmonitor);
+ strcpy(dip->label.name, AudioNmute);
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = ESS_MONITOR_CLASS;
dip->un.e.num_mem = 2;
@@ -2043,7 +2077,7 @@ ess_query_devinfo(addr, dip)
return (0);
}
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
return (ENXIO);
switch (dip->index) {
@@ -2127,7 +2161,7 @@ ess_malloc(addr, size, pool, flags)
struct ess_softc *sc = addr;
int drq;
- if (sc->sc_model != ESS_1788)
+ if (!ESS_USE_AUDIO1(sc->sc_model))
drq = sc->sc_audio2.drq;
else
drq = sc->sc_audio1.drq;
@@ -2234,7 +2268,7 @@ ess_set_gain(sc, port, on)
src = ESS_MREG_VOLUME_MASTER;
break;
case ESS_DAC_PLAY_VOL:
- if (sc->sc_model == ESS_1788)
+ if (ESS_USE_AUDIO1(sc->sc_model))
src = ESS_MREG_VOLUME_VOICE;
else
src = 0x7C;
@@ -2285,7 +2319,7 @@ ess_set_gain(sc, port, on)
}
/* 1788 doesn't have a separate recording mixer */
- if (sc->sc_model == ESS_1788 && mix && src > 0x62)
+ if (ESS_USE_AUDIO1(sc->sc_model) && mix && src > 0x62)
return;
if (on) {
@@ -2640,3 +2674,20 @@ ess_set_mreg_bits(sc, reg, mask)
{
ess_write_mix_reg(sc, reg, ess_read_mix_reg(sc, reg) | mask);
}
+
+void
+ess_read_multi_mix_reg(sc, reg, datap, count)
+ struct ess_softc *sc;
+ u_char reg;
+ u_int8_t *datap;
+ bus_size_t count;
+{
+ bus_space_tag_t iot = sc->sc_iot;
+ bus_space_handle_t ioh = sc->sc_ioh;
+ int s;
+
+ s = splaudio();
+ EWRITE1(iot, ioh, ESS_MIX_REG_SELECT, reg);
+ bus_space_read_multi_1(iot, ioh, ESS_MIX_REG_DATA, datap, count);
+ splx(s);
+}
diff --git a/sys/dev/isa/essreg.h b/sys/dev/isa/essreg.h
index 77ac01b2919..811eebed51d 100644
--- a/sys/dev/isa/essreg.h
+++ b/sys/dev/isa/essreg.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: essreg.h,v 1.1 1999/06/22 16:20:03 niklas Exp $ */
-/* $NetBSD: essreg.h,v 1.11 1999/03/19 12:40:21 mycroft Exp $ */
+/* $OpenBSD: essreg.h,v 1.2 1999/09/30 22:13:52 kstailey Exp $ */
+/* $NetBSD: essreg.h,v 1.12 1999/06/18 20:25:23 augustss Exp $ */
/*
* Copyright 1997
* Digital Equipment Corporation. All rights reserved.
@@ -34,7 +34,7 @@
*/
/*
-** @(#) $RCSfile: essreg.h,v $ $Revision: 1.1 $ (SHARK) $Date: 1999/06/22 16:20:03 $
+** @(#) $RCSfile: essreg.h,v $ $Revision: 1.2 $ (SHARK) $Date: 1999/09/30 22:13:52 $
**
**++
**
@@ -175,7 +175,7 @@
#define ESS_DRQ2_VALID(chan) ((chan) == 0 || (chan) == 1 || (chan) == 3 || (chan) == 5)
-#define ESS_BASE_VALID(base) ((base) == 0x220 || (base) == 0x230 || (base) == 0x240 || (base) == 0x250)
+#define ESS_USE_AUDIO1(model) (((model) == ESS_1788) || ((model) == ESS_1868) || ((model) ==ESS_1878) || ((model) == ESS_1869) || ((model) == ESS_1879))
/*
* Macros to manipulate gain values
diff --git a/sys/dev/isa/essvar.h b/sys/dev/isa/essvar.h
index d48b129302f..cf1838a94d2 100644
--- a/sys/dev/isa/essvar.h
+++ b/sys/dev/isa/essvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: essvar.h,v 1.1 1999/06/22 16:20:03 niklas Exp $ */
+/* $OpenBSD: essvar.h,v 1.2 1999/09/30 22:13:52 kstailey Exp $ */
/* $NetBSD: essvar.h,v 1.14 1999/03/18 06:03:31 mycroft Exp $ */
/*
* Copyright 1997
@@ -34,7 +34,7 @@
*/
/*
-** @(#) $RCSfile: essvar.h,v $ $Revision: 1.1 $ (SHARK) $Date: 1999/06/22 16:20:03 $
+** @(#) $RCSfile: essvar.h,v $ $Revision: 1.2 $ (SHARK) $Date: 1999/09/30 22:13:52 $
**
**++
**
@@ -150,6 +150,10 @@ struct ess_softc
#define ESS_1887 2
#define ESS_888 3
#define ESS_1788 4
+#define ESS_1869 5
+#define ESS_1879 6
+#define ESS_1868 7
+#define ESS_1878 8
u_int sc_version; /* Legacy ES688/ES1688 ID */
};