All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Weinehall <david.weinehall@linux.intel.com>
To: Puthikorn Voravootivat <puthik@chromium.org>,
	intel-gfx@lists.freedesktop.org,
	Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v12 3/3] drm/i915: Add option to support dynamic backlight via DPCD
Date: Tue, 27 Jun 2017 16:23:26 +0300	[thread overview]
Message-ID: <20170627132326.f2q3yn4bh5flji4q@boom> (raw)
In-Reply-To: <20170626141819.mydrydsqfnidwnp7@boom>

On Mon, Jun 26, 2017 at 05:18:19PM +0300, David Weinehall wrote:
> On Thu, Jun 22, 2017 at 12:03:39PM -0700, Puthikorn Voravootivat wrote:
> > This patch adds option to enable dynamic backlight for eDP
> > panel that supports this feature via DPCD register and
> > set minimum / maximum brightness to 0% and 100% of the
> > normal brightness.
> 
> This patch causes a regression on my ThinkPad X1 Carbon Gen 4;
> with enable_dbc = true the backlight stays off; setting i915.enable_dbc=0
> on boot makes things work properly again.

Some more testing indicates that while i915.enable_dbc=0 solves the
initial issue of backlight not coming on, it's not enough--after
suspend/resume the backlight stays off.

Passing i915.enable_dpcd_backlight=0 seems to work both for the initial
case of backlight not coming on at boot, and the issue with backlight
not coming on after suspend/resume.

So:

DBC:1, DPCD: -1: blank screen on boot
DBC:0, DPCD: -1: screen OK on boot, blank after suspend/resume
DBC:1, DPCD:  0: screen OK on boot, screen OK after suspend/resume
DBC:0, DPCD:  0: screen OK on boot, screen OK after suspend/resume

So it seems that at least for the ThinkPad X1 Carbon Gen 4 (possibly
limited to the 2560x1440 model) DPCD backlight isn't supported.

Or possibly something is wrong with the DPCD backlight patch.

> > Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
> > Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_params.c            |  5 +++++
> >  drivers/gpu/drm/i915/i915_params.h            |  3 ++-
> >  drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 26 ++++++++++++++++++++++++++
> >  3 files changed, 33 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> > index 5b5ab15d191f..88b9d3e6713a 100644
> > --- a/drivers/gpu/drm/i915/i915_params.c
> > +++ b/drivers/gpu/drm/i915/i915_params.c
> > @@ -65,6 +65,7 @@ struct i915_params i915 __read_mostly = {
> >  	.inject_load_failure = 0,
> >  	.enable_dpcd_backlight = -1,
> >  	.enable_gvt = false,
> > +	.enable_dbc = true,
> >  };
> >  
> >  module_param_named(modeset, i915.modeset, int, 0400);
> > @@ -254,3 +255,7 @@ MODULE_PARM_DESC(enable_dpcd_backlight,
> >  module_param_named(enable_gvt, i915.enable_gvt, bool, 0400);
> >  MODULE_PARM_DESC(enable_gvt,
> >  	"Enable support for Intel GVT-g graphics virtualization host support(default:false)");
> > +
> > +module_param_named_unsafe(enable_dbc, i915.enable_dbc, bool, 0600);
> > +MODULE_PARM_DESC(enable_dbc,
> > +	"Enable support for dynamic backlight control (default:true)");
> > diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
> > index 0d6cf9138dc4..057e203e6bda 100644
> > --- a/drivers/gpu/drm/i915/i915_params.h
> > +++ b/drivers/gpu/drm/i915/i915_params.h
> > @@ -67,7 +67,8 @@
> >  	func(bool, verbose_state_checks); \
> >  	func(bool, nuclear_pageflip); \
> >  	func(bool, enable_dp_mst); \
> > -	func(bool, enable_gvt)
> > +	func(bool, enable_gvt); \
> > +	func(bool, enable_dbc)
> >  
> >  #define MEMBER(T, member) T member
> >  struct i915_params {
> > diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> > index fea161727c6e..b25cd88fc1c5 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> > @@ -173,6 +173,24 @@ static bool intel_dp_aux_set_pwm_freq(struct intel_connector *connector)
> >  	return true;
> >  }
> >  
> > +/*
> > +* Set minimum / maximum dynamic brightness percentage. This value is expressed
> > +* as the percentage of normal brightness in 5% increments.
> > +*/
> > +static bool
> > +intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
> > +					   u32 min, u32 max)
> > +{
> > +	u8 dbc[] = { DIV_ROUND_CLOSEST(min, 5), DIV_ROUND_CLOSEST(max, 5) };
> > +
> > +	if (drm_dp_dpcd_write(&intel_dp->aux, DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET,
> > +			  dbc, sizeof(dbc)) < 0) {
> > +		DRM_DEBUG_KMS("Failed to write aux DBC brightness level\n");
> > +		return false;
> > +	}
> > +	return true;
> > +}
> > +
> >  static void intel_dp_aux_enable_backlight(const struct intel_crtc_state *crtc_state,
> >  					  const struct drm_connector_state *conn_state)
> >  {
> > @@ -208,6 +226,14 @@ static void intel_dp_aux_enable_backlight(const struct intel_crtc_state *crtc_st
> >  		if (intel_dp_aux_set_pwm_freq(connector))
> >  			new_dpcd_buf |= DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE;
> >  
> > +	if (i915.enable_dbc &&
> > +	    (intel_dp->edp_dpcd[2] & DP_EDP_DYNAMIC_BACKLIGHT_CAP)) {
> > +		if(intel_dp_aux_set_dynamic_backlight_percent(intel_dp, 0, 100)) {
> > +			new_dpcd_buf |= DP_EDP_DYNAMIC_BACKLIGHT_ENABLE;
> > +			DRM_DEBUG_KMS("Enable dynamic brightness.\n");
> > +		}
> > +	}
> > +
> >  	if (new_dpcd_buf != dpcd_buf) {
> >  		if (drm_dp_dpcd_writeb(&intel_dp->aux,
> >  			DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf) < 0) {
> > -- 
> > 2.13.1.611.g7e3b11ae1-goog
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-06-27 13:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 19:03 [PATCH v12 0/3] Enhancement to intel_dp_aux_backlight driver Puthikorn Voravootivat
2017-06-22 19:03 ` [PATCH v12 1/3] drm/i915: Set PWM divider to match desired frequency in vbt Puthikorn Voravootivat
2017-06-22 19:03 ` [PATCH v12 2/3] drm/i915: Add heuristic to determine better way to adjust brightness Puthikorn Voravootivat
2017-06-22 19:03 ` [PATCH v12 3/3] drm/i915: Add option to support dynamic backlight via DPCD Puthikorn Voravootivat
2017-06-26 14:18   ` David Weinehall
2017-06-27 13:23     ` David Weinehall [this message]
2017-06-27 22:29       ` Pandiyan, Dhinakaran
2017-06-28  7:58         ` [Intel-gfx] " David Weinehall
2017-06-22 19:36 ` ✓ Fi.CI.BAT: success for Enhancement to intel_dp_aux_backlight driver (rev12) Patchwork
2017-06-23 10:25 ` [PATCH v12 0/3] Enhancement to intel_dp_aux_backlight driver Daniel Vetter

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=20170627132326.f2q3yn4bh5flji4q@boom \
    --to=david.weinehall@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=puthik@chromium.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.