diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-09-21 02:00:14 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-09-21 02:00:14 +0000 |
commit | 9374afb51ebc8f62f361cee56b2d9f88cb256a83 (patch) | |
tree | 7da114b9908c26e61dbc934cdbb296f7f1a226d4 /sys/dev | |
parent | e8c4433c035f8e08f75ecc8674de407632657270 (diff) |
* use audio(4)'s DVACT_{QUIESCE,RESUME} to handle I/O stopping/restarting
for suspend/resume, and ac97(4)'s ac97_resume() to reset and restore
the codec at resume
* return the sample rate the codec is using and remove unneeded
adjusted sample rate checking that was incorrectly copied from
auich(4)
tested/ok pirofti (on loongson)
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/auglx.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/sys/dev/pci/auglx.c b/sys/dev/pci/auglx.c index e9e1ea2b523..ca0f0443531 100644 --- a/sys/dev/pci/auglx.c +++ b/sys/dev/pci/auglx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auglx.c,v 1.6 2010/09/07 16:21:44 deraadt Exp $ */ +/* $OpenBSD: auglx.c,v 1.7 2010/09/21 02:00:13 jakemsr Exp $ */ /* * Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org> @@ -197,9 +197,6 @@ struct auglx_softc { struct ac97_codec_if *codec_if; struct ac97_host_if host_if; - /* power mgmt */ - u_int16_t sc_ext_ctrl; - int sc_dmamap_flags; }; @@ -551,7 +548,6 @@ auglx_set_params(void *v, int setmode, int usemode, struct audio_params *play, struct auglx_softc *sc = v; int error; u_int orate; - u_int adj_rate; if (setmode & AUMODE_PLAY) { play->factor = 1; @@ -726,28 +722,25 @@ auglx_set_params(void *v, int setmode, int usemode, struct audio_params *play, play->bps = AUDIO_BPS(play->precision); play->msb = 1; - orate = adj_rate = play->sample_rate; + orate = play->sample_rate; - play->sample_rate = adj_rate; + play->sample_rate = orate; error = ac97_set_rate(sc->codec_if, AC97_REG_PCM_LFE_DAC_RATE, &play->sample_rate); if (error) return error; - play->sample_rate = adj_rate; + play->sample_rate = orate; error = ac97_set_rate(sc->codec_if, AC97_REG_PCM_SURR_DAC_RATE, &play->sample_rate); if (error) return error; - play->sample_rate = adj_rate; + play->sample_rate = orate; error = ac97_set_rate(sc->codec_if, AC97_REG_PCM_FRONT_DAC_RATE, &play->sample_rate); if (error) return error; - - if (play->sample_rate == adj_rate) - play->sample_rate = orate; } if (setmode & AUMODE_RECORD) { @@ -903,12 +896,10 @@ auglx_set_params(void *v, int setmode, int usemode, struct audio_params *play, rec->bps = AUDIO_BPS(rec->precision); rec->msb = 1; - orate = rec->sample_rate; error = ac97_set_rate(sc->codec_if, AC97_REG_PCM_LR_ADC_RATE, &rec->sample_rate); if (error) return error; - rec->sample_rate = orate; } return 0; @@ -1343,17 +1334,22 @@ int auglx_activate(struct device *self, int act) { struct auglx_softc *sc = (struct auglx_softc *)self; + int rv = 0; switch (act) { + case DVACT_ACTIVATE: + break; + case DVACT_QUIESCE: + rv = config_activate_children(self, act); + break; case DVACT_SUSPEND: - auglx_read_codec(sc, AC97_REG_EXT_AUDIO_CTRL, &sc->sc_ext_ctrl); break; case DVACT_RESUME: - auglx_reset_codec(sc); - delay(1000); - (sc->codec_if->vtbl->restore_ports)(sc->codec_if); - auglx_write_codec(sc, AC97_REG_EXT_AUDIO_CTRL, sc->sc_ext_ctrl); + ac97_resume(&sc->host_if, sc->codec_if); + rv = config_activate_children(self, act); + break; + case DVACT_DEACTIVATE: break; } - return 0; + return (rv); } |