public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 07/13] drm/i915: move backlight level setting in enable/disable to hooks
Date: Wed, 13 Nov 2013 00:01:44 +0200	[thread overview]
Message-ID: <1384293704.2462.41.camel@ideak-mobl> (raw)
In-Reply-To: <11ab63535e5b44a6a1372981226aea70a7a9f606.1383920621.git.jani.nikula@intel.com>

On Fri, 2013-11-08 at 16:48 +0200, Jani Nikula wrote:
> This allows more flexibility in the ordering of the register writes, and
> lets us drop level setting altogether as necessary on a per platform
> basis.
> 
> For gen2-gen3, this is the only thing that happens in enable/disable.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

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

> ---
>  drivers/gpu/drm/i915/intel_panel.c |   48 +++++++++++++++++++++++++++---------
>  1 file changed, 36 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 5bd64db..ed6b1ec 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -648,6 +648,8 @@ static void pch_disable_backlight(struct intel_connector *connector)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	u32 tmp;
>  
> +	intel_panel_actually_set_backlight(connector, 0);
> +
>  	tmp = I915_READ(BLC_PWM_CPU_CTL2);
>  	I915_WRITE(BLC_PWM_CPU_CTL2, tmp & ~BLM_PWM_ENABLE);
>  
> @@ -655,12 +657,19 @@ static void pch_disable_backlight(struct intel_connector *connector)
>  	I915_WRITE(BLC_PWM_PCH_CTL1, tmp & ~BLM_PCH_PWM_ENABLE);
>  }
>  
> +static void i9xx_disable_backlight(struct intel_connector *connector)
> +{
> +	intel_panel_actually_set_backlight(connector, 0);
> +}
> +
>  static void i965_disable_backlight(struct intel_connector *connector)
>  {
>  	struct drm_device *dev = connector->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	u32 tmp;
>  
> +	intel_panel_actually_set_backlight(connector, 0);
> +
>  	tmp = I915_READ(BLC_PWM_CTL2);
>  	I915_WRITE(BLC_PWM_CTL2, tmp & ~BLM_PWM_ENABLE);
>  }
> @@ -672,6 +681,8 @@ static void vlv_disable_backlight(struct intel_connector *connector)
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
>  	u32 tmp;
>  
> +	intel_panel_actually_set_backlight(connector, 0);
> +
>  	tmp = I915_READ(VLV_BLC_PWM_CTL2(pipe));
>  	I915_WRITE(VLV_BLC_PWM_CTL2(pipe), tmp & ~BLM_PWM_ENABLE);
>  }
> @@ -701,10 +712,7 @@ void intel_panel_disable_backlight(struct intel_connector *connector)
>  	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
>  
>  	panel->backlight.enabled = false;
> -	intel_panel_actually_set_backlight(connector, 0);
> -
> -	if (dev_priv->display.disable_backlight)
> -		dev_priv->display.disable_backlight(connector);
> +	dev_priv->display.disable_backlight(connector);
>  
>  	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
>  }
> @@ -713,6 +721,7 @@ static void pch_enable_backlight(struct intel_connector *connector)
>  {
>  	struct drm_device *dev = connector->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
>  	enum transcoder cpu_transcoder =
>  		intel_pipe_to_cpu_transcoder(dev_priv, pipe);
> @@ -747,12 +756,27 @@ static void pch_enable_backlight(struct intel_connector *connector)
>  		tmp &= ~BLM_PCH_OVERRIDE_ENABLE;
>  		I915_WRITE(BLC_PWM_PCH_CTL1, tmp);
>  	}
> +
> +	/*
> +	 * Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
> +	 * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
> +	 * registers are set.
> +	 */
> +	intel_panel_actually_set_backlight(connector, panel->backlight.level);
> +}
> +
> +static void i9xx_enable_backlight(struct intel_connector *connector)
> +{
> +	struct intel_panel *panel = &connector->panel;
> +
> +	intel_panel_actually_set_backlight(connector, panel->backlight.level);
>  }
>  
>  static void i965_enable_backlight(struct intel_connector *connector)
>  {
>  	struct drm_device *dev = connector->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
>  	u32 tmp;
>  
> @@ -771,12 +795,15 @@ static void i965_enable_backlight(struct intel_connector *connector)
>  	I915_WRITE(BLC_PWM_CTL2, tmp);
>  	POSTING_READ(BLC_PWM_CTL2);
>  	I915_WRITE(BLC_PWM_CTL2, tmp | BLM_PWM_ENABLE);
> +
> +	intel_panel_actually_set_backlight(connector, panel->backlight.level);
>  }
>  
>  static void vlv_enable_backlight(struct intel_connector *connector)
>  {
>  	struct drm_device *dev = connector->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
>  	u32 tmp;
>  
> @@ -793,6 +820,8 @@ static void vlv_enable_backlight(struct intel_connector *connector)
>  	I915_WRITE(VLV_BLC_PWM_CTL2(pipe), tmp);
>  	POSTING_READ(VLV_BLC_PWM_CTL2(pipe));
>  	I915_WRITE(VLV_BLC_PWM_CTL2(pipe), tmp | BLM_PWM_ENABLE);
> +
> +	intel_panel_actually_set_backlight(connector, panel->backlight.level);
>  }
>  
>  void intel_panel_enable_backlight(struct intel_connector *connector)
> @@ -817,15 +846,8 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>  				panel->backlight.level;
>  	}
>  
> -	if (dev_priv->display.enable_backlight)
> -		dev_priv->display.enable_backlight(connector);
> -
> -	/* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
> -	 * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
> -	 * registers are set.
> -	 */
> +	dev_priv->display.enable_backlight(connector);
>  	panel->backlight.enabled = true;
> -	intel_panel_actually_set_backlight(connector, panel->backlight.level);
>  
>  	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
>  }
> @@ -1080,6 +1102,8 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev)
>  		dev_priv->display.get_max_backlight = i965_get_max_backlight;
>  	} else {
>  		dev_priv->display.setup_backlight = i9xx_setup_backlight;
> +		dev_priv->display.enable_backlight = i9xx_enable_backlight;
> +		dev_priv->display.disable_backlight = i9xx_disable_backlight;
>  		dev_priv->display.set_backlight = i9xx_set_backlight;
>  		dev_priv->display.get_backlight = i9xx_get_backlight;
>  		dev_priv->display.get_max_backlight = i9xx_get_max_backlight;

  reply	other threads:[~2013-11-12 22:02 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 14:48 [PATCH 00/13] drm/i915: backlight rewrite Jani Nikula
2013-11-08 14:48 ` [PATCH 01/13] drm/i915: clean up backlight conditional build Jani Nikula
2013-11-12 21:23   ` Imre Deak
2013-11-08 14:48 ` [PATCH 02/13] drm/i915: make backlight info per-connector Jani Nikula
2013-11-12 21:29   ` Imre Deak
2013-11-08 14:48 ` [PATCH 03/13] drm/i915: make asle notifications update backlight on all connectors Jani Nikula
2013-11-12 21:29   ` Imre Deak
2013-11-08 14:48 ` [PATCH 04/13] drm/i915: handle backlight through chip specific functions Jani Nikula
2013-11-12 21:36   ` Imre Deak
2013-11-12 23:19     ` Daniel Vetter
2013-11-08 14:48 ` [PATCH 05/13] drm/i915: fix gen2-gen3 backlight set Jani Nikula
2013-11-12 22:00   ` Imre Deak
2013-11-13  8:27     ` Jani Nikula
2013-11-13  9:04       ` Daniel Vetter
2013-11-13  9:12       ` Imre Deak
2013-11-08 14:48 ` [PATCH 06/13] drm/i915: vlv does not have pipe field in backlight registers Jani Nikula
2013-11-12 22:00   ` Imre Deak
2013-11-08 14:48 ` [PATCH 07/13] drm/i915: move backlight level setting in enable/disable to hooks Jani Nikula
2013-11-12 22:01   ` Imre Deak [this message]
2013-11-08 14:49 ` [PATCH 08/13] drm/i915: use the initialized backlight max value instead of reading it Jani Nikula
2013-11-12 22:42   ` Imre Deak
2013-11-13  8:39     ` Jani Nikula
2013-11-13  9:12       ` Daniel Vetter
2013-11-08 14:49 ` [PATCH 09/13] drm/i915: debug print on backlight register Jani Nikula
2013-11-12 22:48   ` Imre Deak
2013-11-13 10:22     ` Daniel Vetter
2013-11-08 14:49 ` [PATCH 10/13] drm/i915: gather backlight information at setup Jani Nikula
2013-11-13 17:01   ` Imre Deak
2013-11-14  5:19     ` Jani Nikula
2013-11-14  8:22       ` Imre Deak
2013-11-08 14:49 ` [PATCH 11/13] drm/i915: do full backlight setup at enable time Jani Nikula
2013-11-13 17:53   ` Imre Deak
2013-11-14  5:43     ` Jani Nikula
2013-11-14  8:27       ` Daniel Vetter
2013-11-14  8:28       ` Imre Deak
2013-11-14 10:13   ` [PATCH v2 " Jani Nikula
2013-11-14 10:46     ` Imre Deak
2013-11-14 10:14   ` [PATCH 11.5/13] drm/i915: remove QUIRK_NO_PCH_PWM_ENABLE Jani Nikula
2013-11-14 10:50     ` Imre Deak
2013-11-08 14:49 ` [PATCH 12/13] drm/i915: nuke get max backlight functions Jani Nikula
2013-11-13 17:54   ` Imre Deak
2013-11-08 14:49 ` [PATCH 13/13] drm/i915: do not save/restore backlight registers Jani Nikula
2013-11-12 23:25   ` Daniel Vetter
2013-11-13  8:40     ` Jani Nikula
2013-11-13 10:56     ` [PATCH v2] drm/i915: do not save/restore backlight registers in KMS Jani Nikula
2013-11-13 18:05       ` Imre Deak
2013-11-14 11:22         ` Daniel Vetter
2013-11-11  8:36 ` [PATCH 00/13] drm/i915: backlight rewrite Jani Nikula
2013-11-12 21:22 ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384293704.2462.41.camel@ideak-mobl \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox