• Maxime Ripard's avatar
    drm/vc4: hdmi: Reset link on hotplug · 6bed2ea3
    Maxime Ripard authored
    During a hotplug cycle (such as a TV going out of suspend, or when the
    cable is disconnected and reconnected), the expectation is that the same
    state used before the disconnection is reused until the next commit.
    
    However, the HDMI scrambling requires that some flags are set in the
    monitor, and those flags are very likely to be reset when the cable has
    been disconnected. This will thus result in a blank display, even if the
    display pipeline configuration hasn't been modified or is in the exact
    same state.
    
    The solution we've had so far is to enable the scrambling-related bits
    again on reconnection, but the HDMI 2.0 specification (Section 6.1.3.1 -
    Scrambling Control) requires that the scrambling enable bit is set
    before sending any scrambled video signal. Using that solution thus
    breaks that expectation.
    
    The solution used by i915 is to do a full modeset on the connector so
    that we disable the video signal, enable the scrambling bit, and enable
    the video signal again.
    
    As such, we took that code and plugged it into vc4. It probably could
    have been turned into an helper, but it proved to be difficult for
    several reasons:
    
      * i915 has fairly different structures than simpler KMS drivers such
        as vc4, so doing some code that works with both proved to be
        difficult;
    
      * Other simpler drivers could reuse some of it (tegra, dw-hdmi), but
        it would still require to move some parameters currently stored in
        private structure that are needed to compute whether the scrambling
        is needed or not, and then inform the driver that it needs to be
        enabled. Some of those parameters are already in core structures
        (drm_display_mode, drm_display_info, bpc), but the output format
        isnt't. Adding it is fairly challenging since unlike the TMDS char
        rate or mode, there's no consensus on what format to pick in
        drivers, so it's not possible to write some generic code that can
        depend on it.
    
    For these reasons, we chose to duplicate the code for now, until someone
    else really needs it as well, in which case we will be able to convert
    it into a generic helper.
    Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
    Link: https://lore.kernel.org/r/20220829134731.213478-8-maxime@cerno.tech
    6bed2ea3
vc4_hdmi.c 99.3 KB