diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-10-11 12:59:30 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-10-11 12:59:30 +0000 |
commit | 09003ad47b337807cd1bd122f75ca5c47e10fe3e (patch) | |
tree | d653a23ca5a64b9689759d2759b2a761b86337f6 | |
parent | 72516d22971d9fb1bdcc107e71e770c4e9498823 (diff) |
At initialization of HT chips, write configuration on the corresponding
control registers rather than on the PCI configuration space (which is
ok for non-HT chips only). Also fix the offset GPIO mask/dir are read
from EEPROM, old ones are working by accident.
both fixes are from Alexandr Shadchin <ShadchinAV _at_ mail.ru>
Thanks!
-rw-r--r-- | sys/dev/pci/envy.c | 32 | ||||
-rw-r--r-- | sys/dev/pci/envyreg.h | 10 |
2 files changed, 28 insertions, 14 deletions
diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c index 88a9ed8a6b9..de02acc7bbd 100644 --- a/sys/dev/pci/envy.c +++ b/sys/dev/pci/envy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: envy.c,v 1.28 2009/05/18 20:10:12 ratchov Exp $ */ +/* $OpenBSD: envy.c,v 1.29 2009/10/11 12:59:29 ratchov Exp $ */ /* * Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org> * @@ -188,7 +188,7 @@ static unsigned char julia_eeprom[ENVY_EEPROM_MAXSZ] = { 0x20, 0x80, 0xf8, 0xc3, 0x9f, 0xff, 0x7f, 0x9f, 0xff, 0x7f, - 0x16, 0x80, 0x00 + 0x60, 0x00, 0x00 }; struct envy_codec ak4524_dac = { @@ -413,7 +413,6 @@ ak4524_dac_ndev(struct envy_softc *sc) return 3 * (sc->card->noch / 2); } - void ak4524_dac_devinfo(struct envy_softc *sc, struct mixer_devinfo *dev, int idx) { @@ -439,7 +438,7 @@ ak4524_dac_devinfo(struct envy_softc *sc, struct mixer_devinfo *dev, int idx) dev->un.e.member[1].ord = 1; strlcpy(dev->un.e.member[1].label.name, AudioNon, MAX_AUDIO_DEV_LEN); - dev->un.s.num_mem = 2; + dev->un.e.num_mem = 2; snprintf(dev->label.name, MAX_AUDIO_DEV_LEN, AudioNmute "%d-%d", 2 * idx, 2 * idx + 1); } @@ -729,13 +728,24 @@ envy_reset(struct envy_softc *sc) /* * write eeprom values to corresponding registers */ - pci_conf_write(sc->pci_pc, sc->pci_tag, ENVY_CONF, - sc->eeprom[ENVY_EEPROM_CONF] | - (sc->eeprom[ENVY_EEPROM_ACLINK] << 8) | - (sc->eeprom[ENVY_EEPROM_I2S] << 16) | - (sc->eeprom[ENVY_EEPROM_SPDIF] << 24)); - - envy_gpio_setmask(sc, envy_eeprom_gpioxxx(sc, ENVY_EEPROM_GPIOMASK)); + if (sc->isht) { + envy_ccs_write(sc, ENVY_CCS_CONF, + sc->eeprom[ENVY_EEPROM_CONF]); + envy_ccs_write(sc, ENVY_CCS_ACLINK, + sc->eeprom[ENVY_EEPROM_ACLINK]); + envy_ccs_write(sc, ENVY_CCS_I2S, + sc->eeprom[ENVY_EEPROM_I2S]); + envy_ccs_write(sc, ENVY_CCS_SPDIF, + sc->eeprom[ENVY_EEPROM_SPDIF]); + } else { + pci_conf_write(sc->pci_pc, sc->pci_tag, ENVY_CONF, + sc->eeprom[ENVY_EEPROM_CONF] | + (sc->eeprom[ENVY_EEPROM_ACLINK] << 8) | + (sc->eeprom[ENVY_EEPROM_I2S] << 16) | + (sc->eeprom[ENVY_EEPROM_SPDIF] << 24)); + } + + envy_gpio_setmask(sc, envy_eeprom_gpioxxx(sc, ENVY_EEPROM_GPIOMASK(sc))); envy_gpio_setdir(sc, envy_eeprom_gpioxxx(sc, ENVY_EEPROM_GPIODIR(sc))); envy_gpio_setstate(sc, envy_eeprom_gpioxxx(sc, ENVY_EEPROM_GPIOST(sc))); diff --git a/sys/dev/pci/envyreg.h b/sys/dev/pci/envyreg.h index e70ff18603a..27a056a9d0e 100644 --- a/sys/dev/pci/envyreg.h +++ b/sys/dev/pci/envyreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: envyreg.h,v 1.9 2009/05/08 17:52:18 ratchov Exp $ */ +/* $OpenBSD: envyreg.h,v 1.10 2009/10/11 12:59:29 ratchov Exp $ */ /* * Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org> * @@ -36,6 +36,10 @@ #define ENVY_CCS_INT_TMR 0x80 #define ENVY_CCS_INT_MIDI0 0x80 #define ENVY_CCS_INTSTAT 0x02 +#define ENVY_CCS_CONF 0x04 /* Envy24HT only */ +#define ENVY_CCS_ACLINK 0x05 /* Envy24HT only */ +#define ENVY_CCS_I2S 0x06 /* Envy24HT only */ +#define ENVY_CCS_SPDIF 0x07 /* Envy24HT only */ #define ENVY_CCS_GPIODATA0 0x14 /* Envy24HT only */ #define ENVY_CCS_GPIODATA1 0x15 /* Envy24HT only */ #define ENVY_CCS_GPIODATA2 0x1e /* Envy24HT only */ @@ -86,9 +90,9 @@ #define ENVY_EEPROM_ACLINK 7 #define ENVY_EEPROM_I2S 8 #define ENVY_EEPROM_SPDIF 9 -#define ENVY_EEPROM_GPIOMASK 10 +#define ENVY_EEPROM_GPIOMASK(s) ((s)->isht ? 13 : 10) #define ENVY_EEPROM_GPIOST(s) ((s)->isht ? 16 : 11) -#define ENVY_EEPROM_GPIODIR(s) ((s)->isht ? 13 : 12) +#define ENVY_EEPROM_GPIODIR(s) ((s)->isht ? 10 : 12) /* * MT registers for play/record params |