Re: [PATCH 3/3] drm/i915/vlv: use min brightness from VBT

Daniel Vetter
2014-03-31T19:07:08Z

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