diff mbox

[RFC,1/2] drm/i915: shuffle panel code

Message ID 1398803449-27148-1-git-send-email-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula April 29, 2014, 8:30 p.m. UTC
Somehow a few functions have been dropped in the middle of backlight
code. Move them around. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 150 ++++++++++++++++++-------------------
 1 file changed, 75 insertions(+), 75 deletions(-)

Comments

Jesse Barnes May 20, 2014, 7 p.m. UTC | #1
On Tue, 29 Apr 2014 23:30:48 +0300
Jani Nikula <jani.nikula@intel.com> wrote:

> Somehow a few functions have been dropped in the middle of backlight
> code. Move them around. No functional changes.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_panel.c | 150 ++++++++++++++++++-------------------
>  1 file changed, 75 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 44ad415e3706..776249bab488 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -42,6 +42,59 @@ intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
>  	drm_mode_set_crtcinfo(adjusted_mode, 0);
>  }
>  
> +/**
> + * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
> + * @dev: drm device
> + * @fixed_mode : panel native mode
> + * @connector: LVDS/eDP connector
> + *
> + * Return downclock_avail
> + * Find the reduced downclock for LVDS/eDP in EDID.
> + */
> +struct drm_display_mode *
> +intel_find_panel_downclock(struct drm_device *dev,
> +			struct drm_display_mode *fixed_mode,
> +			struct drm_connector *connector)
> +{
> +	struct drm_display_mode *scan, *tmp_mode;
> +	int temp_downclock;
> +
> +	temp_downclock = fixed_mode->clock;
> +	tmp_mode = NULL;
> +
> +	list_for_each_entry(scan, &connector->probed_modes, head) {
> +		/*
> +		 * If one mode has the same resolution with the fixed_panel
> +		 * mode while they have the different refresh rate, it means
> +		 * that the reduced downclock is found. In such
> +		 * case we can set the different FPx0/1 to dynamically select
> +		 * between low and high frequency.
> +		 */
> +		if (scan->hdisplay == fixed_mode->hdisplay &&
> +		    scan->hsync_start == fixed_mode->hsync_start &&
> +		    scan->hsync_end == fixed_mode->hsync_end &&
> +		    scan->htotal == fixed_mode->htotal &&
> +		    scan->vdisplay == fixed_mode->vdisplay &&
> +		    scan->vsync_start == fixed_mode->vsync_start &&
> +		    scan->vsync_end == fixed_mode->vsync_end &&
> +		    scan->vtotal == fixed_mode->vtotal) {
> +			if (scan->clock < temp_downclock) {
> +				/*
> +				 * The downclock is already found. But we
> +				 * expect to find the lower downclock.
> +				 */
> +				temp_downclock = scan->clock;
> +				tmp_mode = scan;
> +			}
> +		}
> +	}
> +
> +	if (temp_downclock < fixed_mode->clock)
> +		return drm_mode_duplicate(dev, tmp_mode);
> +	else
> +		return NULL;
> +}
> +
>  /* adjusted_mode has been preset to be the panel's fixed mode */
>  void
>  intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
> @@ -323,6 +376,28 @@ out:
>  	pipe_config->gmch_pfit.lvds_border_bits = border;
>  }
>  
> +enum drm_connector_status
> +intel_panel_detect(struct drm_device *dev)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +
> +	/* Assume that the BIOS does not lie through the OpRegion... */
> +	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> +		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +			connector_status_connected :
> +			connector_status_disconnected;
> +	}
> +
> +	switch (i915.panel_ignore_lid) {
> +	case -2:
> +		return connector_status_connected;
> +	case -1:
> +		return connector_status_disconnected;
> +	default:
> +		return connector_status_unknown;
> +	}
> +}
> +
>  static u32 intel_panel_compute_brightness(struct intel_connector *connector,
>  					  u32 val)
>  {
> @@ -795,28 +870,6 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>  	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
>  }
>  
> -enum drm_connector_status
> -intel_panel_detect(struct drm_device *dev)
> -{
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	/* Assume that the BIOS does not lie through the OpRegion... */
> -	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> -			connector_status_connected :
> -			connector_status_disconnected;
> -	}
> -
> -	switch (i915.panel_ignore_lid) {
> -	case -2:
> -		return connector_status_connected;
> -	case -1:
> -		return connector_status_disconnected;
> -	default:
> -		return connector_status_unknown;
> -	}
> -}
> -
>  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
>  static int intel_backlight_device_update_status(struct backlight_device *bd)
>  {
> @@ -1103,59 +1156,6 @@ void intel_panel_destroy_backlight(struct drm_connector *connector)
>  	intel_backlight_device_unregister(intel_connector);
>  }
>  
> -/**
> - * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
> - * @dev: drm device
> - * @fixed_mode : panel native mode
> - * @connector: LVDS/eDP connector
> - *
> - * Return downclock_avail
> - * Find the reduced downclock for LVDS/eDP in EDID.
> - */
> -struct drm_display_mode *
> -intel_find_panel_downclock(struct drm_device *dev,
> -			struct drm_display_mode *fixed_mode,
> -			struct drm_connector *connector)
> -{
> -	struct drm_display_mode *scan, *tmp_mode;
> -	int temp_downclock;
> -
> -	temp_downclock = fixed_mode->clock;
> -	tmp_mode = NULL;
> -
> -	list_for_each_entry(scan, &connector->probed_modes, head) {
> -		/*
> -		 * If one mode has the same resolution with the fixed_panel
> -		 * mode while they have the different refresh rate, it means
> -		 * that the reduced downclock is found. In such
> -		 * case we can set the different FPx0/1 to dynamically select
> -		 * between low and high frequency.
> -		 */
> -		if (scan->hdisplay == fixed_mode->hdisplay &&
> -		    scan->hsync_start == fixed_mode->hsync_start &&
> -		    scan->hsync_end == fixed_mode->hsync_end &&
> -		    scan->htotal == fixed_mode->htotal &&
> -		    scan->vdisplay == fixed_mode->vdisplay &&
> -		    scan->vsync_start == fixed_mode->vsync_start &&
> -		    scan->vsync_end == fixed_mode->vsync_end &&
> -		    scan->vtotal == fixed_mode->vtotal) {
> -			if (scan->clock < temp_downclock) {
> -				/*
> -				 * The downclock is already found. But we
> -				 * expect to find the lower downclock.
> -				 */
> -				temp_downclock = scan->clock;
> -				tmp_mode = scan;
> -			}
> -		}
> -	}
> -
> -	if (temp_downclock < fixed_mode->clock)
> -		return drm_mode_duplicate(dev, tmp_mode);
> -	else
> -		return NULL;
> -}
> -
>  /* Set up chip specific backlight functions */
>  void intel_panel_init_backlight_funcs(struct drm_device *dev)
>  {

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Daniel Vetter May 20, 2014, 7:08 p.m. UTC | #2
On Tue, May 20, 2014 at 12:00:27PM -0700, Jesse Barnes wrote:
> On Tue, 29 Apr 2014 23:30:48 +0300
> Jani Nikula <jani.nikula@intel.com> wrote:
> 
> > Somehow a few functions have been dropped in the middle of backlight
> > code. Move them around. No functional changes.
> > 
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_panel.c | 150 ++++++++++++++++++-------------------
> >  1 file changed, 75 insertions(+), 75 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index 44ad415e3706..776249bab488 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -42,6 +42,59 @@ intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
> >  	drm_mode_set_crtcinfo(adjusted_mode, 0);
> >  }
> >  
> > +/**
> > + * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
> > + * @dev: drm device
> > + * @fixed_mode : panel native mode
> > + * @connector: LVDS/eDP connector
> > + *
> > + * Return downclock_avail
> > + * Find the reduced downclock for LVDS/eDP in EDID.
> > + */
> > +struct drm_display_mode *
> > +intel_find_panel_downclock(struct drm_device *dev,
> > +			struct drm_display_mode *fixed_mode,
> > +			struct drm_connector *connector)
> > +{
> > +	struct drm_display_mode *scan, *tmp_mode;
> > +	int temp_downclock;
> > +
> > +	temp_downclock = fixed_mode->clock;
> > +	tmp_mode = NULL;
> > +
> > +	list_for_each_entry(scan, &connector->probed_modes, head) {
> > +		/*
> > +		 * If one mode has the same resolution with the fixed_panel
> > +		 * mode while they have the different refresh rate, it means
> > +		 * that the reduced downclock is found. In such
> > +		 * case we can set the different FPx0/1 to dynamically select
> > +		 * between low and high frequency.
> > +		 */
> > +		if (scan->hdisplay == fixed_mode->hdisplay &&
> > +		    scan->hsync_start == fixed_mode->hsync_start &&
> > +		    scan->hsync_end == fixed_mode->hsync_end &&
> > +		    scan->htotal == fixed_mode->htotal &&
> > +		    scan->vdisplay == fixed_mode->vdisplay &&
> > +		    scan->vsync_start == fixed_mode->vsync_start &&
> > +		    scan->vsync_end == fixed_mode->vsync_end &&
> > +		    scan->vtotal == fixed_mode->vtotal) {
> > +			if (scan->clock < temp_downclock) {
> > +				/*
> > +				 * The downclock is already found. But we
> > +				 * expect to find the lower downclock.
> > +				 */
> > +				temp_downclock = scan->clock;
> > +				tmp_mode = scan;
> > +			}
> > +		}
> > +	}
> > +
> > +	if (temp_downclock < fixed_mode->clock)
> > +		return drm_mode_duplicate(dev, tmp_mode);
> > +	else
> > +		return NULL;
> > +}
> > +
> >  /* adjusted_mode has been preset to be the panel's fixed mode */
> >  void
> >  intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
> > @@ -323,6 +376,28 @@ out:
> >  	pipe_config->gmch_pfit.lvds_border_bits = border;
> >  }
> >  
> > +enum drm_connector_status
> > +intel_panel_detect(struct drm_device *dev)
> > +{
> > +	struct drm_i915_private *dev_priv = dev->dev_private;
> > +
> > +	/* Assume that the BIOS does not lie through the OpRegion... */
> > +	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > +		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > +			connector_status_connected :
> > +			connector_status_disconnected;
> > +	}
> > +
> > +	switch (i915.panel_ignore_lid) {
> > +	case -2:
> > +		return connector_status_connected;
> > +	case -1:
> > +		return connector_status_disconnected;
> > +	default:
> > +		return connector_status_unknown;
> > +	}
> > +}
> > +
> >  static u32 intel_panel_compute_brightness(struct intel_connector *connector,
> >  					  u32 val)
> >  {
> > @@ -795,28 +870,6 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
> >  	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> >  }
> >  
> > -enum drm_connector_status
> > -intel_panel_detect(struct drm_device *dev)
> > -{
> > -	struct drm_i915_private *dev_priv = dev->dev_private;
> > -
> > -	/* Assume that the BIOS does not lie through the OpRegion... */
> > -	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > -			connector_status_connected :
> > -			connector_status_disconnected;
> > -	}
> > -
> > -	switch (i915.panel_ignore_lid) {
> > -	case -2:
> > -		return connector_status_connected;
> > -	case -1:
> > -		return connector_status_disconnected;
> > -	default:
> > -		return connector_status_unknown;
> > -	}
> > -}
> > -
> >  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
> >  static int intel_backlight_device_update_status(struct backlight_device *bd)
> >  {
> > @@ -1103,59 +1156,6 @@ void intel_panel_destroy_backlight(struct drm_connector *connector)
> >  	intel_backlight_device_unregister(intel_connector);
> >  }
> >  
> > -/**
> > - * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
> > - * @dev: drm device
> > - * @fixed_mode : panel native mode
> > - * @connector: LVDS/eDP connector
> > - *
> > - * Return downclock_avail
> > - * Find the reduced downclock for LVDS/eDP in EDID.
> > - */
> > -struct drm_display_mode *
> > -intel_find_panel_downclock(struct drm_device *dev,
> > -			struct drm_display_mode *fixed_mode,
> > -			struct drm_connector *connector)
> > -{
> > -	struct drm_display_mode *scan, *tmp_mode;
> > -	int temp_downclock;
> > -
> > -	temp_downclock = fixed_mode->clock;
> > -	tmp_mode = NULL;
> > -
> > -	list_for_each_entry(scan, &connector->probed_modes, head) {
> > -		/*
> > -		 * If one mode has the same resolution with the fixed_panel
> > -		 * mode while they have the different refresh rate, it means
> > -		 * that the reduced downclock is found. In such
> > -		 * case we can set the different FPx0/1 to dynamically select
> > -		 * between low and high frequency.
> > -		 */
> > -		if (scan->hdisplay == fixed_mode->hdisplay &&
> > -		    scan->hsync_start == fixed_mode->hsync_start &&
> > -		    scan->hsync_end == fixed_mode->hsync_end &&
> > -		    scan->htotal == fixed_mode->htotal &&
> > -		    scan->vdisplay == fixed_mode->vdisplay &&
> > -		    scan->vsync_start == fixed_mode->vsync_start &&
> > -		    scan->vsync_end == fixed_mode->vsync_end &&
> > -		    scan->vtotal == fixed_mode->vtotal) {
> > -			if (scan->clock < temp_downclock) {
> > -				/*
> > -				 * The downclock is already found. But we
> > -				 * expect to find the lower downclock.
> > -				 */
> > -				temp_downclock = scan->clock;
> > -				tmp_mode = scan;
> > -			}
> > -		}
> > -	}
> > -
> > -	if (temp_downclock < fixed_mode->clock)
> > -		return drm_mode_duplicate(dev, tmp_mode);
> > -	else
> > -		return NULL;
> > -}
> > -
> >  /* Set up chip specific backlight functions */
> >  void intel_panel_init_backlight_funcs(struct drm_device *dev)
> >  {
> 
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Queued for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 44ad415e3706..776249bab488 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -42,6 +42,59 @@  intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
 }
 
