diff mbox series

[v2,2/4] drm/i915/display: Use intel_attached_dp instead of local implementation

Message ID 20240906070033.289015-3-jouni.hogander@intel.com (mailing list archive)
State New, archived
Headers show
Series DP2.1 Panel Replay Fixes | expand

Commit Message

Hogander, Jouni Sept. 6, 2024, 7 a.m. UTC
Link training code contains local "connector to intel_dp"
implementation. This was added due to missing MST handling in
intel_attached_dp. Missing MST support is now fixed in
intel_attached_dp. We can now change link training code to use that instead
of local intel_connector_to_intel_dp.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 .../drm/i915/display/intel_dp_link_training.c | 30 +++++++------------
 1 file changed, 11 insertions(+), 19 deletions(-)

Comments

Imre Deak Sept. 6, 2024, 10:51 a.m. UTC | #1
On Fri, Sep 06, 2024 at 10:00:31AM +0300, Jouni Högander wrote:
> Link training code contains local "connector to intel_dp"
> implementation. This was added due to missing MST handling in
> intel_attached_dp. Missing MST support is now fixed in
> intel_attached_dp. We can now change link training code to use that instead
> of local intel_connector_to_intel_dp.
> 
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  .../drm/i915/display/intel_dp_link_training.c | 30 +++++++------------
>  1 file changed, 11 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> index f45797c1a2051..28f6b7bb816e2 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> @@ -1679,19 +1679,11 @@ void intel_dp_128b132b_sdp_crc16(struct intel_dp *intel_dp,
>  	lt_dbg(intel_dp, DP_PHY_DPRX, "DP2.0 SDP CRC16 for 128b/132b enabled\n");
>  }
>  
> -static struct intel_dp *intel_connector_to_intel_dp(struct intel_connector *connector)
> -{
> -	if (connector->mst_port)
> -		return connector->mst_port;
> -	else
> -		return enc_to_intel_dp(intel_attached_encoder(connector));
> -}
> -
>  static int i915_dp_force_link_rate_show(struct seq_file *m, void *data)
>  {
>  	struct intel_connector *connector = to_intel_connector(m->private);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int current_rate = -1;
>  	int force_rate;
>  	int err;
> @@ -1762,7 +1754,7 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
>  	struct seq_file *m = file->private_data;
>  	struct intel_connector *connector = to_intel_connector(m->private);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int rate;
>  	int err;
>  
> @@ -1789,7 +1781,7 @@ static int i915_dp_force_lane_count_show(struct seq_file *m, void *data)
>  {
>  	struct intel_connector *connector = to_intel_connector(m->private);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int current_lane_count = -1;
>  	int force_lane_count;
>  	int err;
> @@ -1864,7 +1856,7 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
>  	struct seq_file *m = file->private_data;
>  	struct intel_connector *connector = to_intel_connector(m->private);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int lane_count;
>  	int err;
>  
> @@ -1891,7 +1883,7 @@ static int i915_dp_max_link_rate_show(void *data, u64 *val)
>  {
>  	struct intel_connector *connector = to_intel_connector(data);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> @@ -1910,7 +1902,7 @@ static int i915_dp_max_lane_count_show(void *data, u64 *val)
>  {
>  	struct intel_connector *connector = to_intel_connector(data);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> @@ -1929,7 +1921,7 @@ static int i915_dp_force_link_training_failure_show(void *data, u64 *val)
>  {
>  	struct intel_connector *connector = to_intel_connector(data);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> @@ -1947,7 +1939,7 @@ static int i915_dp_force_link_training_failure_write(void *data, u64 val)
>  {
>  	struct intel_connector *connector = to_intel_connector(data);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	if (val > 2)
> @@ -1971,7 +1963,7 @@ static int i915_dp_force_link_retrain_show(void *data, u64 *val)
>  {
>  	struct intel_connector *connector = to_intel_connector(data);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> @@ -1989,7 +1981,7 @@ static int i915_dp_force_link_retrain_write(void *data, u64 val)
>  {
>  	struct intel_connector *connector = to_intel_connector(data);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> @@ -2012,7 +2004,7 @@ static int i915_dp_link_retrain_disabled_show(struct seq_file *m, void *data)
>  {
>  	struct intel_connector *connector = to_intel_connector(m->private);
>  	struct intel_display *display = to_intel_display(connector);
> -	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	int err;
>  
>  	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index f45797c1a2051..28f6b7bb816e2 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1679,19 +1679,11 @@  void intel_dp_128b132b_sdp_crc16(struct intel_dp *intel_dp,
 	lt_dbg(intel_dp, DP_PHY_DPRX, "DP2.0 SDP CRC16 for 128b/132b enabled\n");
 }
 
-static struct intel_dp *intel_connector_to_intel_dp(struct intel_connector *connector)
-{
-	if (connector->mst_port)
-		return connector->mst_port;
-	else
-		return enc_to_intel_dp(intel_attached_encoder(connector));
-}
-
 static int i915_dp_force_link_rate_show(struct seq_file *m, void *data)
 {
 	struct intel_connector *connector = to_intel_connector(m->private);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int current_rate = -1;
 	int force_rate;
 	int err;
@@ -1762,7 +1754,7 @@  static ssize_t i915_dp_force_link_rate_write(struct file *file,
 	struct seq_file *m = file->private_data;
 	struct intel_connector *connector = to_intel_connector(m->private);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int rate;
 	int err;
 
@@ -1789,7 +1781,7 @@  static int i915_dp_force_lane_count_show(struct seq_file *m, void *data)
 {
 	struct intel_connector *connector = to_intel_connector(m->private);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int current_lane_count = -1;
 	int force_lane_count;
 	int err;
@@ -1864,7 +1856,7 @@  static ssize_t i915_dp_force_lane_count_write(struct file *file,
 	struct seq_file *m = file->private_data;
 	struct intel_connector *connector = to_intel_connector(m->private);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int lane_count;
 	int err;
 
@@ -1891,7 +1883,7 @@  static int i915_dp_max_link_rate_show(void *data, u64 *val)
 {
 	struct intel_connector *connector = to_intel_connector(data);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -1910,7 +1902,7 @@  static int i915_dp_max_lane_count_show(void *data, u64 *val)
 {
 	struct intel_connector *connector = to_intel_connector(data);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -1929,7 +1921,7 @@  static int i915_dp_force_link_training_failure_show(void *data, u64 *val)
 {
 	struct intel_connector *connector = to_intel_connector(data);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -1947,7 +1939,7 @@  static int i915_dp_force_link_training_failure_write(void *data, u64 val)
 {
 	struct intel_connector *connector = to_intel_connector(data);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	if (val > 2)
@@ -1971,7 +1963,7 @@  static int i915_dp_force_link_retrain_show(void *data, u64 *val)
 {
 	struct intel_connector *connector = to_intel_connector(data);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -1989,7 +1981,7 @@  static int i915_dp_force_link_retrain_write(void *data, u64 val)
 {
 	struct intel_connector *connector = to_intel_connector(data);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
@@ -2012,7 +2004,7 @@  static int i915_dp_link_retrain_disabled_show(struct seq_file *m, void *data)
 {
 	struct intel_connector *connector = to_intel_connector(m->private);
 	struct intel_display *display = to_intel_display(connector);
-	struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	int err;
 
 	err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);