diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-10-19 20:33:29 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-10-19 20:33:29 +0000 |
commit | 8964d3a4802bbd04ef838347f6483564158e9ff8 (patch) | |
tree | fd8a57d879ac328f76e67fb8099555fe70682875 | |
parent | 62465eae361c0bacba8e8181819a7f5f27142200 (diff) |
Put fix from NetBSD:
Enable auvia_reset_codec's code and wait until the card is available.
Fixes 'invalid codec' problems (at least with AD1980).
ok mickey@
-rw-r--r-- | sys/dev/pci/auvia.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c index ececa456711..b514474ff66 100644 --- a/sys/dev/pci/auvia.c +++ b/sys/dev/pci/auvia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auvia.c,v 1.25 2003/05/21 19:32:20 drahn Exp $ */ +/* $OpenBSD: auvia.c,v 1.26 2003/10/19 20:33:28 grange Exp $ */ /* $NetBSD: auvia.c,v 1.7 2000/11/15 21:06:33 jdolecek Exp $ */ /*- @@ -131,6 +131,7 @@ struct cfattach auvia_ca = { #define AUVIA_PCICONF_ACSGD 0x00000400 /* SGD enab */ #define AUVIA_PCICONF_ACFM 0x00000200 /* FM enab */ #define AUVIA_PCICONF_ACSB 0x00000100 /* SB enab */ +#define AUVIA_PCICONF_PRIVALID 0x00000001 /* primary codec rdy */ #define AUVIA_PLAY_BASE 0x00 #define AUVIA_RECORD_BASE 0x10 @@ -341,7 +342,7 @@ auvia_attach_codec(void *addr, struct ac97_codec_if *cif) void auvia_reset_codec(void *addr) { -#ifdef notyet /* XXX seems to make codec become unready... ??? */ + int i; struct auvia_softc *sc = addr; pcireg_t r; @@ -357,8 +358,11 @@ auvia_reset_codec(void *addr) pci_conf_write(sc->sc_pc, sc->sc_pt, AUVIA_PCICONF_JUNK, r); delay(200); - auvia_waitready_codec(sc); -#endif + for (i = 500000; i != 0 && !(pci_conf_read(sc->sc_pc, sc->sc_pt, + AUVIA_PCICONF_JUNK) & AUVIA_PCICONF_PRIVALID); i--) + DELAY(1); + if (i == 0) + printf("%s: codec reset timed out\n", sc->sc_dev.dv_xname); } |