aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-10-29 11:18:25 -0400
committerTakashi Iwai <tiwai@suse.de>2008-10-29 11:21:16 -0400
commit0cbf00980f0fc4cc064a15ab3dfce19b5fae9130 (patch)
tree83c3f27327a605f9c8d07fdf3579ee9f68b8ba96 /sound
parentc1e99bd9d6a0c82f4fa9078ed1f570e57b2f3944 (diff)
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=11889 Tested-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Cc: stable@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_intel.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9f316c1b2790..c04ac38e2b2e 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -45,6 +45,7 @@
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48#include <linux/reboot.h>
48#include <sound/core.h> 49#include <sound/core.h>
49#include <sound/initval.h> 50#include <sound/initval.h>
50#include "hda_codec.h" 51#include "hda_codec.h"
@@ -397,6 +398,9 @@ struct azx {
397 398
398 /* for pending irqs */ 399 /* for pending irqs */
399 struct work_struct irq_pending_work; 400 struct work_struct irq_pending_work;
401
402 /* reboot notifier (for mysterious hangup problem at power-down) */
403 struct notifier_block reboot_notifier;
400}; 404};
401 405
402/* driver types */ 406/* driver types */
@@ -1979,12 +1983,36 @@ static int azx_resume(struct pci_dev *pci)
1979 1983
1980 1984
1981/* 1985/*
1986 * reboot notifier for hang-up problem at power-down
1987 */
1988static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf)
1989{
1990 struct azx *chip = container_of(nb, struct azx, reboot_notifier);
1991 azx_stop_chip(chip);
1992 return NOTIFY_OK;
1993}
1994
1995static void azx_notifier_register(struct azx *chip)
1996{
1997 chip->reboot_notifier.notifier_call = azx_halt;
1998 register_reboot_notifier(&chip->reboot_notifier);
1999}
2000
2001static void azx_notifier_unregister(struct azx *chip)
2002{
2003 if (chip->reboot_notifier.notifier_call)
2004 unregister_reboot_notifier(&chip->reboot_notifier);
2005}
2006
2007/*
1982 * destructor 2008 * destructor
1983 */ 2009 */
1984static int azx_free(struct azx *chip) 2010static int azx_free(struct azx *chip)
1985{ 2011{
1986 int i; 2012 int i;
1987 2013
2014 azx_notifier_unregister(chip);
2015
1988 if (chip->initialized) { 2016 if (chip->initialized) {
1989 azx_clear_irq_pending(chip); 2017 azx_clear_irq_pending(chip);
1990 for (i = 0; i < chip->num_streams; i++) 2018 for (i = 0; i < chip->num_streams; i++)
@@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
2348 pci_set_drvdata(pci, card); 2376 pci_set_drvdata(pci, card);
2349 chip->running = 1; 2377 chip->running = 1;
2350 power_down_all_codecs(chip); 2378 power_down_all_codecs(chip);
2379 azx_notifier_register(chip);
2351 2380
2352 dev++; 2381 dev++;
2353 return err; 2382 return err;