The panel bridge attach hook calls the connector's reset function to
initialize the connector state when the device is already registered.

Now that connectors are being migrated from the reset hook to
atomic_create_state, prefer it over reset and fall back to the reset
hook if atomic_create_state is not implemented.

Signed-off-by: Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/drm_panel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index c00529bfb706..c9f49e18890a 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -102,12 +102,22 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
        drm_panel_bridge_set_orientation(connector, bridge);
 
        drm_connector_attach_encoder(connector, encoder);
 
        if (bridge->dev->registered) {
-               if (connector->funcs->reset)
+               if (connector->funcs->atomic_create_state) {
+                       struct drm_connector_state *conn_state;
+
+                       conn_state = 
connector->funcs->atomic_create_state(connector);
+                       if (IS_ERR(conn_state))
+                               return PTR_ERR(conn_state);
+
+                       connector->state = conn_state;
+               } else if (connector->funcs->reset) {
                        connector->funcs->reset(connector);
+               }
+
                drm_connector_register(connector);
        }
 
        return 0;
 }

-- 
2.55.0

Reply via email to