Skip to content

Commit 0051027

Browse files
tmlindrobertfoss
authored andcommitted
drm/bridge: tc358775: Get bridge data lanes instead of the DSI host lanes
The current code assumes the data-lanes property is configured on the DSI host side instead of the bridge side, and assumes DSI host endpoint 1. Let's standardize on what the other bridge drivers are doing and parse the data-lanes property for the bridge. Only if data-lanes property is not found, let's be nice and also check the DSI host for old dtb in use and warn. And as Dmitry pointed out, the lanes for the host and the bridge may be different because the lanes may be swapped on the host side. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Robert Foss <rfoss@kernel.org> Signed-off-by: Robert Foss <rfoss@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240225062008.33191-7-tony@atomide.com
1 parent 733daae commit 0051027

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

drivers/gpu/drm/bridge/tc358775.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -525,27 +525,24 @@ tc_mode_valid(struct drm_bridge *bridge,
525525
static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc)
526526
{
527527
struct device_node *endpoint;
528-
struct device_node *parent;
529528
struct device_node *remote;
530529
int dsi_lanes = -1;
531530

532-
/*
533-
* To get the data-lanes of dsi, we need to access the dsi0_out of port1
534-
* of dsi0 endpoint from bridge port0 of d2l_in
535-
*/
536531
endpoint = of_graph_get_endpoint_by_regs(tc->dev->of_node,
537532
TC358775_DSI_IN, -1);
538-
if (endpoint) {
539-
/* dsi0_out node */
540-
parent = of_graph_get_remote_port_parent(endpoint);
541-
of_node_put(endpoint);
542-
if (parent) {
543-
/* dsi0 port 1 */
544-
dsi_lanes = drm_of_get_data_lanes_count_ep(parent, 1, -1, 1, 4);
545-
of_node_put(parent);
546-
}
533+
dsi_lanes = drm_of_get_data_lanes_count(endpoint, 1, 4);
534+
535+
/* Quirk old dtb: Use data lanes from the DSI host side instead of bridge */
536+
if (dsi_lanes == -EINVAL || dsi_lanes == -ENODEV) {
537+
remote = of_graph_get_remote_endpoint(endpoint);
538+
dsi_lanes = drm_of_get_data_lanes_count(remote, 1, 4);
539+
of_node_put(remote);
540+
if (dsi_lanes >= 1)
541+
dev_warn(tc->dev, "no dsi-lanes for the bridge, using host lanes\n");
547542
}
548543

544+
of_node_put(endpoint);
545+
549546
if (dsi_lanes < 0)
550547
return dsi_lanes;
551548

0 commit comments

Comments
 (0)