[PATCH/RFC 06/12] drm: rcar-du: lvds: Do not look at ports for identifying bridges

From: Fabrizio Castro
Date: Fri Aug 02 2019 - 03:35:08 EST


We may be connected to a dual LVDS display, therefore checking
if node != remote_input for identifying bridges is not going to
work anymore.
We could try to match the ports on the remote end to the LVDS
encoders, however the companion LVDS encoder instance doesn't
hold a reference to the primary LVDS encoder instance.
We know we could be connected to either a bridge, or a panel,
therefore look through the registered bridges and panels, until
we have a match.

Signed-off-by: Fabrizio Castro <fabrizio.castro@xxxxxxxxxxxxxx>
---
drivers/gpu/drm/rcar-du/rcar_lvds.c | 29 +++--------------------------
1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index c306fab..2d54ae5 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -711,10 +711,7 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds)
static int rcar_lvds_parse_dt(struct rcar_lvds *lvds)
{
struct device_node *local_output = NULL;
- struct device_node *remote_input = NULL;
struct device_node *remote = NULL;
- struct device_node *node;
- bool is_bridge = false;
int ret = 0;

local_output = of_graph_get_endpoint_by_regs(lvds->dev->of_node, 1, 0);
@@ -742,27 +739,8 @@ static int rcar_lvds_parse_dt(struct rcar_lvds *lvds)
goto done;
}

- remote_input = of_graph_get_remote_endpoint(local_output);
-
- for_each_endpoint_of_node(remote, node) {
- if (node != remote_input) {
- /*
- * We've found one endpoint other than the input, this
- * must be a bridge.
- */
- is_bridge = true;
- of_node_put(node);
- break;
- }
- }
-
- if (is_bridge) {
- lvds->next_bridge = of_drm_find_bridge(remote);
- if (!lvds->next_bridge) {
- ret = -EPROBE_DEFER;
- goto done;
- }
-
+ lvds->next_bridge = of_drm_find_bridge(remote);
+ if (lvds->next_bridge) {
if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK)
lvds->dual_link = lvds->next_bridge->timings
? lvds->next_bridge->timings->dual_link
@@ -770,7 +748,7 @@ static int rcar_lvds_parse_dt(struct rcar_lvds *lvds)
} else {
lvds->panel = of_drm_find_panel(remote);
if (IS_ERR(lvds->panel)) {
- ret = PTR_ERR(lvds->panel);
+ ret = -EPROBE_DEFER;
goto done;
}
}
@@ -784,7 +762,6 @@ static int rcar_lvds_parse_dt(struct rcar_lvds *lvds)

done:
of_node_put(local_output);
- of_node_put(remote_input);
of_node_put(remote);

switch (ret) {
--
2.7.4