From c13c691bd8826b978325575be9a87f577b83b86b Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
Date: Mon, 14 Aug 2023 13:02:23 +0300
Subject: [PATCH] drm/bridge: tc358768: fix 'Add DRM_BRIDGE_ATTACH_NO_CONNECTOR
support'
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/bridge/tc358768.c | 56 +++++++++++++------------------
1 file changed, 24 insertions(+), 32 deletions(-)
diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c
index 82ea4d9a814a..9705ce1bd028 100644
--- a/drivers/gpu/drm/bridge/tc358768.c
+++ b/drivers/gpu/drm/bridge/tc358768.c
@@ -455,8 +455,6 @@ static int tc358768_dsi_host_detach(struct mipi_dsi_host *host,
struct tc358768_priv *priv = dsi_host_to_tc358768(host);
drm_bridge_remove(&priv->bridge);
- if (priv->output.panel)
- drm_panel_bridge_remove(priv->output.next_bridge);
return 0;
}
@@ -531,49 +529,42 @@ static int tc358768_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
struct tc358768_priv *priv = bridge_to_tc358768(bridge);
+ struct drm_bridge *next_bridge;
+ struct drm_panel *panel;
+ int ret;
if (!drm_core_check_feature(bridge->dev, DRIVER_ATOMIC)) {
dev_err(priv->dev, "needs atomic updates support\n");
return -ENOTSUPP;
}
- if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
- struct device_node *node;
-
- /* Get the next bridge, connected to port@1. */
- node = of_graph_get_remote_node(priv->dev->of_node, 1, -1);
- if (!node)
- return -ENODEV;
-
- priv->output.next_bridge = of_drm_find_bridge(node);
- of_node_put(node);
- if (!priv->output.next_bridge)
- return -EPROBE_DEFER;
- } else {
- struct drm_bridge *bridge;
- struct drm_panel *panel;
- int ret;
-
- ret = drm_of_find_panel_or_bridge(priv->dev->of_node, 1, 0,
- &panel, &bridge);
- if (ret)
- return ret;
-
- if (panel) {
- bridge = drm_panel_bridge_add_typed(panel,
- DRM_MODE_CONNECTOR_DSI);
- if (IS_ERR(bridge))
- return PTR_ERR(bridge);
- }
+ ret = drm_of_find_panel_or_bridge(priv->dev->of_node, 1, -1, &panel,
+ &next_bridge);