[17/41] drm/bridge: analogix_dp: Don't use fast link training when panel just powered up
diff mbox

Message ID 20170310043305.17216-18-seanpaul@chromium.org
State New
Headers show

Commit Message

Sean Paul March 10, 2017, 4:32 a.m. UTC
From: zain wang <wzz@rock-chips.com>

Panel would reset it's setting when it power down. It would forget the last
successed link training setting. So we can't use the last successful link
training setting to do fast link training. Let's reset fast_train_enable in
analogix_dp_bridge_disable();

Cc: St├ęphane Marchesin <marcheu@chromium.org>
Signed-off-by: zain wang <wzz@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 9 +++++----
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Andrzej Hajda March 16, 2017, 2:34 p.m. UTC | #1
On 10.03.2017 05:32, Sean Paul wrote:
> From: zain wang <wzz@rock-chips.com>
>
> Panel would reset it's setting when it power down. It would forget the last
> successed link training setting. So we can't use the last successful link
> training setting to do fast link training. Let's reset fast_train_enable in
> analogix_dp_bridge_disable();

Period at the end. Please add info about renaming. Now I understand
similar patch about psr_enable, it confused me due to wrong description.

Regards
Andrzej

>
> Cc: St├ęphane Marchesin <marcheu@chromium.org>
> Signed-off-by: zain wang <wzz@rock-chips.com>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 9 +++++----
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 +-
>  2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 52218d743059..919ae68e7670 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -582,14 +582,14 @@ static int analogix_dp_process_equalizer_training(struct analogix_dp_device *dp)
>  		if (retval != 1) {
>  			dev_err(dp->dev, "failed to read downspread %d\n",
>  				retval);
> -			dp->fast_train_support = false;
> +			dp->fast_train_enable = false;
>  		} else {
> -			dp->fast_train_support =
> +			dp->fast_train_enable =
>  				(spread & DP_NO_AUX_HANDSHAKE_LINK_TRAINING) ?
>  					true : false;
>  		}
>  		dev_dbg(dp->dev, "fast link training %s\n",
> -			dp->fast_train_support ? "supported" : "unsupported");
> +			dp->fast_train_enable ? "supported" : "unsupported");
>  
>  		/* set enhanced mode if available */
>  		analogix_dp_set_enhanced_mode(dp);
> @@ -796,7 +796,7 @@ static int analogix_dp_fast_link_train(struct analogix_dp_device *dp)
>  
>  static int analogix_dp_train_link(struct analogix_dp_device *dp)
>  {
> -	if (dp->fast_train_support)
> +	if (dp->fast_train_enable)
>  		return analogix_dp_fast_link_train(dp);
>  
>  	return analogix_dp_full_link_train(dp, dp->video_info.max_lane_count,
> @@ -1200,6 +1200,7 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
>  		DRM_ERROR("failed to setup the panel ret = %d\n", ret);
>  
>  	dp->psr_enable = false;
> +	dp->fast_train_enable = false;
>  	dp->dpms_mode = DRM_MODE_DPMS_OFF;
>  }
>  
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
> index 6a96ef7e6934..403ff853464b 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
> @@ -173,7 +173,7 @@ struct analogix_dp_device {
>  	int			hpd_gpio;
>  	bool                    force_hpd;
>  	bool			psr_enable;
> -	bool			fast_train_support;
> +	bool			fast_train_enable;
>  
>  	struct mutex		panel_lock;
>  	bool			panel_is_modeset;

Patch
diff mbox

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 52218d743059..919ae68e7670 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -582,14 +582,14 @@  static int analogix_dp_process_equalizer_training(struct analogix_dp_device *dp)
 		if (retval != 1) {
 			dev_err(dp->dev, "failed to read downspread %d\n",
 				retval);
-			dp->fast_train_support = false;
+			dp->fast_train_enable = false;
 		} else {
-			dp->fast_train_support =
+			dp->fast_train_enable =
 				(spread & DP_NO_AUX_HANDSHAKE_LINK_TRAINING) ?
 					true : false;
 		}
 		dev_dbg(dp->dev, "fast link training %s\n",
-			dp->fast_train_support ? "supported" : "unsupported");
+			dp->fast_train_enable ? "supported" : "unsupported");
 
 		/* set enhanced mode if available */
 		analogix_dp_set_enhanced_mode(dp);
@@ -796,7 +796,7 @@  static int analogix_dp_fast_link_train(struct analogix_dp_device *dp)
 
 static int analogix_dp_train_link(struct analogix_dp_device *dp)
 {
-	if (dp->fast_train_support)
+	if (dp->fast_train_enable)
 		return analogix_dp_fast_link_train(dp);
 
 	return analogix_dp_full_link_train(dp, dp->video_info.max_lane_count,
@@ -1200,6 +1200,7 @@  static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
 		DRM_ERROR("failed to setup the panel ret = %d\n", ret);
 
 	dp->psr_enable = false;
+	dp->fast_train_enable = false;
 	dp->dpms_mode = DRM_MODE_DPMS_OFF;
 }
 
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
index 6a96ef7e6934..403ff853464b 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
@@ -173,7 +173,7 @@  struct analogix_dp_device {
 	int			hpd_gpio;
 	bool                    force_hpd;
 	bool			psr_enable;
-	bool			fast_train_support;
+	bool			fast_train_enable;
 
 	struct mutex		panel_lock;
 	bool			panel_is_modeset;