Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Add some constant symbols for AC97 registers and val...
details: https://anonhg.NetBSD.org/src/rev/c5c87196fcb5
branches: trunk
changeset: 537846:c5c87196fcb5
user: kent <kent%NetBSD.org@localhost>
date: Sun Oct 06 16:33:35 2002 +0000
description:
Add some constant symbols for AC97 registers and values based on OpenBSD.
Rename some symbols to sync with OpenBSD:
AC97_REG_EXTENDED_ID
-> AC97_REG_EXT_AUDIO_ID
AC97_REG_EXTENDED_STATUS
-> AC97_REG_EXT_AUDIO_CTRL
AC97_CODEC_DOES_VRA/AC97_ENAB_VRA
-> AC97_EXT_AUDIO_VRA
AC97_CODEC_DOES_MICVRA/AC97_ENAB_MICVRA
-> AC97_EXT_AUDIO_VRM
ac97feature: "mic channel" -> "dedicated mic channel"
ac97_attach(): print extended capabilities; VRA, DRA, SPDIF, VRM, CDAC,
SDAC, LDAC.
diffstat:
sys/dev/ic/ac97.c | 46 +++++++++++++++++++++++++++++--
sys/dev/ic/ac97reg.h | 74 ++++++++++++++++++++++++++++++++++++++++++---------
sys/dev/pci/auich.c | 24 ++++++++--------
sys/dev/pci/auvia.c | 12 ++++----
4 files changed, 121 insertions(+), 35 deletions(-)
diffs (283 lines):
diff -r b12cc510ac70 -r c5c87196fcb5 sys/dev/ic/ac97.c
--- a/sys/dev/ic/ac97.c Sun Oct 06 15:06:05 2002 +0000
+++ b/sys/dev/ic/ac97.c Sun Oct 06 16:33:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ac97.c,v 1.26 2002/10/04 19:22:40 joda Exp $ */
+/* $NetBSD: ac97.c,v 1.27 2002/10/06 16:33:35 kent Exp $ */
/* $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $ */
/*
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.26 2002/10/04 19:22:40 joda Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.27 2002/10/06 16:33:35 kent Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -367,7 +367,7 @@
};
static const char * const ac97feature[] = {
- "mic channel",
+ "dedicated mic channel",
"reserved",
"tone",
"simulated stereo",
@@ -574,6 +574,7 @@
u_int16_t id1, id2, caps;
u_int32_t id;
mixer_ctrl_t ctl;
+ const char *delim;
as = malloc(sizeof(struct ac97_softc), M_DEVBUF, M_WAITOK|M_ZERO);
@@ -631,8 +632,45 @@
j++;
}
}
+ printf("%s%s\n", j? ", " : "", ac97enhancement[(caps >> 10) & 0x1f]);
- printf("%s%s\n", j? ", " : "", ac97enhancement[(caps >> 10) & 0x1f]);
+ ac97_read(as, AC97_REG_EXT_AUDIO_ID, &caps);
+ if (caps & (AC97_EXT_AUDIO_VRA | AC97_EXT_AUDIO_DRA
+ | AC97_EXT_AUDIO_SPDIF | AC97_EXT_AUDIO_VRM
+ | AC97_EXT_AUDIO_CDAC | AC97_EXT_AUDIO_SDAC
+ | AC97_EXT_AUDIO_LDAC)) {
+ printf("%s:", sc_dev->dv_xname);
+ delim = "";
+
+ if (caps & AC97_EXT_AUDIO_VRA) {
+ printf("%s variable rate audio", delim);
+ delim = ",";
+ }
+ if (caps & AC97_EXT_AUDIO_DRA) {
+ printf("%s double rate output", delim);
+ delim = ",";
+ }
+ if (caps & AC97_EXT_AUDIO_SPDIF) {
+ printf("%s S/PDIF", delim);
+ delim = ",";
+ }
+ if (caps & AC97_EXT_AUDIO_VRM) {
+ printf("%s variable rate dedicated mic", delim);
+ delim = ",";
+ }
+ if (caps & AC97_EXT_AUDIO_CDAC) {
+ printf("%s center DAC", delim);
+ delim = ",";
+ }
+ if (caps & AC97_EXT_AUDIO_SDAC) {
+ printf("%s surround DAC", delim);
+ delim = ",";
+ }
+ if (caps & AC97_EXT_AUDIO_LDAC) {
+ printf("%s LFE DAC", delim);
+ }
+ printf("\n");
+ }
ac97_setup_source_info(as);
diff -r b12cc510ac70 -r c5c87196fcb5 sys/dev/ic/ac97reg.h
--- a/sys/dev/ic/ac97reg.h Sun Oct 06 15:06:05 2002 +0000
+++ b/sys/dev/ic/ac97reg.h Sun Oct 06 16:33:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ac97reg.h,v 1.5 2002/10/06 15:06:05 kent Exp $ */
+/* $NetBSD: ac97reg.h,v 1.6 2002/10/06 16:33:35 kent Exp $ */
/*
* Copyright (c) 1999 Constantine Sapuntzakis
@@ -43,34 +43,82 @@
#define AC97_REG_PCMOUT_VOLUME 0x18
#define AC97_REG_RECORD_SELECT 0x1a
#define AC97_REG_RECORD_GAIN 0x1c
-#define AC97_REG_RECORD_GAIN_MIC 0x1e
+#define AC97_REG_RECORD_GAIN_MIC 0x1e /* for dedicated mic */
#define AC97_REG_GP 0x20
#define AC97_REG_3D_CONTROL 0x22
- /* 0x24 reserved */
+ /* 0x24 Modem sample rate in AC97 1.03
+ Reserved in AC97 2.0
+ Interrupt/paging in AC97 2.3 */
#define AC97_REG_POWER 0x26
+#define AC97_POWER_ADC 0x0001
+#define AC97_POWER_DAC 0x0002
+#define AC97_POWER_ANL 0x0004
+#define AC97_POWER_REF 0x0008
+#define AC97_POWER_IN 0x0100
+#define AC97_POWER_OUT 0x0200
+#define AC97_POWER_MIXER 0x0400
+#define AC97_POWER_MIXER_VREF 0x0800
+#define AC97_POWER_ACLINK 0x1000
+#define AC97_POWER_CLK 0x2000
+#define AC97_POWER_AUX 0x4000
+#define AC97_POWER_EAMP 0x8000
/* AC'97 2.0 extensions -- 0x28-0x3a */
-#define AC97_REG_EXTENDED_ID 0x28
-#define AC97_CODEC_DOES_VRA 0x0001
-#define AC97_CODEC_DOES_MICVRA 0x0008
-#define AC97_REG_EXTENDED_STATUS 0x2a
-#define AC97_ENAB_VRA 0x0001
-#define AC97_ENAB_MICVRA 0x0008
+#define AC97_REG_EXT_AUDIO_ID 0x28
+#define AC97_REG_EXT_AUDIO_CTRL 0x2a
+#define AC97_EXT_AUDIO_VRA 0x0001
+#define AC97_EXT_AUDIO_DRA 0x0002
+#define AC97_EXT_AUDIO_SPDIF 0x0004
+#define AC97_EXT_AUDIO_VRM 0x0008 /* for dedicated mic */
+#define AC97_EXT_AUDIO_DSA0 0x0010 /* for EXT ID */
+#define AC97_EXT_AUDIO_DSA1 0x0020 /* for EXT ID */
+#define AC97_EXT_AUDIO_SPSA0 0x0010 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_SPSA1 0x0020 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_CDAC 0x0040
+#define AC97_EXT_AUDIO_SDAC 0x0080
+#define AC97_EXT_AUDIO_LDAC 0x0100
+#define AC97_EXT_AUDIO_AMAP 0x0200 /* for EXT ID */
+#define AC97_EXT_AUDIO_REV_11 0x0000 /* for EXT ID */
+#define AC97_EXT_AUDIO_REV_22 0x0400 /* for EXT ID */
+#define AC97_EXT_AUDIO_REV_23 0x0800 /* for EXT ID */
+#define AC97_EXT_AUDIO_REV_MASK 0x0C00 /* for EXT ID */
+#define AC97_EXT_AUDIO_ID 0xC000 /* for EXT ID */
+#define AC97_EXT_AUDIO_MADC 0x0200 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_SPCV 0x0400 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_PRI 0x0800 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_PRJ 0x1000 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_PRK 0x2000 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_PRL 0x4000 /* for EXT STATUS */
+#define AC97_EXT_AUDIO_VCFG 0x8000 /* for EXT STATUS */
+
+#define AC97_SINGLE_RATE 48000
#define AC97_REG_PCM_FRONT_DAC_RATE 0x2c
#define AC97_REG_PCM_SURR_DAC_RATE 0x2e
#define AC97_REG_PCM_LFE_DAC_RATE 0x30
#define AC97_REG_PCM_LR_ADC_RATE 0x32
-#define AC97_REG_PCM_MIC_ADC_RATE 0x34
+#define AC97_REG_PCM_MIC_ADC_RATE 0x34 /* dedicated mic */
#define AC97_REG_CENTER_LFE_MASTER 0x36 /* center + LFE master volume */
#define AC97_REG_SURR_MASTER 0x38 /* surround (rear) master vol */
- /* 0x3a reserved */
+#define AC97_REG_SPDIF_CRTL 0x3a
+#define AC97_SPDIF_V 0x8000
+#define AC97_SPDIF_DRS 0x4000
+#define AC97_SPDIF_SPSR_44K 0x0000
+#define AC97_SPDIF_SPSR_48K 0x2000
+#define AC97_SPDIF_SPSR_32K 0x1000
+#define AC97_SPDIF_SPSR_MASK 0x3000
+#define AC97_SPDIF_L 0x0800
+#define AC97_SPDIF_CC_MASK 0x07f0
+#define AC97_SPDIF_PRE 0x0008
+#define AC97_SPDIF_COPY 0x0004
+#define AC97_SPDIF_NONAUDIO 0x0002
+#define AC97_SPDIF_PRO 0x0001
/* Modem -- 0x3c-0x58 */
/* Vendor specific -- 0x5a-0x7b */
-#define AC97_REG_VENDOR_ID1 0x7c
-#define AC97_REG_VENDOR_ID2 0x7e
+#define AC97_REG_VENDOR_ID1 0x7c
+#define AC97_REG_VENDOR_ID2 0x7e
#define AC97_CODEC_ID(a0, a1, a2, x) \
(((a0) << 24) | ((a1) << 16) | ((a2) << 8) | (x))
diff -r b12cc510ac70 -r c5c87196fcb5 sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c Sun Oct 06 15:06:05 2002 +0000
+++ b/sys/dev/pci/auich.c Sun Oct 06 16:33:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auich.c,v 1.25 2002/10/04 14:33:30 kent Exp $ */
+/* $NetBSD: auich.c,v 1.26 2002/10/06 16:33:36 kent Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -114,7 +114,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.25 2002/10/04 14:33:30 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.26 2002/10/06 16:33:36 kent Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -478,14 +478,14 @@
if (ac97_attach(&sc->host_if) != 0)
return;
- auich_read_codec(sc, AC97_REG_EXTENDED_ID, &ext_id);
- if ((ext_id & (AC97_CODEC_DOES_VRA | AC97_CODEC_DOES_MICVRA)) != 0) {
- auich_read_codec(sc, AC97_REG_EXTENDED_STATUS, &ext_status);
- if ((ext_id & AC97_CODEC_DOES_VRA) !=0)
- ext_status |= AC97_ENAB_VRA;
- if ((ext_id & AC97_CODEC_DOES_MICVRA) !=0)
- ext_status |= AC97_ENAB_MICVRA;
- auich_write_codec(sc, AC97_REG_EXTENDED_STATUS, ext_status);
+ auich_read_codec(sc, AC97_REG_EXT_AUDIO_ID, &ext_id);
+ if ((ext_id & (AC97_EXT_AUDIO_VRA | AC97_EXT_AUDIO_VRM)) != 0) {
+ auich_read_codec(sc, AC97_REG_EXT_AUDIO_CTRL, &ext_status);
+ if ((ext_id & AC97_EXT_AUDIO_VRA) != 0)
+ ext_status |= AC97_EXT_AUDIO_VRA;
+ if ((ext_id & AC97_EXT_AUDIO_VRM) != 0)
+ ext_status |= AC97_EXT_AUDIO_VRM;
+ auich_write_codec(sc, AC97_REG_EXT_AUDIO_CTRL, ext_status);
/* so it claims to do variable rate, let's make sure */
if (auich_set_rate(sc, AUMODE_PLAY, 44100) == 44100)
@@ -1325,7 +1325,7 @@
/* Power down */
DPRINTF(1, ("%s: power down\n", sc->sc_dev.dv_xname));
sc->sc_suspend = why;
- auich_read_codec(sc, AC97_REG_EXTENDED_STATUS, &sc->ext_status);
+ auich_read_codec(sc, AC97_REG_EXT_AUDIO_CTRL, &sc->ext_status);
break;
case PWR_RESUME:
@@ -1341,7 +1341,7 @@
auich_reset_codec(sc);
DELAY(1000);
(sc->codec_if->vtbl->restore_ports)(sc->codec_if);
- auich_write_codec(sc, AC97_REG_EXTENDED_STATUS, sc->ext_status);
+ auich_write_codec(sc, AC97_REG_EXT_AUDIO_CTRL, sc->ext_status);
break;
case PWR_SOFTSUSPEND:
diff -r b12cc510ac70 -r c5c87196fcb5 sys/dev/pci/auvia.c
--- a/sys/dev/pci/auvia.c Sun Oct 06 15:06:05 2002 +0000
+++ b/sys/dev/pci/auvia.c Sun Oct 06 16:33:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auvia.c,v 1.22 2002/10/05 18:08:30 kent Exp $ */
+/* $NetBSD: auvia.c,v 1.23 2002/10/06 16:33:36 kent Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.22 2002/10/05 18:08:30 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.23 2002/10/06 16:33:36 kent Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -327,15 +327,15 @@
* Print a warning if the codec doesn't support hardware variable
* rate audio.
*/
- if (auvia_read_codec(sc, AC97_REG_EXTENDED_ID, &v)
- || !(v & AC97_CODEC_DOES_VRA)) {
+ if (auvia_read_codec(sc, AC97_REG_EXT_AUDIO_ID, &v)
+ || !(v & AC97_EXT_AUDIO_VRA)) {
printf("%s: warning: codec doesn't support hardware AC'97 2.0 Variable Rate Audio\n",
sc->sc_dev.dv_xname);
sc->sc_fixed_rate = AUVIA_FIXED_RATE; /* XXX wrong value */
} else {
/* enable VRA */
- auvia_write_codec(sc, AC97_REG_EXTENDED_STATUS,
- AC97_ENAB_VRA | AC97_ENAB_MICVRA);
+ auvia_write_codec(sc, AC97_REG_EXT_AUDIO_CTRL,
+ AC97_EXT_AUDIO_VRA | AC97_EXT_AUDIO_VRM);
sc->sc_fixed_rate = 0;
}
Home |
Main Index |
Thread Index |
Old Index