From 153f04daa902a8075c72461549fd320d09229c79 Mon Sep 17 00:00:00 2001 From: someya Date: Thu, 30 May 2002 17:04:13 +0000 Subject: [PATCH] Fix playback problem on SiS7018. - mute the volume for interrupt channel - add some improvements for device initialization but recording does not work properly. Reported and tested by Jan Wagner . Thanks. --- sys/dev/pci/autri.c | 33 +++++++++++++++++---------------- sys/dev/pci/autrireg.h | 5 +++-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/sys/dev/pci/autri.c b/sys/dev/pci/autri.c index 7703e7f54d88..33fedf59220d 100644 --- a/sys/dev/pci/autri.c +++ b/sys/dev/pci/autri.c @@ -1,4 +1,4 @@ -/* $NetBSD: autri.c,v 1.4 2002/02/05 01:51:51 eeh Exp $ */ +/* $NetBSD: autri.c,v 1.5 2002/05/30 17:04:13 someya Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -398,12 +398,12 @@ autri_reset_codec(void *sc_) ready = AUTRI_NX_ACR0_CODEC_READY; break; case AUTRI_DEVICE_ID_SIS_7018: - /* warm reset AC'97 codec */ - autri_reg_set_4(sc, AUTRI_SIS_SCTRL, 1); - delay(100); + /* cold reset AC'97 codec */ + autri_reg_set_4(sc, AUTRI_SIS_SCTRL, 2); + delay(1000); /* release reset (warm & cold) */ autri_reg_clear_4(sc, AUTRI_SIS_SCTRL, 3); - delay(100); + delay(2000); addr = AUTRI_SIS_SCTRL; ready = AUTRI_SIS_SCTRL_CODEC_READY; @@ -654,7 +654,7 @@ autri_init(void *sc_) delay(100); /* reset Digital Controller */ reg = pci_conf_read(pc, pt, AUTRI_PCI_LEGACY_IOBASE); - pci_conf_write(pc, pt, AUTRI_PCI_LEGACY_IOBASE, reg | 0x000c0000); + pci_conf_write(pc, pt, AUTRI_PCI_LEGACY_IOBASE, reg | 0x00040000); delay(100); /* release reset */ reg = pci_conf_read(pc, pt, AUTRI_PCI_LEGACY_IOBASE); @@ -725,10 +725,10 @@ autri_enable_loop_interrupt(void *sc_) /*reg = (ENDLP_IE | MIDLP_IE);*/ reg = ENDLP_IE; -#if 0 + if (sc->sc_devid == AUTRI_DEVICE_ID_SIS_7018) reg |= BANK_B_EN; -#endif + autri_reg_set_4(sc,AUTRI_LFO_GC_CIR,reg); } @@ -1223,16 +1223,14 @@ autri_setup_channel(struct autri_softc *sc, int mode, if (mode == AUMODE_PLAY) { chst = &sc->sc_play; dch[0] = ((delta << 12) / 48000) & 0x0000ffff; - if (sc->sc_devid != AUTRI_DEVICE_ID_SIS_7018) - ctrl |= AUTRI_CTRL_WAVEVOL; -/* - if (sc->sc_devid == AUTRI_DEVICE_ID_ALI_M5451) - ctrl |= 0x80000000; -*/ + ctrl |= AUTRI_CTRL_WAVEVOL; } else { chst = &sc->sc_rec; dch[0] = ((48000 << 12) / delta) & 0x0000ffff; - ctrl |= AUTRI_CTRL_MUTE; + if (sc->sc_devid == AUTRI_DEVICE_ID_SIS_7018) + ctrl |= AUTRI_CTRL_MUTEVOL_SIS; + else + ctrl |= AUTRI_CTRL_MUTEVOL; } dmaaddr = DMAADDR(chst->dma); @@ -1248,7 +1246,10 @@ autri_setup_channel(struct autri_softc *sc, int mode, else { /* channel for interrupt */ dmalen = (chst->blksize >> factor); - ctrl |= AUTRI_CTRL_MUTE; + if (sc->sc_devid == AUTRI_DEVICE_ID_SIS_7018) + ctrl |= AUTRI_CTRL_MUTEVOL_SIS; + else + ctrl |= AUTRI_CTRL_MUTEVOL; } eso = dmalen - 1; diff --git a/sys/dev/pci/autrireg.h b/sys/dev/pci/autrireg.h index d8c563276c17..0bf1d77fc510 100644 --- a/sys/dev/pci/autrireg.h +++ b/sys/dev/pci/autrireg.h @@ -1,4 +1,4 @@ -/* $NetBSD: autrireg.h,v 1.1 2001/11/18 03:16:02 someya Exp $ */ +/* $NetBSD: autrireg.h,v 1.2 2002/05/30 17:04:13 someya Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -147,7 +147,8 @@ */ #define AUTRI_ARAM_CR 0xe0 # define AUTRI_CTRL_WAVEVOL 0x80000000 -# define AUTRI_CTRL_MUTE 0x3fff0000 +# define AUTRI_CTRL_MUTEVOL 0x3fff0000 +# define AUTRI_CTRL_MUTEVOL_SIS 0x3f000fff # define AUTRI_CTRL_16BIT 0x00008000 # define AUTRI_CTRL_STEREO 0x00004000 # define AUTRI_CTRL_SIGNED 0x00002000