+/**
+ * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
+ * @dev: drm device
+ * @fixed_mode : panel native mode
+ * @connector: LVDS/eDP connector
+ *
+ * Return downclock_avail
+ * Find the reduced downclock for LVDS/eDP in EDID.
+ */
+struct drm_display_mode *
+intel_find_panel_downclock(struct drm_device *dev,
+			struct drm_display_mode *fixed_mode,
+			struct drm_connector *connector)
+{
+	struct drm_display_mode *scan, *tmp_mode;
+	int temp_downclock;
+
+	temp_downclock = fixed_mode->clock;
+	tmp_mode = NULL;
+
+	list_for_each_entry(scan, &connector->probed_modes, head) {
+		/*
+		 * If one mode has the same resolution with the fixed_panel
+		 * mode while they have the different refresh rate, it means
+		 * that the reduced downclock is found. In such
+		 * case we can set the different FPx0/1 to dynamically select
+		 * between low and high frequency.
+		 */
+		if (scan->hdisplay == fixed_mode->hdisplay &&
+		    scan->hsync_start == fixed_mode->hsync_start &&
+		    scan->hsync_end == fixed_mode->hsync_end &&
+		    scan->htotal == fixed_mode->htotal &&
+		    scan->vdisplay == fixed_mode->vdisplay &&
+		    scan->vsync_start == fixed_mode->vsync_start &&
+		    scan->vsync_end == fixed_mode->vsync_end &&
+		    scan->vtotal == fixed_mode->vtotal) {
+			if (scan->clock < temp_downclock) {
+				/*
+				 * The downclock is already found. But we
+				 * expect to find the lower downclock.
+				 */
+				temp_downclock = scan->clock;
+				tmp_mode = scan;
+			}
+		}
+	}
+
+	if (temp_downclock < fixed_mode->clock)
+		return drm_mode_duplicate(dev, tmp_mode);
+	else
+		return NULL;
+}
+
 /* adjusted_mode has been preset to be the panel's fixed mode */
 void
 intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
@@ -323,6 +376,28 @@  out:
 	pipe_config->gmch_pfit.lvds_border_bits = border;
 }
 
+enum drm_connector_status
+intel_panel_detect(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* Assume that the BIOS does not lie through the OpRegion... */
+	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
+		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+			connector_status_connected :
+			connector_status_disconnected;
+	}
+
+	switch (i915.panel_ignore_lid) {
+	case -2:
+		return connector_status_connected;
+	case -1:
+		return connector_status_disconnected;
+	default:
+		return connector_status_unknown;
+	}
+}
+
 static u32 intel_panel_compute_brightness(struct intel_connector *connector,
 					  u32 val)
 {
@@ -795,28 +870,6 @@  void intel_panel_enable_backlight(struct intel_connector *connector)
 	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
 }
 
-enum drm_connector_status
-intel_panel_detect(struct drm_device *dev)
-{
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	/* Assume that the BIOS does not lie through the OpRegion... */
-	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
-			connector_status_connected :
-			connector_status_disconnected;
-	}
-
-	switch (i915.panel_ignore_lid) {
-	case -2:
-		return connector_status_connected;
-	case -1:
-		return connector_status_disconnected;
-	default:
-		return connector_status_unknown;
-	}
-}
-
 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 static int intel_backlight_device_update_status(struct backlight_device *bd)
 {
@@ -1103,59 +1156,6 @@  void intel_panel_destroy_backlight(struct drm_connector *connector)
 	intel_backlight_device_unregister(intel_connector);
 }
 
