• Takashi Iwai's avatar
    drm/radeon: Add HD-audio component notifier support (v6) · 20ea3471
    Takashi Iwai authored
    This patch adds the support for the notification of HD-audio hotplug
    via the already existing drm_audio_component framework to radeon
    driver.  This allows us more reliable hotplug notification and ELD
    transfer without accessing HD-audio bus; it's more efficient, and more
    importantly, it works without waking up the runtime PM.
    
    The implementation is rather simplistic: radeon driver provides the
    get_eld ops for HD-audio, and it notifies the audio hotplug via
    pin_eld_notify callback upon each radeon_audio_enable() call.
    The pin->id is referred as the port number passed to the notifier
    callback, and the corresponding connector is looked through the
    encoder list in the get_eld callback in turn.
    
    The bind and unbind callbacks handle the device-link so that it
    assures the PM call order.
    
    Also, as a gratis bonus, this patch "fixes" the regression by the
    recent change in HD-audio to be more strict for the HDMI/DP
    connection, too.  Since the HD-audio HDMI/DP codec requires both the
    connection bit and the valid ELD to be provided, it started failing on
    some RADEON gfx boards where the ELD update performed instably.  As
    this change switches the communication to a direct way between the
    audio and the graphics drivers, now the system receives the proper
    ELD, and the HDMI/DP hotplug starts working again.
    
    [ v2: fix the logic in radeon_audio_component_get_eld to walk the
      connector list since that is where the EDID lives and we can
      derive the encoder from the connector because the encoder has
      not been assigned at this point (i.e., during monitor probe).
    
      v3: the component binding is moved outside radeon_audio_init() and
      _fini(), as those are called from suspend/resume, too.
      Drop modeset lock calls that caused Oops.
      Moved Kconfig change so that it can be applied on older kernels.
    
      v4: revive drm_modeset_lock*() again, add the missing
      device_link_remove() call at unbinding
    
      v5: squash in mutex fix
    
      v6: squash in fix for audio get_eld callback ]
    
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1569Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    20ea3471
radeon_audio.c 25.4 KB