diff options
author | Damien Couderc <couderc@cvs.openbsd.org> | 2003-07-15 13:20:32 +0000 |
---|---|---|
committer | Damien Couderc <couderc@cvs.openbsd.org> | 2003-07-15 13:20:32 +0000 |
commit | 87a39e559ebe9525c40b6ba0151137062faeade8 (patch) | |
tree | b723365c5497dd9f2c84e760de7f845cc99bcda8 /sys/dev | |
parent | a29304ce87a166f1999c49c4275dec2c309bcc0d (diff) |
Add support for AD1985, deraadt@ ok
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ac97.c | 32 | ||||
-rw-r--r-- | sys/dev/ic/ac97.h | 13 |
2 files changed, 41 insertions, 4 deletions
diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c index 0dcc07bb644..96490df1f14 100644 --- a/sys/dev/ic/ac97.c +++ b/sys/dev/ic/ac97.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.c,v 1.36 2003/04/27 11:22:52 ho Exp $ */ +/* $OpenBSD: ac97.c,v 1.37 2003/07/15 13:20:31 couderc Exp $ */ /* * Copyright (c) 1999, 2000 Constantine Sapuntzakis @@ -294,6 +294,8 @@ int ac97_get_portnum_by_name(struct ac97_codec_if *, char *, char *, char *); void ac97_restore_shadow(struct ac97_codec_if *self); +static void ac97_ad198x_init(struct ac97_softc *); + struct ac97_codec_if_vtbl ac97civ = { ac97_mixer_get_port, ac97_mixer_set_port, @@ -308,6 +310,7 @@ const struct ac97_codecid { u_int8_t rev; u_int8_t shift; /* no use yet */ char * const name; + void (*init)(struct ac97_softc *); } ac97_ad[] = { { 0x03, 0xff, 0, 0, "AD1819" }, { 0x40, 0xff, 0, 0, "AD1881" }, @@ -316,6 +319,7 @@ const struct ac97_codecid { { 0x61, 0xff, 0, 0, "AD1886" }, { 0x70, 0xff, 0, 0, "AD1981" }, { 0x72, 0xff, 0, 0, "AD1981A" }, + { 0x75, 0xff, 0, 0, "AD1985", ac97_ad198x_init }, }, ac97_ak[] = { { 0x00, 0xfe, 1, 0, "AK4540" }, { 0x01, 0xfe, 1, 0, "AK4540" }, @@ -643,6 +647,9 @@ ac97_attach(host_if) u_int32_t id; mixer_ctrl_t ctl; int error, i; + void (*initfunc)(struct ac97_softc *); + + initfunc = NULL; if (!(as = malloc(sizeof(struct ac97_softc), M_DEVBUF, M_NOWAIT))) return (ENOMEM); @@ -688,9 +695,10 @@ ac97_attach(host_if) if (codec->id == (id & codec->mask)) break; } - if (codec >= vendor->codecs && codec->mask) + if (codec >= vendor->codecs && codec->mask) { printf(" %s", codec->name); - else + initfunc = codec->init; + } else printf(" <%02x>", id & 0xff); if (codec >= vendor->codecs && codec->rev) printf(" rev %d", @@ -751,6 +759,10 @@ ac97_attach(host_if) AudioNsource, NULL); ac97_mixer_set_port(&as->codec_if, &ctl); + /* use initfunc for specific device */ + if (initfunc != NULL) + initfunc(as); + return (0); } @@ -1019,3 +1031,17 @@ ac97_set_rate(codec_if, p, mode) return (0); } + +/* + * Codec-dependent initialization + */ + +static void +ac97_ad198x_init(struct ac97_softc *as) +{ + unsigned short misc; + + ac97_read(as, AC97_AD_REG_MISC, &misc); + ac97_write(as, AC97_AD_REG_MISC, + misc|AC97_AD_MISC_DAM|AC97_AD_MISC_MADPD); +} diff --git a/sys/dev/ic/ac97.h b/sys/dev/ic/ac97.h index 0bfaf790e58..a2e88960b62 100644 --- a/sys/dev/ic/ac97.h +++ b/sys/dev/ic/ac97.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.h,v 1.14 2002/07/28 06:27:07 fgsch Exp $ */ +/* $OpenBSD: ac97.h,v 1.15 2003/07/15 13:20:31 couderc Exp $ */ /* * Copyright (c) 1999 Constantine Sapuntzakis @@ -153,3 +153,14 @@ int ac97_set_rate(struct ac97_codec_if *, struct audio_params *, int); #define AC97_REG_VENDOR_ID2 0x7e #define AC97_VENDOR_ID_MASK 0xffffff00 +/* Analog Devices codec specific data */ +#define AC97_AD_REG_MISC 0x76 +#define AC97_AD_MISC_MBG 0x0001 /* 0 */ +#define AC97_AD_MISC_VREFD 0x0002 /* 1 */ +#define AC97_AD_MISC_VREFH 0x0004 /* 2 */ +#define AC97_AD_MISC_MADST 0x0008 /* 3 */ +#define AC97_AD_MISC_MADPD 0x0020 /* 5 */ +#define AC97_AD_MISC_FMXE 0x0100 /* 8 */ +#define AC97_AD_MISC_DAM 0x0400 /*10 */ +#define AC97_AD_MISC_MSPLT 0x1000 /*12 */ +#define AC97_AD_MISC_DACZ 0x4000 /*14 */ |