#ifdef CONFIG_SND_HDA_DSP_LOADER
        struct azx_dev saved_azx_dev;
 #endif
+
+       /* secondary power domain for hdmi audio under vga device */
+       struct dev_pm_domain hdmi_pm_domain;
 };
 
 #define CREATE_TRACE_POINTS
        int i, ok;
 
 #ifdef CONFIG_PM_RUNTIME
-       if (chip->pci->dev.power.runtime_status != RPM_ACTIVE)
-               return IRQ_NONE;
+       if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
+               if (chip->pci->dev.power.runtime_status != RPM_ACTIVE)
+                       return IRQ_NONE;
 #endif
 
        spin_lock(&chip->reg_lock);
        }
 
        status = azx_readl(chip, INTSTS);
-       if (status == 0) {
+       if (status == 0 || status == 0xffffffff) {
                spin_unlock(&chip->reg_lock);
                return IRQ_NONE;
        }
        struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip = card->private_data;
 
+       if (chip->disabled)
+               return 0;
+
+       if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
+               return 0;
+
        azx_stop_chip(chip);
        azx_enter_link_reset(chip);
        azx_clear_irq_pending(chip);
        struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip = card->private_data;
 
+       if (chip->disabled)
+               return 0;
+
+       if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
+               return 0;
+
        if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
                hda_display_power(true);
        azx_init_pci(chip);
        struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip = card->private_data;
 
+       if (chip->disabled)
+               return 0;
+
        if (!power_save_controller ||
            !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
                return -EBUSY;
                           "%s: %s via VGA-switcheroo\n", pci_name(chip->pci),
                           disabled ? "Disabling" : "Enabling");
                if (disabled) {
+                       pm_runtime_put_sync_suspend(&pci->dev);
                        azx_suspend(&pci->dev);
+                       /* when we get suspended by vga switcheroo we end up in D3cold,
+                        * however we have no ACPI handle, so pci/acpi can't put us there,
+                        * put ourselves there */
+                       pci->current_state = PCI_D3cold;
                        chip->disabled = true;
                        if (snd_hda_lock_devices(chip->bus))
                                snd_printk(KERN_WARNING SFX "%s: Cannot lock devices!\n",
                                           pci_name(chip->pci));
                } else {
                        snd_hda_unlock_devices(chip->bus);
+                       pm_runtime_get_noresume(&pci->dev);
                        chip->disabled = false;
                        azx_resume(&pci->dev);
                }
        if (err < 0)
                return err;
        chip->vga_switcheroo_registered = 1;
+
+       /* register as an optimus hdmi audio power domain */
+       vga_switcheroo_init_domain_pm_optimus_hdmi_audio(&chip->pci->dev, &chip->hdmi_pm_domain);
        return 0;
 }
 #else
        power_down_all_codecs(chip);
        azx_notifier_register(chip);
        azx_add_card_list(chip);
-       if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
+       if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || chip->use_vga_switcheroo)
                pm_runtime_put_noidle(&pci->dev);
 
        return 0;