Commit 0cbf0098 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add reboot notifier

The current snd-hda-intel driver seems blocking the power-off on some
devices like eeepc.  Although this is likely a BIOS problem, we can add
a workaround by disabling IRQ lines before power-off operation.
This patch adds the reboot notifier to achieve it.

The detailed problem description is found in bug#11889:
    http://bugme.linux-foundation.org/show_bug.cgi?id=11889Tested-by: default avatarLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Cc: stable@kernel.org
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c1e99bd9
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/reboot.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/initval.h> #include <sound/initval.h>
#include "hda_codec.h" #include "hda_codec.h"
...@@ -397,6 +398,9 @@ struct azx { ...@@ -397,6 +398,9 @@ struct azx {
/* for pending irqs */ /* for pending irqs */
struct work_struct irq_pending_work; struct work_struct irq_pending_work;
/* reboot notifier (for mysterious hangup problem at power-down) */
struct notifier_block reboot_notifier;
}; };
/* driver types */ /* driver types */
...@@ -1978,6 +1982,28 @@ static int azx_resume(struct pci_dev *pci) ...@@ -1978,6 +1982,28 @@ static int azx_resume(struct pci_dev *pci)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
/*
* reboot notifier for hang-up problem at power-down
*/
static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf)
{
struct azx *chip = container_of(nb, struct azx, reboot_notifier);
azx_stop_chip(chip);
return NOTIFY_OK;
}
static void azx_notifier_register(struct azx *chip)
{
chip->reboot_notifier.notifier_call = azx_halt;
register_reboot_notifier(&chip->reboot_notifier);
}
static void azx_notifier_unregister(struct azx *chip)
{
if (chip->reboot_notifier.notifier_call)
unregister_reboot_notifier(&chip->reboot_notifier);
}
/* /*
* destructor * destructor
*/ */
...@@ -1985,6 +2011,8 @@ static int azx_free(struct azx *chip) ...@@ -1985,6 +2011,8 @@ static int azx_free(struct azx *chip)
{ {
int i; int i;
azx_notifier_unregister(chip);
if (chip->initialized) { if (chip->initialized) {
azx_clear_irq_pending(chip); azx_clear_irq_pending(chip);
for (i = 0; i < chip->num_streams; i++) for (i = 0; i < chip->num_streams; i++)
...@@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci, ...@@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
chip->running = 1; chip->running = 1;
power_down_all_codecs(chip); power_down_all_codecs(chip);
azx_notifier_register(chip);
dev++; dev++;
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment