Enhancement to intel_dp_aux_backlight driver
Subsystems (2)
v2 cover Enhancement to intel_dp_aux_backlight driver
This patch set contain 4 patches.
- First two patches allow enable DPCD backlight control when panel can also do that via PWM pin and fix the usage of enable register.
- Next patch adds enable DBC by default
- Last patch makes the driver restore last brightness level after turning display off and on.
Change log:
v2:
- Drop PWM frequency patch
- Addess suggestion from Jani Nikula
Puthikorn Voravootivat (4):
drm/i915: Add DPCD prefered mode for backlight control drm/i915: Correctly enable blacklight adjustment via DPCD drm/i915: Support dynamic backlight via DPCD register drm/i915: Store brightness level in aux backlight driver
drivers/gpu/drm/i915/i915_params.c | 6 +- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 87 ++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 20 deletions(-)
Signature · 6 lines
2.12.0.246.ga2ecc84866-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/4 drm/i915: Add DPCD prefered mode for backlight control
Currently the intel_dp_aux_backlight driver requires eDP panel to not also support backlight adjustment via PWM pin to use this driver.
This force the eDP panel that support both ways of backlight adjustment to do it via PWM pin.
This patch adds the new prefer DPCD mode in the i915_param to make it enable to prefer DPCD over the PWM via kernel param.
This patch also add a check to DP_EDP_BACKLIGHT_AUX_ENABLE_CAP in set_aux_backlight_enable() since the backlight enablement can be done via BL_ENABLE eDP connector pin in the case that it does not support doing that via AUX.
--- drivers/gpu/drm/i915/i915_params.c | 6 ++--- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 33 +++++++++++++++++++-------- 3 files changed, 27 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_params.c +3 -3
@@ -61,7 +61,7 @@ struct i915_params i915 __read_mostly = { .guc_log_level = -1, .enable_dp_mst = true, .inject_load_failure = 0, - .enable_dpcd_backlight = false, + .enable_dpcd_backlight = 0, .enable_gvt = false, };
@@ -236,9 +236,9 @@ MODULE_PARM_DESC(enable_dp_mst,module_param_named_unsafe (inject_load_failure, i915.inject_load_failure, uint,0400 );MODULE_PARM_DESC (inject_load_failure,"Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)" ); -module_param_named (enable_dpcd_backlight, i915.enable_dpcd_backlight, bool,0600 ); +module_param_named (enable_dpcd_backlight, i915.enable_dpcd_backlight, int,0600 );MODULE_PARM_DESC (enable_dpcd_backlight, -"Enable support for DPCD backlight control (default:false)" ); +"Enable support for DPCD backlight control (0:disable (default), 1:prefer PWM pin, 2: prefer DPCD)" );module_param_named (enable_gvt, i915.enable_gvt, bool,0400 ); MODULE_PARM_DESC(enable_gvt,
drivers/gpu/drm/i915/i915_params.h +1 -1
@@ -49,6 +49,7 @@func (int, use_mmio_flip); \func (int, mmio_debug); \func (int, edp_vswing); \ +func (int, enable_dpcd_backlight); \ func(unsigned int, inject_load_failure); \/* leave bools at the end to not create holes */ \func (bool, alpha_support); \
@@ -64,7 +65,6 @@func (bool, verbose_state_checks); \func (bool, nuclear_pageflip); \func (bool, enable_dp_mst); \ -func (bool, enable_dpcd_backlight); \ func(bool, enable_gvt)#define MEMBER (T , member) T member
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +23 -10
@@ -28,6 +28,10 @@ static void set_aux_backlight_enable(struct intel_dp *intel_dp, bool enable) {uint8_t reg_val =0 ; +/* Early return when display use other mechanism to enable backlight. */ +if (!(intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP )) +return ; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) <0 ) { DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n",
@@ -138,27 +142,36 @@ static bool intel_dp_aux_display_control_capable(struct intel_connector *connector) {struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base); +bool supported;/* Check the eDP Display control capabilities registers to determine if * the panel can support backlight control over the aux channel */ -if (intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP && - (intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) && - !((intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_PIN_ENABLE_CAP ) || - (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ))) { -DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" ); -return true; +switch (i915.enable_dpcd_backlight) { +case 1 :/* prefer PWM pin */ + supported = (intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) && + !(intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_PIN_ENABLE_CAP ) && + !(intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ); +break ; +case 2 :/* prefer DPCD */ + supported = (intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ); +break ; +default : + supported = false; } -return false; + +if (supported) +DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" ); + +return supported; }int intel_dp_aux_init_backlight_funcs (struct intel_connector *intel_connector) {struct intel_panel *panel = &intel_connector->panel; -if (!i915.enable_dpcd_backlight) -return -ENODEV ; -if (!intel_dp_aux_display_control_capable (intel_connector))return -ENODEV ;
Signature · 6 lines
2.12.0.246.ga2ecc84866-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/4 drm/i915: Correctly enable blacklight adjustment via DPCD
In reply to Puthikorn Voravootivatintel_dp_aux_enable_backlight() assumed that the register BACKLIGHT_BRIGHTNESS_CONTROL_MODE can only has value 01 (DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET) when initialize.
This patch fixed that by handling all cases of that register.
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 29 +++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +23 -6
@@ -101,15 +101,32 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector) {struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base);uint8_t dpcd_buf =0 ; +uint8_t edp_backlight_mode =0 ;set_aux_backlight_enable (intel_dp, true); -if ((drm_dp_dpcd_readb (&intel_dp->aux, -DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf) ==1 ) && - ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) == -DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET )) -drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , - (dpcd_buf |DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD )); +if (!drm_dp_dpcd_readb (&intel_dp->aux, +DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf)) { +return ; + } + + edp_backlight_mode = dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; + +switch (edp_backlight_mode) { +case DP_EDP_BACKLIGHT_CONTROL_MODE_PWM : +case DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET : +case DP_EDP_BACKLIGHT_CONTROL_MODE_PRODUCT : + dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; + dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; +drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_BACKLIGHT_MODE_SET_REGISTER , dpcd_buf); +break ; + +/* Do nothing when it is already DPCD mode */ +case DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD : +default : +break ; + } }static void intel_dp_aux_disable_backlight (struct intel_connector *connector)
Signature · 6 lines
2.12.0.246.ga2ecc84866-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/4 drm/i915: Support dynamic backlight via DPCD register
In reply to Puthikorn VoravootivatThis patch enables dynamic backlight by default for eDP panel that supports this feature via DPCD register and set minimum / maximum brightness to 0% and 100% of the normal brightness.
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 31 +++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +27 -4
@@ -97,10 +97,24 @@ intel_dp_aux_set_backlight(struct intel_connector *connector, u32 level) } } +/* +* Set minimum / maximum dynamic brightness percentage. This value is expressed +* as the percentage of normal brightness in 5% increments. +*/ +static void +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 ) }; +drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET , + dbc,sizeof (dbc)); +} +static void intel_dp_aux_enable_backlight (struct intel_connector *connector) {struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base);uint8_t dpcd_buf =0 ; +uint8_t new_dpcd_buf =0 ;uint8_t edp_backlight_mode =0 ;set_aux_backlight_enable (intel_dp, true);
@@ -110,16 +124,15 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector)return ; } + new_dpcd_buf = dpcd_buf; edp_backlight_mode = dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ;switch (edp_backlight_mode) {case DP_EDP_BACKLIGHT_CONTROL_MODE_PWM :case DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET :case DP_EDP_BACKLIGHT_CONTROL_MODE_PRODUCT : - dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; - dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; -drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_BACKLIGHT_MODE_SET_REGISTER , dpcd_buf); + new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; + new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ;break ;/* Do nothing when it is already DPCD mode */
@@ -127,6 +140,16 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector)default :break ; } + +if (intel_dp->edp_dpcd[2 ] &DP_EDP_DYNAMIC_BACKLIGHT_CAP ) { + new_dpcd_buf |=DP_EDP_DYNAMIC_BACKLIGHT_ENABLE ; +intel_dp_aux_set_dynamic_backlight_percent (intel_dp,0 ,100 ); + } + +if (new_dpcd_buf != dpcd_buf) { +drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf); + } }static void intel_dp_aux_disable_backlight (struct intel_connector *connector)
Signature · 6 lines
2.12.0.246.ga2ecc84866-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/4 drm/i915: Store brightness level in aux backlight driver
In reply to Puthikorn VoravootivatSome panel will default to zero brightness when turning the panel off and on again. This patch stores last brightness level before turning off and set them back when panel is turning on.
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +2 -0
@@ -95,6 +95,7 @@ intel_dp_aux_set_backlight(struct intel_connector *connector, u32 level)DRM_DEBUG_KMS ("Failed to write aux backlight level\n" );return ; } + connector->panel.backlight.level = level; }/*
@@ -150,6 +151,7 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector)drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf); } +intel_dp_aux_set_backlight (connector, connector->panel.backlight.level); }static void intel_dp_aux_disable_backlight (struct intel_connector *connector)
Signature · 6 lines
2.12.0.246.ga2ecc84866-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for Enhancement to intel_dp_aux_backlight driver
In reply to Puthikorn Voravootivat== Series Details ==
== Series Details ==
Series: Enhancement to intel_dp_aux_backlight driver
URL : https://patchwork.freedesktop.org/series/21086/
State : failure
== Summary ==
Series 21086v1 Enhancement to intel_dp_aux_backlight driver
https://patchwork.freedesktop.org/api/1.0/series/21086/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-wb:
pass -> INCOMPLETE (fi-skl-6260u)
Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass -> DMESG-WARN (fi-bxt-t5700) fdo#100125
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
dmesg-warn -> PASS (fi-byt-j1900)fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 465s fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 614s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 535s fi-bxt-t5700 total:278 pass:257 dwarn:1 dfail:0 fail:0 skip:20 time: 593s fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 505s fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 507s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 442s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 432s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 446s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 502s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 490s fi-kbl-7500u total:278 pass:259 dwarn:1 dfail:0 fail:0 skip:18 time: 475s fi-skl-6260u total:52 pass:50 dwarn:0 dfail:0 fail:0 skip:1 time: 0s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 596s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 493s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 534s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 547s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 419s
2095bbc9d234d71fa44fd9181597431e2653058c drm-tip: 2017y-03m-10d-15h-03m-17s UTC integration manifest 90b039a drm/i915: Store brightness level in aux backlight driver
0ac7dcc drm/i915: Support dynamic backlight via DPCD register
cbfa045 drm/i915: Correctly enable blacklight adjustment via DPCD
c82e5ca drm/i915: Add DPCD prefered mode for backlight control
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4141/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.BAT: failure for Enhancement to intel_dp_aux_backlight driver
HI,
Quoted 15 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Patchwork
Sent: Saturday, March 11, 2017 1:23 AM
To: Puthikorn Voravootivat <[email protected]>
Cc: [email protected]
Subject: [Intel-gfx] ✗ Fi.CI.BAT: failure for Enhancement tointel_dp_aux_backlightdriver== Series Details ==
Series: Enhancement to
intel_dp_aux_backlightdriver
URL : https://patchwork.freedesktop.org/series/21086/
State : failure
Quoted 8 lines
== Summary ==
Series 21086v1 Enhancement to
intel_dp_aux_backlightdriver
https://patchwork.freedesktop.org/api/1.0/series/21086/revisions/1/mbox/Test
gem_exec_flush:Subgroup basic-batch-kernel-default-wb: pass -> INCOMPLETE (fi-skl-6260u)
I suppose so that same as https://bugs.freedesktop.org/show_bug.ci?id=100112
But on different system. Chris, ack?
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.BAT: failure for Enhancement to intel_dp_aux_backlight driver
Quoted 18 lines · Jani
HI,
Quoted 17 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Patchwork
Sent: Saturday, March 11, 2017 1:23 AM
To: Puthikorn Voravootivat <[email protected]>
Cc: [email protected]
Subject: [Intel-gfx] ✗ Fi.CI.BAT: failure for Enhancement tointel_dp_aux_backlightdriver== Series Details ==
Series: Enhancement to
intel_dp_aux_backlightdriver
URL : https://patchwork.freedesktop.org/series/21086/
State : failure== Summary ==
Quoted 8 lines
Quoted 6 lines
Series 21086v1 Enhancement to
intel_dp_aux_backlightdriver
https://patchwork.freedesktop.org/api/1.0/series/21086/revisions/1/mbox/Test
gem_exec_flush:Subgroup basic-batch-kernel-default-wb: pass -> INCOMPLETE (fi-skl-6260u)I suppose so that same as https://bugs.freedesktop.org/show_bug.ci?id=100112
But on different system. Chris, ack?
Nah, it looks like the previous bug was fixed, (9759df989f1 lib: Fix hang detector) - at least we haven't had a spurious incomplete on a main CI run since. So I am hoping this is something else; but we still do not have any information on the cause.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx