All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915/vlv: use min brightness from VBT
Date: Mon, 31 Mar 2014 21:07:04 +0200	[thread overview]
Message-ID: <20140331190703.GA22327@phenom.ffwll.local> (raw)
In-Reply-To: <1396289637-1013-3-git-send-email-jbarnes@virtuousgeek.org>

On Mon, Mar 31, 2014 at 11:13:57AM -0700, Jesse Barnes wrote:
> Going below the minimum value may affect the BLC_EN line, so try to use
> the VBT provided minimum where possible, otherwise use an experimentally
> derived value to prevent the panel from coming up.

"to prevent the panel form failing to come up" I hope?
-Daniel

> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_drv.h    |  1 +
>  drivers/gpu/drm/i915/intel_bios.c  |  3 ++-
>  drivers/gpu/drm/i915/intel_drv.h   |  1 +
>  drivers/gpu/drm/i915/intel_panel.c | 10 +++++++++-
>  4 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ff02225..3c40dcb 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1148,6 +1148,7 @@ struct intel_vbt_data {
>  	struct {
>  		u16 pwm_freq_hz;
>  		bool active_low_pwm;
> +		u8 min_brightness;
>  	} backlight;
>  
>  	/* MIPI DSI */
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 4867f4c..e8dedf5 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -301,11 +301,12 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
>  
>  	dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
>  	dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm;
> +	dev_priv->vbt.backlight.min_brightness = entry->min_brightness;
>  	DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, "
>  		      "active %s, min brightness %u, level %u\n",
>  		      dev_priv->vbt.backlight.pwm_freq_hz,
>  		      dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
> -		      entry->min_brightness,
> +		      dev_priv->vbt.backlight.min_brightness,
>  		      backlight_data->level[panel_type]);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 0e91c40..053a968 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -166,6 +166,7 @@ struct intel_panel {
>  		bool present;
>  		u32 level;
>  		u32 max;
> +		u32 min;
>  		bool enabled;
>  		bool combination_mode;	/* gen 2/4 only */
>  		bool active_low_pwm;
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 21c5e6f..27d7508 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -510,6 +510,9 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
>  	else
>  		level = freq / max * level;
>  
> +	if (level < panel->backlight.min)
> +		level = panel->backlight.min;
> +
>  	panel->backlight.level = level;
>  	if (panel->backlight.device)
>  		panel->backlight.device->props.brightness = level;
> @@ -1047,7 +1050,12 @@ static int vlv_setup_backlight(struct intel_connector *connector)
>  
>  	ctl = I915_READ(VLV_BLC_PWM_CTL(PIPE_A));
>  	panel->backlight.max = ctl >> 16;
> -	if (!panel->backlight.max)
> +	panel->backlight.min = dev_priv->vbt.backlight.min_brightness;
> +	/* sane (i.e. checked on scope) default */
> +	if (!panel->backlight.min)
> +		panel->backlight.min = 64;
> +	if (!panel->backlight.max ||
> +	    panel->backlight.max < panel->backlight.min)
>  		return -ENODEV;
>  
>  	val = _vlv_get_backlight(dev, PIPE_A);
> -- 
> 1.8.4.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-03-31 19:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 18:13 [PATCH 1/3] drm/i915: add PWM and BLC assertion checks Jesse Barnes
2014-03-31 18:13 ` [PATCH 2/3] drm/i915: correct BLC vs PWM enable/disable ordering Jesse Barnes
2014-06-19 18:00   ` Jesse Barnes
2014-07-07 21:45     ` Daniel Vetter
2014-06-25 12:21   ` Jani Nikula
2014-06-25 15:02     ` Jesse Barnes
2014-06-26  7:58       ` Jani Nikula
2014-03-31 18:13 ` [PATCH 3/3] drm/i915/vlv: use min brightness from VBT Jesse Barnes
2014-03-31 19:07   ` Daniel Vetter [this message]
2014-03-31 19:14     ` Jesse Barnes
2014-04-01  8:08   ` Jani Nikula
2014-04-01 16:16     ` Jesse Barnes
2014-04-01  7:19 ` [PATCH 1/3] drm/i915: add PWM and BLC assertion checks Jani Nikula
2014-04-01  9:27   ` Jani Nikula
2014-04-01 16:14     ` Jesse Barnes
2014-04-01 16:13   ` Jesse Barnes
2014-06-25 12:45     ` Jani Nikula

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=20140331190703.GA22327@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.