Skip to contentSkip to conversation

drm/bridge/synopsys: dsi: add optional pixel clock

PATCH Superseded Philippe Cornu 3 participants 5 messages Oct 26, 2017 – Oct 27, 2017

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge/synopsys: dsi: add optional pixel clock

The pixel clock is optional. When available, it offers a better preciseness for timing computations.

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +18 -6
index d9cca4f..8b3787d 100644
@@ -225,6 +225,7 @@ struct dw_mipi_dsi {
 	void __iomem *base;
 
 	struct clk *pclk;
+	struct clk *px_clk;
 
 	unsigned int lane_mbps; /* per lane */
 	u32 channel;
@@ -753,24 +754,28 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 	struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
 	const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
 	void *priv_data = dsi->plat_data->priv_data;
+	struct drm_display_mode px_clk_mode = *mode;
 	int ret;
 
 	clk_prepare_enable(dsi->pclk);
 
-	ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags,
+	if (dsi->px_clk)
+		px_clk_mode.clock = clk_get_rate(dsi->px_clk) / 1000;
+
+	ret = phy_ops->get_lane_mbps(priv_data, &px_clk_mode, dsi->mode_flags,
 				     dsi->lanes, dsi->format, &dsi->lane_mbps);
 	if (ret)
 		DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n");
 
 	pm_runtime_get_sync(dsi->dev);
 	dw_mipi_dsi_init(dsi);
-	dw_mipi_dsi_dpi_config(dsi, mode);
+	dw_mipi_dsi_dpi_config(dsi, &px_clk_mode);
 	dw_mipi_dsi_packet_handler_config(dsi);
 	dw_mipi_dsi_video_mode_config(dsi);
-	dw_mipi_dsi_video_packet_config(dsi, mode);
+	dw_mipi_dsi_video_packet_config(dsi, &px_clk_mode);
 	dw_mipi_dsi_command_mode_config(dsi);
-	dw_mipi_dsi_line_timer_config(dsi, mode);
-	dw_mipi_dsi_vertical_timing_config(dsi, mode);
+	dw_mipi_dsi_line_timer_config(dsi, &px_clk_mode);
+	dw_mipi_dsi_vertical_timing_config(dsi, &px_clk_mode);
 
 	dw_mipi_dsi_dphy_init(dsi);
 	dw_mipi_dsi_dphy_timing_config(dsi);
@@ -784,7 +789,7 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 
 	dw_mipi_dsi_dphy_enable(dsi);
 
-	dw_mipi_dsi_wait_for_two_frames(mode);
+	dw_mipi_dsi_wait_for_two_frames(&px_clk_mode);
 
 	/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */
 	dw_mipi_dsi_set_mode(dsi, 0);
@@ -878,6 +883,13 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge)
 		return ERR_PTR(ret);
 	}
 
+	dsi->px_clk = devm_clk_get(dev, "px_clk");
+	if (IS_ERR(dsi->px_clk)) {
+		ret = PTR_ERR(dsi->px_clk);
+		dev_dbg(dev, "Unable to get optional px_clk: %d\n", ret);
+		dsi->px_clk = NULL;
+	}
+
 	/*
 	 * Note that the reset was not defined in the initial device tree, so
 	 * we have to be prepared for it not being found.
Signature · 1 line
1.9.1
#1 lore raw
Quoted 25 lines · Philippe Cornu

The pixel clock is optional. When available, it offers a better preciseness for timing computations.

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -0
index d9cca4f..8b3787d 100644
@@ -225,6 +225,7 @@ struct dw_mipi_dsi {
 	void __iomem *base;
 
 	struct clk *pclk;
+	struct clk *px_clk;
 
 	unsigned int lane_mbps; /* per lane */
 	u32 channel;
@@ -753,24 +754,28 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 	struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
 	const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
 	void *priv_data = dsi->plat_data->priv_data;
+	struct drm_display_mode px_clk_mode = *mode;

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, · line 766

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +4 -1
 	int ret;
 
 	clk_prepare_enable(dsi->pclk);
 
-	ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags,
+	if (dsi->px_clk)
+		px_clk_mode.clock = clk_get_rate(dsi->px_clk) / 1000;
+
+	ret = phy_ops->get_lane_mbps(priv_data, &px_clk_mode, dsi->mode_flags,
 				     dsi->lanes, dsi->format, &dsi->lane_mbps);

Just small suggestion: if pixel clock rate matters, maybe better is to fix it in adjusted_mode in mode_fixup callback.

Quoted 29 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5 -5
 	if (ret)
 		DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n");
 
 	pm_runtime_get_sync(dsi->dev);
 	dw_mipi_dsi_init(dsi);
-	dw_mipi_dsi_dpi_config(dsi, mode);
+	dw_mipi_dsi_dpi_config(dsi, &px_clk_mode);
 	dw_mipi_dsi_packet_handler_config(dsi);
 	dw_mipi_dsi_video_mode_config(dsi);
