Enhancement to intel_dp_aux_backlight driver
Subsystems (3)
v9 cover Enhancement to intel_dp_aux_backlight driver
This patch set contain 5 patches. Another 4 patches in previous version was already merged in v7.
- First two patches allow choosing which way to adjust brightness if both PWM pin and AUX are supported
- Next patch adds support for dynamic brightness.
- Last two patches set the PWM freqency to match data in panel vbt.
Change log:
v9:
- Fix nits in v8
v8:
- Drop 4 patches that was already merged
- Move DP_EDP_BACKLIGHT_AUX_ENABLE_CAP check to patch #2 to avoid behavior change if only apply patch #1
- Add TODO to warn about enable backlight twice in patch #2
- Use DIV_ROUND_CLOSEST instead of just "/" in patch #5
- Fix bug calculate pn in patch #5
- Clarify commit message / code comment in patch #5
v7:
- Add check in intel_dp_pwm_pin_display_control_capable in patch #4
- Add option in patch #6 to enable DPCD or not
- Change definition in patch #8 and implementation in #9 to use Khz
- Fix compiler warning from build bot in patch #9
v6:
- Address review from Dhinakaran
- Make PWM frequency to have highest value of Pn that make the frequency still within 25% of desired frequency.
v5:
- Split first patch in v4 to 3 patches
- Bump priority for "Correctly enable backlight brightness adjustment via DPCD"
- Make logic clearer for the case that both PWM pin and AUX are supported
- Add more log when write to register fail
- Add log when enable DBC
v4:
- Rebase / minor typo fix.
v3:
- Add new implementation of PWM frequency patch
v2:
- Drop PWM frequency patch
- Address suggestion from Jani Nikula
Puthikorn Voravootivat (5):
drm/i915: Drop AUX backlight enable check for backlight control drm/i915: Allow choosing how to adjust brightness if both supported drm/i915: Add option to support dynamic backlight via DPCD
drm: Add definition for eDP backlight frequency drm/i915: Set PWM divider to match desired frequency in vbt
drivers/gpu/drm/i915/i915_params.c | 13 ++- drivers/gpu/drm/i915/i915_params.h | 5 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 156 +++++++++++++++++++++++--- include/drm/drm_dp_helper.h | 2 + 4 files changed, 157 insertions(+), 19 deletions(-)
Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v9 1/5 drm/i915: Drop AUX backlight enable check for backlight control
There are some panel that
(1) does not support display backlight enable via AUX
(2) support display backlight adjustment via AUX
(3) support display backlight enable via eDP BL_ENABLE pin
The current driver required that (1) must be support to enable (2). This patch drops that requirement.
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +5 -3
@@ -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",
@@ -165,10 +169,8 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)* 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[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ) && - !((intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_PIN_ENABLE_CAP ) || - (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ))) { + !(intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP )) {DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" );return true; }
Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v9 1/5] drm/i915: Drop AUX backlight enable check for backlight control
Quoted 9 lines · Puthikorn Voravootivat
There are some panel that
(1) does not support display backlight enable via AUX
(2) support display backlight adjustment via AUX
(3) support display backlight enable via eDPBL_ENABLEpinThe current driver required that (1) must be support to enable (2). This patch drops that requirement.
Signed-off-by Puthikorn Voravootivat <[email protected]>
Quoted 31 lines
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_dp_aux_backlight.c +5
-3@@ -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",@@ -165,10 +169,8 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)* 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[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ) && - !((intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_PIN_ENABLE_CAP ) || - (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ))) { + !(intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP )) {DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" );return true; }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH v9 1/5] drm/i915: Drop AUX backlight enable check for backlight control
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Puthikorn Voravootivat
There are some panel that
(1) does not support display backlight enable via AUX
(2) support display backlight adjustment via AUX
(3) support display backlight enable via eDPBL_ENABLEpin
Quoted 6 lines
Quoted 4 lines
The current driver required that (1) must be support to enable (2). This patch drops that requirement.
Signed-off-by Puthikorn Voravootivat <[email protected]>Reviewed-by Jani Nikula <[email protected]>
And pushed to drm-intel-next-queued, thanks for the patch.
BR,
Jani.
Quoted 32 lines
Quoted 32 lines
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_dp_aux_backlight.c +5
-3@@ -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",@@ -165,10 +169,8 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)* 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[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ) && - !((intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_PIN_ENABLE_CAP ) || - (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ))) { + !(intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP )) {DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" );return true; }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 2/5 drm/i915: Allow choosing how to adjust brightness if both supported
In reply to Puthikorn VoravootivatAdd option to allow choosing how to adjust brightness if panel supports both PWM pin and AUX channel.
--- drivers/gpu/drm/i915/i915_params.c | 8 +++++--- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 26 ++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_params.c +5 -3
@@ -63,7 +63,7 @@ struct i915_params i915 __read_mostly = { .huc_firmware_path = NULL, .enable_dp_mst = true, .inject_load_failure = 0, - .enable_dpcd_backlight = false, + .enable_dpcd_backlight = -1, .enable_gvt = false, };
@@ -246,9 +246,11 @@ 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 " +"(-1:disable (default), 0:Use PWM pin if both supported, " +"1:Use DPCD if both supported" );module_param_named (enable_gvt, i915.enable_gvt, bool,0400 ); MODULE_PARM_DESC(enable_gvt,
drivers/gpu/drm/i915/i915_params.h +1 -1
@@ -66,7 +66,7 @@func (bool, verbose_state_checks); \func (bool, nuclear_pageflip); \func (bool, enable_dp_mst); \ -func (bool, enable_dpcd_backlight); \ +func (int, enable_dpcd_backlight); \ func(bool, enable_gvt)#define MEMBER (T , member) T member
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +22 -4
@@ -43,6 +43,9 @@ static void set_aux_backlight_enable(struct intel_dp *intel_dp, bool enable)else reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); +/* TODO: If the panel also support enabling backlight via BL_ENABLE pin, +* the backlight will be enabled again in _intel_edp_backlight_on() +*/ if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , reg_val) !=1 ) { DRM_DEBUG_KMS("Failed to %s aux backlight\n",
@@ -168,20 +171,35 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)/* 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[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ) && - !(intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP )) { +if ((intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP )) {DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" );return true; }return false; } +static bool +intel_dp_pwm_pin_display_control_capable (struct intel_connector *connector) +{ +struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base); + +/* Check the eDP Display control capabilities registers to determine if +* the panel can support backlight control via BL_PWM_DIM eDP pin +*/ +return (intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ); +} +int intel_dp_aux_init_backlight_funcs (struct intel_connector *intel_connector) {struct intel_panel *panel = &intel_connector->panel; -if (!i915.enable_dpcd_backlight) +if (i915.enable_dpcd_backlight ==-1 ) +return -ENODEV ; + +if (i915.enable_dpcd_backlight ==0 && +intel_dp_pwm_pin_display_control_capable (intel_connector))return -ENODEV ;if (!intel_dp_aux_display_control_capable (intel_connector))
Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v9 2/5] drm/i915: Allow choosing how to adjust brightness if both supported
Quoted 24 lines · Puthikorn Voravootivat
Add option to allow choosing how to adjust brightness if panel supports both PWM pin and AUX channel.
Signed-off-by Puthikorn Voravootivat <[email protected]>--- drivers/gpu/drm/i915/i915_params.c | 8 +++++--- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 26 ++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-)drivers/gpu/drm/i915/i915_params.c +1
-1@@ -63,7 +63,7 @@ struct i915_params i915 __read_mostly = { .huc_firmware_path = NULL, .enable_dp_mst = true, .inject_load_failure = 0, - .enable_dpcd_backlight = false, + .enable_dpcd_backlight = -1, .enable_gvt = false, };
drivers/gpu/drm/i915/i915_params.c MODULE_PARM_DESC(enable_dp_mst, · line 249
Quoted 5 lines
drivers/gpu/drm/i915/i915_params.c +1
-1@@ -246,9 +246,11 @@ 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 );
This module parameter must be an _unsafe one, we cannot expect users to set this stuff correctly. For debugging this is fine, for shipping it's not fine at all.
For upstream this either needs to work as-is (using suitable heuristics/whitelists/whatever), or we need to throw out the entire support. Having dead code around is not an option imo.
Also, Jani told me that apparently the reason we had to disable this is that it broke an SDP. We don't support SDP once the platform is past PV, because they're a pain. So if that's the only reason, then please re-enable the code again.
Once more: No module options that you expect to be used for configuring the driver. Especially around backlights the situation we're in is already a disaster, let's not make it worse. If i915 doesn't know how to drive the backlight, then no one else will.
As-is, nack on this approach. We need:
1) _unsafe mod option
2) get this enabled by default
3) fix exceptions in the code, not by exposing even more tuning knobs
Thanks, Daniel
Quoted 82 lines
drivers/gpu/drm/i915/i915_params.c +3
-1MODULE_PARM_DESC (enable_dpcd_backlight, -"Enable support for DPCD backlight control (default:false)" ); +"Enable support for DPCD backlight control " +"(-1:disable (default), 0:Use PWM pin if both supported, " +"1:Use DPCD if both supported" );module_param_named (enable_gvt, i915.enable_gvt, bool,0400 ); MODULE_PARM_DESC(enable_gvt,drivers/gpu/drm/i915/i915_params.h +1
-1@@ -66,7 +66,7 @@func (bool, verbose_state_checks); \func (bool, nuclear_pageflip); \func (bool, enable_dp_mst); \ -func (bool, enable_dpcd_backlight); \ +func (int, enable_dpcd_backlight); \ func(bool, enable_gvt)#define MEMBER (T , member) T memberdrivers/gpu/drm/i915/intel_dp_aux_backlight.c +22
-4@@ -43,6 +43,9 @@ static void set_aux_backlight_enable(struct intel_dp *intel_dp, bool enable)else reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); +/* TODO: If the panel also support enabling backlight via BL_ENABLE pin, +* the backlight will be enabled again in _intel_edp_backlight_on() +*/ if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , reg_val) !=1 ) { DRM_DEBUG_KMS("Failed to %s aux backlight\n",@@ -168,20 +171,35 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)/* 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[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ) && - !(intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP )) { +if ((intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP )) {DRM_DEBUG_KMS ("AUX Backlight Control Supported!\n" );return true; }return false; } +static bool +intel_dp_pwm_pin_display_control_capable (struct intel_connector *connector) +{ +struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base); + +/* Check the eDP Display control capabilities registers to determine if +* the panel can support backlight control via BL_PWM_DIM eDP pin +*/ +return (intel_dp->edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP ); +} +int intel_dp_aux_init_backlight_funcs (struct intel_connector *intel_connector) {struct intel_panel *panel = &intel_connector->panel; -if (!i915.enable_dpcd_backlight) +if (i915.enable_dpcd_backlight ==-1 ) +return -ENODEV ; + +if (i915.enable_dpcd_backlight ==0 && +intel_dp_pwm_pin_display_control_capable (intel_connector))return -ENODEV ;if (!intel_dp_aux_display_control_capable (intel_connector))Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 3/5 drm/i915: Add option to support dynamic backlight via DPCD
In reply to Puthikorn VoravootivatThis 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.
--- 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 | 42 ++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_params.c +5 -0
@@ -65,6 +65,7 @@ struct i915_params i915 __read_mostly = { .inject_load_failure = 0, .enable_dpcd_backlight = -1, .enable_gvt = false, + .enable_dbc = false, };module_param_named (modeset, i915.modeset, int,0400 );
@@ -255,3 +256,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 (enable_dbc, i915.enable_dbc, bool,0600 ); +MODULE_PARM_DESC (enable_dbc, +"Enable support for dynamic backlight control (default:false)" );
drivers/gpu/drm/i915/i915_params.h +2 -1
@@ -67,7 +67,8 @@func (bool, nuclear_pageflip); \func (bool, enable_dp_mst); \func (int, enable_dpcd_backlight); \ - func(bool, enable_gvt) +func (bool, enable_gvt); \ + func(bool, enable_dbc)#define MEMBER (T , member) T memberstruct i915_params {
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +34 -8
69 lines not on this page · raw message
Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v9 4/5 drm: Add definition for eDP backlight frequency
In reply to Puthikorn VoravootivatThis patch adds the following definition
- Bit mask for EDP_PWMGEN_BIT_COUNT and min/max cap register which only use bit 0:4
- Base frequency (27 MHz) for backlight PWM frequency generator.
--- include/drm/drm_dp_helper.h | 2 ++ 1 file changed, 2 insertions(+)
include/drm/drm_dp_helper.h +2 -0
@@ -572,10 +572,12 @@#define DP_EDP_PWMGEN_BIT_COUNT 0x724#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN 0x725#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX 0x726 +# define DP_EDP_PWMGEN_BIT_COUNT_MASK (0x1f << 0)#define DP_EDP_BACKLIGHT_CONTROL_STATUS 0x727#define DP_EDP_BACKLIGHT_FREQ_SET 0x728 +# define DP_EDP_BACKLIGHT_FREQ_BASE_KHZ 27000#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB 0x72a#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID 0x72b
Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH v9 4/5] drm: Add definition for eDP backlight frequency
Quoted 17 lines · Puthikorn Voravootivat
This patch adds the following definition
- Bit mask forEDP_PWMGEN_BIT_COUNTand min/max cap register which only use bit 0:4
- Base frequency (27 MHz) for backlight PWM frequency generator.Signed-off-by Puthikorn Voravootivat <[email protected]>Reviewed-by Dhinakaran Pandiyan <[email protected]>--- include/drm/drm_dp_helper.h | 2 ++ 1 file changed, 2 insertions(+)include/drm/drm_dp_helper.h +0
-0
include/drm/drm_dp_helper.h line 575
Quoted 4 lines
include/drm/drm_dp_helper.h +1
-0@@ -572,10 +572,12 @@#define DP_EDP_PWMGEN_BIT_COUNT 0x724#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN 0x725#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX 0x726 +# define DP_EDP_PWMGEN_BIT_COUNT_MASK (0x1f << 0)
^^
Extra space crept in.
BR,
Jani.
Quoted 8 lines
include/drm/drm_dp_helper.h +1
-0#define DP_EDP_BACKLIGHT_CONTROL_STATUS 0x727#define DP_EDP_BACKLIGHT_FREQ_SET 0x728 +# define DP_EDP_BACKLIGHT_FREQ_BASE_KHZ 27000#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB 0x72a#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID 0x72b
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH v9 4/5] drm: Add definition for eDP backlight frequency
Quoted 24 lines · Jani Nikula
Quoted 17 lines · Puthikorn Voravootivat
This patch adds the following definition
- Bit mask forEDP_PWMGEN_BIT_COUNTand min/max cap register which only use bit 0:4
- Base frequency (27 MHz) for backlight PWM frequency generator.Signed-off-by Puthikorn Voravootivat <[email protected]>Reviewed-by Dhinakaran Pandiyan <[email protected]>--- include/drm/drm_dp_helper.h | 2 ++ 1 file changed, 2 insertions(+)include/drm/drm_dp_helper.h +0
-0include/drm/drm_dp_helper.h line 575
Quoted 4 lines
include/drm/drm_dp_helper.h +1
-0@@ -572,10 +572,12 @@#define DP_EDP_PWMGEN_BIT_COUNT 0x724#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN 0x725#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX 0x726 +# define DP_EDP_PWMGEN_BIT_COUNT_MASK (0x1f << 0)^^
Quoted 1 line
Extra space crept in.
Fixed that while applying to drm-intel-next-queued, thanks for the patch. Pushed via drm-intel with Dave's IRC ack to not require a backmerge for the subsequent patches.
BR,
Jani.
Quoted 12 lines
BR,
Jani.Quoted 8 lines
include/drm/drm_dp_helper.h +1
-0#define DP_EDP_BACKLIGHT_CONTROL_STATUS 0x727#define DP_EDP_BACKLIGHT_FREQ_SET 0x728 +# define DP_EDP_BACKLIGHT_FREQ_BASE_KHZ 27000#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB 0x72a#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID 0x72b
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 5/5 drm/i915: Set PWM divider to match desired frequency in vbt
In reply to Puthikorn VoravootivatRead desired PWM frequency from panel vbt and calculate the value for divider in DPCD address 0x724 and 0x728 to have as many bits as possible for PWM duty cyle for granularity of brightness adjustment while the frequency divisor is still within 25% of the desired value.
--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 82 +++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +82 -0
@@ -116,10 +116,85 @@ intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp, } } +/* +* Set PWM Frequency divider to match desired frequency in vbt. +* The PWM Frequency is calculated as 27Mhz / (F x P). +* - Where F = PWM Frequency Pre-Divider value programmed by field 7:0 of the +* EDP_BACKLIGHT_FREQ_SET register (DPCD Address 00728h) +* - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the +* EDP_PWMGEN_BIT_COUNT register (DPCD Address 00724h) +*/ +static void intel_dp_aux_set_pwm_freq (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base); +int freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ; +u8 pn, pn_min, pn_max; + +/* Find desired value of (F x P) +* Note that, if F x P is out of supported range, the maximum value or +* minimum value will applied automatically. So no need to check that. +*/ + freq = dev_priv->vbt.backlight.pwm_freq_hz; +DRM_DEBUG_KMS ("VBT defined backlight frequency %u Hz\n" , freq); +if (!freq) { +DRM_DEBUG_KMS ("Use panel default backlight frequency\n" ); +return ; + } + + fxp =DIV_ROUND_CLOSEST (KHz (DP_EDP_BACKLIGHT_FREQ_BASE_KHZ ), freq); + +/* Use highest possible value of Pn for more granularity of brightness +* adjustment while satifying the conditions below. +* - Pn is in the range of Pn_min and Pn_max +* - F is in the range of 1 and 255 +* - FxP is within 25% of desired value. +* Note: 25% is arbitrary value and may need some tweak. +*/ +if (drm_dp_dpcd_readb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN , &pn_min) !=1 ) { +DRM_DEBUG_KMS ("Failed to read pwmgen bit count cap min\n" ); +return ; + } +if (drm_dp_dpcd_readb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max) !=1 ) { +DRM_DEBUG_KMS ("Failed to read pwmgen bit count cap max\n" ); +return ; + } + pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + + fxp_min =DIV_ROUND_CLOSEST (fxp *3 ,4 ); + fxp_max =DIV_ROUND_CLOSEST (fxp *5 ,4 ); +if (fxp_min < (1 << pn_min) || (255 << pn_max) < fxp_max) { +DRM_DEBUG_KMS ("VBT defined backlight frequency out of range\n" ); +return ; + } + +for (pn = pn_max; pn >= pn_min; pn--) { + f =clamp (DIV_ROUND_CLOSEST (fxp ,1 << pn),1 ,255 ); + fxp_actual = f << pn; +if (fxp_min <= fxp_actual && fxp_actual <= fxp_max) +break ; + } + +if (drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT , pn) <0 ) { +DRM_DEBUG_KMS ("Failed to write aux pwmgen bit count\n" ); +return ; + } +if (drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_BACKLIGHT_FREQ_SET , (u8 ) f) <0 ) { +DRM_DEBUG_KMS ("Failed to write aux backlight freq\n" ); +return ; + } +} +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, new_dpcd_buf, edp_backlight_mode; +bool freq_cap;if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf) !=1 ) {
@@ -152,6 +227,10 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector)DRM_DEBUG_KMS ("Enable dynamic brightness.\n" ); } + freq_cap = intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP ; +if (freq_cap) + new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; +if (new_dpcd_buf != dpcd_buf) {if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf) <0 ) {
@@ -159,6 +238,9 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector) } } +if (freq_cap) +intel_dp_aux_set_pwm_freq (connector); +set_aux_backlight_enable (intel_dp, true);intel_dp_aux_set_backlight (connector, connector->panel.backlight.level); }
Signature · 6 lines
2.13.0.219.gdb65acc882-goog _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH v9 5/5] drm/i915: Set PWM divider to match desired frequency in vbt
Quoted 5 lines · Puthikorn Voravootivat
Read desired PWM frequency from panel vbt and calculate the value for divider in DPCD address
0x724and0x728to have as many bits as possible for PWM duty cyle for granularity of brightness adjustment while the frequency divisor is still within 25% of the desired value.
IIUC this patch doesn't have a dependency on the more contentious patches 2/5 and 3/5. This should probably be merged before them.
I share DK's concern about doing a bunch of reads and writes and calculations every time the backlight's enabled. But I guess that could be optimized later.
I haven't had time to check the changed algorithm here, but in the mean time one comment below.
BR,
Jani.
Quoted 108 lines
Signed-off-by Puthikorn Voravootivat <[email protected]>--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 82 +++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)drivers/gpu/drm/i915/intel_dp_aux_backlight.c +79
-0@@ -116,10 +116,85 @@ intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp, } } +/* +* Set PWM Frequency divider to match desired frequency in vbt. +* The PWM Frequency is calculated as 27Mhz / (F x P). +* - Where F = PWM Frequency Pre-Divider value programmed by field 7:0 of the +* EDP_BACKLIGHT_FREQ_SET register (DPCD Address 00728h) +* - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the +* EDP_PWMGEN_BIT_COUNT register (DPCD Address 00724h) +*/ +static void intel_dp_aux_set_pwm_freq (struct intel_connector *connector) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_dp *intel_dp =enc_to_intel_dp (&connector->encoder->base); +int freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ; +u8 pn, pn_min, pn_max; + +/* Find desired value of (F x P) +* Note that, if F x P is out of supported range, the maximum value or +* minimum value will applied automatically. So no need to check that. +*/ + freq = dev_priv->vbt.backlight.pwm_freq_hz; +DRM_DEBUG_KMS ("VBT defined backlight frequency %u Hz\n" , freq); +if (!freq) { +DRM_DEBUG_KMS ("Use panel default backlight frequency\n" ); +return ; + } + + fxp =DIV_ROUND_CLOSEST (KHz (DP_EDP_BACKLIGHT_FREQ_BASE_KHZ ), freq); + +/* Use highest possible value of Pn for more granularity of brightness +* adjustment while satifying the conditions below. +* - Pn is in the range of Pn_min and Pn_max +* - F is in the range of 1 and 255 +* - FxP is within 25% of desired value. +* Note: 25% is arbitrary value and may need some tweak. +*/ +if (drm_dp_dpcd_readb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN , &pn_min) !=1 ) { +DRM_DEBUG_KMS ("Failed to read pwmgen bit count cap min\n" ); +return ; + } +if (drm_dp_dpcd_readb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max) !=1 ) { +DRM_DEBUG_KMS ("Failed to read pwmgen bit count cap max\n" ); +return ; + } + pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + + fxp_min =DIV_ROUND_CLOSEST (fxp *3 ,4 ); + fxp_max =DIV_ROUND_CLOSEST (fxp *5 ,4 ); +if (fxp_min < (1 << pn_min) || (255 << pn_max) < fxp_max) { +DRM_DEBUG_KMS ("VBT defined backlight frequency out of range\n" ); +return ; + } + +for (pn = pn_max; pn >= pn_min; pn--) { + f =clamp (DIV_ROUND_CLOSEST (fxp ,1 << pn),1 ,255 ); + fxp_actual = f << pn; +if (fxp_min <= fxp_actual && fxp_actual <= fxp_max) +break ; + } + +if (drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT , pn) <0 ) { +DRM_DEBUG_KMS ("Failed to write aux pwmgen bit count\n" ); +return ; + } +if (drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_BACKLIGHT_FREQ_SET , (u8 ) f) <0 ) { +DRM_DEBUG_KMS ("Failed to write aux backlight freq\n" ); +return ; + } +} +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, new_dpcd_buf, edp_backlight_mode; +bool freq_cap;if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf) !=1 ) {@@ -152,6 +227,10 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector)DRM_DEBUG_KMS ("Enable dynamic brightness.\n" ); } + freq_cap = intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP ; +if (freq_cap) + new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; +if (new_dpcd_buf != dpcd_buf) {if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf) <0 ) {
drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct intel_connector *connector) · line 242
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +2
-0@@ -159,6 +238,9 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector) } } +if (freq_cap) +intel_dp_aux_set_pwm_freq (connector);
What happens if there are any errors within that function, and it fails to write DP_EDP_BACKLIGHT_FREQ_SET, but DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE has been set?
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +1
-0+set_aux_backlight_enable (intel_dp, true);intel_dp_aux_set_backlight (connector, connector->panel.backlight.level); }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v9 5/5] drm/i915: Set PWM divider to match desired frequency in vbt
Good catch.
It will use default frequency in this case. But it is better to not set DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP in this case.
I will add return value to intel_dp_aux_set_pwm_freq() and set DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP based on that.
Quoted 161 lines · Jani Nikula
Quoted 5 lines · Puthikorn Voravootivat
Read desired PWM frequency from panel vbt and calculate the value for divider in DPCD address
0x724and0x728to have as many bits as possible for PWM duty cyle for granularity of brightness adjustment while the frequency divisor is still within 25% of the desired value.IIUC this patch doesn't have a dependency on the more contentious patches 2/5 and 3/5. This should probably be merged before them.
I share DK's concern about doing a bunch of reads and writes and calculations every time the backlight's enabled. But I guess that could be optimized later.
I haven't had time to check the changed algorithm here, but in the mean time one comment below.
BR,
Jani.Quoted 4 lines
Signed-off-by Puthikorn Voravootivat <[email protected]>--- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 82+++++++++++++++++++++++++++
Review
Quoted 3 lines
1 file changed, 82 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_dp_aux_backlight.cdrivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct
Quoted 4 lines
index
f1b7855a2d2a..b7cd44550127100644drivers/gpu/drm/i915/intel_dp_aux_backlight.c +0
-0@@ -116,10 +116,85 @@ intel_dp_aux_set_dynamic_backlight_percent(struct
intel_dp*intel_dp,drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 7 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +4
-0} } +/* +* Set PWM Frequency divider to match desired frequency in vbt. +* The PWM Frequency is calculated as 27Mhz / (F x P). +* - Where F = PWM Frequency Pre-Divider value programmed by field 7:0 of the
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct · line 124
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +2
-0+* EDP_BACKLIGHT_FREQ_SET register (DPCD Address 00728h) +* - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +3
-0+* EDP_PWMGEN_BIT_COUNT register (DPCD Address 00724h) +*/ +static void intel_dp_aux_set_pwm_freq(struct intel_connector*connector)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +3
-0+{ + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_dp *intel_dp = enc_to_intel_dp(&connector->
encoder->base);drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +5
-0+int freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ; +u8 pn, pn_min, pn_max; + +/* Find desired value of (F x P) +* Note that, if F x P is out of supported range, the maximum value or
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct · line 136
Quoted 1 line
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +1
-0+* minimum value will applied automatically. So no need to check that.
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +9
-0+*/ + freq = dev_priv->vbt.backlight.pwm_freq_hz; +DRM_DEBUG_KMS ("VBT defined backlight frequency %u Hz\n" , freq); +if (!freq) { +DRM_DEBUG_KMS ("Use panel default backlight frequency\n" ); +return ; + } + + fxp = DIV_ROUND_CLOSEST(KHz(DP_EDP_BACKLIGHT_FREQ_BASE_KHZ),freq);
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct · line 147
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +2
-0+ +/* Use highest possible value of Pn for more granularity of brightness
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +8
-0+* adjustment while satifying the conditions below. +* - Pn is in the range of Pn_min and Pn_max +* - F is in the range of 1 and 255 +* - FxP is within 25% of desired value. +* Note: 25% is arbitrary value and may need some tweak. +*/ +if (drm_dp_dpcd_readb (&intel_dp->aux, + DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min)!= 1) {
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +5
-0+DRM_DEBUG_KMS ("Failed to read pwmgen bit count cap min\n" ); +return ; + } +if (drm_dp_dpcd_readb (&intel_dp->aux, + DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max)!= 1) {
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +10
-0+DRM_DEBUG_KMS ("Failed to read pwmgen bit count cap max\n" ); +return ; + } + pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + + fxp_min =DIV_ROUND_CLOSEST (fxp *3 ,4 ); + fxp_max =DIV_ROUND_CLOSEST (fxp *5 ,4 ); +if (fxp_min < (1 << pn_min) || (255 << pn_max) < fxp_max) { + DRM_DEBUG_KMS("VBT defined backlight frequency out ofrange\n");
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +13
-0+return ; + } + +for (pn = pn_max; pn >= pn_min; pn--) { + f =clamp (DIV_ROUND_CLOSEST (fxp ,1 << pn),1 ,255 ); + fxp_actual = f << pn; +if (fxp_min <= fxp_actual && fxp_actual <= fxp_max) +break ; + } + +if (drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_PWMGEN_BIT_COUNT , pn) <0 ) { +DRM_DEBUG_KMS ("Failed to write aux pwmgen bit count\n" );drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +9
-0+return ; + } +if (drm_dp_dpcd_writeb (&intel_dp->aux, +DP_EDP_BACKLIGHT_FREQ_SET , (u8 ) f) <0 ) { +DRM_DEBUG_KMS ("Failed to write aux backlight freq\n" ); +return ; + } +} + static void intel_dp_aux_enable_backlight(struct intel_connector*connector)
drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct · line 195
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +0
-0{ struct intel_dp *intel_dp = enc_to_intel_dp(&connector->
encoder->base);drivers/gpu/drm/i915/intel_dp_aux_backlight.c intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +1
-0uint8_t dpcd_buf, new_dpcd_buf, edp_backlight_mode; +bool freq_cap; if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf) !=1) {
drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct
Quoted 1 line
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +0
-0@@ -152,6 +227,10 @@ static void intel_dp_aux_enable_backlight(struct
intel_connector*connector)drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct intel_connector *connector)
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +1
-0DRM_DEBUG_KMS ("Enable dynamic brightness.\n" ); } + freq_cap = intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_ CAP;
drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct intel_connector *connector)
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +3
-0+if (freq_cap) + new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; +if (new_dpcd_buf != dpcd_buf) {if (drm_dp_dpcd_writeb (&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf)< 0) {
drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct
Quoted 1 line
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +0
-0@@ -159,6 +238,9 @@ static void intel_dp_aux_enable_backlight(struct
intel_connector*connector)drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct intel_connector *connector) · line 242
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +2
-0} } +if (freq_cap) +intel_dp_aux_set_pwm_freq (connector);What happens if there are any errors within that function, and it fails to write
DP_EDP_BACKLIGHT_FREQ_SET, butDP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLEhas been set?
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct intel_connector *connector)
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +1
-0+set_aux_backlight_enable (intel_dp, true); intel_dp_aux_set_backlight(connector, connector->panel.backlight.level);
drivers/gpu/drm/i915/intel_dp_aux_backlight.c static void intel_dp_aux_enable_backlight(struct · line 246
Quoted 1 line
drivers/gpu/drm/i915/intel_dp_aux_backlight.c +0
-0}--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Enhancement to intel_dp_aux_backlight driver (rev8)
In reply to Puthikorn Voravootivat== Series Details ==
== Series Details ==
Series: Enhancement to intel_dp_aux_backlight driver (rev8)
URL : https://patchwork.freedesktop.org/series/21086/
State : success
== Summary ==
Series 21086v8 Enhancement to intel_dp_aux_backlight driver
https://patchwork.freedesktop.org/api/1.0/series/21086/revisions/8/mbox/
fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:431s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:438s
fi-bdw-5557u failed to collect. IGT log at Patchwork_4792/fi-bdw-5557u/igt.log fi-bsw-n3050 failed to collect. IGT log at Patchwork_4792/fi-bsw-n3050/igt.log fi-bxt-j4205 failed to collect. IGT log at Patchwork_4792/fi-bxt-j4205/igt.log fi-byt-j1900 failed to collect. IGT log at Patchwork_4792/fi-byt-j1900/igt.log fi-byt-n2820 failed to collect. IGT log at Patchwork_4792/fi-byt-n2820/igt.log fi-hsw-4770 failed to collect. IGT log at Patchwork_4792/fi-hsw-4770/igt.log fi-hsw-4770r failed to collect. IGT log at Patchwork_4792/fi-hsw-4770r/igt.log fi-ilk-650 failed to collect. IGT log at Patchwork_4792/fi-ilk-650/igt.log fi-ivb-3520m failed to collect. IGT log at Patchwork_4792/fi-ivb-3520m/igt.log fi-ivb-3770 failed to collect. IGT log at Patchwork_4792/fi-ivb-3770/igt.log fi-kbl-7500u failed to collect. IGT log at Patchwork_4792/fi-kbl-7500u/igt.log fi-kbl-7560u failed to collect. IGT log at Patchwork_4792/fi-kbl-7560u/igt.log fi-skl-6260u failed to collect. IGT log at Patchwork_4792/fi-skl-6260u/igt.log fi-skl-6700hq failed to collect. IGT log at Patchwork_4792/fi-skl-6700hq/igt.log fi-skl-6700k failed to collect. IGT log at Patchwork_4792/fi-skl-6700k/igt.log fi-skl-6770hq failed to collect. IGT log at Patchwork_4792/fi-skl-6770hq/igt.log fi-snb-2520m failed to collect. IGT log at Patchwork_4792/fi-snb-2520m/igt.log fi-snb-2600 failed to collect. IGT log at Patchwork_4792/fi-snb-2600/igt.log
26f8446d6f098e0f05c0aaaa09f29f7f086decf8 drm-tip: 2017y-05m-23d-21h-09m-34s UTC integration manifest 9306eb3 drm/i915: Set PWM divider to match desired frequency in vbt
45be0dd drm: Add definition for eDP backlight frequency
98ab393 drm/i915: Add option to support dynamic backlight via DPCD
51873e2 drm/i915: Allow choosing how to adjust brightness if both supported
a782c81 drm/i915: Drop AUX backlight enable check for backlight control
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4792/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✓ Fi.CI.BAT: success for Enhancement to intel_dp_aux_backlight driver (rev8)
Hi,
Quoted 15 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Patchwork
Sent: Wednesday, May 24, 2017 1:52 AM
To: Puthikorn Voravootivat <[email protected]>
Cc: [email protected]
Subject: [Intel-gfx] ✓ Fi.CI.BAT: success for Enhancement tointel_dp_aux_backlightdriver (rev8)== Series Details ==
Series: Enhancement to
intel_dp_aux_backlightdriver (rev8)
URL : https://patchwork.freedesktop.org/series/21086/
State : success
Quoted 7 lines
== Summary ==
Series 21086v8 Enhancement to
intel_dp_aux_backlightdriver
https://patchwork.freedesktop.org/api/1.0/series/21086/revisions/8/mbox/fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:431s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:438s
And to be investigated...why not logs. Resending when clear.
Quoted 27 lines
fi-bdw-5557u failed to collect. IGT log at Patchwork_4792/fi-bdw-5557u/igt.log fi-bsw-n3050 failed to collect. IGT log at Patchwork_4792/fi-bsw-n3050/igt.log fi-bxt-j4205 failed to collect. IGT log at Patchwork_4792/fi-bxt-j4205/igt.log fi-byt-j1900 failed to collect. IGT log at Patchwork_4792/fi-byt-j1900/igt.log fi-byt-n2820 failed to collect. IGT log at Patchwork_4792/fi-byt-n2820/igt.log fi-hsw-4770 failed to collect. IGT log at Patchwork_4792/fi-hsw-4770/igt.log fi-hsw-4770r failed to collect. IGT log at Patchwork_4792/fi-hsw-4770r/igt.log fi-ilk-650 failed to collect. IGT log at Patchwork_4792/fi-ilk-650/igt.log fi-ivb- 3520m failed to collect. IGT log at Patchwork_4792/fi-ivb-3520m/igt.log fi-ivb-3770 failed to collect. IGT log at Patchwork_4792/fi-ivb-3770/igt.log fi-kbl-7500u failed to collect. IGT log at Patchwork_4792/fi-kbl-7500u/igt.log fi-kbl-7560u failed to collect. IGT log at Patchwork_4792/fi-kbl-7560u/igt.log fi-skl-6260u failed to collect. IGT log at Patchwork_4792/fi-skl-6260u/igt.log fi-skl-6700hq failed to collect. IGT log at Patchwork_4792/fi-skl-6700hq/igt.log fi-skl-6700k failed to collect. IGT log at Patchwork_4792/fi-skl-6700k/igt.log fi-skl-6770hq failed to collect. IGT log at Patchwork_4792/fi-skl-6770hq/igt.log fi-snb-2520m failed to collect. IGT log at Patchwork_4792/fi-snb-2520m/igt.log fi-snb-2600 failed to collect. IGT log at Patchwork_4792/fi-snb-2600/igt.log
26f8446d6f098e0f05c0aaaa09f29f7f086decf8drm-tip: 2017y-05m-23d-21h- 09m-34s UTC integration manifest
9306eb3 drm/i915: Set PWM divider to match desired frequency in vbt 45be0dd
drm: Add definition for eDP backlight frequency
98ab393 drm/i915: Add option to support dynamic backlight via DPCD 51873e2 drm/i915: Allow choosing how to adjust brightness if both supported a782c81 drm/i915: Drop AUX backlight enable check for backlight control
Quoted 7 lines
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4792/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Enhancement to intel_dp_aux_backlight driver (rev8)
In reply to Puthikorn Voravootivat== Series Details ==
== Series Details ==
Series: Enhancement to intel_dp_aux_backlight driver (rev8)
URL : https://patchwork.freedesktop.org/series/21086/
State : success
== Summary ==
Series 21086v8 Enhancement to intel_dp_aux_backlight driver
https://patchwork.freedesktop.org/api/1.0/series/21086/revisions/8/mbox/
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-atomic:
fail -> PASS (fi-snb-2600) fdo#100215fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:445s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:430s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:583s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:505s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:488s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:490s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:421s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:415s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:418s 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:464s fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:470s fi-kbl-7560u total:278 pass:263 dwarn:5 dfail:0 fail:0 skip:10 time:569s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:457s fi-skl-6700hq total:278 pass:239 dwarn:0 dfail:1 fail:17 skip:21 time:434s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:471s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:506s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:444s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:533s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:405s
26f8446d6f098e0f05c0aaaa09f29f7f086decf8 drm-tip: 2017y-05m-23d-21h-09m-34s UTC integration manifest b8fd48f drm/i915: Set PWM divider to match desired frequency in vbt
c09ffde drm: Add definition for eDP backlight frequency
7da6b4f drm/i915: Add option to support dynamic backlight via DPCD
0bd9b03 drm/i915: Allow choosing how to adjust brightness if both supported
3227a9e drm/i915: Drop AUX backlight enable check for backlight control
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4793/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx