[ACPI] fix resume issues on Asus L5D
authorRafael J. Wysocki <rjwysocki@sisk.pl>
Sun, 24 Jul 2005 18:22:00 +0000 (14:22 -0400)
committerLen Brown <len.brown@intel.com>
Sat, 30 Jul 2005 02:04:26 +0000 (22:04 -0400)
http://bugzilla.kernel.org/show_bug.cgi?id=4416

Signed-off-by: Rafael J. Wysocki <rjwysocki@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/net/sk98lin/skge.c
drivers/pcmcia/yenta_socket.c
sound/pci/intel8x0.c

index 05b827f79f54a247232dc4280bebd12930595a28..7bfaef9305b29fa3ecd2e6ce15a4ea5375b5ad55 100644 (file)
@@ -5134,6 +5134,67 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
        kfree(pAC);
 }
 
+#ifdef CONFIG_PM
+static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+       struct net_device *dev = pci_get_drvdata(pdev);
+       DEV_NET *pNet = netdev_priv(dev);
+       SK_AC *pAC = pNet->pAC;
+       struct net_device *otherdev = pAC->dev[1];
+
+       if (pNet->Up) {
+               pAC->WasIfUp[0] = SK_TRUE;
+               DoPrintInterfaceChange = SK_FALSE;
+               SkDrvDeInitAdapter(pAC, 0);  /* performs SkGeClose */
+       }
+       if (otherdev != dev) {
+               pNet = netdev_priv(otherdev);
+               if (pNet->Up) {
+                       pAC->WasIfUp[1] = SK_TRUE;
+                       DoPrintInterfaceChange = SK_FALSE;
+                       SkDrvDeInitAdapter(pAC, 1);  /* performs SkGeClose */
+               }
+       }
+
+       pci_save_state(pdev);
+       pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
+       if (pAC->AllocFlag & SK_ALLOC_IRQ) {
+               free_irq(dev->irq, dev);
+       }
+       pci_disable_device(pdev);
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
+       return 0;
+}
+
+static int skge_resume(struct pci_dev *pdev)
+{
+       struct net_device *dev = pci_get_drvdata(pdev);
+       DEV_NET *pNet = netdev_priv(dev);
+       SK_AC *pAC = pNet->pAC;
+
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       pci_enable_device(pdev);
+       pci_set_master(pdev);
+       if (pAC->GIni.GIMacsFound == 2)
+               request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev);
+       else
+               request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev);
+
+        if (pAC->WasIfUp[0] == SK_TRUE) {
+               DoPrintInterfaceChange = SK_FALSE;
+               SkDrvInitAdapter(pAC, 0);    /* first device  */
+        }
+       if (pAC->dev[1] != dev && pAC->WasIfUp[1] == SK_TRUE) {
+               DoPrintInterfaceChange = SK_FALSE;
+               SkDrvInitAdapter(pAC, 1);    /* first device  */
+       }
+
+       return 0;
+}
+#endif
+
 static struct pci_device_id skge_pci_tbl[] = {
        { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
        { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -5159,6 +5220,8 @@ static struct pci_driver skge_driver = {
        .id_table       = skge_pci_tbl,
        .probe          = skge_probe_one,
        .remove         = __devexit_p(skge_remove_one),
+       .suspend        = skge_suspend,
+       .resume         = skge_resume,
 };
 
 static int __init skge_init(void)
index caf7159a54be7bff7a8ac1b9a9d16825e13968f5..a8a9d954bcf430225ba3a8dbf9d2541b29b71c39 100644 (file)
@@ -1034,6 +1034,8 @@ static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
                pci_read_config_dword(dev, 17*4, &socket->saved_state[1]);
                pci_disable_device(dev);
 
+               free_irq(dev->irq, socket);
+
                /*
                 * Some laptops (IBM T22) do not like us putting the Cardbus
                 * bridge into D3.  At a guess, some other laptop will
@@ -1059,6 +1061,13 @@ static int yenta_dev_resume (struct pci_dev *dev)
                pci_enable_device(dev);
                pci_set_master(dev);
 
+               if (socket->cb_irq)
+                       if (request_irq(socket->cb_irq, yenta_interrupt,
+                                       SA_SHIRQ, "yenta", socket)) {
+                               printk(KERN_WARNING "Yenta: request_irq() failed on resume!\n");
+                               socket->cb_irq = 0;
+                       }
+
                if (socket->type && socket->type->restore_state)
                        socket->type->restore_state(socket);
        }
index 8b33b12fa5dc7e65fa438efebcbdd88ab65be118..2a7e63b5757f42b54e10d2e0c125d04d5f795b66 100644 (file)
@@ -2367,6 +2367,8 @@ static int intel8x0_suspend(snd_card_t *card, pm_message_t state)
        for (i = 0; i < 3; i++)
                if (chip->ac97[i])
                        snd_ac97_suspend(chip->ac97[i]);
+       if (chip->irq >= 0)
+               free_irq(chip->irq, (void *)chip);
        pci_disable_device(chip->pci);
        return 0;
 }
@@ -2378,7 +2380,9 @@ static int intel8x0_resume(snd_card_t *card)
 
        pci_enable_device(chip->pci);
        pci_set_master(chip->pci);
-       snd_intel8x0_chip_init(chip, 0);
+       request_irq(chip->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip);
+       synchronize_irq(chip->irq);
+       snd_intel8x0_chip_init(chip, 1);
 
        /* refill nocache */
        if (chip->fix_nocache)