Skip to content
  • Dave Airlie's avatar
    snd/hda: add runtime suspend/resume on optimus support (v4) · 246efa4a
    Dave Airlie authored
    
    
    Add support for HDMI audio device on VGA cards that powerdown
    to D3cold using non-standard ACPI/PCI infrastructure (optimus).
    
    This does a couple of things to make it work:
    
    a) add a set of power ops for the hdmi domain, and enables them
    via vga_switcheroo when we are a switcheroo controlled card. This
    just replaces the runtime resume operation so that when the card
    is in D3cold the userspace pci config space access via sysfs,
    the vga switcheroon runtime resume gets called first and it calls
    the GPU resume callback before calling the sound card runtime
    resume.
    
    b) standard ACPI/PCI stacks won't put a device into D3cold without
    an ACPI handle, but since the hdmi audio devices on gpus don't have
    an ACPI handle, we need to manually force the device into D3cold
    after suspend from the switcheroo path only.
    
    c) don't try and do runtime s/r when the GPU is off.
    
    d) call runtime suspend/resume during switcheroo suspend/resume
    this is to make sure the runtime stack knows to try and resume
    the hdmi audio device for pci config space access.
    
    v2: fix incorrect runtime call suspend->resume.
    
    v3: rework irq handler to avoid false irq when we are resuming
    but haven't runtime resumed yet, don't bother trying D3cold,
    it won't work, just set it manually ourselves, move runtime s/r
    calls outside the main s/r hook. enable dnyamic pm properly by
    dropping reference.
    
    v4: put back irq handler check just wrap it with cap check
    
    Acked-by: default avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    246efa4a