-	dw_mipi_dsi_video_packet_config(dsi, mode);
+	dw_mipi_dsi_video_packet_config(dsi, &px_clk_mode);
 	dw_mipi_dsi_command_mode_config(dsi);
-	dw_mipi_dsi_line_timer_config(dsi, mode);
-	dw_mipi_dsi_vertical_timing_config(dsi, mode);
+	dw_mipi_dsi_line_timer_config(dsi, &px_clk_mode);
+	dw_mipi_dsi_vertical_timing_config(dsi, &px_clk_mode);
 
 	dw_mipi_dsi_dphy_init(dsi);
 	dw_mipi_dsi_dphy_timing_config(dsi);
@@ -784,7 +789,7 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 
 	dw_mipi_dsi_dphy_enable(dsi);
 
-	dw_mipi_dsi_wait_for_two_frames(mode);
+	dw_mipi_dsi_wait_for_two_frames(&px_clk_mode);
 
 	/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */
 	dw_mipi_dsi_set_mode(dsi, 0);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 892

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +7 -0
@@ -878,6 +883,13 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge)
 		return ERR_PTR(ret);
 	}
 
+	dsi->px_clk = devm_clk_get(dev, "px_clk");
+	if (IS_ERR(dsi->px_clk)) {
+		ret = PTR_ERR(dsi->px_clk);
+		dev_dbg(dev, "Unable to get optional px_clk: %d\n", ret);
+		dsi->px_clk = NULL;
+	}
+

devm_clk_get is called from bridge::attach callback, do we have guarantee that in ::detach callback the clock will be removed? And what if the clock is defined in dts, but it cannot be get due to other reasons? I guess the code should fail then, ie you should have different paths for -ENOENT and for other errors.

 --
Regards
Andrzej

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 895

Quoted 3 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
 	/*
 	 * Note that the reset was not defined in the initial device tree, so
 	 * we have to be prepared for it not being found.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Andrzej,

Quoted 30 lines · Andrzej Hajda
Quoted 29 lines · Philippe Cornu

The pixel clock is optional. When available, it offers a better preciseness for timing computations.

---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 24 ++++++++++++++++++------
  1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -0
index d9cca4f..8b3787d 100644
@@ -225,6 +225,7 @@ struct dw_mipi_dsi {
  	void __iomem *base;
 
  	struct clk *pclk;
+	struct clk *px_clk;
 
  	unsigned int lane_mbps; /* per lane */
  	u32 channel;
@@ -753,24 +754,28 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
  	struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
  	const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
  	void *priv_data = dsi->plat_data->priv_data;
+	struct drm_display_mode px_clk_mode = *mode;
  	int ret;
 
  	clk_prepare_enable(dsi->pclk);
 
Quoted 10 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, · line 766

Quoted 6 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +4 -1
-	ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags,
+	if (dsi->px_clk)
+		px_clk_mode.clock = clk_get_rate(dsi->px_clk) / 1000;
+
+	ret = phy_ops->get_lane_mbps(priv_data, &px_clk_mode, dsi->mode_flags,
  				     dsi->lanes, dsi->format, &dsi->lane_mbps);

Just small suggestion: if pixel clock rate matters, maybe better is to fix it in adjusted_mode in mode_fixup callback.

Well, it was my first idea but unfortunately, "_adjusted_" stuffs are not used by many drivers, and it means that other drivers using this generic dw dsi driver will have to handle the "_adjusted_" stuffs too in their own crtc or dsi specific parts...

So that is why I have chosen to use the "optional" pixel clock (as defined in the documentation): as it is optional, it is up to the "specific dt part" to use it or not, whatever the "crtc" driver (often handling the set rate, like in stm32 ltdc.c), avoiding then more patches in the specific parts and more importantly in the crtc parts...

What is your opinion then?

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5 -5
  	if (ret)
  		DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n");
 
  	pm_runtime_get_sync(dsi->dev);
  	dw_mipi_dsi_init(dsi);
-	dw_mipi_dsi_dpi_config(dsi, mode);
+	dw_mipi_dsi_dpi_config(dsi, &px_clk_mode);
  	dw_mipi_dsi_packet_handler_config(dsi);
  	dw_mipi_dsi_video_mode_config(dsi);
-	dw_mipi_dsi_video_packet_config(dsi, mode);
+	dw_mipi_dsi_video_packet_config(dsi, &px_clk_mode);
  	dw_mipi_dsi_command_mode_config(dsi);
-	dw_mipi_dsi_line_timer_config(dsi, mode);
-	dw_mipi_dsi_vertical_timing_config(dsi, mode);
+	dw_mipi_dsi_line_timer_config(dsi, &px_clk_mode);
+	dw_mipi_dsi_vertical_timing_config(dsi, &px_clk_mode);
 
  	dw_mipi_dsi_dphy_init(dsi);
  	dw_mipi_dsi_dphy_timing_config(dsi);
