diff mbox series

[2/2] drm/i915: Use intel_hdmi_port_clock() more

Message ID 20210204020846.2094-2-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915: Index min_{cdclk, voltage_level}[] with pipe | expand

Commit Message

Ville Syrjälä Feb. 4, 2021, 2:08 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the hand rolled intel_hdmi_port_clock() stuff
with the real thing.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_hdmi.c | 27 ++++++++++++-----------
 1 file changed, 14 insertions(+), 13 deletions(-)

Comments

Kahola, Mika Feb. 5, 2021, 1:50 p.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Thursday, February 4, 2021 4:09 AM
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 2/2] drm/i915: Use intel_hdmi_port_clock() more
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Replace the hand rolled intel_hdmi_port_clock() stuff with the real thing.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_hdmi.c | 27 ++++++++++++-----------
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c
> b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 66e1ac3887c6..457a16c8803a 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2229,6 +2229,16 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi,
>  	return MODE_OK;
>  }
> 
> +static int intel_hdmi_port_clock(int clock, int bpc) {
> +	/*
> +	 * Need to adjust the port link by:
> +	 *  1.5x for 12bpc
> +	 *  1.25x for 10bpc
> +	 */
> +	return clock * bpc / 8;
> +}
> +
>  static enum drm_mode_status
>  intel_hdmi_mode_valid(struct drm_connector *connector,
>  		      struct drm_display_mode *mode)
> @@ -2260,17 +2270,18 @@ intel_hdmi_mode_valid(struct drm_connector
> *connector,
>  		clock /= 2;
> 
>  	/* check if we can do 8bpc */
> -	status = hdmi_port_clock_valid(hdmi, clock, true, has_hdmi_sink);
> +	status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock,
> 8),
> +				       true, has_hdmi_sink);
> 
>  	if (has_hdmi_sink) {
>  		/* if we can't do 8bpc we may still be able to do 12bpc */
>  		if (status != MODE_OK && !HAS_GMCH(dev_priv))
> -			status = hdmi_port_clock_valid(hdmi, clock * 3 / 2,
> +			status = hdmi_port_clock_valid(hdmi,
> intel_hdmi_port_clock(clock,
> +12),
>  						       true, has_hdmi_sink);
> 
>  		/* if we can't do 8,12bpc we may still be able to do 10bpc */
>  		if (status != MODE_OK && INTEL_GEN(dev_priv) >= 11)
> -			status = hdmi_port_clock_valid(hdmi, clock * 5 / 4,
> +			status = hdmi_port_clock_valid(hdmi,
> intel_hdmi_port_clock(clock,
> +10),
>  						       true, has_hdmi_sink);
>  	}
>  	if (status != MODE_OK)
> @@ -2378,16 +2389,6 @@ intel_hdmi_ycbcr420_config(struct
> intel_crtc_state *crtc_state,
>  	return intel_pch_panel_fitting(crtc_state, conn_state);  }
> 
> -static int intel_hdmi_port_clock(int clock, int bpc) -{
> -	/*
> -	 * Need to adjust the port link by:
> -	 *  1.5x for 12bpc
> -	 *  1.25x for 10bpc
> -	 */
> -	return clock * bpc / 8;
> -}
> -
>  static int intel_hdmi_compute_bpc(struct intel_encoder *encoder,
>  				  struct intel_crtc_state *crtc_state,
>  				  int clock)
> --
> 2.26.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 66e1ac3887c6..457a16c8803a 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -2229,6 +2229,16 @@  hdmi_port_clock_valid(struct intel_hdmi *hdmi,
 	return MODE_OK;
 }
 
+static int intel_hdmi_port_clock(int clock, int bpc)
+{
+	/*
+	 * Need to adjust the port link by:
+	 *  1.5x for 12bpc
+	 *  1.25x for 10bpc
+	 */
+	return clock * bpc / 8;
+}
+
 static enum drm_mode_status
 intel_hdmi_mode_valid(struct drm_connector *connector,
 		      struct drm_display_mode *mode)
@@ -2260,17 +2270,18 @@  intel_hdmi_mode_valid(struct drm_connector *connector,
 		clock /= 2;
 
 	/* check if we can do 8bpc */
-	status = hdmi_port_clock_valid(hdmi, clock, true, has_hdmi_sink);
+	status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 8),
+				       true, has_hdmi_sink);
 
 	if (has_hdmi_sink) {
 		/* if we can't do 8bpc we may still be able to do 12bpc */
 		if (status != MODE_OK && !HAS_GMCH(dev_priv))
-			status = hdmi_port_clock_valid(hdmi, clock * 3 / 2,
+			status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 12),
 						       true, has_hdmi_sink);
 
 		/* if we can't do 8,12bpc we may still be able to do 10bpc */
 		if (status != MODE_OK && INTEL_GEN(dev_priv) >= 11)
-			status = hdmi_port_clock_valid(hdmi, clock * 5 / 4,
+			status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 10),
 						       true, has_hdmi_sink);
 	}
 	if (status != MODE_OK)
@@ -2378,16 +2389,6 @@  intel_hdmi_ycbcr420_config(struct intel_crtc_state *crtc_state,
 	return intel_pch_panel_fitting(crtc_state, conn_state);
 }
 
-static int intel_hdmi_port_clock(int clock, int bpc)
-{
-	/*
-	 * Need to adjust the port link by:
-	 *  1.5x for 12bpc
-	 *  1.25x for 10bpc
-	 */
-	return clock * bpc / 8;
-}
-
 static int intel_hdmi_compute_bpc(struct intel_encoder *encoder,
 				  struct intel_crtc_state *crtc_state,
 				  int clock)