diff -upr sys.org/dev/sound/pci/ich.c sys/dev/sound/pci/ich.c --- sys.org/dev/sound/pci/ich.c Wed Apr 16 12:16:55 2003 +++ sys/dev/sound/pci/ich.c Wed Jun 25 17:49:29 2003 @@ -800,6 +800,27 @@ ich_pci_detach(device_t dev) return 0; } +static void +ich_pci_codec_reset(struct sc_info *sc) +{ + int i; + uint32_t control; + + control = ich_rd(sc, ICH_REG_GLOB_CNT, 4); + control &= ~(ICH_GLOB_CTL_SHUT); + control |= (control & ICH_GLOB_CTL_COLD) ? ICH_GLOB_CTL_WARM : ICH_GLOB_CTL_COLD; + ich_wr(sc, ICH_REG_GLOB_CNT, control, 4); + + for (i = 500000; i; i--) { + if (ich_rd(sc, ICH_REG_GLOB_STA, 4) & ICH_GLOB_STA_PCR) + break; /* or ICH_SCR? */ + DELAY(1); + } + + if (i <= 0) + printf("%s: time out\n", __func__); +} + static int ich_pci_suspend(device_t dev) { @@ -822,6 +843,9 @@ ich_pci_resume(device_t dev) struct sc_info *sc; int i; + pci_enable_io(dev, SYS_RES_IOPORT); + pci_enable_busmaster(dev); + sc = pcm_getdevinfo(dev); /* Reinit audio device */ @@ -830,6 +854,8 @@ ich_pci_resume(device_t dev) return ENXIO; } /* Reinit mixer */ + ich_pci_codec_reset(sc); + ac97_setextmode(sc->codec, sc->hasvra | sc->hasvrm); if (mixer_reinit(dev) == -1) { device_printf(dev, "unable to reinitialize the mixer\n"); return ENXIO;