• Douglas Anderson's avatar
    drm/bridge: ti-sn65dsi86: Use drm_bridge_connector · e283820c
    Douglas Anderson authored
    The ti-sn65dsi86 driver shouldn't hand-roll its own bridge
    connector. It should use the normal drm_bridge_connector. Let's switch
    to do that, removing all of the custom code.
    
    NOTE: this still _doesn't_ implement DRM_BRIDGE_ATTACH_NO_CONNECTOR
    support for ti-sn65dsi86 and that would still be a useful thing to do
    in the future. It was attempted in the past [1] but put on the back
    burner. However, unless we instantly change ti-sn65dsi86 fully from
    not supporting DRM_BRIDGE_ATTACH_NO_CONNECTOR at all to _only_
    supporting DRM_BRIDGE_ATTACH_NO_CONNECTOR then we'll still need a bit
    of time when we support both. This is a better way to support the old
    way where the driver hand rolls things itself.
    
    A new notes about the implementation here:
    * When using the drm_bridge_connector the connector should be created
      after all the bridges, so we change the ordering a bit.
    * I'm reasonably certain that we don't need to do anything to "free"
      the new drm_bridge_connector. If drm_bridge_connector_init() returns
      success then we know drm_connector_init() was called with the
      `drm_bridge_connector_funcs`. The `drm_bridge_connector_funcs` has a
      .destroy() that does all the cleanup. drm_connector_init() calls
      __drm_mode_object_add() with a drm_connector_free() that will call
      the .destroy().
    * I'm also reasonably certain that I don't need to "undo" the
      drm_bridge_attach() if drm_bridge_connector_init() fails. The
      "detach" function is private and other similar code doesn't try to
      undo the drm_bridge_attach() in error cases. There's also a comment
      indicating the lack of balance at the top of drm_bridge_attach().
    
    [1] https://lore.kernel.org/r/20210920225801.227211-4-robdclark@gmail.comSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
    Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220204161245.v2.1.I3ab26b7f197cc56c874246a43e57913e9c2c1028@changeid
    e283820c
ti-sn65dsi86.c 53.7 KB