Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Add a powerhook to reload AC97 registers after a...



details:   https://anonhg.NetBSD.org/src/rev/2aa109cc3a8a
branches:  trunk
changeset: 499686:2aa109cc3a8a
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Mon Nov 27 01:56:53 2000 +0000

description:
Add a powerhook to reload AC97 registers after a resume.
Sound now works after suspend/resume on my Sony PCG-Z505S

diffstat:

 sys/dev/pci/neo.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r 6c8c4b924483 -r 2aa109cc3a8a sys/dev/pci/neo.c
--- a/sys/dev/pci/neo.c Mon Nov 27 00:54:25 2000 +0000
+++ b/sys/dev/pci/neo.c Mon Nov 27 01:56:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: neo.c,v 1.4 2000/11/05 16:44:08 thorpej Exp $  */
+/*     $NetBSD: neo.c,v 1.5 2000/11/27 01:56:53 sommerfeld Exp $       */
 
 /*
  * Copyright (c) 1999 Cameron Grant <gandalf%vilnya.demon.co.uk@localhost>
@@ -160,7 +160,9 @@
         u_int32_t       rwmark;
 
        struct ac97_codec_if *codec_if;
-       struct ac97_host_if host_if;    
+       struct ac97_host_if host_if;
+
+       void            *powerhook;
 };
 
 /* -------------------------------------------------------------------- */
@@ -204,6 +206,7 @@
 paddr_t        neo_mappage(void *, void *, off_t, int);
 int    neo_get_props(void *);
 void   neo_set_mixer(struct neo_softc *sc, int a, int d);
+void   neo_power(int why, void *arg);
 
 struct cfattach neo_ca = {
        sizeof(struct neo_softc), neo_match, neo_attach
@@ -524,6 +527,17 @@
 }
 
 void
+neo_power(int why, void *addr)
+{
+       struct neo_softc *sc = (struct neo_softc *)addr;
+
+       if (why == PWR_RESUME) {
+               nm_init(sc);
+               (sc->codec_if->vtbl->restore_ports)(sc->codec_if);
+       }
+}
+
+void
 neo_attach(struct device *parent, struct device *self, void *aux)
 {
        struct neo_softc *sc = (struct neo_softc *)self;
@@ -591,6 +605,8 @@
        if ((error = ac97_attach(&sc->host_if)) != 0)
                return;
 
+       sc->powerhook = powerhook_establish(neo_power, sc);
+
        audio_attach_mi(&neo_hw_if, sc, &sc->dev);
 }
 



Home | Main Index | Thread Index | Old Index