summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2017-09-22 06:33:45 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2017-09-22 06:33:45 +0000
commit8394d6b5511f9db51254612233cc9cb129559a17 (patch)
tree6e4be14ce536ecc4f88cf34dce7c4b849bba583a /sys/dev/pci
parentb3e5e8bbc94dada8807e17b1e75d6124e2bb621e (diff)
Move the powering down of all codecs into azalia_halt_corb() after the
check that the CORB is running. Fixes a regression introduced in -r1.236 that resulted in printing 'azalia0: CORB is not running' on each suspend resume cycle. Issue reported on icb by mlarkin; tested by Manuel Giraud, ratchov and myself. ok ratchov
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/azalia.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 0ef837158fe..0b7836c310f 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.237 2017/09/08 05:36:52 deraadt Exp $ */
+/* $OpenBSD: azalia.c,v 1.238 2017/09/22 06:33:44 tb Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -696,8 +696,6 @@ azalia_shutdown(void *v)
{
azalia_t *az = (azalia_t *)v;
uint32_t gctl;
- codec_t *codec;
- int i;
/* disable unsolicited response */
gctl = AZ_READ_4(az, GCTL);
@@ -705,15 +703,6 @@ azalia_shutdown(void *v)
timeout_del(&az->unsol_to);
- /* power off all codecs */
- for (i = 0; i < az->ncodecs; i++) {
- codec = &az->codecs[i];
- if (codec->audiofunc < 0)
- continue;
- azalia_comresp(codec, codec->audiofunc, CORB_SET_POWER_STATE,
- CORB_PS_D3, NULL);
- }
-
/* halt CORB/RIRB */
azalia_halt_corb(az);
azalia_halt_rirb(az);
@@ -989,10 +978,20 @@ int
azalia_halt_corb(azalia_t *az)
{
uint8_t corbctl;
+ codec_t *codec;
int i;
corbctl = AZ_READ_1(az, CORBCTL);
if (corbctl & HDA_CORBCTL_CORBRUN) { /* running? */
+ /* power off all codecs */
+ for (i = 0; i < az->ncodecs; i++) {
+ codec = &az->codecs[i];
+ if (codec->audiofunc < 0)
+ continue;
+ azalia_comresp(codec, codec->audiofunc,
+ CORB_SET_POWER_STATE, CORB_PS_D3, NULL);
+ }
+
AZ_WRITE_1(az, CORBCTL, corbctl & ~HDA_CORBCTL_CORBRUN);
for (i = 5000; i > 0; i--) {
DELAY(10);