• Takashi Iwai's avatar
    ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI · ade49db3
    Takashi Iwai authored
    AMD/ATI and Nvidia HDMI codec drivers didn't have the audio component
    binding like i915, but it worked only with the traditional HD-audio
    unsolicited event for the HDMI hotplug detection and the ELD read-up
    thereafter.  This has been a problem in many ways: first of all, it
    goes through the hardware event transition (from GPU register write,
    HD-audio controller trigger, and finally to HD-audio unsolicited event
    handling), which is often unreliable and may miss some opportunities.
    Second, each unsol event handling and ELD read-up need the explicit
    power up / down when the codec is in the runtime suspend.  Last but
    not least, which is the most important, the hotplug wakeup may be
    missed when the HD-audio controller is in runtime suspend.  Especially
    the last point is a big problem due to the recent change relevant with
    vga_switcheroo that forcibly enables the runtime PM for AMD HDMI
    controllers.
    
    These issues are solved by introducing the audio component; the
    hotplug notification is done by a direct function callback, which is
    more accurate and reliable, and it can be processed without the actual
    hardware access, i.e. no runtime PM trigger is needed, and the
    HD-audio gets the event even if it's in runtime suspend.  The same for
    ELD query, as it's read directly from the cached ELD bytes stored in
    the DRM driver, hence the whole hardware access can be skipped.
    
    So here it is: this patch implements the audio component binding with
    AMD/ATI and Nouveau DRM drivers.  The biggest difference from i915
    implementation is that this binding is fully optional and it can be
    enabled asynchronously on the fly.  That is, the driver will switch
    from the HD-audio unsolicited event to the notify callback once when
    the DRM component gets bound.  Similarly, when DRM driver gets
    unloaded, the HDMI event handling returns to the legacy mode, too.
    
    Also, another difference from i915 is that the new code registers the
    component in the codec driver, while i915 HDMI codec assumes the
    component binding was already done in the HD-audio controller driver.
    Hence the new code does need to de-register the component binding at
    the codec exit, too.
    
    Some other details:
    - The match component ops assumes that both VGA and HD-audio
      controller PCI entries belong to the same PCI bus, and only accepts
      such an entry.
    
    - The pin2port audio_ops is implemented with assumption of the fixed
      widget layout.  For AMD, it's starting from 3, with step 2 (3, 5, 7,
      ...), while for Nvidia, it's starting from 4, with step 1 (4, 5, 6,
      ...)
    
    As of this patch, the corresponding component isn't implemented in DRM
    side, so this change alone won't give any benefit.  By the following
    changes in DRM sides, the mission will be completed.
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    ade49db3
patch_hdmi.c 112 KB