diff options
-rw-r--r-- | sys/dev/ic/ac97.c | 26 | ||||
-rw-r--r-- | sys/dev/ic/ac97.h | 14 | ||||
-rw-r--r-- | sys/dev/pci/envy.c | 29 |
3 files changed, 59 insertions, 10 deletions
diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c index e732b2e77b7..c43b91225e2 100644 --- a/sys/dev/ic/ac97.c +++ b/sys/dev/ic/ac97.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.c,v 1.74 2010/08/08 20:37:33 jakemsr Exp $ */ +/* $OpenBSD: ac97.c,v 1.75 2010/12/22 09:54:27 jakemsr Exp $ */ /* * Copyright (c) 1999, 2000 Constantine Sapuntzakis @@ -351,6 +351,7 @@ void ac97_ad1886_init(struct ac97_softc *, int); void ac97_ad198x_init(struct ac97_softc *, int); void ac97_alc650_init(struct ac97_softc *, int); void ac97_cx20468_init(struct ac97_softc *, int); +void ac97_vt1616_init(struct ac97_softc *, int); struct ac97_codec_if_vtbl ac97civ = { ac97_mixer_get_port, @@ -446,7 +447,7 @@ const struct ac97_codecid { { 0x11, 0xff, 0, 0, "ICE1232" }, { 0x14, 0xff, 0, 0, "ICE1232A" }, { 0x51, 0xff, 0, 0, "VIA VT1616" }, - { 0x52, 0xff, 0, 0, "VIA VT1616i" }, + { 0x52, 0xff, 0, 0, "VIA VT1616i", ac97_vt1616_init }, }, ac97_it[] = { { 0x20, 0xff, 0, 0, "ITE2226E" }, { 0x60, 0xff, 0, 0, "ITE2646E" }, @@ -1509,3 +1510,24 @@ ac97_cx20468_init(struct ac97_softc *as, int resuming) ac97_write(as, AC97_CX_REG_MISC, misc & ~(AC97_CX_SPDIFEN | AC97_CX_COPYRIGHT | AC97_CX_MASK)); } + +void +ac97_vt1616_init(struct ac97_softc *as, int resuming) +{ + u_int16_t reg; + + if (as->host_if->flags(as->host_if->arg) & AC97_HOST_VT1616_DYNEX) { + ac97_read(as, AC97_VT_REG_TEST, ®); + + /* disable 'hp' mixer controls controlling the surround pins */ + reg &= ~(AC97_VT_LVL); + + /* disable downmixing */ + reg &= ~(AC97_VT_LCTF | AC97_VT_STF); + + /* enable DC offset removal */ + reg |= AC97_VT_BPDC; + + ac97_write(as, AC97_VT_REG_TEST, reg); + } +} diff --git a/sys/dev/ic/ac97.h b/sys/dev/ic/ac97.h index 650f42ae77d..abdd405dbf3 100644 --- a/sys/dev/ic/ac97.h +++ b/sys/dev/ic/ac97.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.h,v 1.24 2010/08/08 20:37:33 jakemsr Exp $ */ +/* $OpenBSD: ac97.h,v 1.25 2010/12/22 09:54:27 jakemsr Exp $ */ /* * Copyright (c) 1999 Constantine Sapuntzakis @@ -36,7 +36,8 @@ enum ac97_host_flags { AC97_HOST_DONT_READ = 0x1, AC97_HOST_DONT_READANY = 0x2, AC97_HOST_SWAPPED_CHANNELS = 0x4, - AC97_HOST_ALC650_PIN47_IS_EAPD = 0x8 + AC97_HOST_ALC650_PIN47_IS_EAPD = 0x8, + AC97_HOST_VT1616_DYNEX = 0x10 }; struct ac97_host_if { @@ -237,6 +238,15 @@ void ac97_get_default_params(struct audio_params *); #define AC97_CX_COPYRIGHT 0x04 #define AC97_CX_SPDIFEN 0x08 + +/* VIA codec specific data */ +#define AC97_VT_REG_TEST 0x5a +#define AC97_VT_LVL 0x8000 /* hp controls rear */ +#define AC97_VT_LCTF 0x1000 /* lfe/center to front downmix */ +#define AC97_VT_STF 0x0800 /* surround to front downmix */ +#define AC97_VT_BPDC 0x0400 /* enable DC-offset cancellation */ +#define AC97_VT_DC 0x0200 /* DC offset cancellation capable */ + #define AC97_IS_FIXED_RATE(codec) !((codec)->vtbl->get_caps(codec) & \ AC97_EXT_AUDIO_VRA) #define AC97_BITS_6CH (AC97_EXT_AUDIO_SDAC | AC97_EXT_AUDIO_CDAC | \ diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c index 40a61f42770..594ba922017 100644 --- a/sys/dev/pci/envy.c +++ b/sys/dev/pci/envy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: envy.c,v 1.48 2010/10/30 21:16:58 ratchov Exp $ */ +/* $OpenBSD: envy.c,v 1.49 2010/12/22 09:54:27 jakemsr Exp $ */ /* * Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org> * @@ -140,7 +140,8 @@ void ewx_codec_write(struct envy_softc *, int, int, int); void revo51_init(struct envy_softc *); void revo51_codec_write(struct envy_softc *, int, int, int); -void tremor51_init(struct envy_softc *); +void envy_ac97_init(struct envy_softc *); +void dynex_sc51_init(struct envy_softc *); void julia_init(struct envy_softc *); void julia_codec_write(struct envy_softc *, int, int, int); @@ -335,7 +336,13 @@ struct envy_card envy_cards[] = { PCI_ID_CODE(0x1412, 0x2403), "VIA Tremor 5.1", 2, &unkenvy_codec, 6, &unkenvy_codec, - tremor51_init, + envy_ac97_init, + unkenvy_codec_write + }, { + PCI_ID_CODE(0x14c3, 0x1705), + "Dynex DX-SC51", + 2, &unkenvy_codec, 6, &unkenvy_codec, + dynex_sc51_init, unkenvy_codec_write }, { 0, @@ -619,11 +626,11 @@ revo51_codec_write(struct envy_softc *sc, int dev, int addr, int data) } /* - * VIA Tremor 5.1 specific code + * Generic AC'97 initialization */ void -tremor51_init(struct envy_softc *sc) +envy_ac97_init(struct envy_softc *sc) { sc->isac97 = 1; sc->host_if.arg = sc; @@ -632,13 +639,23 @@ tremor51_init(struct envy_softc *sc) sc->host_if.write = envy_ac97_write_codec; sc->host_if.reset = envy_ac97_reset_codec; sc->host_if.flags = envy_ac97_flags_codec; - sc->codec_flags = 0; if (ac97_attach(&sc->host_if) != 0) printf("%s: can't attach ac97\n", DEVNAME(sc)); } /* + * Dynex + */ + +void +dynex_sc51_init(struct envy_softc *sc) +{ + sc->codec_flags |= AC97_HOST_VT1616_DYNEX; + envy_ac97_init(sc); +} + +/* * ESI Julia specific code */ |