-/**
- * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
- * @dev: drm device
- * @fixed_mode : panel native mode
- * @connector: LVDS/eDP connector
- *
- * Return downclock_avail
- * Find the reduced downclock for LVDS/eDP in EDID.
- */
-struct drm_display_mode *
-intel_find_panel_downclock(struct drm_device *dev,
-			struct drm_display_mode *fixed_mode,
-			struct drm_connector *connector)
-{
-	struct drm_display_mode *scan, *tmp_mode;
-	int temp_downclock;
-
-	temp_downclock = fixed_mode->clock;
-	tmp_mode = NULL;
-
-	list_for_each_entry(scan, &connector->probed_modes, head) {
-		/*
-		 * If one mode has the same resolution with the fixed_panel
-		 * mode while they have the different refresh rate, it means
-		 * that the reduced downclock is found. In such
-		 * case we can set the different FPx0/1 to dynamically select
-		 * between low and high frequency.
-		 */
-		if (scan->hdisplay == fixed_mode->hdisplay &&
-		    scan->hsync_start == fixed_mode->hsync_start &&
-		    scan->hsync_end == fixed_mode->hsync_end &&
-		    scan->htotal == fixed_mode->htotal &&
-		    scan->vdisplay == fixed_mode->vdisplay &&
-		    scan->vsync_start == fixed_mode->vsync_start &&
-		    scan->vsync_end == fixed_mode->vsync_end &&
-		    scan->vtotal == fixed_mode->vtotal) {
-			if (scan->clock < temp_downclock) {
-				/*
-				 * The downclock is already found. But we
-				 * expect to find the lower downclock.
-				 */
-				temp_downclock = scan->clock;
-				tmp_mode = scan;
-			}
-		}
-	}
-
-	if (temp_downclock < fixed_mode->clock)
-		return drm_mode_duplicate(dev, tmp_mode);
-	else
-		return NULL;
-}
-
 /* Set up chip specific backlight functions */
 void intel_panel_init_backlight_funcs(struct drm_device *dev)
 {