diff mbox series

[03/11] drm/bridge: icn6211: Convert to drm_of_get_data_lanes_ep

Message ID 20220519112657.62283-3-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series [01/11] drm: of: Add drm_of_get_data_lanes and drm_of_get_data_lanes_ep | expand

Commit Message

Marek Vasut May 19, 2022, 11:26 a.m. UTC
Convert driver to use this new helper to standardize
OF "data-lanes" parsing.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Andrzej Hajda May 23, 2022, 3:35 p.m. UTC | #1
On 19.05.2022 13:26, Marek Vasut wrote:
> Convert driver to use this new helper to standardize
> OF "data-lanes" parsing.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> To: dri-devel@lists.freedesktop.org
> ---
>   drivers/gpu/drm/bridge/chipone-icn6211.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)

For this and the rest:

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

>
> diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
> index 45bb89ac3fff7..e53a19f721c8c 100644
> --- a/drivers/gpu/drm/bridge/chipone-icn6211.c
> +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
> @@ -496,21 +496,18 @@ static int chipone_dsi_attach(struct chipone *icn)
>   {
>   	struct mipi_dsi_device *dsi = icn->dsi;
>   	struct device *dev = icn->dev;
> -	struct device_node *endpoint;
>   	int dsi_lanes, ret;
>   
> -	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
> -	dsi_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> -	of_node_put(endpoint);
> +	dsi_lanes = drm_of_get_data_lanes_ep(dev->of_node, 0, 0, 1, 4);
>   
>   	/*
>   	 * If the 'data-lanes' property does not exist in DT or is invalid,
>   	 * default to previously hard-coded behavior, which was 4 data lanes.
>   	 */
> -	if (dsi_lanes >= 1 && dsi_lanes <= 4)
> -		icn->dsi->lanes = dsi_lanes;
> -	else
> +	if (dsi_lanes < 0)
>   		icn->dsi->lanes = 4;
> +	else
> +		icn->dsi->lanes = dsi_lanes;
>   
>   	dsi->format = MIPI_DSI_FMT_RGB888;
>   	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
index 45bb89ac3fff7..e53a19f721c8c 100644
--- a/drivers/gpu/drm/bridge/chipone-icn6211.c
+++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
@@ -496,21 +496,18 @@  static int chipone_dsi_attach(struct chipone *icn)
 {
 	struct mipi_dsi_device *dsi = icn->dsi;
 	struct device *dev = icn->dev;
-	struct device_node *endpoint;
 	int dsi_lanes, ret;
 
-	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
-	dsi_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
-	of_node_put(endpoint);
+	dsi_lanes = drm_of_get_data_lanes_ep(dev->of_node, 0, 0, 1, 4);
 
 	/*
 	 * If the 'data-lanes' property does not exist in DT or is invalid,
 	 * default to previously hard-coded behavior, which was 4 data lanes.
 	 */
-	if (dsi_lanes >= 1 && dsi_lanes <= 4)
-		icn->dsi->lanes = dsi_lanes;
-	else
+	if (dsi_lanes < 0)
 		icn->dsi->lanes = 4;
+	else
+		icn->dsi->lanes = dsi_lanes;
 
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |