tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Allow hdaudio(4) to suspend
Hi tech-kern@,
the patch attached lets me suspend my laptop again. The underlying issue
is as follows:
hdaudio0 at pci0 dev 3 function 0: HD Audio Controller
hdaudio0: interrupting at ioapic0 pin 16, event channel 6
hdaudio0: RIRB timeout
hdaudio0: RIRB timeout
[does not attach any hdafg(4) and therefore no audio(4) here]
hdaudio1 at pci0 dev 27 function 0: HD Audio Controller
hdaudio1: interrupting at ioapic0 pin 22, event channel 8
hdafg0 at hdaudio1: Realtek product 0x0292
hdafg0: DAC00 2ch: Speaker [Built-In], HP Out [Jack]
hdafg0: ADC01 2ch: Mic In [Jack]
hdafg0: ADC02 2ch: Mic In [Built-In]
hdafg0: 2ch/2ch 32000Hz 44100Hz 48000Hz 88200Hz 96000Hz 192000Hz PCM16 PCM20 PCM24 AC3
audio0 at hdafg0: full duplex, playback, capture, mmap, independent
Really hdaudio0 failed to attach, but the device remained in the tree.
Even though the PMF registration was performed, it is explicitly
de-registered in the code path for errors - therefore preventing
suspending later.
In sys/dev/pci/hdaudio_pci.c:
160 if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
161 aprint_error_dev(self, "couldn't establish power handler\n");
162
163 hdaudio_pci_reinit(sc);
164
165 /* Attach bus-independent HD audio layer */
166 if (hdaudio_attach(self, &sc->sc_hdaudio)) {
[...]
179 pmf_device_deregister(self);
Let me know if the patch attached is a satisfying fix for the time
being. I will commit it in a couple days if there is no objection.
Subsidiary question: is there a consensus on the behaviour of the kernel
if a device driver matches, but then really fails to attach?
Cheers,
--
khorben
--- sys/dev/pci/hdaudio_pci.c 2017-01-25 22:58:21.000000000 +0100
+++ sys/dev/pci/hdaudio_pci.c.new 2017-01-23 01:51:18.000000000 +0100
@@ -157,9 +157,6 @@
}
aprint_normal_dev(self, "interrupting at %s\n", intrstr);
- if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
- aprint_error_dev(self, "couldn't establish power handler\n");
-
hdaudio_pci_reinit(sc);
/* Attach bus-independent HD audio layer */
@@ -176,8 +173,12 @@
csr &= ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE);
pci_conf_write(sc->sc_pc, sc->sc_tag,
PCI_COMMAND_STATUS_REG, csr);
- pmf_device_deregister(self);
+
+ if (!pmf_device_register(self, NULL, NULL))
+ aprint_error_dev(self, "couldn't establish power handler\n");
}
+ else if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
+ aprint_error_dev(self, "couldn't establish power handler\n");
}
static int
Home |
Main Index |
Thread Index |
Old Index