[PATCHv2,09/22] drm/bridge: tc358767: move PXL PLL enable/disable to stream enable/disable

Message ID 20190326103146.24795-10-tomi.valkeinen@ti.com
State Superseded
Headers show
Series
  • drm/bridge: tc358767: DP support
Related show

Commit Message

Tomi Valkeinen March 26, 2019, 10:31 a.m.
We set up the PXL PLL inside tc_main_link_setup. This is unnecessary,
and makes tc_main_link_setup depend on the video-mode, which should not
be the case. As PXL PLL is used only for the video stream (and only when
using the HW test pattern), let's move the PXL PLL setup into
tc_stream_enable.

Also, currently the PXL PLL is only disabled if the driver if removed.
Let's disable the PXL PLL when the stream is disabled.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/bridge/tc358767.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Andrzej Hajda April 15, 2019, 8:28 a.m. | #1
On 26.03.2019 11:31, Tomi Valkeinen wrote:
> We set up the PXL PLL inside tc_main_link_setup. This is unnecessary,
> and makes tc_main_link_setup depend on the video-mode, which should not
> be the case. As PXL PLL is used only for the video stream (and only when
> using the HW test pattern), let's move the PXL PLL setup into
> tc_stream_enable.
>
> Also, currently the PXL PLL is only disabled if the driver if removed.
> Let's disable the PXL PLL when the stream is disabled.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

 --
Regards
Andrzej
Laurent Pinchart April 20, 2019, 9:33 p.m. | #2
Hi Tomi,

Thank you for the patch.

On Tue, Mar 26, 2019 at 12:31:33PM +0200, Tomi Valkeinen wrote:
> We set up the PXL PLL inside tc_main_link_setup. This is unnecessary,
> and makes tc_main_link_setup depend on the video-mode, which should not
> be the case. As PXL PLL is used only for the video stream (and only when
> using the HW test pattern), let's move the PXL PLL setup into
> tc_stream_enable.
> 
> Also, currently the PXL PLL is only disabled if the driver if removed.
> Let's disable the PXL PLL when the stream is disabled.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/bridge/tc358767.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index bfc673bd5986..f8039149a4e8 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -877,14 +877,6 @@ static int tc_main_link_setup(struct tc_data *tc)
>  	tc_write(DP1_PLLCTRL, PLLUPDATE | PLLEN);
>  	tc_wait_pll_lock(tc);
>  
> -	/* PXL PLL setup */
> -	if (tc_test_pattern) {
> -		ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk),
> -				    1000 * tc->mode->clock);
> -		if (ret)
> -			goto err;
> -	}
> -
>  	/* Reset/Enable Main Links */
>  	dp_phy_ctrl |= DP_PHY_RST | PHY_M1_RST | PHY_M0_RST;
>  	tc_write(DP_PHY_CTRL, dp_phy_ctrl);
> @@ -1020,6 +1012,14 @@ static int tc_stream_enable(struct tc_data *tc)
>  
>  	dev_dbg(tc->dev, "stream enable\n");
>  
> +	/* PXL PLL setup */
> +	if (tc_test_pattern) {
> +		ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk),
> +				    1000 * tc->mode->clock);
> +		if (ret)
> +			goto err;
> +	}
> +
>  	ret = tc_set_video_mode(tc, tc->mode);
>  	if (ret)
>  		goto err;
> @@ -1064,6 +1064,8 @@ static int tc_stream_disable(struct tc_data *tc)
>  
>  	tc_write(DP0CTL, 0);
>  
> +	tc_pxl_pll_dis(tc);
> +
>  	return 0;
>  err:
>  	return ret;
> @@ -1390,8 +1392,6 @@ static int tc_remove(struct i2c_client *client)
>  	drm_bridge_remove(&tc->bridge);
>  	drm_dp_aux_unregister(&tc->aux);
>  
> -	tc_pxl_pll_dis(tc);
> -
>  	return 0;
>  }
>

Patch

diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index bfc673bd5986..f8039149a4e8 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -877,14 +877,6 @@  static int tc_main_link_setup(struct tc_data *tc)
 	tc_write(DP1_PLLCTRL, PLLUPDATE | PLLEN);
 	tc_wait_pll_lock(tc);
 
-	/* PXL PLL setup */
-	if (tc_test_pattern) {
-		ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk),
-				    1000 * tc->mode->clock);
-		if (ret)
-			goto err;
-	}
-
 	/* Reset/Enable Main Links */
 	dp_phy_ctrl |= DP_PHY_RST | PHY_M1_RST | PHY_M0_RST;
 	tc_write(DP_PHY_CTRL, dp_phy_ctrl);
@@ -1020,6 +1012,14 @@  static int tc_stream_enable(struct tc_data *tc)
 
 	dev_dbg(tc->dev, "stream enable\n");
 
+	/* PXL PLL setup */
+	if (tc_test_pattern) {
+		ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk),
+				    1000 * tc->mode->clock);
+		if (ret)
+			goto err;
+	}
+
 	ret = tc_set_video_mode(tc, tc->mode);
 	if (ret)
 		goto err;
@@ -1064,6 +1064,8 @@  static int tc_stream_disable(struct tc_data *tc)
 
 	tc_write(DP0CTL, 0);
 
+	tc_pxl_pll_dis(tc);
+
 	return 0;
 err:
 	return ret;
@@ -1390,8 +1392,6 @@  static int tc_remove(struct i2c_client *client)
 	drm_bridge_remove(&tc->bridge);
 	drm_dp_aux_unregister(&tc->aux);
 
-	tc_pxl_pll_dis(tc);
-
 	return 0;
 }