@@ -784,7 +789,7 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 
  	dw_mipi_dsi_dphy_enable(dsi);
 
-	dw_mipi_dsi_wait_for_two_frames(mode);
+	dw_mipi_dsi_wait_for_two_frames(&px_clk_mode);
 
  	/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */
  	dw_mipi_dsi_set_mode(dsi, 0);
@@ -878,6 +883,13 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge)
  		return ERR_PTR(ret);
  	}
 
Quoted 14 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 892

Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +7 -0
+	dsi->px_clk = devm_clk_get(dev, "px_clk");
+	if (IS_ERR(dsi->px_clk)) {
+		ret = PTR_ERR(dsi->px_clk);
+		dev_dbg(dev, "Unable to get optional px_clk: %d\n", ret);
+		dsi->px_clk = NULL;
+	}
+

devm_clk_get is called from bridge::attach callback, do we have guarantee that in ::detach callback the clock will be removed? And what if the clock is defined in dts, but it cannot be get due to other reasons? I guess the code should fail then, ie you should have different paths for -ENOENT and for other errors.

I will do more tests related to your above comments,

Many thanks for your comments and support,
Philippe :-)

Quoted 9 lines

 --
Regards
Andrzej

Quoted 3 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
  	/*
  	 * Note that the reset was not defined in the initial device tree, so
  	 * we have to be prepared for it not being found.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to Philippe Cornu

Hi Philippe,

Quoted 22 lines · Philippe Cornu

The pixel clock is optional. When available, it offers a better preciseness for timing computations.

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -0
index d9cca4f..8b3787d 100644
@@ -225,6 +225,7 @@ struct dw_mipi_dsi {
 	void __iomem *base;
 
 	struct clk *pclk;
+	struct clk *px_clk;
 
 	unsigned int lane_mbps; /* per lane */
 	u32 channel;
@@ -753,24 +754,28 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 	struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, · line 763

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +3 -1
 	const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
 	void *priv_data = dsi->plat_data->priv_data;
+	struct drm_display_mode px_clk_mode = *mode;
 	int ret;
 
 	clk_prepare_enable(dsi->pclk);
 
-	ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags,
+	if (dsi->px_clk)
+		px_clk_mode.clock = clk_get_rate(dsi->px_clk) / 1000;

I don't understand why is the pixel clock rate divided by 1000 different from the mode clock in the first place? If px_clk is just the DPI input pixel clock signal from the display controller, I'd expect the mode to be adjusted correctly.

Quoted 32 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +7 -5
+
+	ret = phy_ops->get_lane_mbps(priv_data, &px_clk_mode, dsi->mode_flags,
 				     dsi->lanes, dsi->format, &dsi->lane_mbps);
 	if (ret)
 		DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n");
 
 	pm_runtime_get_sync(dsi->dev);
 	dw_mipi_dsi_init(dsi);
-	dw_mipi_dsi_dpi_config(dsi, mode);
+	dw_mipi_dsi_dpi_config(dsi, &px_clk_mode);
 	dw_mipi_dsi_packet_handler_config(dsi);
 	dw_mipi_dsi_video_mode_config(dsi);
-	dw_mipi_dsi_video_packet_config(dsi, mode);
+	dw_mipi_dsi_video_packet_config(dsi, &px_clk_mode);
 	dw_mipi_dsi_command_mode_config(dsi);
-	dw_mipi_dsi_line_timer_config(dsi, mode);
-	dw_mipi_dsi_vertical_timing_config(dsi, mode);
+	dw_mipi_dsi_line_timer_config(dsi, &px_clk_mode);
+	dw_mipi_dsi_vertical_timing_config(dsi, &px_clk_mode);
 
 	dw_mipi_dsi_dphy_init(dsi);
 	dw_mipi_dsi_dphy_timing_config(dsi);
@@ -784,7 +789,7 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 
 	dw_mipi_dsi_dphy_enable(dsi);
 
-	dw_mipi_dsi_wait_for_two_frames(mode);
+	dw_mipi_dsi_wait_for_two_frames(&px_clk_mode);
 
 	/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */
 	dw_mipi_dsi_set_mode(dsi, 0);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 886

Quoted 4 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -0
@@ -878,6 +883,13 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge)
 		return ERR_PTR(ret);
 	}
 
+	dsi->px_clk = devm_clk_get(dev, "px_clk");

Is "px_clk" what the pixel clock is called in the datasheet?

If this is probed from DT, the new optional property must be documented in the binding docs.

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 888

