From patchwork Sun Nov 26 16:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 747448 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=atomide.com header.i=@atomide.com header.b="IMfnWVio" Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D168DD7 for ; Sun, 26 Nov 2023 08:34:32 -0800 (PST) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id 13C0B60461; Sun, 26 Nov 2023 16:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701016472; bh=9i8b9tXyh1uDR+OQA6gU/NAtE3k4V7XC10gl799vQqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMfnWViolujDn0MfZMj3UnLY4R85WyrD+34DaiXlvGbPvIN9SLLra4j0TtlgeECUs OWkjzSx2y+p3I6nj2ojMY6OtT7cnGlwAUIYHFkbTXQJ28p1F+bMI+I7rgUhuboreB9 PwsTrRbCJOwMA7K8tt53Wl9SxOkOSN7l8epGwCe3wYXDWVhUe8cVTDiTzTHF7BQH8u ue6n4R7XD7IAIccB2D+v48MRACMVBUrkOc4cI6/U72ENN0Z9k+J/43oWmYIkWJDUkA dSGAFBzzLqPggezTXrRH+ZcK2fnyrESOmqvKr+ER0KgA1j6FmYmrA/YfOhIW+yCeqw OGjN4djTnuPEQ== From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , Vinay Simha BN Cc: Carl Philipp Klemm , Ivaylo Dimitrov , Merlijn Wajer , Pavel Machek , Sebastian Reichel , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH 2/6] drm/bridge: tc358775: Fix getting dsi host data lanes Date: Sun, 26 Nov 2023 18:32:37 +0200 Message-ID: <20231126163247.10131-2-tony@atomide.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231126163247.10131-1-tony@atomide.com> References: <20231126163247.10131-1-tony@atomide.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The current code assume hardcoded dsi host endpoint 1, which may not be the case. Let's fix that and simplify the code by getting the dsi endpoint with of_graph_get_remote_endpoint() that does not assume any endpoint numbering. Fixes: b26975593b17 ("display/drm/bridge: TC358775 DSI/LVDS driver") Signed-off-by: Tony Lindgren --- drivers/gpu/drm/bridge/tc358775.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -528,25 +528,17 @@ tc_mode_valid(struct drm_bridge *bridge, static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc) { struct device_node *endpoint; - struct device_node *parent; struct device_node *remote; int dsi_lanes = -1; - /* - * To get the data-lanes of dsi, we need to access the dsi0_out of port1 - * of dsi0 endpoint from bridge port0 of d2l_in - */ endpoint = of_graph_get_endpoint_by_regs(tc->dev->of_node, TC358775_DSI_IN, -1); if (endpoint) { - /* dsi0_out node */ - parent = of_graph_get_remote_port_parent(endpoint); + /* Get the configured data lanes on the dsi host side */ + remote = of_graph_get_remote_endpoint(endpoint); of_node_put(endpoint); - if (parent) { - /* dsi0 port 1 */ - dsi_lanes = drm_of_get_data_lanes_count_ep(parent, 1, -1, 1, 4); - of_node_put(parent); - } + dsi_lanes = drm_of_get_data_lanes_count(remote, 1, 4); + of_node_put(remote); } if (dsi_lanes < 0)