Add a powerhook to reload AC97 registers after a resume.

Sound now works after suspend/resume on my Sony PCG-Z505S
This commit is contained in:
sommerfeld 2000-11-27 01:56:53 +00:00
parent 18f3d66238
commit 248928c7cf
1 changed files with 18 additions and 2 deletions

View File

@ -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>
@ -160,7 +160,9 @@ struct neo_softc {
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 @@ size_t neo_round_buffersize(void *, int, size_t);
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
@ -523,6 +526,17 @@ neo_match(struct device *parent, struct cfdata *match, void *aux)
return (0);
}
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)
{
@ -591,6 +605,8 @@ neo_attach(struct device *parent, struct device *self, void *aux)
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);
}