Quoted 2 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -0
+	if (IS_ERR(dsi->px_clk)) {
+		ret = PTR_ERR(dsi->px_clk);

Better leave ret == 0 for -ENOENT, but return the error for all others.

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 895

Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +4 -0
+		dev_dbg(dev, "Unable to get optional px_clk: %d\n", ret);
+		dsi->px_clk = NULL;
+	}
+
 	/*
 	 * Note that the reset was not defined in the initial device tree, so
 	 * we have to be prepared for it not being found.

regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Hi Philipp,

Quoted 32 lines · Philipp Zabel

Hi Philippe,

Quoted 29 lines · Philippe Cornu

The pixel clock is optional. When available, it offers a better preciseness for timing computations.

---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 24 ++++++++++++++++++------
  1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -0
index d9cca4f..8b3787d 100644
@@ -225,6 +225,7 @@ struct dw_mipi_dsi {
  	void __iomem *base;
 
  	struct clk *pclk;
+	struct clk *px_clk;
 
  	unsigned int lane_mbps; /* per lane */
  	u32 channel;
@@ -753,24 +754,28 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
  	struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
  	const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
  	void *priv_data = dsi->plat_data->priv_data;
+	struct drm_display_mode px_clk_mode = *mode;
  	int ret;
 
  	clk_prepare_enable(dsi->pclk);
 
Quoted 9 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, · line 763

Quoted 3 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -1
-	ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags,
+	if (dsi->px_clk)
+		px_clk_mode.clock = clk_get_rate(dsi->px_clk) / 1000;

I don't understand why is the pixel clock rate divided by 1000 different from the mode clock in the first place? If px_clk is just the DPI input pixel clock signal from the display controller, I'd expect the mode to be adjusted correctly.

The display panel requests a given px clk frequency. Then, the set rate is performed by the "crtc" (ie. the display controller). Depending of the hw platform, the real frequency is different from the requested one as pll work with dividers (and sometimes pll are shared between several IPs adding more constraints...) so preciseness is not "perfect".

This preciseness is "hw platform dependent" that is why this px clock is used here only if the platform populates the related dt.

Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +7 -5
+
+	ret = phy_ops->get_lane_mbps(priv_data, &px_clk_mode, dsi->mode_flags,
  				     dsi->lanes, dsi->format, &dsi->lane_mbps);
  	if (ret)
  		DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n");
 
  	pm_runtime_get_sync(dsi->dev);
  	dw_mipi_dsi_init(dsi);
-	dw_mipi_dsi_dpi_config(dsi, mode);
+	dw_mipi_dsi_dpi_config(dsi, &px_clk_mode);
  	dw_mipi_dsi_packet_handler_config(dsi);
  	dw_mipi_dsi_video_mode_config(dsi);
-	dw_mipi_dsi_video_packet_config(dsi, mode);
+	dw_mipi_dsi_video_packet_config(dsi, &px_clk_mode);
  	dw_mipi_dsi_command_mode_config(dsi);
-	dw_mipi_dsi_line_timer_config(dsi, mode);
-	dw_mipi_dsi_vertical_timing_config(dsi, mode);
+	dw_mipi_dsi_line_timer_config(dsi, &px_clk_mode);
+	dw_mipi_dsi_vertical_timing_config(dsi, &px_clk_mode);
 
  	dw_mipi_dsi_dphy_init(dsi);
  	dw_mipi_dsi_dphy_timing_config(dsi);
@@ -784,7 +789,7 @@ void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
 
  	dw_mipi_dsi_dphy_enable(dsi);
 
-	dw_mipi_dsi_wait_for_two_frames(mode);
+	dw_mipi_dsi_wait_for_two_frames(&px_clk_mode);
 
  	/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */
  	dw_mipi_dsi_set_mode(dsi, 0);
@@ -878,6 +883,13 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge)
  		return ERR_PTR(ret);
  	}
 
Quoted 7 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 886

Quoted 1 line
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -0
+	dsi->px_clk = devm_clk_get(dev, "px_clk");

Is "px_clk" what the pixel clock is called in the datasheet?

If this is probed from DT, the new optional property must be documented in the binding docs.

The px clk (and "px_clk") are already documented in Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt as optional.

- "px_clk" is the pixel clock for the DPI/RGB input. (optional)

Do you think bindings is clear enough?

Quoted 5 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 888

Quoted 2 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -0
+	if (IS_ERR(dsi->px_clk)) {
+		ret = PTR_ERR(dsi->px_clk);

Better leave ret == 0 for -ENOENT, but return the error for all others.

Ok, I will do more test here.

Many thanks for your comments,
Philippe :-)

Quoted 11 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) · line 895

Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +4 -0
+		dev_dbg(dev, "Unable to get optional px_clk: %d\n", ret);
+		dsi->px_clk = NULL;
+	}
+
  	/*
  	 * Note that the reset was not defined in the initial device tree, so
  	 * we have to be prepared for it not being found.

regards
Philipp

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel