diff mbox

[v2,06/11] drm/i915: DSI pixel clock check

Message ID 1438238978-10638-7-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola July 30, 2015, 6:49 a.m. UTC
It is possible the we request to have a mode that has
higher pixel clock than our HW can support. This patch
checks if requested pixel clock is lower than the one
supported by the HW. The requested mode is discarded
if we cannot support the requested pixel clock.

This patch applies to DSI.

V2:
- removed computation for max pixel clock

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Chris Wilson July 30, 2015, 6:52 a.m. UTC | #1
On Thu, Jul 30, 2015 at 09:49:33AM +0300, Mika Kahola wrote:
> It is possible the we request to have a mode that has
> higher pixel clock than our HW can support. This patch
> checks if requested pixel clock is lower than the one
> supported by the HW. The requested mode is discarded
> if we cannot support the requested pixel clock.
> 
> This patch applies to DSI.
> 
> V2:
> - removed computation for max pixel clock
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dsi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 18dd7d7..2882978 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -654,6 +654,11 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>  {
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
> +	struct intel_encoder *intel_encoder = intel_connector->encoder;
> +	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&intel_encoder->base);
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = to_i915(dev);
> +	int max_pixclk = dev_priv->max_dotclk;

You only wanted i915, why all the extra steps?
	int max_pixclk = to_i915(connector->dev)->max_dotclk;
-Chris
Mika Kahola July 30, 2015, 10:39 a.m. UTC | #2
On Thu, 2015-07-30 at 07:52 +0100, Chris Wilson wrote:
> On Thu, Jul 30, 2015 at 09:49:33AM +0300, Mika Kahola wrote:
> > It is possible the we request to have a mode that has
> > higher pixel clock than our HW can support. This patch
> > checks if requested pixel clock is lower than the one
> > supported by the HW. The requested mode is discarded
> > if we cannot support the requested pixel clock.
> > 
> > This patch applies to DSI.
> > 
> > V2:
> > - removed computation for max pixel clock
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dsi.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> > index 18dd7d7..2882978 100644
> > --- a/drivers/gpu/drm/i915/intel_dsi.c
> > +++ b/drivers/gpu/drm/i915/intel_dsi.c
> > @@ -654,6 +654,11 @@ intel_dsi_mode_valid(struct drm_connector *connector,
> >  {
> >  	struct intel_connector *intel_connector = to_intel_connector(connector);
> >  	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
> > +	struct intel_encoder *intel_encoder = intel_connector->encoder;
> > +	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&intel_encoder->base);
> > +	struct drm_device *dev = intel_dsi->base.base.dev;
> > +	struct drm_i915_private *dev_priv = to_i915(dev);
> > +	int max_pixclk = dev_priv->max_dotclk;
> 
> You only wanted i915, why all the extra steps?
> 	int max_pixclk = to_i915(connector->dev)->max_dotclk;
There's really no need for all these steps. All I need to extract is the
max_dotclk and I could do that shorter. This is also applicable for
other patches in the series.

-Mika-

> -Chris
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 18dd7d7..2882978 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -654,6 +654,11 @@  intel_dsi_mode_valid(struct drm_connector *connector,
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
+	struct intel_encoder *intel_encoder = intel_connector->encoder;
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&intel_encoder->base);
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	int max_pixclk = dev_priv->max_dotclk;
 
 	DRM_DEBUG_KMS("\n");
 
@@ -669,6 +674,9 @@  intel_dsi_mode_valid(struct drm_connector *connector,
 			return MODE_PANEL;
 	}
 
+	if (mode->clock > max_pixclk)
+		return MODE_CLOCK_HIGH;
+
 	return MODE_OK;
 }