drm: Extract DPCD backlight helpers from i915, add support in nouveau
Subsystems (5)
Lyude Paul
maintainerv3 cover drm: Extract DPCD backlight helpers from i915, add support in nouveau
This series:
* Cleans up i915's DPCD backlight code a little bit
* Extracts i915's DPCD backlight code into a set of shared DRM helpers
* Starts using those helpers in nouveau to add support to nouveau for DPCD backlight control
v2 series-wide changes:
* Rebase
v3 series-wide changes:
* Split up the changes to intel's backlight code into separate patches
Lyude Paul (10):
drm/nouveau/kms/nv40-/backlight: Assign prop type once drm/nouveau/kms: Don't probe eDP connectors more then once drm/i915/dpcd_bl: Remove redundant AUX backlight frequency
calculations
drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit drm/i915/dpcd_bl: Cache some backlight capabilities in
intel_panel.backlight
drm/i915/dpcd_bl: Move VESA backlight enabling code closer together drm/i915/dpcd_bl: Return early in vesa_calc_max_backlight if we can't
read PWMGEN_BIT_COUNT
drm/i915/dpcd_bl: Print return codes for VESA backlight failures drm/dp: Extract i915's eDP backlight code into DRM helpers
drivers/gpu/drm/drm_dp_helper.c | 332 ++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 2 +- .../drm/i915/display/intel_dp_aux_backlight.c | 329 +++-------------- drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 6 + include/drm/drm_dp_helper.h | 48 +++ 6 files changed, 428 insertions(+), 293 deletions(-)
Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lyude Paul
maintainerRFC v3 1/10 drm/nouveau/kms/nv40-/backlight: Assign prop type once
--- drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +1 -3
@@ -106,7 +106,6 @@ nv40_backlight_init(struct nouveau_encoder *encoder,if (!(nvif_rd32 (device,NV40_PMC_BACKLIGHT ) &NV40_PMC_BACKLIGHT_MASK ))return -ENODEV ; - props->type =BACKLIGHT_RAW ; props->max_brightness =31 ; *ops = &nv40_bl_ops;return 0 ;
@@ -212,7 +211,6 @@ nv50_backlight_init(struct nouveau_encoder *nv_encoder,else *ops = &nva3_bl_ops; - props->type =BACKLIGHT_RAW ; props->max_brightness =100 ;return 0 ;
@@ -226,7 +224,7 @@ nouveau_backlight_init(struct drm_connector *connector)struct nouveau_encoder *nv_encoder =NULL ;struct nvif_device *device = &drm->client.device;char backlight_name[BL_NAME_SIZE ]; -struct backlight_properties props = {0 }; +struct backlight_properties props = { .type =BACKLIGHT_RAW ,0 };const struct backlight_ops *ops;int ret;
Signature · 6 lines
2.29.2 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Lyude Paul
maintainerRFC v3 2/10 drm/nouveau/kms: Don't probe eDP connectors more then once
In reply to Lyude PauleDP doesn't do hotplugging, so there's no reason for us to reprobe it (unless a connection status change is being forced, of course).
--- drivers/gpu/drm/nouveau/nouveau_connector.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +6 -0
@@ -556,6 +556,12 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)int ret;enum drm_connector_status conn_status = connector_status_disconnected; +/* eDP doesn't do hotplugging, never probe more then once */ +if (nv_connector->type == DCB_CONNECTOR_eDP && + connector->force ==DRM_FORCE_UNSPECIFIED && + connector->status != connector_status_unknown) +return connector->status; +/* Outputs are only polled while runtime active, so resuming the * device here is unnecessary (and would deadlock upon runtime suspend * because it waits for polling to finish). We do however, want to
Signature · 6 lines
2.29.2 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Lyude Paul
maintainerRFC v3 3/10 drm/i915/dpcd_bl: Remove redundant AUX backlight frequency calculations
In reply to Lyude PaulNoticed this while moving all of the VESA backlight code in i915 over to DRM helpers: it would appear that we calculate the frequency value we want to write to DP_EDP_BACKLIGHT_FREQ_SET twice even though this value never actually changes during runtime. So, let's simplify things by just caching this value in intel_panel.backlight, and re-writing it as-needed.
Changes since v1:
* Wrap panel->backlight.edp.vesa.pwm_freq_pre_divider in DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP check - Jani
--- .../drm/i915/display/intel_display_types.h | 1 + .../drm/i915/display/intel_dp_aux_backlight.c | 65 ++++++------------- 2 files changed, 20 insertions(+), 46 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
@@ -264,6 +264,7 @@ struct intel_panel {union {struct {u8 pwmgen_bit_count; +u8 pwm_freq_pre_divider; } vesa;struct {bool sdr_uses_aux;
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +19 -46
99 lines not on this page · raw message
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lyude Paul
maintainerRFC v3 4/10 drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly
In reply to Lyude PaulThis is kind of an annoying aspect of DRM's DP helpers:
drm_dp_dpcd_readb/writeb() return the size of bytes read/written on success, thus we want to check against that instead of checking if the return value is less than 0.
I'll probably be fixing this in the near future once I start doing DP work again, also because I'd rather not mix a tree-wide refactor like that in with a patch series intended to be around introducing DP backlight helpers. So, for now let's just handle the return values from each function correctly.
--- .../drm/i915/display/intel_dp_aux_backlight.c | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +19 -22
@@ -107,7 +107,7 @@ intel_dp_aux_supports_hdr_backlight(struct intel_connector *connector)u8 tcon_cap[4 ]; ret =drm_dp_dpcd_read (aux,INTEL_EDP_HDR_TCON_CAP0 , tcon_cap,sizeof (tcon_cap)); -if (ret <0 ) +if (ret !=sizeof (tcon_cap))return false;if (!(tcon_cap[1 ] &INTEL_EDP_HDR_TCON_BRIGHTNESS_NITS_CAP ))
@@ -137,7 +137,7 @@ intel_dp_aux_hdr_get_backlight(struct intel_connector *connector, enum pipe pipeu8 tmp;u8 buf[2 ] = {0 }; -if (drm_dp_dpcd_readb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , &tmp) <0 ) { +if (drm_dp_dpcd_readb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , &tmp) !=1 ) {drm_err (&i915->drm,"Failed to read current backlight mode from DPCD\n" );return 0 ; }
@@ -153,7 +153,8 @@ intel_dp_aux_hdr_get_backlight(struct intel_connector *connector, enum pipe pipereturn panel->backlight.max; } -if (drm_dp_dpcd_read (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf,sizeof (buf)) <0 ) { +if (drm_dp_dpcd_read (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf, +sizeof (buf)) !=sizeof (buf)) {drm_err (&i915->drm,"Failed to read brightness from DPCD\n" );return 0 ; }
@@ -172,7 +173,8 @@ intel_dp_aux_hdr_set_aux_backlight(const struct drm_connector_state *conn_state, buf[0 ] = level &0xFF ; buf[1 ] = (level &0xFF00 ) >>8 ; -if (drm_dp_dpcd_write (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf,4 ) <0 ) +if (drm_dp_dpcd_write (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf, +sizeof (buf)) !=sizeof (buf))drm_err (dev,"Failed to write brightness level to DPCD\n" ); }
@@ -203,7 +205,7 @@ intel_dp_aux_hdr_enable_backlight(const struct intel_crtc_state *crtc_state,u8 old_ctrl, ctrl; ret =drm_dp_dpcd_readb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , &old_ctrl); -if (ret <0 ) { +if (ret !=1 ) {drm_err (&i915->drm,"Failed to read current backlight control mode: %d\n" , ret);return ; }
@@ -221,7 +223,7 @@ intel_dp_aux_hdr_enable_backlight(const struct intel_crtc_state *crtc_state, }if (ctrl != old_ctrl) -if (drm_dp_dpcd_writeb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , ctrl) <0 ) +if (drm_dp_dpcd_writeb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , ctrl) !=1 )drm_err (&i915->drm,"Failed to configure DPCD brightness controls\n" ); }
@@ -277,8 +279,7 @@ static void set_vesa_backlight_enable(struct intel_dp *intel_dp, bool enable)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 ) { +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) {drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" ,DP_EDP_DISPLAY_CONTROL_REGISTER );return ;
@@ -332,8 +333,8 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enif (!intel_dp_aux_vesa_backlight_dpcd_mode (connector))return connector->panel.backlight.max; -if (drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , - &read_val,sizeof (read_val)) <0 ) { +if (drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , &read_val, +sizeof (read_val)) !=sizeof (read_val)) {drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" ,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB );return 0 ;
@@ -365,8 +366,8 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, vals[0 ] = (level &0xFF00 ) >>8 ; vals[1 ] = (level &0xFF ); } -if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , - vals,sizeof (vals)) <0 ) { +if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals, +sizeof (vals)) !=sizeof (vals)) {drm_dbg_kms (&i915->drm,"Failed to write aux backlight level\n" );return ;
@@ -401,9 +402,8 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; -if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_PWMGEN_BIT_COUNT , - pwmgen_bit_count) <0 ) +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , + pwmgen_bit_count) !=1 )drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count\n" );
@@ -424,11 +424,9 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, }if (new_dpcd_buf != dpcd_buf) { -if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf) <0 ) { -drm_dbg_kms (&i915->drm, -"Failed to write aux backlight mode\n" ); - } +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , + new_dpcd_buf) !=1 ) +drm_dbg_kms (&i915->drm,"Failed to write aux backlight mode\n" ); }intel_dp_aux_vesa_set_backlight (conn_state, level);
@@ -519,8 +517,7 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connecto }drm_dbg_kms (&i915->drm,"Using eDP pwmgen bit count of %d\n" , pn); -if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_PWMGEN_BIT_COUNT , pn) <0 ) { +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pn) !=1 ) {drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count\n" );return max_backlight;
Signature · 6 lines
2.29.2 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [RFC v3 04/10] drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly
Quoted 5 lines · Lyude Paul
This is kind of an annoying aspect of DRM's DP helpers:
drm_dp_dpcd_readb/writeb() return the size of bytes read/written on success, thus we want to check against that instead of checking if the return value is less than 0.
Quoted 7 lines
I'll probably be fixing this in the near future once I start doing DP work again, also because I'd rather not mix a tree-wide refactor like that in with a patch series intended to be around introducing DP backlight helpers. So, for now let's just handle the return values from each function correctly.
Signed-off-by Lyude Paul <[email protected]>
Quoted 140 lines
--- .../drm/i915/display/intel_dp_aux_backlight.c | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +19
-22@@ -107,7 +107,7 @@ intel_dp_aux_supports_hdr_backlight(struct intel_connector *connector)u8 tcon_cap[4 ]; ret =drm_dp_dpcd_read (aux,INTEL_EDP_HDR_TCON_CAP0 , tcon_cap,sizeof (tcon_cap)); -if (ret <0 ) +if (ret !=sizeof (tcon_cap))return false;if (!(tcon_cap[1 ] &INTEL_EDP_HDR_TCON_BRIGHTNESS_NITS_CAP ))@@ -137,7 +137,7 @@ intel_dp_aux_hdr_get_backlight(struct intel_connector *connector, enum pipe pipeu8 tmp;u8 buf[2 ] = {0 }; -if (drm_dp_dpcd_readb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , &tmp) <0 ) { +if (drm_dp_dpcd_readb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , &tmp) !=1 ) {drm_err (&i915->drm,"Failed to read current backlight mode from DPCD\n" );return 0 ; }@@ -153,7 +153,8 @@ intel_dp_aux_hdr_get_backlight(struct intel_connector *connector, enum pipe pipereturn panel->backlight.max; } -if (drm_dp_dpcd_read (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf,sizeof (buf)) <0 ) { +if (drm_dp_dpcd_read (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf, +sizeof (buf)) !=sizeof (buf)) {drm_err (&i915->drm,"Failed to read brightness from DPCD\n" );return 0 ; }@@ -172,7 +173,8 @@ intel_dp_aux_hdr_set_aux_backlight(const struct drm_connector_state *conn_state, buf[0 ] = level &0xFF ; buf[1 ] = (level &0xFF00 ) >>8 ; -if (drm_dp_dpcd_write (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf,4 ) <0 ) +if (drm_dp_dpcd_write (&intel_dp->aux,INTEL_EDP_BRIGHTNESS_NITS_LSB , buf, +sizeof (buf)) !=sizeof (buf))drm_err (dev,"Failed to write brightness level to DPCD\n" ); }@@ -203,7 +205,7 @@ intel_dp_aux_hdr_enable_backlight(const struct intel_crtc_state *crtc_state,u8 old_ctrl, ctrl; ret =drm_dp_dpcd_readb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , &old_ctrl); -if (ret <0 ) { +if (ret !=1 ) {drm_err (&i915->drm,"Failed to read current backlight control mode: %d\n" , ret);return ; }@@ -221,7 +223,7 @@ intel_dp_aux_hdr_enable_backlight(const struct intel_crtc_state *crtc_state, }if (ctrl != old_ctrl) -if (drm_dp_dpcd_writeb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , ctrl) <0 ) +if (drm_dp_dpcd_writeb (&intel_dp->aux,INTEL_EDP_HDR_GETSET_CTRL_PARAMS , ctrl) !=1 )drm_err (&i915->drm,"Failed to configure DPCD brightness controls\n" ); }@@ -277,8 +279,7 @@ static void set_vesa_backlight_enable(struct intel_dp *intel_dp, bool enable)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 ) { +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) {drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" ,DP_EDP_DISPLAY_CONTROL_REGISTER );return ;@@ -332,8 +333,8 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enif (!intel_dp_aux_vesa_backlight_dpcd_mode (connector))return connector->panel.backlight.max; -if (drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , - &read_val,sizeof (read_val)) <0 ) { +if (drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , &read_val, +sizeof (read_val)) !=sizeof (read_val)) {drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" ,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB );return 0 ;@@ -365,8 +366,8 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, vals[0 ] = (level &0xFF00 ) >>8 ; vals[1 ] = (level &0xFF ); } -if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , - vals,sizeof (vals)) <0 ) { +if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals, +sizeof (vals)) !=sizeof (vals)) {drm_dbg_kms (&i915->drm,"Failed to write aux backlight level\n" );return ;@@ -401,9 +402,8 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; -if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_PWMGEN_BIT_COUNT , - pwmgen_bit_count) <0 ) +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , + pwmgen_bit_count) !=1 )drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count\n" );@@ -424,11 +424,9 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, }if (new_dpcd_buf != dpcd_buf) { -if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf) <0 ) { -drm_dbg_kms (&i915->drm, -"Failed to write aux backlight mode\n" ); - } +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , + new_dpcd_buf) !=1 ) +drm_dbg_kms (&i915->drm,"Failed to write aux backlight mode\n" ); }intel_dp_aux_vesa_set_backlight (conn_state, level);@@ -519,8 +517,7 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connecto }drm_dbg_kms (&i915->drm,"Using eDP pwmgen bit count of %d\n" , pn); -if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_EDP_PWMGEN_BIT_COUNT , pn) <0 ) { +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pn) !=1 ) {drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count\n" );return max_backlight;Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Lyude Paul
maintainerRFC v3 5/10 drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit
In reply to Lyude PaulGet rid of the extraneous switch case in here, and just open code edp_backlight_mode as we only ever use it once.
--- .../gpu/drm/i915/display/intel_dp_aux_backlight.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +2 -13
@@ -382,7 +382,7 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp);struct intel_panel *panel = &connector->panel; -u8 dpcd_buf, new_dpcd_buf, edp_backlight_mode; +u8 dpcd_buf, new_dpcd_buf;u8 pwmgen_bit_count = panel->backlight.edp.vesa.pwmgen_bit_count; if (drm_dp_dpcd_readb(&intel_dp->aux,
@@ -393,12 +393,8 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, } 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 : +if ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) !=DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) { new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ;
@@ -406,13 +402,6 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, pwmgen_bit_count) != 1)drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count\n" ); - -break ; - -/* Do nothing when it is already DPCD mode */ -case DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD : -default : -break ; }if (panel->backlight.edp.vesa.pwm_freq_pre_divider) {
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Nouveau] [RFC v3 05/10] drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit
Quoted 23 lines · Lyude Paul
Get rid of the extraneous switch case in here, and just open code
edp_backlight_modeas we only ever use it once.Signed-off-by Lyude Paul <[email protected]>--- .../gpu/drm/i915/display/intel_dp_aux_backlight.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-1@@ -382,7 +382,7 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp);struct intel_panel *panel = &connector->panel; -u8 dpcd_buf, new_dpcd_buf, edp_backlight_mode; +u8 dpcd_buf, new_dpcd_buf;u8 pwmgen_bit_count = panel->backlight.edp.vesa.pwmgen_bit_count; if (drm_dp_dpcd_readb(&intel_dp->aux,
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, · line 397
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-5@@ -393,12 +393,8 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, } 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 : +if ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) !=DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) {
You probably meant != MODE_DPCD?
Quoted 20 lines
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-8new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ;@@ -406,13 +402,6 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, pwmgen_bit_count) != 1)drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count\n" ); - -break ; - -/* Do nothing when it is already DPCD mode */ -case DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD : -default : -break ; }if (panel->backlight.edp.vesa.pwm_freq_pre_divider) { --2.29.2
Quoted 4 lines
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Lyude Paul
maintainerRFC v3 6/10 drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight
In reply to Lyude PaulSince we're about to be moving this code into shared DRM helpers, we might as well start to cache certain backlight capabilities that can be determined from the EDP DPCD, and are likely to be relevant to the majority of drivers using said helpers. The main purpose of this is just to prevent every driver from having to check everything against the eDP DPCD using DP macros, which makes the code slightly easier to read (especially since the names of some of the eDP capabilities don't exactly match up with what we actually need to use them for, like DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT for instance).
--- .../drm/i915/display/intel_display_types.h | 2 ++ .../drm/i915/display/intel_dp_aux_backlight.c | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +2 -0
@@ -265,6 +265,8 @@ struct intel_panel {struct {u8 pwmgen_bit_count;u8 pwm_freq_pre_divider; +bool lsb_reg_used; +bool aux_enable; } vesa;struct {bool sdr_uses_aux;
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +19 -10
@@ -270,13 +270,14 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi }/* VESA backlight callbacks */ -static void set_vesa_backlight_enable (struct intel_dp *intel_dp,bool enable) +static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) { +struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp);u8 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 )) +if (!connector->panel.backlight.edp.vesa.aux_enable)return ;if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) {
@@ -339,9 +340,11 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, en DP_EDP_BACKLIGHT_BRIGHTNESS_MSB);return 0 ; } - level = read_val[0 ]; -if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) + +if (connector->panel.backlight.edp.vesa.lsb_reg_used) level = (read_val[0 ] <<8 | read_val[1 ]); +else + level = read_val[0 ];return level; }
@@ -359,13 +362,14 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state,struct drm_i915_private *i915 =dp_to_i915 (intel_dp);u8 vals[2 ] = {0x0 }; - vals[0 ] = level; -/* Write the MSB and/or LSB */ -if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) { +if (connector->panel.backlight.edp.vesa.lsb_reg_used) { vals[0 ] = (level &0xFF00 ) >>8 ; vals[1 ] = (level &0xFF ); + }else { + vals[0 ] = level; } +if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals,sizeof (vals)) !=sizeof (vals)) { drm_dbg_kms(&i915->drm,
@@ -419,14 +423,13 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, }intel_dp_aux_vesa_set_backlight (conn_state, level); -set_vesa_backlight_enable (intel_dp, true); +set_vesa_backlight_enable (connector, true); }static void intel_dp_aux_vesa_disable_backlight (const struct drm_connector_state *old_conn_state,u32 level) { -set_vesa_backlight_enable (enc_to_intel_dp (to_intel_encoder (old_conn_state->best_encoder)), - false); +set_vesa_backlight_enable (to_intel_connector (old_conn_state->connector), false); }/*
@@ -524,8 +527,14 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connectostatic int intel_dp_aux_vesa_setup_backlight (struct intel_connector *connector,enum pipe pipe) { +struct intel_dp *intel_dp =intel_attached_dp (connector);struct intel_panel *panel = &connector->panel; +if (intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) + panel->backlight.edp.vesa.aux_enable = true; +if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) + panel->backlight.edp.vesa.lsb_reg_used = true; + panel->backlight.max =intel_dp_aux_vesa_calc_max_backlight (connector);if (!panel->backlight.max)return -ENODEV ;
Signature · 6 lines
2.29.2 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [RFC v3 06/10] drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight
Quoted 11 lines · Lyude Paul
Since we're about to be moving this code into shared DRM helpers, we might as well start to cache certain backlight capabilities that can be determined from the EDP DPCD, and are likely to be relevant to the majority of drivers using said helpers. The main purpose of this is just to prevent every driver from having to check everything against the eDP DPCD using DP macros, which makes the code slightly easier to read (especially since the names of some of the eDP capabilities don't exactly match up with what we actually need to use them for, like
DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNTfor instance).Signed-off-by Lyude Paul <[email protected]>
Quoted 110 lines
--- .../drm/i915/display/intel_display_types.h | 2 ++ .../drm/i915/display/intel_dp_aux_backlight.c | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-)drivers/gpu/drm/i915/display/intel_display_types.h +2
-0@@ -265,6 +265,8 @@ struct intel_panel {struct {u8 pwmgen_bit_count;u8 pwm_freq_pre_divider; +bool lsb_reg_used; +bool aux_enable; } vesa;struct {bool sdr_uses_aux;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +19
-10@@ -270,13 +270,14 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi }/* VESA backlight callbacks */ -static void set_vesa_backlight_enable (struct intel_dp *intel_dp,bool enable) +static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) { +struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp);u8 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 )) +if (!connector->panel.backlight.edp.vesa.aux_enable)return ;if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) {@@ -339,9 +340,11 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, en DP_EDP_BACKLIGHT_BRIGHTNESS_MSB);return 0 ; } - level = read_val[0 ]; -if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) + +if (connector->panel.backlight.edp.vesa.lsb_reg_used) level = (read_val[0 ] <<8 | read_val[1 ]); +else + level = read_val[0 ];return level; }@@ -359,13 +362,14 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state,struct drm_i915_private *i915 =dp_to_i915 (intel_dp);u8 vals[2 ] = {0x0 }; - vals[0 ] = level; -/* Write the MSB and/or LSB */ -if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) { +if (connector->panel.backlight.edp.vesa.lsb_reg_used) { vals[0 ] = (level &0xFF00 ) >>8 ; vals[1 ] = (level &0xFF ); + }else { + vals[0 ] = level; } +if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals,sizeof (vals)) !=sizeof (vals)) { drm_dbg_kms(&i915->drm,@@ -419,14 +423,13 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, }intel_dp_aux_vesa_set_backlight (conn_state, level); -set_vesa_backlight_enable (intel_dp, true); +set_vesa_backlight_enable (connector, true); }static void intel_dp_aux_vesa_disable_backlight (const struct drm_connector_state *old_conn_state,u32 level) { -set_vesa_backlight_enable (enc_to_intel_dp (to_intel_encoder (old_conn_state->best_encoder)), - false); +set_vesa_backlight_enable (to_intel_connector (old_conn_state->connector), false); }/* @@ -524,8 +527,14 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connectostatic int intel_dp_aux_vesa_setup_backlight (struct intel_connector *connector,enum pipe pipe) { +struct intel_dp *intel_dp =intel_attached_dp (connector);struct intel_panel *panel = &connector->panel; +if (intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) + panel->backlight.edp.vesa.aux_enable = true; +if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) + panel->backlight.edp.vesa.lsb_reg_used = true; + panel->backlight.max =intel_dp_aux_vesa_calc_max_backlight (connector);if (!panel->backlight.max)return -ENODEV ;Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lyude Paul
maintainerRFC v3 7/10 drm/i915/dpcd_bl: Move VESA backlight enabling code closer together
In reply to Lyude PaulNo functional changes, just move set_vesa_backlight_enable() closer to it's only caller: intel_dp_aux_vesa_enable_backlight().
--- .../drm/i915/display/intel_dp_aux_backlight.c | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +27 -27
@@ -270,33 +270,6 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi }/* VESA backlight callbacks */ -static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) -{ -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -u8 reg_val =0 ; - -/* Early return when display use other mechanism to enable backlight. */ -if (!connector->panel.backlight.edp.vesa.aux_enable) -return ; - -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , -DP_EDP_DISPLAY_CONTROL_REGISTER ); -return ; - } -if (enable) - reg_val |=DP_EDP_BACKLIGHT_ENABLE ; -else - reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); - -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , - reg_val) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to %s aux backlight\n" , - enable ?"enable" :"disable" ); - } -} -static bool intel_dp_aux_vesa_backlight_dpcd_mode (struct intel_connector *connector) {struct intel_dp *intel_dp =intel_attached_dp (connector);
@@ -378,6 +351,33 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, } } +static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) +{ +struct intel_dp *intel_dp =intel_attached_dp (connector); +struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +u8 reg_val =0 ; + +/* Early return when display use other mechanism to enable backlight. */ +if (!connector->panel.backlight.edp.vesa.aux_enable) +return ; + +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , +DP_EDP_DISPLAY_CONTROL_REGISTER ); +return ; + } +if (enable) + reg_val |=DP_EDP_BACKLIGHT_ENABLE ; +else + reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); + +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , + reg_val) !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to %s aux backlight\n" , + enable ?"enable" :"disable" ); + } +} +static void intel_dp_aux_vesa_enable_backlight (const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state,u32 level)
Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC v3 07/10] drm/i915/dpcd_bl: Move VESA backlight enabling code closer together
Quoted 4 lines · Lyude Paul
No functional changes, just move
set_vesa_backlight_enable()closer to it's only caller:intel_dp_aux_vesa_enable_backlight().Signed-off-by Lyude Paul <[email protected]>
Quoted 83 lines
--- .../drm/i915/display/intel_dp_aux_backlight.c | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +27
-27@@ -270,33 +270,6 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi }/* VESA backlight callbacks */ -static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) -{ -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -u8 reg_val =0 ; - -/* Early return when display use other mechanism to enable backlight. */ -if (!connector->panel.backlight.edp.vesa.aux_enable) -return ; - -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , -DP_EDP_DISPLAY_CONTROL_REGISTER ); -return ; - } -if (enable) - reg_val |=DP_EDP_BACKLIGHT_ENABLE ; -else - reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); - -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , - reg_val) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to %s aux backlight\n" , - enable ?"enable" :"disable" ); - } -} -static bool intel_dp_aux_vesa_backlight_dpcd_mode (struct intel_connector *connector) {struct intel_dp *intel_dp =intel_attached_dp (connector);@@ -378,6 +351,33 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, } } +static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) +{ +struct intel_dp *intel_dp =intel_attached_dp (connector); +struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +u8 reg_val =0 ; + +/* Early return when display use other mechanism to enable backlight. */ +if (!connector->panel.backlight.edp.vesa.aux_enable) +return ; + +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , +DP_EDP_DISPLAY_CONTROL_REGISTER ); +return ; + } +if (enable) + reg_val |=DP_EDP_BACKLIGHT_ENABLE ; +else + reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); + +if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , + reg_val) !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to %s aux backlight\n" , + enable ?"enable" :"disable" ); + } +} +static void intel_dp_aux_vesa_enable_backlight (const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state,u32 level)Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lyude Paul
maintainerRFC v3 8/10 drm/i915/dpcd_bl: Return early in vesa_calc_max_backlight if we can't read PWMGEN_BIT_COUNT
In reply to Lyude PaulIf we can't read DP_EDP_PWMGEN_BIT_COUNT in intel_dp_aux_vesa_calc_max_backlight() but do have a valid PWM frequency defined in the VBT, we'll keep going in the function until we inevitably fail on reading DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN. There's not much point in doing this, so just return early.
--- drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +6 -3
@@ -449,11 +449,14 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connectoint freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ;u8 pn, pn_min, pn_max; -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , &pn) ==1 ) { - pn &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; - max_backlight = (1 << pn) -1 ; +if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , &pn) !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap\n" ); +return 0 ; } + pn &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + max_backlight = (1 << pn) -1 ; +/* 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.
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lyude Paul
maintainerRFC v3 9/10 drm/i915/dpcd_bl: Print return codes for VESA backlight failures
In reply to Lyude PaulAlso, stop printing the DPCD register that failed, and just describe it instead. Saves us from having to look up each register offset when reading through kernel logs (plus, DPCD dumping with drm.debug |= 0x100 will give us that anyway).
--- .../drm/i915/display/intel_dp_aux_backlight.c | 101 +++++++++--------- 1 file changed, 52 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +52 -49
@@ -274,14 +274,12 @@ static bool intel_dp_aux_vesa_backlight_dpcd_mode(struct intel_connector *connec {struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +int ret;u8 mode_reg; -if (drm_dp_dpcd_readb (&intel_dp->aux, -DP_EDP_BACKLIGHT_MODE_SET_REGISTER , - &mode_reg) !=1 ) { -drm_dbg_kms (&i915->drm, -"Failed to read the DPCD register 0x%x\n" , -DP_EDP_BACKLIGHT_MODE_SET_REGISTER ); + ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &mode_reg); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read backlight mode: %d\n" , ret);return false; }
@@ -297,6 +295,7 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, en {struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +int ret;u8 read_val[2 ] = {0x0 };u16 level =0 ;
@@ -307,10 +306,10 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enif (!intel_dp_aux_vesa_backlight_dpcd_mode (connector))return connector->panel.backlight.max; -if (drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , &read_val, -sizeof (read_val)) !=sizeof (read_val)) { -drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , -DP_EDP_BACKLIGHT_BRIGHTNESS_MSB ); + ret =drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , &read_val, +sizeof (read_val)); +if (ret !=sizeof (read_val)) { +drm_dbg_kms (&i915->drm,"Failed to read brightness level: %d\n" , ret);return 0 ; }
@@ -333,6 +332,7 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state,struct intel_connector *connector =to_intel_connector (conn_state->connector);struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +int ret;u8 vals[2 ] = {0x0 };/* Write the MSB and/or LSB */
@@ -343,10 +343,10 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, vals[0 ] = level; } -if (drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals, -sizeof (vals)) !=sizeof (vals)) { -drm_dbg_kms (&i915->drm, -"Failed to write aux backlight level\n" ); + ret =drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals, +sizeof (vals)); +if (ret !=sizeof (vals)) { +drm_dbg_kms (&i915->drm,"Failed to write aux backlight level: %d\n" , ret);return ; } }
@@ -355,26 +355,28 @@ static void set_vesa_backlight_enable(struct intel_connector *connector, bool en {struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +int ret;u8 reg_val =0 ;/* Early return when display use other mechanism to enable backlight. */ if (!connector->panel.backlight.edp.vesa.aux_enable)return ; -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , -DP_EDP_DISPLAY_CONTROL_REGISTER ); + ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read eDP display control register: %d\n" , ret);return ; } +if (enable) reg_val |=DP_EDP_BACKLIGHT_ENABLE ;else reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , - reg_val) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to %s aux backlight\n" , - enable ?"enable" :"disable" ); + ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , reg_val); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to %s aux backlight: %d\n" , + enable ?"enable" :"disable" , ret); } }
@@ -386,13 +388,13 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp);struct intel_panel *panel = &connector->panel; +int ret;u8 dpcd_buf, new_dpcd_buf;u8 pwmgen_bit_count = panel->backlight.edp.vesa.pwmgen_bit_count; -if (drm_dp_dpcd_readb (&intel_dp->aux, -DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read DPCD register 0x%x\n" , -DP_EDP_BACKLIGHT_MODE_SET_REGISTER ); + ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read backlight mode: %d\n" , ret);return ; }
@@ -402,24 +404,26 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , - pwmgen_bit_count) !=1 ) -drm_dbg_kms (&i915->drm, -"Failed to write aux pwmgen bit count\n" ); + ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pwmgen_bit_count); +if (ret !=1 ) +drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count: %d\n" , ret); }if (panel->backlight.edp.vesa.pwm_freq_pre_divider) { -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_FREQ_SET , - panel->backlight.edp.vesa.pwm_freq_pre_divider) ==1 ) + ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_FREQ_SET , + panel->backlight.edp.vesa.pwm_freq_pre_divider); +if (ret ==1 ) new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ;else -drm_dbg_kms (&i915->drm,"Failed to write aux backlight frequency\n" ); +drm_dbg_kms (&i915->drm,"Failed to write aux backlight frequency: %d\n" , + ret); }if (new_dpcd_buf != dpcd_buf) { -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , - new_dpcd_buf) !=1 ) -drm_dbg_kms (&i915->drm,"Failed to write aux backlight mode\n" ); + ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , + new_dpcd_buf); +if (ret !=1 ) +drm_dbg_kms (&i915->drm,"Failed to write aux backlight mode: %d\n" , ret); }intel_dp_aux_vesa_set_backlight (conn_state, level);
@@ -446,11 +450,12 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connectostruct intel_dp *intel_dp =intel_attached_dp (connector);struct intel_panel *panel = &connector->panel;u32 max_backlight =0 ; -int freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ; +int ret, freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ;u8 pn, pn_min, pn_max; -if (drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , &pn) !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap\n" ); + ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , &pn); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap: %d\n" , ret);return 0 ; }
@@ -479,16 +484,14 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connecto* - 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_dbg_kms (&i915->drm, -"Failed to read pwmgen bit count cap min\n" ); + ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN , &pn_min); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap min: %d\n" , ret);return max_backlight; } -if (drm_dp_dpcd_readb (&intel_dp->aux, -DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max) !=1 ) { -drm_dbg_kms (&i915->drm, -"Failed to read pwmgen bit count cap max\n" ); + ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap max: %d\n" , ret);return max_backlight; } pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ;
@@ -512,9 +515,9 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connecto }drm_dbg_kms (&i915->drm,"Using eDP pwmgen bit count of %d\n" , pn); -if (drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pn) !=1 ) { -drm_dbg_kms (&i915->drm, -"Failed to write aux pwmgen bit count\n" ); + ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pn); +if (ret !=1 ) { +drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count: %d\n" , ret);return max_backlight; }
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lyude Paul
maintainerRFC v3 10/10 drm/dp: Extract i915's eDP backlight code into DRM helpers
In reply to Lyude PaulSince we're about to implement eDP backlight support in nouveau using the standard protocol from VESA, we might as well just take the code that's already written for this and move it into a set of shared DRM helpers.
Note that these helpers are intended to handle DPCD related backlight control bits such as setting the brightness level over AUX, probing the backlight's TCON, enabling/disabling the backlight over AUX if supported, etc. Any PWM-related portions of backlight control are explicitly left up to the driver, as these will vary from platform to platform.
The only exception to this is the calculation of the PWM frequency pre-divider value. This is because the only platform-specific information required for this is the PWM frequency of the panel, which the driver is expected to provide if available. The actual algorithm for calculating this value is standard and is defined in the eDP specification from VESA.
Note that these helpers do not yet implement the full range of features the VESA backlight interface provides, and only provide the following functionality (all of which was already present in i915's DPCD backlight support):
* Basic control of brightness levels
* Basic probing of backlight capabilities
* Helpers for enabling and disabling the backlight
v3:
* Split out changes to i915's backlight code to separate patches to make it easier to review
--- drivers/gpu/drm/drm_dp_helper.c | 332 ++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 5 +- .../drm/i915/display/intel_dp_aux_backlight.c | 285 ++------------- include/drm/drm_dp_helper.h | 48 +++ 4 files changed, 412 insertions(+), 258 deletions(-)
drivers/gpu/drm/drm_dp_helper.c +332 -0
@@ -3082,3 +3082,335 @@ int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc)return 0 ; }EXPORT_SYMBOL (drm_dp_pcon_convert_rgb_to_ycbcr); + +/** +* drm_edp_backlight_set_level() - Set the backlight level of an eDP panel via AUX +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* @level: The brightness level to set +* +* Sets the brightness level of an eDP panel's backlight. Note that the panel's backlight must +* already have been enabled by the driver by calling drm_edp_backlight_enable(). +* +* Returns: %0 on success, negative error code on failure +*/ +int drm_edp_backlight_set_level (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +u16 level) +{ +int ret; +u8 buf[2 ] = {0 }; + +if (bl->lsb_reg_used) { + buf[0 ] = (level &0xFF00 ) >>8 ; + buf[1 ] = (level &0x00FF ); + }else { + buf[0 ] = level; + } + + ret =drm_dp_dpcd_write (aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , buf,sizeof (buf)); +if (ret !=sizeof (buf)) { +DRM_ERROR ("%s: Failed to write aux backlight level: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_set_level); + +static int +drm_edp_backlight_set_enable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +bool enable) +{ +int ret; +u8 buf; + +/* The panel uses something other then DPCD for enabling it's backlight */ +if (!bl->aux_enable) +return 0 ; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_DISPLAY_CONTROL_REGISTER , &buf); +if (ret !=1 ) { +DRM_ERROR ("%s: Failed to read eDP display control register: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } +if (enable) + buf |=DP_EDP_BACKLIGHT_ENABLE ; +else + buf &= ~DP_EDP_BACKLIGHT_ENABLE ; + + ret =drm_dp_dpcd_writeb (aux,DP_EDP_DISPLAY_CONTROL_REGISTER , buf); +if (ret !=1 ) { +DRM_ERROR ("%s: Failed to write eDP display control register: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + +return 0 ; +} + +/** +* drm_edp_backlight_enable() - Enable an eDP panel's backlight using DPCD +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* @level: The initial backlight level to set via AUX, if there is one +* +* This function handles enabling DPCD backlight controls on a panel over DPCD, while additionally +* restoring any important backlight state such as the given backlight level, the brightness byte +* count, backlight frequency, etc. +* +* Note that certain panels, while supporting brightness level controls over DPCD, may not support +* having their backlights enabled via the standard %DP_EDP_DISPLAY_CONTROL_REGISTER. On such panels +* &drm_edp_backlight_info.aux_enable will be set to %false, this function will skip the step of +* programming the %DP_EDP_DISPLAY_CONTROL_REGISTER, and the driver must perform the required +* implementation specific step for enabling the backlight after calling this function. +* +* Returns: %0 on success, negative error code on failure. +*/ +int drm_edp_backlight_enable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +const u16 level) +{ +int ret; +u8 dpcd_buf, new_dpcd_buf; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read backlight mode: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + + new_dpcd_buf = dpcd_buf; + +if ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) !=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ) { + new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; + new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; + + ret =drm_dp_dpcd_writeb (aux,DP_EDP_PWMGEN_BIT_COUNT , bl->pwmgen_bit_count); +if (ret !=1 ) +DRM_DEBUG_KMS ("%s: Failed to write aux pwmgen bit count: %d\n" , + aux->name, ret); + } + +if (bl->pwm_freq_pre_divider) { + ret =drm_dp_dpcd_writeb (aux,DP_EDP_BACKLIGHT_FREQ_SET , bl->pwm_freq_pre_divider); +if (ret !=1 ) +DRM_DEBUG_KMS ("%s: Failed to write aux backlight frequency: %d\n" , + aux->name, ret); +else + new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; + } + +if (new_dpcd_buf != dpcd_buf) { + ret =drm_dp_dpcd_writeb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to write aux backlight mode: %d\n" , + aux->name, ret); +return ret <0 ? ret : -EIO ; + } + } + + ret =drm_edp_backlight_set_level (aux, bl, level); +if (ret <0 ) +return ret; + ret =drm_edp_backlight_set_enable (aux, bl, true); +if (ret <0 ) +return ret; + +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_enable); + +/** +* drm_edp_backlight_disable() - Disable an eDP backlight using DPCD, if supported +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* +* This function handles disabling DPCD backlight controls on a panel over AUX. Note that some +* panels have backlights that are enabled/disabled by other means, despite having their brightness +* values controlled through DPCD. On such panels &drm_edp_backlight_info.aux_enable will be set to +* %false, this function will become a no-op (and we will skip updating +* %DP_EDP_DISPLAY_CONTROL_REGISTER), and the driver must take care to perform it's own +* implementation specific step for disabling the backlight. +* +* Returns: %0 on success or no-op, negative error code on failure. +*/ +int drm_edp_backlight_disable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl) +{ +int ret; + + ret =drm_edp_backlight_set_enable (aux, bl, false); +if (ret <0 ) +return ret; + +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_disable); + +static inline int +drm_edp_backlight_probe_max (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u16 driver_pwm_freq_hz,const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ]) +{ +int fxp, fxp_min, fxp_max, fxp_actual, f =1 ; +int ret; +u8 pn, pn_min, pn_max; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_PWMGEN_BIT_COUNT , &pn); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read pwmgen bit count cap: %d\n" , aux->name, ret); +return -ENODEV ; + } + + pn &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + bl->max = (1 << pn) -1 ; +if (!driver_pwm_freq_hz) +return 0 ; + +/* +* Set PWM Frequency divider to match desired frequency provided by the driver. +* 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) +*/ + +/* 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. +*/ + fxp =DIV_ROUND_CLOSEST (1000 *DP_EDP_BACKLIGHT_FREQ_BASE_KHZ , driver_pwm_freq_hz); + +/* 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. +*/ + ret =drm_dp_dpcd_readb (aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN , &pn_min); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read pwmgen bit count cap min: %d\n" , aux->name, ret); +return 0 ; + } + ret =drm_dp_dpcd_readb (aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read pwmgen bit count cap max: %d\n" , aux->name, ret); +return 0 ; + } + pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + +/* Ensure frequency is within 25% of desired value */ + 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 ("%s: Driver defined backlight frequency (%d) out of range\n" , + aux->name, driver_pwm_freq_hz); +return 0 ; + } + +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 ; + } + + ret =drm_dp_dpcd_writeb (aux,DP_EDP_PWMGEN_BIT_COUNT , pn); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to write aux pwmgen bit count: %d\n" , aux->name, ret); +return 0 ; + } + bl->pwmgen_bit_count = pn; + bl->max = (1 << pn) -1 ; + +if (edp_dpcd[2 ] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP ) { + bl->pwm_freq_pre_divider = f; +DRM_DEBUG_KMS ("%s: Using backlight frequency from driver (%dHz)\n" , + aux->name, driver_pwm_freq_hz); + } + +return 0 ; +} + +static inline int +drm_edp_backlight_probe_level (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u8 *current_mode) +{ +int ret; +u8 buf[2 ]; +u8 mode_reg; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &mode_reg); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read backlight mode: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + + *current_mode = (mode_reg &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ); +if (*current_mode ==DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ) { +int size =1 + bl->lsb_reg_used; + + ret =drm_dp_dpcd_read (aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , buf, size); +if (ret != size) { +DRM_DEBUG_KMS ("%s: Failed to read backlight level: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + +if (bl->lsb_reg_used) +return (buf[0 ] <<8 ) | buf[1 ]; +else +return buf[0 ]; + } + +/* +* If we're not in DPCD control mode yet, the programmed brightness value is meaningless and +* the driver should assume max brightness +*/ +return bl->max; +} + +/** +* drm_edp_backlight_init() - Probe a display panel's TCON using the standard VESA eDP backlight +* interface. +* @aux: The DP aux device to use for probing +* @bl: The &drm_edp_backlight_info struct to fill out with information on the backlight +* @driver_pwm_freq_hz: Optional PWM frequency from the driver in hz +* @edp_dpcd: A cached copy of the eDP DPCD +* @current_level: Where to store the probed brightness level +* @current_mode: Where to store the currently set backlight control mode +* +* Initializes a &drm_edp_backlight_info struct by probing @aux for it's backlight capabilities, +* along with also probing the current and maximum supported brightness levels. +* +* If @driver_pwm_freq_hz is non-zero, this will be used as the backlight frequency. Otherwise, the +* default frequency from the panel is used. +* +* Returns: %0 on success, negative error code on failure. +*/ +int +drm_edp_backlight_init (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u16 driver_pwm_freq_hz,const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ], +u16 *current_level,u8 *current_mode) +{ +int ret; + +if (edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) + bl->aux_enable = true; +if (edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) + bl->lsb_reg_used = true; + + ret =drm_edp_backlight_probe_max (aux, bl, driver_pwm_freq_hz, edp_dpcd); +if (ret <0 ) +return ret; + + ret =drm_edp_backlight_probe_level (aux, bl, current_mode); +if (ret <0 ) +return ret; + *current_level = ret; + +DRM_DEBUG_KMS ("%s: Found backlight level=%d/%d pwm_freq_pre_divider=%d mode=%x\n" , + aux->name, *current_level, bl->max, bl->pwm_freq_pre_divider, *current_mode); +DRM_DEBUG_KMS ("%s: Backlight caps: pwmgen_bit_count=%d lsb_reg_used=%d aux_enable=%d\n" , + aux->name, bl->pwmgen_bit_count, bl->lsb_reg_used, bl->aux_enable); +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_init);
drivers/gpu/drm/i915/display/intel_display_types.h +1 -4
@@ -263,10 +263,7 @@ struct intel_panel {/* DPCD backlight */ union {struct { -u8 pwmgen_bit_count; -u8 pwm_freq_pre_divider; -bool lsb_reg_used; -bool aux_enable; +struct drm_edp_backlight_info info; } vesa;struct {bool sdr_uses_aux;
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +31 -254
331 lines not on this page · raw message
include/drm/drm_dp_helper.h +48 -0
60 lines not on this page · raw message
Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerRe: [RFC v3 10/10] drm/dp: Extract i915's eDP backlight code into DRM helpers
Hi
Am 06.02.21 um 00:45 schrieb Lyude Paul:
Quoted 59 lines
Since we're about to implement eDP backlight support in nouveau using the standard protocol from VESA, we might as well just take the code that's already written for this and move it into a set of shared DRM helpers.
Note that these helpers are intended to handle DPCD related backlight control bits such as setting the brightness level over AUX, probing the backlight's TCON, enabling/disabling the backlight over AUX if supported, etc. Any PWM-related portions of backlight control are explicitly left up to the driver, as these will vary from platform to platform.
The only exception to this is the calculation of the PWM frequency pre-divider value. This is because the only platform-specific information required for this is the PWM frequency of the panel, which the driver is expected to provide if available. The actual algorithm for calculating this value is standard and is defined in the eDP specification from VESA.
Note that these helpers do not yet implement the full range of features the VESA backlight interface provides, and only provide the following functionality (all of which was already present in i915's DPCD backlight support):
* Basic control of brightness levels
* Basic probing of backlight capabilities
* Helpers for enabling and disabling the backlightv3:
* Split out changes to i915's backlight code to separate patches to make it easier to reviewSigned-off-by Lyude Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Dave Airlie <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 332 ++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 5 +- .../drm/i915/display/intel_dp_aux_backlight.c | 285 ++------------- include/drm/drm_dp_helper.h | 48 +++ 4 files changed, 412 insertions(+), 258 deletions(-)drivers/gpu/drm/drm_dp_helper.c +11
-0@@ -3082,3 +3082,335 @@ int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc)return 0 ; }EXPORT_SYMBOL (drm_dp_pcon_convert_rgb_to_ycbcr); + +/** +* drm_edp_backlight_set_level() - Set the backlight level of an eDP panel via AUX +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* @level: The brightness level to set +* +* Sets the brightness level of an eDP panel's backlight. Note that the panel's backlight must +* already have been enabled by the driver by calling drm_edp_backlight_enable(). +* +* Returns: %0 on success, negative error code on failure
drivers/gpu/drm/drm_dp_helper.c int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc) · line 3105
Quoted 10 lines
drivers/gpu/drm/drm_dp_helper.c +10
-0+*/ +int drm_edp_backlight_set_level (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +u16 level) +{ +int ret; +u8 buf[2 ] = {0 }; + +if (bl->lsb_reg_used) { + buf[0 ] = (level &0xFF00 ) >>8 ; + buf[1 ] = (level &0x00FF );
Maybe 0x00ff and 0xff00 for aesthetic reasons.
drivers/gpu/drm/drm_dp_helper.c int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc) · line 3112
Quoted 7 lines
drivers/gpu/drm/drm_dp_helper.c +7
-0+ }else { + buf[0 ] = level; + } + + ret =drm_dp_dpcd_write (aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , buf,sizeof (buf)); +if (ret !=sizeof (buf)) { +DRM_ERROR ("%s: Failed to write aux backlight level: %d\n" , aux->name, ret);
Since you're adding this code, you should probably convert to drm_err() helpers as well. Here and elsewhere.
Quoted 5 lines
drivers/gpu/drm/drm_dp_helper.c +5
-0+return ret <0 ? ret : -EIO ; + } + +return 0 ; +}
drivers/gpu/drm/drm_dp_helper.c int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc) · line 3127
Quoted 10 lines
drivers/gpu/drm/drm_dp_helper.c +10
-0+EXPORT_SYMBOL (drm_edp_backlight_set_level); + +static int +drm_edp_backlight_set_enable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +bool enable) +{ +int ret; +u8 buf; + +/* The panel uses something other then DPCD for enabling it's backlight */
'its'
Best regards
Thomas
Quoted 710 lines
drivers/gpu/drm/drm_dp_helper.c +289
-0+if (!bl->aux_enable) +return 0 ; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_DISPLAY_CONTROL_REGISTER , &buf); +if (ret !=1 ) { +DRM_ERROR ("%s: Failed to read eDP display control register: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } +if (enable) + buf |=DP_EDP_BACKLIGHT_ENABLE ; +else + buf &= ~DP_EDP_BACKLIGHT_ENABLE ; + + ret =drm_dp_dpcd_writeb (aux,DP_EDP_DISPLAY_CONTROL_REGISTER , buf); +if (ret !=1 ) { +DRM_ERROR ("%s: Failed to write eDP display control register: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + +return 0 ; +} + +/** +* drm_edp_backlight_enable() - Enable an eDP panel's backlight using DPCD +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* @level: The initial backlight level to set via AUX, if there is one +* +* This function handles enabling DPCD backlight controls on a panel over DPCD, while additionally +* restoring any important backlight state such as the given backlight level, the brightness byte +* count, backlight frequency, etc. +* +* Note that certain panels, while supporting brightness level controls over DPCD, may not support +* having their backlights enabled via the standard %DP_EDP_DISPLAY_CONTROL_REGISTER. On such panels +* &drm_edp_backlight_info.aux_enable will be set to %false, this function will skip the step of +* programming the %DP_EDP_DISPLAY_CONTROL_REGISTER, and the driver must perform the required +* implementation specific step for enabling the backlight after calling this function. +* +* Returns: %0 on success, negative error code on failure. +*/ +int drm_edp_backlight_enable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +const u16 level) +{ +int ret; +u8 dpcd_buf, new_dpcd_buf; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read backlight mode: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + + new_dpcd_buf = dpcd_buf; + +if ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) !=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ) { + new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; + new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; + + ret =drm_dp_dpcd_writeb (aux,DP_EDP_PWMGEN_BIT_COUNT , bl->pwmgen_bit_count); +if (ret !=1 ) +DRM_DEBUG_KMS ("%s: Failed to write aux pwmgen bit count: %d\n" , + aux->name, ret); + } + +if (bl->pwm_freq_pre_divider) { + ret =drm_dp_dpcd_writeb (aux,DP_EDP_BACKLIGHT_FREQ_SET , bl->pwm_freq_pre_divider); +if (ret !=1 ) +DRM_DEBUG_KMS ("%s: Failed to write aux backlight frequency: %d\n" , + aux->name, ret); +else + new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; + } + +if (new_dpcd_buf != dpcd_buf) { + ret =drm_dp_dpcd_writeb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to write aux backlight mode: %d\n" , + aux->name, ret); +return ret <0 ? ret : -EIO ; + } + } + + ret =drm_edp_backlight_set_level (aux, bl, level); +if (ret <0 ) +return ret; + ret =drm_edp_backlight_set_enable (aux, bl, true); +if (ret <0 ) +return ret; + +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_enable); + +/** +* drm_edp_backlight_disable() - Disable an eDP backlight using DPCD, if supported +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* +* This function handles disabling DPCD backlight controls on a panel over AUX. Note that some +* panels have backlights that are enabled/disabled by other means, despite having their brightness +* values controlled through DPCD. On such panels &drm_edp_backlight_info.aux_enable will be set to +* %false, this function will become a no-op (and we will skip updating +* %DP_EDP_DISPLAY_CONTROL_REGISTER), and the driver must take care to perform it's own +* implementation specific step for disabling the backlight. +* +* Returns: %0 on success or no-op, negative error code on failure. +*/ +int drm_edp_backlight_disable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl) +{ +int ret; + + ret =drm_edp_backlight_set_enable (aux, bl, false); +if (ret <0 ) +return ret; + +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_disable); + +static inline int +drm_edp_backlight_probe_max (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u16 driver_pwm_freq_hz,const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ]) +{ +int fxp, fxp_min, fxp_max, fxp_actual, f =1 ; +int ret; +u8 pn, pn_min, pn_max; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_PWMGEN_BIT_COUNT , &pn); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read pwmgen bit count cap: %d\n" , aux->name, ret); +return -ENODEV ; + } + + pn &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + bl->max = (1 << pn) -1 ; +if (!driver_pwm_freq_hz) +return 0 ; + +/* +* Set PWM Frequency divider to match desired frequency provided by the driver. +* 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) +*/ + +/* 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. +*/ + fxp =DIV_ROUND_CLOSEST (1000 *DP_EDP_BACKLIGHT_FREQ_BASE_KHZ , driver_pwm_freq_hz); + +/* 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. +*/ + ret =drm_dp_dpcd_readb (aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN , &pn_min); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read pwmgen bit count cap min: %d\n" , aux->name, ret); +return 0 ; + } + ret =drm_dp_dpcd_readb (aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read pwmgen bit count cap max: %d\n" , aux->name, ret); +return 0 ; + } + pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; + +/* Ensure frequency is within 25% of desired value */ + 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 ("%s: Driver defined backlight frequency (%d) out of range\n" , + aux->name, driver_pwm_freq_hz); +return 0 ; + } + +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 ; + } + + ret =drm_dp_dpcd_writeb (aux,DP_EDP_PWMGEN_BIT_COUNT , pn); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to write aux pwmgen bit count: %d\n" , aux->name, ret); +return 0 ; + } + bl->pwmgen_bit_count = pn; + bl->max = (1 << pn) -1 ; + +if (edp_dpcd[2 ] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP ) { + bl->pwm_freq_pre_divider = f; +DRM_DEBUG_KMS ("%s: Using backlight frequency from driver (%dHz)\n" , + aux->name, driver_pwm_freq_hz); + } + +return 0 ; +} + +static inline int +drm_edp_backlight_probe_level (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u8 *current_mode) +{ +int ret; +u8 buf[2 ]; +u8 mode_reg; + + ret =drm_dp_dpcd_readb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &mode_reg); +if (ret !=1 ) { +DRM_DEBUG_KMS ("%s: Failed to read backlight mode: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + + *current_mode = (mode_reg &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ); +if (*current_mode ==DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ) { +int size =1 + bl->lsb_reg_used; + + ret =drm_dp_dpcd_read (aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , buf, size); +if (ret != size) { +DRM_DEBUG_KMS ("%s: Failed to read backlight level: %d\n" , aux->name, ret); +return ret <0 ? ret : -EIO ; + } + +if (bl->lsb_reg_used) +return (buf[0 ] <<8 ) | buf[1 ]; +else +return buf[0 ]; + } + +/* +* If we're not in DPCD control mode yet, the programmed brightness value is meaningless and +* the driver should assume max brightness +*/ +return bl->max; +} + +/** +* drm_edp_backlight_init() - Probe a display panel's TCON using the standard VESA eDP backlight +* interface. +* @aux: The DP aux device to use for probing +* @bl: The &drm_edp_backlight_info struct to fill out with information on the backlight +* @driver_pwm_freq_hz: Optional PWM frequency from the driver in hz +* @edp_dpcd: A cached copy of the eDP DPCD +* @current_level: Where to store the probed brightness level +* @current_mode: Where to store the currently set backlight control mode +* +* Initializes a &drm_edp_backlight_info struct by probing @aux for it's backlight capabilities, +* along with also probing the current and maximum supported brightness levels. +* +* If @driver_pwm_freq_hz is non-zero, this will be used as the backlight frequency. Otherwise, the +* default frequency from the panel is used. +* +* Returns: %0 on success, negative error code on failure. +*/ +int +drm_edp_backlight_init (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u16 driver_pwm_freq_hz,const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ], +u16 *current_level,u8 *current_mode) +{ +int ret; + +if (edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) + bl->aux_enable = true; +if (edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) + bl->lsb_reg_used = true; + + ret =drm_edp_backlight_probe_max (aux, bl, driver_pwm_freq_hz, edp_dpcd); +if (ret <0 ) +return ret; + + ret =drm_edp_backlight_probe_level (aux, bl, current_mode); +if (ret <0 ) +return ret; + *current_level = ret; + +DRM_DEBUG_KMS ("%s: Found backlight level=%d/%d pwm_freq_pre_divider=%d mode=%x\n" , + aux->name, *current_level, bl->max, bl->pwm_freq_pre_divider, *current_mode); +DRM_DEBUG_KMS ("%s: Backlight caps: pwmgen_bit_count=%d lsb_reg_used=%d aux_enable=%d\n" , + aux->name, bl->pwmgen_bit_count, bl->lsb_reg_used, bl->aux_enable); +return 0 ; +} +EXPORT_SYMBOL (drm_edp_backlight_init);drivers/gpu/drm/i915/display/intel_display_types.h +1
-4@@ -263,10 +263,7 @@ struct intel_panel {/* DPCD backlight */ union {struct { -u8 pwmgen_bit_count; -u8 pwm_freq_pre_divider; -bool lsb_reg_used; -bool aux_enable; +struct drm_edp_backlight_info info; } vesa;struct {bool sdr_uses_aux;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +31
-254@@ -270,114 +270,19 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi }/* VESA backlight callbacks */ -static bool intel_dp_aux_vesa_backlight_dpcd_mode (struct intel_connector *connector) -{ -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -int ret; -u8 mode_reg; - - ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &mode_reg); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read backlight mode: %d\n" , ret); -return false; - } - -return (mode_reg &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) == -DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; -} - -/* -* Read the current backlight value from DPCD register(s) based -* on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported -*/ static u32 intel_dp_aux_vesa_get_backlight (struct intel_connector *connector,enum pipe unused) { -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -int ret; -u8 read_val[2 ] = {0x0 }; -u16 level =0 ; - -/* -* If we're not in DPCD control mode yet, the programmed brightness -* value is meaningless and we should assume max brightness -*/ -if (!intel_dp_aux_vesa_backlight_dpcd_mode (connector)) -return connector->panel.backlight.max; - - ret =drm_dp_dpcd_read (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , &read_val, -sizeof (read_val)); -if (ret !=sizeof (read_val)) { -drm_dbg_kms (&i915->drm,"Failed to read brightness level: %d\n" , ret); -return 0 ; - } - -if (connector->panel.backlight.edp.vesa.lsb_reg_used) - level = (read_val[0 ] <<8 | read_val[1 ]); -else - level = read_val[0 ]; - -return level; +return connector->panel.backlight.level; } -/* -* Sends the current backlight level over the aux channel, checking if its using -* 8-bit or 16 bit value (MSB and LSB) -*/ static void -intel_dp_aux_vesa_set_backlight (const struct drm_connector_state *conn_state, -u32 level) +intel_dp_aux_vesa_set_backlight (const struct drm_connector_state *conn_state,u32 level) {struct intel_connector *connector =to_intel_connector (conn_state->connector); -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -int ret; -u8 vals[2 ] = {0x0 }; - -/* Write the MSB and/or LSB */ -if (connector->panel.backlight.edp.vesa.lsb_reg_used) { - vals[0 ] = (level &0xFF00 ) >>8 ; - vals[1 ] = (level &0xFF ); - }else { - vals[0 ] = level; - } - - ret =drm_dp_dpcd_write (&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB , vals, -sizeof (vals)); -if (ret !=sizeof (vals)) { -drm_dbg_kms (&i915->drm,"Failed to write aux backlight level: %d\n" , ret); -return ; - } -} - -static void set_vesa_backlight_enable (struct intel_connector *connector,bool enable) -{ -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -int ret; -u8 reg_val =0 ; - -/* Early return when display use other mechanism to enable backlight. */ -if (!connector->panel.backlight.edp.vesa.aux_enable) -return ; - - ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , ®_val); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read eDP display control register: %d\n" , ret); -return ; - } - -if (enable) - reg_val |=DP_EDP_BACKLIGHT_ENABLE ; -else - reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE ); +struct intel_panel *panel = &connector->panel; +struct intel_dp *intel_dp =enc_to_intel_dp (connector->encoder); - ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_DISPLAY_CONTROL_REGISTER , reg_val); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to %s aux backlight: %d\n" , - enable ?"enable" :"disable" , ret); - } +drm_edp_backlight_set_level (&intel_dp->aux, &panel->backlight.edp.vesa.info, level); } static void@@ -385,170 +290,46 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state, u32 level) {struct intel_connector *connector =to_intel_connector (conn_state->connector); -struct intel_dp *intel_dp =intel_attached_dp (connector); -struct drm_i915_private *i915 =dp_to_i915 (intel_dp);struct intel_panel *panel = &connector->panel; -int ret; -u8 dpcd_buf, new_dpcd_buf; -u8 pwmgen_bit_count = panel->backlight.edp.vesa.pwmgen_bit_count; - - ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read backlight mode: %d\n" , ret); -return ; - } - - new_dpcd_buf = dpcd_buf; - -if ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) !=DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) { - new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; - new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; - - ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pwmgen_bit_count); -if (ret !=1 ) -drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count: %d\n" , ret); - } - -if (panel->backlight.edp.vesa.pwm_freq_pre_divider) { - ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_FREQ_SET , - panel->backlight.edp.vesa.pwm_freq_pre_divider); -if (ret ==1 ) - new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; -else -drm_dbg_kms (&i915->drm,"Failed to write aux backlight frequency: %d\n" , - ret); - } - -if (new_dpcd_buf != dpcd_buf) { - ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , - new_dpcd_buf); -if (ret !=1 ) -drm_dbg_kms (&i915->drm,"Failed to write aux backlight mode: %d\n" , ret); - } +struct intel_dp *intel_dp =enc_to_intel_dp (connector->encoder); -intel_dp_aux_vesa_set_backlight (conn_state, level); -set_vesa_backlight_enable (connector, true); +drm_edp_backlight_enable (&intel_dp->aux, &panel->backlight.edp.vesa.info, level); }static void intel_dp_aux_vesa_disable_backlight (const struct drm_connector_state *old_conn_state,u32 level) { -set_vesa_backlight_enable (to_intel_connector (old_conn_state->connector), false); -} - -/* -* Compute PWM frequency divider value based off the frequency provided to us by the 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 u32 intel_dp_aux_vesa_calc_max_backlight (struct intel_connector *connector) -{ -struct drm_i915_private *i915 =to_i915 (connector->base.dev); -struct intel_dp *intel_dp =intel_attached_dp (connector); +struct intel_connector *connector =to_intel_connector (old_conn_state->connector);struct intel_panel *panel = &connector->panel; -u32 max_backlight =0 ; -int ret, freq, fxp, fxp_min, fxp_max, fxp_actual, f =1 ; -u8 pn, pn_min, pn_max; - - ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , &pn); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap: %d\n" , ret); -return 0 ; - } - - pn &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; - max_backlight = (1 << pn) -1 ; - -/* 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 = i915->vbt.backlight.pwm_freq_hz; -drm_dbg_kms (&i915->drm,"VBT defined backlight frequency %u Hz\n" , - freq); -if (!freq) { -drm_dbg_kms (&i915->drm, -"Use panel default backlight frequency\n" ); -return max_backlight; - } - - 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. -*/ - ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN , &pn_min); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap min: %d\n" , ret); -return max_backlight; - } - ret =drm_dp_dpcd_readb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX , &pn_max); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to read pwmgen bit count cap max: %d\n" , ret); -return max_backlight; - } - pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; - pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK ; - -/* Ensure frequency is within 25% of desired value */ - 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_dbg_kms (&i915->drm, -"VBT defined backlight frequency out of range\n" ); -return max_backlight; - } - -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 ; - } - -drm_dbg_kms (&i915->drm,"Using eDP pwmgen bit count of %d\n" , pn); - ret =drm_dp_dpcd_writeb (&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT , pn); -if (ret !=1 ) { -drm_dbg_kms (&i915->drm,"Failed to write aux pwmgen bit count: %d\n" , ret); -return max_backlight; - } - - panel->backlight.edp.vesa.pwmgen_bit_count = pn; -if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP ) - panel->backlight.edp.vesa.pwm_freq_pre_divider = f; - - max_backlight = (1 << pn) -1 ; +struct intel_dp *intel_dp =enc_to_intel_dp (connector->encoder); -return max_backlight; +drm_edp_backlight_disable (&intel_dp->aux, &panel->backlight.edp.vesa.info); } -static int intel_dp_aux_vesa_setup_backlight (struct intel_connector *connector, -enum pipe pipe) +static int intel_dp_aux_vesa_setup_backlight (struct intel_connector *connector,enum pipe pipe) {struct intel_dp *intel_dp =intel_attached_dp (connector);struct intel_panel *panel = &connector->panel; +struct drm_i915_private *i915 =dp_to_i915 (intel_dp); +u16 current_level; +u8 current_mode; +int ret; -if (intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) - panel->backlight.edp.vesa.aux_enable = true; -if (intel_dp->edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT ) - panel->backlight.edp.vesa.lsb_reg_used = true; - - panel->backlight.max =intel_dp_aux_vesa_calc_max_backlight (connector); -if (!panel->backlight.max) -return -ENODEV ; + ret =drm_edp_backlight_init (&intel_dp->aux, &panel->backlight.edp.vesa.info, + i915->vbt.backlight.pwm_freq_hz, intel_dp->edp_dpcd, + ¤t_level, ¤t_mode); +if (ret <0 ) +return ret; + panel->backlight.max = panel->backlight.edp.vesa.info.max; panel->backlight.min =0 ; - panel->backlight.level =intel_dp_aux_vesa_get_backlight (connector, pipe); - panel->backlight.enabled =intel_dp_aux_vesa_backlight_dpcd_mode (connector) && - panel->backlight.level !=0 ; +if (current_mode ==DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ) { + panel->backlight.level = current_level; + panel->backlight.enabled = panel->backlight.level !=0 ; + }else { + panel->backlight.level = panel->backlight.max; + panel->backlight.enabled = false; + }return 0 ; }@@ -559,16 +340,12 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector)struct intel_dp *intel_dp =intel_attached_dp (connector);struct drm_i915_private *i915 =dp_to_i915 (intel_dp); -/* Check the eDP Display control capabilities registers to determine if -* the panel can support backlight control over the aux channel. -* -* TODO: We currently only support AUX only backlight configurations, not backlights which +/* TODO: We currently only support AUX only backlight configurations, not backlights which * require a mix of PWM and AUX controls to work. In the mean time, these machines typically * work just fine using normal PWM controls anyway. */ -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 )) { +if ((intel_dp->edp_dpcd[1 ] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP ) && +drm_edp_backlight_supported (intel_dp->edp_dpcd)) {drm_dbg_kms (&i915->drm,"AUX Backlight Control Supported!\n" );return true; }include/drm/drm_dp_helper.h +48
-0@@ -1790,6 +1790,24 @@ drm_dp_sink_can_do_video_without_timing_msa(const u8 dpcd[DP_RECEIVER_CAP_SIZE])DP_MSA_TIMING_PAR_IGNORED ; } +/** +* drm_edp_backlight_supported() - Check an eDP DPCD for VESA backlight support +* @edp_dpcd: The DPCD to check +* +* Note that currently this function will return %false for panels which support various DPCD +* backlight features but which require the brightness be set through PWM, and don't support setting +* the brightness level via the DPCD. This is a TODO. +* +* Returns: %True if @edp_dpcd indicates that VESA backlight controls are supported, %false +* otherwise +*/ +static inline bool +drm_edp_backlight_supported (const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ]) +{ +return (edp_dpcd[1 ] &DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP ) && + (edp_dpcd[2 ] &DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP ); +} +/* * DisplayPort AUX channel */ @@ -2089,6 +2107,36 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk)return desc->quirks &BIT (quirk); } +/** +* struct drm_edp_backlight_info - Probed eDP backlight info struct +* @pwmgen_bit_count: The pwmgen bit count +* @pwm_freq_pre_divider: The PWM frequency pre-divider value being used for this backlight, if any +* @max: The maximum backlight level that may be set +* @lsb_reg_used: Do we also write values to the DP_EDP_BACKLIGHT_BRIGHTNESS_LSB register? +* @aux_enable: Does the panel support the AUX enable cap? +* +* This structure contains various data about an eDP backlight, which can be populated by using +* drm_edp_backlight_init(). +*/ +struct drm_edp_backlight_info { +u8 pwmgen_bit_count; +u8 pwm_freq_pre_divider; +u16 max; + +bool lsb_reg_used :1 ; +bool aux_enable :1 ; +}; + +int +drm_edp_backlight_init (struct drm_dp_aux *aux,struct drm_edp_backlight_info *bl, +u16 driver_pwm_freq_hz,const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ], +u16 *current_level,u8 *current_mode); +int drm_edp_backlight_set_level (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +u16 level); +int drm_edp_backlight_enable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl, +u16 level); +int drm_edp_backlight_disable (struct drm_dp_aux *aux,const struct drm_edp_backlight_info *bl); +#ifdef CONFIG_DRM_DP_CEC void drm_dp_cec_irq (struct drm_dp_aux *aux); void drm_dp_cec_register_connector(struct drm_dp_aux *aux,
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lyude Paul
maintainerRe: [RFC v3 10/10] drm/dp: Extract i915's eDP backlight code into DRM helpers
Quoted 91 lines · Thomas Zimmermann
Hi
Am 06.02.21 um 00:45 schrieb Lyude Paul:
Quoted 68 lines
Since we're about to implement eDP backlight support in nouveau using the standard protocol from VESA, we might as well just take the code that's already written for this and move it into a set of shared DRM helpers.
Note that these helpers are intended to handle DPCD related backlight control bits such as setting the brightness level over AUX, probing the backlight's TCON, enabling/disabling the backlight over AUX if supported, etc. Any PWM-related portions of backlight control are explicitly left up to the driver, as these will vary from platform to platform.
The only exception to this is the calculation of the PWM frequency pre-divider value. This is because the only platform-specific information required for this is the PWM frequency of the panel, which the driver is expected to provide if available. The actual algorithm for calculating this value is standard and is defined in the eDP specification from VESA.
Note that these helpers do not yet implement the full range of features the VESA backlight interface provides, and only provide the following functionality (all of which was already present in i915's DPCD backlight support):
* Basic control of brightness levels
* Basic probing of backlight capabilities
* Helpers for enabling and disabling the backlightv3:
* Split out changes to i915's backlight code to separate patches to make it easier to reviewSigned-off-by Lyude Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Dave Airlie <[email protected]>---
drivers/gpu/drm/drm_dp_helper.c | 332 ++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 5 +-.../drm/i915/display/intel_dp_aux_backlight.c| 285 ++------------- include/drm/drm_dp_helper.h | 48 +++4 files changed, 412 insertions(+), 258 deletions(-)drivers/gpu/drm/drm_dp_helper.c +0
-0@@ -3082,3 +3082,335 @@ int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc) return 0; }
EXPORT_SYMBOL(drm_dp_pcon_convert_rgb_to_ycbcr);drivers/gpu/drm/drm_dp_helper.c +3
-0+ +/** +* drm_edp_backlight_set_level() - Set the backlight level of an eDP panel via AUX
+ * @aux: The DP AUX channel to use
+ * @bl: Backlight capability info fromdrm_edp_backlight_init()
+ * @level: The brightness level to set
+ *
+ * Sets the brightness level of an eDP panel's backlight. Note that the panel's backlight must
+ * already have been enabled by the driver by callingdrm_edp_backlight_enable().
+ *
+ * Returns: %0 on success, negative error code on failure
+ */
+int drm_edp_backlight_set_level(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level)drivers/gpu/drm/drm_dp_helper.c int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc) · line 3105
Quoted 7 lines
drivers/gpu/drm/drm_dp_helper.c +7
-0+{ + int ret; + u8 buf[2] = { 0 }; + + if (bl->lsb_reg_used) { + buf[0] = (level & 0xFF00) >> 8; + buf[1] = (level & 0x00FF);Maybe
0x00ffand0xff00for aesthetic reasons.Quoted 9 lines
+ } else {
+ buf[0] = level;
+ }
+
+ ret =drm_dp_dpcd_write(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, sizeof(buf));
+ if (ret != sizeof(buf)) {
+ DRM_ERROR("%s: Failed to write aux backlight level: %d\n",aux->name, ret);
Quoted 2 lines
Since you're adding this code, you should probably convert to
drm_err()helpers as well. Here and elsewhere.
this is next up on my todo list JFYI-I don't do it right now because there isn't actually any backpointer to the drm driver (and you can't just use the parent of the aux device, since that technically doesn't need to be the drm driver).
I'd add it in this series, but that's going to involve updating functions across the tree like drm_dp_aux_init() so I'd like to do it in a different patch series
Quoted 878 lines
Quoted 17 lines
+ return ret < 0 ? ret :
-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +7
-0+ + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_set_level); + +static int +drm_edp_backlight_set_enable(struct drm_dp_aux *aux, const struct
drm_edp_backlight_info*bl,
+ bool enable)drivers/gpu/drm/drm_dp_helper.c +5
-0+{ + int ret; + u8 buf; + + /* The panel uses something other then DPCD for enabling it'sQuoted 1 line
backlight */
'its'
Best regards
ThomasQuoted 853 lines
+ if (!bl->aux_enable)
+ return 0;
+
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, &buf); + if (ret != 1) {
+ DRM_ERROR("%s: Failed to read eDP display control register:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }
+ if (enable)
+ buf |=DP_EDP_BACKLIGHT_ENABLE;
+ else
+ buf &= ~DP_EDP_BACKLIGHT_ENABLE;
+
+ ret =drm_dp_dpcd_writeb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, buf); + if (ret != 1) {
+ DRM_ERROR("%s: Failed to write eDP display control register:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +11
-0+ + return 0; +} + +/** +* drm_edp_backlight_enable() - Enable an eDP panel's backlight using DPCD +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* @level: The initial backlight level to set via AUX, if there is one +* +* This function handles enabling DPCD backlight controls on a panel over DPCD, while additionally
+ * restoring any important backlight state such as the given backlight level, the brightness byte
+ * count, backlight frequency, etc.
+ *
+ * Note that certain panels, while supporting brightness level controls over DPCD, may not support
+ * having their backlights enabled via the standard %DP_EDP_DISPLAY_CONTROL_REGISTER. On such panels
+ * &drm_edp_backlight_info.aux_enable will be set to %false, this function will skip the step of
+ * programming the %DP_EDP_DISPLAY_CONTROL_REGISTER, and the driver must perform the required
+ * implementation specific step for enabling the backlight after calling this function.
+ *
+ * Returns: %0 on success, negative error code on failure.
+ */
+int drm_edp_backlight_enable(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ const u16 level)drivers/gpu/drm/drm_dp_helper.c +5
-0+{ + int ret; + u8 dpcd_buf, new_dpcd_buf; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
&dpcd_buf);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight mode: %d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +4
-0+ + new_dpcd_buf = dpcd_buf; + + if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) {
+ new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; + new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; +
+ ret = drm_dp_dpcd_writeb(aux,DP_EDP_PWMGEN_BIT_COUNT, bl-Quoted 1 line
pwmgen_bit_count);+ if (ret != 1)
+ DRM_DEBUG_KMS("%s: Failed to write aux pwmgen bit
count: %d\n",
+aux->name, ret);
+ }
+
+ if (bl->pwm_freq_pre_divider) {
+ ret = drm_dp_dpcd_writeb(aux,DP_EDP_BACKLIGHT_FREQ_SET, bl-Quoted 1 line
pwm_freq_pre_divider);+ if (ret != 1)
+ DRM_DEBUG_KMS("%s: Failed to write aux backlight
frequency: %d\n",
+aux->name, ret);
+ else
+ new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE;
+ }
+
+ if (new_dpcd_buf!=dpcd_buf) {
+ ret =drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to write aux backlight
mode: %d\n",
+aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }
+ }drivers/gpu/drm/drm_dp_helper.c +14
-0+ + ret = drm_edp_backlight_set_level(aux, bl, level); + if (ret < 0) + return ret; + ret = drm_edp_backlight_set_enable(aux, bl, true); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_enable); + +/** +* drm_edp_backlight_disable() - Disable an eDP backlight using DPCD, if supported
+ * @aux: The DP AUX channel to use
+ * @bl: Backlight capability info fromdrm_edp_backlight_init()
+ *
+ * This function handles disabling DPCD backlight controls on a panel over AUX. Note that some
+ * panels have backlights that are enabled/disabled by other means, despite having their brightness
+ * values controlled through DPCD. On such panels &drm_edp_backlight_info.aux_enable will be set to
+ * %false, this function will become a no-op (and we will skip updating
+ * %DP_EDP_DISPLAY_CONTROL_REGISTER), and the driver must take care to perform it's own
+ * implementation specific step for disabling the backlight.
+ *
+ * Returns: %0 on success or no-op, negative error code on failure.
+ */
+intdrm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl)drivers/gpu/drm/drm_dp_helper.c +13
-0+{ + int ret; + + ret = drm_edp_backlight_set_enable(aux, bl, false); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_disable); + +static inline int +drm_edp_backlight_probe_max(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE])drivers/gpu/drm/drm_dp_helper.c +8
-0+{ + int fxp, fxp_min, fxp_max, fxp_actual, f = 1; + int ret; + u8 pn, pn_min, pn_max; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT, &pn); + if (ret != 1) { + DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap:%d\n",
aux->name, ret);
+ return-ENODEV;
+ }drivers/gpu/drm/drm_dp_helper.c +8
-0+ + pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK; + bl->max = (1 << pn) - 1; + if (!driver_pwm_freq_hz) + return 0; + + /* +* Set PWM Frequency divider to match desired frequency provided by the driver.
+ * 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_SETregister (DPCD Address 00728h) + * - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the
+ *EDP_PWMGEN_BIT_COUNTregister (DPCD Address 00724h) + */
+
+ /* 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.
+ */
+ fxp =DIV_ROUND_CLOSEST(1000 * DP_EDP_BACKLIGHT_FREQ_BASE_KHZ, driver_pwm_freq_hz);
+
+ /* Use highest possible value of Pn for more granularity of brightness adjustment while
+ * satifying the conditions below.
+ * - Pn is in the range ofPn_minandPn_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. + */
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap min:
%d\n",aux->name, ret);
+ return 0;
+ }
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap max:
%d\n",aux->name, ret);
+ return 0;
+ }
+ pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
+ pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
+
+ /* Ensure frequency is within 25% of desired value */
+ 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("%s: Driver defined backlight frequency (%d) out of range\n",
+aux->name,driver_pwm_freq_hz);
+ return 0;
+ }drivers/gpu/drm/drm_dp_helper.c +11
-0+ + 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; + } + + ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, pn); + if (ret != 1) { + DRM_DEBUG_KMS("%s: Failed to write aux pwmgen bit count:%d\n",
aux->name, ret);
+ return 0;
+ }
+ bl->pwmgen_bit_count = pn;
+ bl->max = (1 << pn) - 1;
+
+ if (edp_dpcd[2] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) { + bl->pwm_freq_pre_divider = f;
+ DRM_DEBUG_KMS("%s: Using backlight frequency from driver (%dHz)\n",
+aux->name,driver_pwm_freq_hz); + }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + return 0; +} + +static inline int +drm_edp_backlight_probe_level(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u8*current_mode)drivers/gpu/drm/drm_dp_helper.c +6
-0+{ + int ret; + u8 buf[2]; + u8 mode_reg; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
&mode_reg);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight mode: %d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + *current_mode = (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK); + if (*current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + int size = 1 + bl->lsb_reg_used; + + ret = drm_dp_dpcd_read(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,buf, size);
+ if (ret != size) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight level:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +9
-0+ + if (bl->lsb_reg_used) + return (buf[0] << 8) | buf[1]; + else + return buf[0]; + } + + /* +* If we're not in DPCD control mode yet, the programmed brightness value is meaningless and
+ * the driver should assume max brightness + */
+ returnbl->max;drivers/gpu/drm/drm_dp_helper.c +4
-0+} + +/** +* drm_edp_backlight_init() - Probe a display panel's TCON using the standard VESA eDP backlight
+ * interface.
+ * @aux: The DP aux device to use for probing
+ * @bl: The&drm_edp_backlight_infostruct to fill out with information on the backlight
+ * @driver_pwm_freq_hz: Optional PWM frequency from the driver in hz
+ * @edp_dpcd: A cached copy of the eDP DPCD
+ * @current_level: Where to store the probed brightness level
+ * @current_mode: Where to store the currently set backlight control mode
+ *
+ * Initializes a&drm_edp_backlight_infostruct by probing @aux for it's backlight capabilities,
+ * along with also probing the current and maximum supported brightness levels.
+ *
+ * If @driver_pwm_freq_hz is non-zero, this will be used as the backlight frequency. Otherwise, the
+ * default frequency from the panel is used.
+ *
+ * Returns: %0 on success, negative error code on failure.
+ */drivers/gpu/drm/drm_dp_helper.c +2
-0+int +drm_edp_backlight_init(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
+ u16*current_level, u8*current_mode)drivers/gpu/drm/drm_dp_helper.c +9
-0+{ + int ret; + + if (edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) + bl->aux_enable = true; + if (edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) + bl->lsb_reg_used = true; + + ret = drm_edp_backlight_probe_max(aux, bl, driver_pwm_freq_hz,
edp_dpcd);
+ if (ret < 0)
+ return ret;drivers/gpu/drm/drm_dp_helper.c +7
-0+ + ret = drm_edp_backlight_probe_level(aux, bl, current_mode); + if (ret < 0) + return ret; + *current_level = ret; + + DRM_DEBUG_KMS("%s: Found backlight level=%d/%dpwm_freq_pre_divider=%d mode=%x\n",
+aux->name,*current_level,bl->max, bl-Quoted 1 line
pwm_freq_pre_divider,*current_mode);+ DRM_DEBUG_KMS("%s: Backlight caps: pwmgen_bit_count=%d lsb_reg_used=%d aux_enable=%d\n",
+aux->name,bl->pwmgen_bit_count,bl->lsb_reg_used, bl-Quoted 1 line
aux_enable);+ return 0;
drivers/gpu/drm/drm_dp_helper.c +2
-0+} +EXPORT_SYMBOL (drm_edp_backlight_init);drivers/gpu/drm/i915/display/intel_display_types.h +1
-4@@ -263,10 +263,7 @@ struct intel_panel { /* DPCD backlight */ union { struct { - u8 pwmgen_bit_count; - u8 pwm_freq_pre_divider; - bool lsb_reg_used; - bool aux_enable; + struct drm_edp_backlight_info info; } vesa; struct { bool sdr_uses_aux;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -270,114 +270,19 @@ intel_dp_aux_hdr_setup_backlight(struct
intel_connector*connector, enum pipe pi
}
/* VESA backlight callbacks */
-static boolintel_dp_aux_vesa_backlight_dpcd_mode(struct intel_connector *connector)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-7-{ - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int ret; - u8 mode_reg; - - ret = drm_dp_dpcd_readb(&intel_dp->aux,
DP_EDP_BACKLIGHT_MODE_SET_REGISTER,&mode_reg);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read backlight mode:
%d\n", ret);
- return false;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-9- - return (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) == - DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; -} - -/* -* Read the current backlight value from DPCD register(s) based -* on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported -*/ static u32
intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enum pipe unused)
{
- structintel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); - int ret;
- u8 read_val[2] = {0x0};
- u16 level = 0;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-9- - /* - * If we're not in DPCD control mode yet, the programmed brightness - * value is meaningless and we should assume max brightness - */ - if (!intel_dp_aux_vesa_backlight_dpcd_mode(connector)) - return connector->panel.backlight.max; - - ret = drm_dp_dpcd_read(&intel_dp->aux,
DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,&read_val,
-sizeof(read_val));
- if (ret !=sizeof(read_val)) {
- drm_dbg_kms(&i915->drm, "Failed to read brightness level:
%d\n", ret);
- return 0;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-7- - if (connector->panel.backlight.edp.vesa.lsb_reg_used) - level = (read_val[0] << 8 | read_val[1]); - else - level = read_val[0]; - - return level; + return connector->panel.backlight.level;}
-/*
- * Sends the current backlight level over the aux channel, checking if its using
- * 8-bit or 16 bit value (MSB and LSB)
- */
static void
-intel_dp_aux_vesa_set_backlight(const structdrm_connector_state*conn_state,
- u32 level) +intel_dp_aux_vesa_set_backlight(const structdrm_connector_state*conn_state, u32 level)
{
structintel_connector*connector = to_intel_connector(conn_state-Quoted 1 line
connector);
- struct
intel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); - int ret;
- u8 vals[2] = {0x0};drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-10- - /* Write the MSB and/or LSB */ - if (connector->panel.backlight.edp.vesa.lsb_reg_used) { - vals[0] = (level & 0xFF00) >> 8; - vals[1] = (level & 0xFF); - } else { - vals[0] = level; - } - - ret = drm_dp_dpcd_write(&intel_dp->aux,
DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, vals,
- sizeof(vals));
- if (ret != sizeof(vals)) {
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight
level: %d\n", ret);
- return;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-3-} - -static void set_vesa_backlight_enable(struct intel_connector *connector,bool enable)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-7-{ - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int ret; - u8 reg_val = 0; - - /* Early return when display use other mechanism to enablebacklight. */
- if (!connector->panel.backlight.edp.vesa.aux_enable)
- return;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, ®_val);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read eDP display control
register: %d\n", ret);
- return;
- }
-
- if (enable)
- reg_val |=DP_EDP_BACKLIGHT_ENABLE;
- else
- reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE);
+ structintel_panel*panel =&connector->panel;
+ structintel_dp*intel_dp=enc_to_intel_dp(connector->encoder);
- ret =drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, reg_val);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to %s aux backlight: %d\n", - enable ? "enable" : "disable", ret); - }
+ drm_edp_backlight_set_level(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info, level);
}
static voiddrivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -385,170 +290,46 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,const struct
drm_connector_state*conn_state, u32 level)
{
structintel_connector*connector = to_intel_connector(conn_state-Quoted 1 line
connector);
- struct
intel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); structintel_panel*panel =&connector->panel;
- int ret;
- u8dpcd_buf,new_dpcd_buf;
- u8pwmgen_bit_count=panel->backlight.edp.vesa.pwmgen_bit_count; -
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read backlight mode:
%d\n", ret);
- return;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-4- - new_dpcd_buf = dpcd_buf; - - if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) {
- new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; - new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; -
- ret =drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, pwmgen_bit_count);
- if (ret != 1)
- drm_dbg_kms(&i915->drm, "Failed to write aux pwmgen bit count: %d\n", ret);
- }
-
- if (panel->backlight.edp.vesa.pwm_freq_pre_divider) {
- ret = drm_dp_dpcd_writeb(&intel_dp->aux,DP_EDP_BACKLIGHT_FREQ_SET,
- panel-Quoted 1 line
backlight.edp.vesa.pwm_freq_pre_divider);
- if (ret == 1)
- new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE;
- else
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight frequency: %d\n",
- ret);
- }
-
- if (new_dpcd_buf!=dpcd_buf) {
- ret = drm_dp_dpcd_writeb(&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
-new_dpcd_buf);
- if (ret != 1)
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight mode: %d\n", ret);
- }
+ structintel_dp*intel_dp=enc_to_intel_dp(connector->encoder);
- intel_dp_aux_vesa_set_backlight(conn_state, level); - set_vesa_backlight_enable(connector, true);
+ drm_edp_backlight_enable(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info, level);
}
static void intel_dp_aux_vesa_disable_backlight(const structdrm_connector_state*old_conn_state,
u32 level) {
- set_vesa_backlight_enable(to_intel_connector(old_conn_state-Quoted 1 line
connector), false);
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-4-} - -/* -* Compute PWM frequency divider value based off the frequency provided to us by the 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_SETregister (DPCD Address 00728h)
- * - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the
- *EDP_PWMGEN_BIT_COUNTregister (DPCD Address 00724h)
- */
-static u32intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connector)
-{
- structdrm_i915_private*i915 =to_i915(connector->base.dev); - structintel_dp*intel_dp=intel_attached_dp(connector); + structintel_connector*connector =to_intel_connector(old_conn_state->connector);
structintel_panel*panel =&connector->panel;
- u32max_backlight= 0;
- int ret, freq, fxp,fxp_min,fxp_max,fxp_actual, f = 1; - u8 pn,pn_min,pn_max;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, &pn);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count
cap: %d\n", ret);
- return 0;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-6- - pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK; - max_backlight = (1 << pn) - 1; - - /* 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 =i915->vbt.backlight.pwm_freq_hz;
- drm_dbg_kms(&i915->drm, "VBT defined backlight frequency %u Hz\n", - freq);
- if (!freq) {
- drm_dbg_kms(&i915->drm,
- "Use panel default backlight frequency\n"); - returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-4- - fxp = DIV_ROUND_CLOSEST(KHz(DP_EDP_BACKLIGHT_FREQ_BASE_KHZ), freq); - - /* Use highest possible value of Pn for more granularity ofbrightness
- * adjustment while satifying the conditions below.
- * - Pn is in the range ofPn_minandPn_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. - */
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap
min: %d\n", ret);
- returnmax_backlight;
- }
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap
max: %d\n", ret);
- returnmax_backlight;
- }
- pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
- pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-8- - /* Ensure frequency is within 25% of desired value */ - 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_dbg_kms(&i915->drm, - "VBT defined backlight frequency out ofrange\n");
- returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-10- - 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; - } - - drm_dbg_kms(&i915->drm, "Using eDP pwmgen bit count of %d\n", pn); - ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT,pn);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to write aux pwmgen bit
count: %d\n", ret);
- returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-6- - panel->backlight.edp.vesa.pwmgen_bit_count = pn; - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) - panel->backlight.edp.vesa.pwm_freq_pre_divider = f; - - max_backlight = (1 << pn) - 1; + struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
- returnmax_backlight;
+ drm_edp_backlight_disable(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info);
}
-static int intel_dp_aux_vesa_setup_backlight(structintel_connector*connector,
- enum pipe pipe) +static intintel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe)
{
structintel_dp*intel_dp=intel_attached_dp(connector); structintel_panel*panel =&connector->panel;
+ structdrm_i915_private*i915 =dp_to_i915(intel_dp);
+ u16current_level;
+ u8current_mode;
+ int ret;
- if (intel_dp->edp_dpcd[1] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) - panel->backlight.edp.vesa.aux_enable = true;
- if (intel_dp->edp_dpcd[2] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) - panel->backlight.edp.vesa.lsb_reg_used = true; -
- panel->backlight.max =intel_dp_aux_vesa_calc_max_backlight(connector);
- if (!panel->backlight.max)
- return-ENODEV;
+ ret = drm_edp_backlight_init(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info,
+
i915->vbt.backlight.pwm_freq_hz,intel_dp->edp_dpcd,
+¤t_level,¤t_mode); + if (ret < 0)
+ return ret;
+ panel->backlight.max =panel->backlight.edp.vesa.info.max;panel->backlight.min= 0;
- panel->backlight.level =intel_dp_aux_vesa_get_backlight(connector, pipe);
- panel->backlight.enabled =intel_dp_aux_vesa_backlight_dpcd_mode(connector)&&
-panel->backlight.level!= 0; + if (current_mode==DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + panel->backlight.level =current_level;
+ panel->backlight.enabled =panel->backlight.level!= 0; + } else {
+ panel->backlight.level =panel->backlight.max; + panel->backlight.enabled = false;
+ }
return 0;
}drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -559,16 +340,12 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector) struct intel_dp *intel_dp = intel_attached_dp(connector); struct drm_i915_private *i915 = dp_to_i915(intel_dp);
- /* Check the eDP Display control capabilities registers to determine if
- * the panel can support backlight control over the aux channel. - *
- * TODO: We currently only support AUX only backlight configurations, not backlights which
+ /* TODO: We currently only support AUX only backlight configurations, not backlights which
* require a mix of PWM and AUX controls to work. In the mean time, these machines typically
* work just fine using normal PWM controls anyway.
*/
- 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)) {
+ if ((intel_dp->edp_dpcd[1] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && +drm_edp_backlight_supported(intel_dp->edp_dpcd)) {drm_dbg_kms(&i915->drm, "AUX Backlight Control Supported!\n");
return true;
}include/drm/drm_dp_helper.h +0
-0@@ -1790,6 +1790,24 @@ drm_dp_sink_can_do_video_without_timing_msa(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) DP_MSA_TIMING_PAR_IGNORED; }
+/**
+ *drm_edp_backlight_supported()- Check an eDP DPCD for VESA backlight support
+ * @edp_dpcd: The DPCD to check
+ *
+ * Note that currently this function will return %false for panels which support various DPCD
+ * backlight features but which require the brightness be set through PWM, and don't support setting
+ * the brightness level via the DPCD. This is a TODO.
+ *
+ * Returns: %True if @edp_dpcd indicates that VESA backlight controls are supported, %false
+ * otherwise
+ */include/drm/drm_dp_helper.h +7
-0+static inline bool +drm_edp_backlight_supported (const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ]) +{ + return (edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && + (edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP); +} +/*
* DisplayPort AUX channel
*/include/drm/drm_dp_helper.h +0
-0@@ -2089,6 +2107,36 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk) return desc->quirks & BIT(quirk); }
+/**
+ * structdrm_edp_backlight_info- Probed eDP backlight info struct
+ * @pwmgen_bit_count: The pwmgen bit count
+ * @pwm_freq_pre_divider: The PWM frequency pre-divider value being used for this backlight, if any
+ * @max: The maximum backlight level that may be set
+ * @lsb_reg_used: Do we also write values to theDP_EDP_BACKLIGHT_BRIGHTNESS_LSBregister?
+ * @aux_enable: Does the panel support the AUX enable cap?
+ *
+ * This structure contains various data about an eDP backlight, which can be populated by using
+ *drm_edp_backlight_init().
+ */include/drm/drm_dp_helper.h +11
-0+struct drm_edp_backlight_info { + u8 pwmgen_bit_count; + u8 pwm_freq_pre_divider; + u16 max; + + bool lsb_reg_used : 1; + bool aux_enable : 1; +}; + +int +drm_edp_backlight_init(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
+ u16*current_level, u8*current_mode); +int drm_edp_backlight_set_level(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level);
+int drm_edp_backlight_enable(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level);
+intdrm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl);
+
#ifdefCONFIG_DRM_DP_CEC
voiddrm_dp_cec_irq(struct drm_dp_aux *aux);
void drm_dp_cec_register_connector(structdrm_dp_aux*aux,
Signature · 13 lines
Sincerely, Lyude Paul (she/her) Software Engineer at Red Hat Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've asked me a question, are waiting for a review/merge on a patch, etc. and I haven't responded in a while, please feel free to send me another email to check on my status. I don't bite! _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Thomas Zimmermann
maintainerRe: [RFC v3 10/10] drm/dp: Extract i915's eDP backlight code into DRM helpers
Hi
Am 09.02.21 um 00:03 schrieb Lyude Paul:
Quoted 14 lines
Quoted 11 lines
Quoted 10 lines
+ } else {
+ buf[0] = level;
+ }
+
+ ret =drm_dp_dpcd_write(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, sizeof(buf));
+ if (ret != sizeof(buf)) {
+ DRM_ERROR("%s: Failed to write aux backlight level: %d\n",aux->name, ret);Quoted 2 lines
Since you're adding this code, you should probably convert to
drm_err()helpers as well. Here and elsewhere.
Quoted 6 lines
this is next up on my todo list JFYI-I don't do it right now because there isn't actually any backpointer to the drm driver (and you can't just use the parent of the aux device, since that technically doesn't need to be the drm driver).
I'd add it in this series, but that's going to involve updating functions across the tree like
drm_dp_aux_init()so I'd like to do it in a different patch series
Ok, sure. Makes sense.
Best regards
Thomas
Quoted 880 lines
Quoted 879 lines
Quoted 18 lines
+ return ret < 0 ? ret :
-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +7
-0+ + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_set_level); + +static int +drm_edp_backlight_set_enable(struct drm_dp_aux *aux, const struct
drm_edp_backlight_info*bl,
+ bool enable)drivers/gpu/drm/drm_dp_helper.c +5
-0+{ + int ret; + u8 buf; + + /* The panel uses something other then DPCD for enabling it'sQuoted 1 line
backlight */
'its'
Best regards
ThomasQuoted 853 lines
+ if (!bl->aux_enable)
+ return 0;
+
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, &buf); + if (ret != 1) {
+ DRM_ERROR("%s: Failed to read eDP display control register:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }
+ if (enable)
+ buf |=DP_EDP_BACKLIGHT_ENABLE;
+ else
+ buf &= ~DP_EDP_BACKLIGHT_ENABLE;
+
+ ret =drm_dp_dpcd_writeb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, buf); + if (ret != 1) {
+ DRM_ERROR("%s: Failed to write eDP display control register:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +11
-0+ + return 0; +} + +/** +* drm_edp_backlight_enable() - Enable an eDP panel's backlight using DPCD +* @aux: The DP AUX channel to use +* @bl: Backlight capability info from drm_edp_backlight_init() +* @level: The initial backlight level to set via AUX, if there is one +* +* This function handles enabling DPCD backlight controls on a panel over DPCD, while additionally
+ * restoring any important backlight state such as the given backlight level, the brightness byte
+ * count, backlight frequency, etc.
+ *
+ * Note that certain panels, while supporting brightness level controls over DPCD, may not support
+ * having their backlights enabled via the standard %DP_EDP_DISPLAY_CONTROL_REGISTER. On such panels
+ * &drm_edp_backlight_info.aux_enable will be set to %false, this function will skip the step of
+ * programming the %DP_EDP_DISPLAY_CONTROL_REGISTER, and the driver must perform the required
+ * implementation specific step for enabling the backlight after calling this function.
+ *
+ * Returns: %0 on success, negative error code on failure.
+ */
+int drm_edp_backlight_enable(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ const u16 level)drivers/gpu/drm/drm_dp_helper.c +5
-0+{ + int ret; + u8 dpcd_buf, new_dpcd_buf; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
&dpcd_buf);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight mode: %d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +4
-0+ + new_dpcd_buf = dpcd_buf; + + if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) {
+ new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; + new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; +
+ ret = drm_dp_dpcd_writeb(aux,DP_EDP_PWMGEN_BIT_COUNT, bl-Quoted 1 line
pwmgen_bit_count);+ if (ret != 1)
+ DRM_DEBUG_KMS("%s: Failed to write aux pwmgen bit
count: %d\n",
+aux->name, ret);
+ }
+
+ if (bl->pwm_freq_pre_divider) {
+ ret = drm_dp_dpcd_writeb(aux,DP_EDP_BACKLIGHT_FREQ_SET, bl-Quoted 1 line
pwm_freq_pre_divider);+ if (ret != 1)
+ DRM_DEBUG_KMS("%s: Failed to write aux backlight
frequency: %d\n",
+aux->name, ret);
+ else
+ new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE;
+ }
+
+ if (new_dpcd_buf!=dpcd_buf) {
+ ret =drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to write aux backlight
mode: %d\n",
+aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }
+ }drivers/gpu/drm/drm_dp_helper.c +14
-0+ + ret = drm_edp_backlight_set_level(aux, bl, level); + if (ret < 0) + return ret; + ret = drm_edp_backlight_set_enable(aux, bl, true); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_enable); + +/** +* drm_edp_backlight_disable() - Disable an eDP backlight using DPCD, if supported
+ * @aux: The DP AUX channel to use
+ * @bl: Backlight capability info fromdrm_edp_backlight_init()
+ *
+ * This function handles disabling DPCD backlight controls on a panel over AUX. Note that some
+ * panels have backlights that are enabled/disabled by other means, despite having their brightness
+ * values controlled through DPCD. On such panels &drm_edp_backlight_info.aux_enable will be set to
+ * %false, this function will become a no-op (and we will skip updating
+ * %DP_EDP_DISPLAY_CONTROL_REGISTER), and the driver must take care to perform it's own
+ * implementation specific step for disabling the backlight.
+ *
+ * Returns: %0 on success or no-op, negative error code on failure.
+ */
+intdrm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl)drivers/gpu/drm/drm_dp_helper.c +13
-0+{ + int ret; + + ret = drm_edp_backlight_set_enable(aux, bl, false); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_disable); + +static inline int +drm_edp_backlight_probe_max(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE])drivers/gpu/drm/drm_dp_helper.c +8
-0+{ + int fxp, fxp_min, fxp_max, fxp_actual, f = 1; + int ret; + u8 pn, pn_min, pn_max; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT, &pn); + if (ret != 1) { + DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap:%d\n",
aux->name, ret);
+ return-ENODEV;
+ }drivers/gpu/drm/drm_dp_helper.c +8
-0+ + pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK; + bl->max = (1 << pn) - 1; + if (!driver_pwm_freq_hz) + return 0; + + /* +* Set PWM Frequency divider to match desired frequency provided by the driver.
+ * 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_SETregister (DPCD Address 00728h) + * - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the
+ *EDP_PWMGEN_BIT_COUNTregister (DPCD Address 00724h) + */
+
+ /* 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.
+ */
+ fxp =DIV_ROUND_CLOSEST(1000 * DP_EDP_BACKLIGHT_FREQ_BASE_KHZ, driver_pwm_freq_hz);
+
+ /* Use highest possible value of Pn for more granularity of brightness adjustment while
+ * satifying the conditions below.
+ * - Pn is in the range ofPn_minandPn_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. + */
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap min:
%d\n",aux->name, ret);
+ return 0;
+ }
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap max:
%d\n",aux->name, ret);
+ return 0;
+ }
+ pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
+ pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
+
+ /* Ensure frequency is within 25% of desired value */
+ 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("%s: Driver defined backlight frequency (%d) out of range\n",
+aux->name,driver_pwm_freq_hz);
+ return 0;
+ }drivers/gpu/drm/drm_dp_helper.c +11
-0+ + 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; + } + + ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, pn); + if (ret != 1) { + DRM_DEBUG_KMS("%s: Failed to write aux pwmgen bit count:%d\n",
aux->name, ret);
+ return 0;
+ }
+ bl->pwmgen_bit_count = pn;
+ bl->max = (1 << pn) - 1;
+
+ if (edp_dpcd[2] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) { + bl->pwm_freq_pre_divider = f;
+ DRM_DEBUG_KMS("%s: Using backlight frequency from driver (%dHz)\n",
+aux->name,driver_pwm_freq_hz); + }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + return 0; +} + +static inline int +drm_edp_backlight_probe_level(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u8*current_mode)drivers/gpu/drm/drm_dp_helper.c +6
-0+{ + int ret; + u8 buf[2]; + u8 mode_reg; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
&mode_reg);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight mode: %d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + *current_mode = (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK); + if (*current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + int size = 1 + bl->lsb_reg_used; + + ret = drm_dp_dpcd_read(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,buf, size);
+ if (ret != size) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight level:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +9
-0+ + if (bl->lsb_reg_used) + return (buf[0] << 8) | buf[1]; + else + return buf[0]; + } + + /* +* If we're not in DPCD control mode yet, the programmed brightness value is meaningless and
+ * the driver should assume max brightness + */
+ returnbl->max;drivers/gpu/drm/drm_dp_helper.c +4
-0+} + +/** +* drm_edp_backlight_init() - Probe a display panel's TCON using the standard VESA eDP backlight
+ * interface.
+ * @aux: The DP aux device to use for probing
+ * @bl: The&drm_edp_backlight_infostruct to fill out with information on the backlight
+ * @driver_pwm_freq_hz: Optional PWM frequency from the driver in hz
+ * @edp_dpcd: A cached copy of the eDP DPCD
+ * @current_level: Where to store the probed brightness level
+ * @current_mode: Where to store the currently set backlight control mode
+ *
+ * Initializes a&drm_edp_backlight_infostruct by probing @aux for it's backlight capabilities,
+ * along with also probing the current and maximum supported brightness levels.
+ *
+ * If @driver_pwm_freq_hz is non-zero, this will be used as the backlight frequency. Otherwise, the
+ * default frequency from the panel is used.
+ *
+ * Returns: %0 on success, negative error code on failure.
+ */(quoted diff) +2
-0+int +drm_edp_backlight_init(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
+ u16*current_level, u8*current_mode)drivers/gpu/drm/drm_dp_helper.c +9
-0+{ + int ret; + + if (edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) + bl->aux_enable = true; + if (edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) + bl->lsb_reg_used = true; + + ret = drm_edp_backlight_probe_max(aux, bl, driver_pwm_freq_hz,
edp_dpcd);
+ if (ret < 0)
+ return ret;drivers/gpu/drm/drm_dp_helper.c +7
-0+ + ret = drm_edp_backlight_probe_level(aux, bl, current_mode); + if (ret < 0) + return ret; + *current_level = ret; + + DRM_DEBUG_KMS("%s: Found backlight level=%d/%dpwm_freq_pre_divider=%d mode=%x\n",
+aux->name,*current_level,bl->max, bl-Quoted 1 line
pwm_freq_pre_divider,*current_mode);+ DRM_DEBUG_KMS("%s: Backlight caps: pwmgen_bit_count=%d lsb_reg_used=%d aux_enable=%d\n",
+aux->name,bl->pwmgen_bit_count,bl->lsb_reg_used, bl-Quoted 1 line
aux_enable);+ return 0;
(quoted diff) +2
-0+} +EXPORT_SYMBOL(drm_edp_backlight_init);drivers/gpu/drm/i915/display/intel_display_types.h +1
-4@@ -263,10 +263,7 @@ struct intel_panel { /* DPCD backlight */ union { struct { - u8 pwmgen_bit_count; - u8 pwm_freq_pre_divider; - bool lsb_reg_used; - bool aux_enable; + struct drm_edp_backlight_info info; } vesa; struct { bool sdr_uses_aux;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -270,114 +270,19 @@ intel_dp_aux_hdr_setup_backlight(struct
intel_connector*connector, enum pipe pi
}/* VESA backlight callbacks */
-static boolintel_dp_aux_vesa_backlight_dpcd_mode(struct intel_connector *connector)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-7-{ - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int ret; - u8 mode_reg; - - ret = drm_dp_dpcd_readb(&intel_dp->aux,
DP_EDP_BACKLIGHT_MODE_SET_REGISTER,&mode_reg);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read backlight mode:
%d\n", ret);
- return false;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-9- - return (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) == - DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; -} - -/* -* Read the current backlight value from DPCD register(s) based -* on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported -*/ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector*connector, enum pipe unused)
{
- structintel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); - int ret;
- u8 read_val[2] = {0x0};
- u16 level = 0;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-9- - /* - * If we're not in DPCD control mode yet, the programmed brightness - * value is meaningless and we should assume max brightness - */ - if (!intel_dp_aux_vesa_backlight_dpcd_mode(connector)) - return connector->panel.backlight.max; - - ret = drm_dp_dpcd_read(&intel_dp->aux,
DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,&read_val,
-sizeof(read_val));
- if (ret !=sizeof(read_val)) {
- drm_dbg_kms(&i915->drm, "Failed to read brightness level:
%d\n", ret);
- return 0;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-9- - if (connector->panel.backlight.edp.vesa.lsb_reg_used) - level = (read_val[0] << 8 | read_val[1]); - else - level = read_val[0]; - - return level; + return connector->panel.backlight.level; } -/* -* Sends the current backlight level over the aux channel, checking if its using
- * 8-bit or 16 bit value (MSB and LSB)
- */
static void
-intel_dp_aux_vesa_set_backlight(const structdrm_connector_state*conn_state,
- u32 level) +intel_dp_aux_vesa_set_backlight(const structdrm_connector_state*conn_state, u32 level)
{
structintel_connector*connector = to_intel_connector(conn_state-Quoted 1 line
connector);
- struct
intel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); - int ret;
- u8 vals[2] = {0x0};drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-10- - /* Write the MSB and/or LSB */ - if (connector->panel.backlight.edp.vesa.lsb_reg_used) { - vals[0] = (level & 0xFF00) >> 8; - vals[1] = (level & 0xFF); - } else { - vals[0] = level; - } - - ret = drm_dp_dpcd_write(&intel_dp->aux,
DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, vals,
- sizeof(vals));
- if (ret != sizeof(vals)) {
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight
level: %d\n", ret);
- return;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-3-} - -static void set_vesa_backlight_enable(struct intel_connector *connector,bool enable)
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-7-{ - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int ret; - u8 reg_val = 0; - - /* Early return when display use other mechanism to enablebacklight. */
- if (!connector->panel.backlight.edp.vesa.aux_enable)
- return;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, ®_val);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read eDP display control
register: %d\n", ret);
- return;
- }
-
- if (enable)
- reg_val |=DP_EDP_BACKLIGHT_ENABLE;
- else
- reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE);
+ structintel_panel*panel =&connector->panel;
+ structintel_dp*intel_dp=enc_to_intel_dp(connector->encoder);- ret =
drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, reg_val);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to %s aux backlight: %d\n", - enable ? "enable" : "disable", ret); - }
+ drm_edp_backlight_set_level(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info, level);
}
static void
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +2
-46@@ -385,170 +290,46 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state, u32 level) { struct intel_connector *connector = to_intel_connector(conn_state- > connector); - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_panel *panel = &connector->panel; - int ret; - u8 dpcd_buf, new_dpcd_buf; - u8 pwmgen_bit_count = panel->backlight.edp.vesa.pwmgen_bit_count; - - ret = drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf); - if (ret != 1) { - drm_dbg_kms(&i915->drm, "Failed to read backlight mode: %d\n", ret); - return; - } - - new_dpcd_buf = dpcd_buf; - - if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) != DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) { - new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; - new_dpcd_buf |= DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; - - ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, pwmgen_bit_count); - if (ret != 1) - drm_dbg_kms(&i915->drm, "Failed to write aux pwmgen bit count: %d\n", ret); - } - - if (panel->backlight.edp.vesa.pwm_freq_pre_divider) { - ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_BACKLIGHT_FREQ_SET, - panel- > backlight.edp.vesa.pwm_freq_pre_divider); - if (ret == 1) - new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE ; - else - drm_dbg_kms(&i915->drm, "Failed to write aux backlight frequency: %d\n", - ret); - } - - if (new_dpcd_buf != dpcd_buf) { - ret = drm_dp_dpcd_writeb(&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , - new_dpcd_buf); - if (ret != 1) - drm_dbg_kms(&i915->drm, "Failed to write aux backlight mode: %d\n", ret); - } + struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); - intel_dp_aux_vesa_set_backlight(conn_state, level); - set_vesa_backlight_enable(connector, true); + drm_edp_backlight_enable(&intel_dp->aux, &panel- > backlight.edp.vesa.info, level); } static void intel_dp_aux_vesa_disable_backlight(const structdrm_connector_state *old_conn_state, u32 level) { - set_vesa_backlight_enable(to_intel_connector(old_conn_state- > connector), false); -} - -/* -* Compute PWM frequency divider value based off the frequency provided to us by the 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_SETregister (DPCD Address 00728h)
- * - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the
- *EDP_PWMGEN_BIT_COUNTregister (DPCD Address 00724h)
- */
-static u32intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connector)
-{
- structdrm_i915_private*i915 =to_i915(connector->base.dev); - structintel_dp*intel_dp=intel_attached_dp(connector); + structintel_connector*connector =to_intel_connector(old_conn_state->connector);
structintel_panel*panel =&connector->panel;
- u32max_backlight= 0;
- int ret, freq, fxp,fxp_min,fxp_max,fxp_actual, f = 1; - u8 pn,pn_min,pn_max;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, &pn);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count
cap: %d\n", ret);
- return 0;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-6- - pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK; - max_backlight = (1 << pn) - 1; - - /* 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 =i915->vbt.backlight.pwm_freq_hz;
- drm_dbg_kms(&i915->drm, "VBT defined backlight frequency %u Hz\n", - freq);
- if (!freq) {
- drm_dbg_kms(&i915->drm,
- "Use panel default backlight frequency\n"); - returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-4- - fxp = DIV_ROUND_CLOSEST(KHz(DP_EDP_BACKLIGHT_FREQ_BASE_KHZ), freq); - - /* Use highest possible value of Pn for more granularity ofbrightness
- * adjustment while satifying the conditions below.
- * - Pn is in the range ofPn_minandPn_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. - */
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap
min: %d\n", ret);
- returnmax_backlight;
- }
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap
max: %d\n", ret);
- returnmax_backlight;
- }
- pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
- pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-8- - /* Ensure frequency is within 25% of desired value */ - 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_dbg_kms(&i915->drm, - "VBT defined backlight frequency out ofrange\n");
- returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-10- - 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; - } - - drm_dbg_kms(&i915->drm, "Using eDP pwmgen bit count of %d\n", pn); - ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT,pn);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to write aux pwmgen bit
count: %d\n", ret);
- returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +2
-7- - panel->backlight.edp.vesa.pwmgen_bit_count = pn; - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) - panel->backlight.edp.vesa.pwm_freq_pre_divider = f; - - max_backlight = (1 << pn) - 1; + struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); - return max_backlight; + drm_edp_backlight_disable(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info);
}
-static int intel_dp_aux_vesa_setup_backlight(struct
intel_connector*connector,
- enum pipe pipe) +static intintel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe)
{
structintel_dp*intel_dp=intel_attached_dp(connector); structintel_panel*panel =&connector->panel;
+ structdrm_i915_private*i915 =dp_to_i915(intel_dp); + u16current_level;
+ u8current_mode;
+ int ret;- if (intel_dp->edp_dpcd[1] &
DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) - panel->backlight.edp.vesa.aux_enable = true;
- if (intel_dp->edp_dpcd[2] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) - panel->backlight.edp.vesa.lsb_reg_used = true; -
- panel->backlight.max =intel_dp_aux_vesa_calc_max_backlight(connector);
- if (!panel->backlight.max)
- return-ENODEV;
+ ret = drm_edp_backlight_init(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info,
+
i915->vbt.backlight.pwm_freq_hz,intel_dp->edp_dpcd,
+¤t_level,¤t_mode); + if (ret < 0)
+ return ret;+ panel->backlight.max =
panel->backlight.edp.vesa.info.max;
panel->backlight.min = 0;
- panel->backlight.level =intel_dp_aux_vesa_get_backlight(connector, pipe);
- panel->backlight.enabled =intel_dp_aux_vesa_backlight_dpcd_mode(connector)&&
-panel->backlight.level!= 0; + if (current_mode==DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + panel->backlight.level =current_level;
+ panel->backlight.enabled =panel->backlight.level!= 0; + } else {
+ panel->backlight.level =panel->backlight.max; + panel->backlight.enabled = false;
+ }return 0;
}drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-1@@ -559,16 +340,12 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector) struct intel_dp *intel_dp = intel_attached_dp(connector); struct drm_i915_private *i915 = dp_to_i915(intel_dp); - /* Check the eDP Display control capabilities registers to determineif
- * the panel can support backlight control over the aux channel. - *
- * TODO: We currently only support AUX only backlight configurations, not backlights which
+ /* TODO: We currently only support AUX only backlight configurations, not backlights which
* require a mix of PWM and AUX controls to work. In the mean time,
these machines typically
* work just fine using normal PWM controls anyway.
*/
- 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)) {
+ if ((intel_dp->edp_dpcd[1] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && +drm_edp_backlight_supported(intel_dp->edp_dpcd)) {
drm_dbg_kms(&i915->drm, "AUX Backlight Control
Supported!\n");
return true;
}include/drm/drm_dp_helper.h +2
-0@@ -1790,6 +1790,24 @@ drm_dp_sink_can_do_video_without_timing_msa(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) DP_MSA_TIMING_PAR_IGNORED; } +/** +* drm_edp_backlight_supported() - Check an eDP DPCD for VESA backlight support
+ * @edp_dpcd: The DPCD to check
+ *
+ * Note that currently this function will return %false for panels which support various DPCD
+ * backlight features but which require the brightness be set through PWM, and don't support setting
+ * the brightness level via the DPCD. This is a TODO.
+ *
+ * Returns: %True if @edp_dpcd indicates that VESA backlight controls are supported, %false
+ * otherwise
+ */include/drm/drm_dp_helper.h +11
-0+static inline bool +drm_edp_backlight_supported (const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE ]) +{ + return (edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && + (edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP); +} + /** DisplayPort AUX channel */ @@ -2089,6 +2107,36 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk) return desc->quirks & BIT(quirk); } +/** +* struct drm_edp_backlight_info - Probed eDP backlight info struct +* @pwmgen_bit_count: The pwmgen bit count +* @pwm_freq_pre_divider: The PWM frequency pre-divider value being used for this backlight, if any
+ * @max: The maximum backlight level that may be set
+ * @lsb_reg_used: Do we also write values to theDP_EDP_BACKLIGHT_BRIGHTNESS_LSBregister?
+ * @aux_enable: Does the panel support the AUX enable cap?
+ *
+ * This structure contains various data about an eDP backlight, which can be populated by using
+ *drm_edp_backlight_init().
+ */include/drm/drm_dp_helper.h +11
-0+struct drm_edp_backlight_info { + u8 pwmgen_bit_count; + u8 pwm_freq_pre_divider; + u16 max; + + bool lsb_reg_used : 1; + bool aux_enable : 1; +}; + +int +drm_edp_backlight_init(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
+ u16*current_level, u8*current_mode); +int drm_edp_backlight_set_level(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level);
+int drm_edp_backlight_enable(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level);
+intdrm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl);
+
#ifdefCONFIG_DRM_DP_CEC
voiddrm_dp_cec_irq(struct drm_dp_aux *aux);
void drm_dp_cec_register_connector(structdrm_dp_aux*aux,
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lyude Paul
maintainerRe: [RFC v3 10/10] drm/dp: Extract i915's eDP backlight code into DRM helpers
Quoted 25 lines · Thomas Zimmermann
Hi
Am 09.02.21 um 00:03 schrieb Lyude Paul:
Quoted 22 lines
Quoted 13 lines
Quoted 12 lines
+ } else {
+ buf[0] = level;
+ }
+
+ ret = drm_dp_dpcd_write(aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf,
sizeof(buf));
+ if (ret != sizeof(buf)) {
+ DRM_ERROR("%s: Failed to write aux backlight level:
%d\n",aux->name, ret);Quoted 2 lines
Since you're adding this code, you should probably convert to
drm_err()helpers as well. Here and elsewhere.this is next up on my todo list JFYI-I don't do it right now because there isn't
actually any backpointer to the drm driver (and you can't just use the parent of
the aux device, since that technically doesn't need to be the drm driver).
Quoted 6 lines
Quoted 4 lines
I'd add it in this series, but that's going to involve updating functions across
the tree likedrm_dp_aux_init()so I'd like to do it in a different patch seriesOk, sure. Makes sense.
I'm actually probably just going to do it anyway, since it seems like a want of folks really want to keep the drm_dbg_*() prints around
Quoted 951 lines
Best regards
ThomasQuoted 946 lines
Quoted 945 lines
Quoted 18 lines
+ return ret < 0 ? ret :
-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +7
-0+ + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_set_level); + +static int +drm_edp_backlight_set_enable(struct drm_dp_aux *aux, const struct
drm_edp_backlight_info*bl,
+ bool enable)drivers/gpu/drm/drm_dp_helper.c +5
-0+{ + int ret; + u8 buf; + + /* The panel uses something other then DPCD for enabling it'sQuoted 1 line
backlight */
'its'
Best regards
ThomasQuoted 919 lines
+ if (!bl->aux_enable)
+ return 0;
+
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, &buf);
+ if (ret != 1) {
+ DRM_ERROR("%s: Failed to read eDP display control register:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }
+ if (enable)
+ buf |=DP_EDP_BACKLIGHT_ENABLE;
+ else
+ buf &= ~DP_EDP_BACKLIGHT_ENABLE;
+
+ ret =drm_dp_dpcd_writeb(aux, DP_EDP_DISPLAY_CONTROL_REGISTER, buf);
+ if (ret != 1) {
+ DRM_ERROR("%s: Failed to write eDP display control register:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + return 0; +} + +/** +* drm_edp_backlight_enable() - Enable an eDP panel's backlight using DPCD
+ * @aux: The DP AUX channel to use
+ * @bl: Backlight capability info fromdrm_edp_backlight_init()
+ * @level: The initial backlight level to set via AUX, if there is one
+ *
+ * This function handles enabling DPCD backlight controls on a panel over
DPCD, while additionally
+ * restoring any important backlight state such as the given backlight level, the brightness byte
+ * count, backlight frequency, etc.
+ *
+ * Note that certain panels, while supporting brightness level controls over DPCD, may not support
+ * having their backlights enabled via the standard %DP_EDP_DISPLAY_CONTROL_REGISTER. On such panels
+ * &drm_edp_backlight_info.aux_enable will be set to %false, this function
will skip the step of
+ * programming the %DP_EDP_DISPLAY_CONTROL_REGISTER, and the driver must
perform the required
+ * implementation specific step for enabling the backlight after calling
this function.
+ *
+ * Returns: %0 on success, negative error code on failure.
+ */
+int drm_edp_backlight_enable(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ const u16 level)drivers/gpu/drm/drm_dp_helper.c +5
-0+{ + int ret; + u8 dpcd_buf, new_dpcd_buf; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
&dpcd_buf);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight mode: %d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +4
-0+ + new_dpcd_buf = dpcd_buf; + + if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) {
+ new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; + new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; +
+ ret = drm_dp_dpcd_writeb(aux,DP_EDP_PWMGEN_BIT_COUNT, bl-Quoted 1 line
pwmgen_bit_count);+ if (ret != 1)
+ DRM_DEBUG_KMS("%s: Failed to write aux pwmgen bit
count: %d\n",
+aux->name, ret);
+ }
+
+ if (bl->pwm_freq_pre_divider) {
+ ret = drm_dp_dpcd_writeb(aux,DP_EDP_BACKLIGHT_FREQ_SET, bl-Quoted 1 line
pwm_freq_pre_divider);+ if (ret != 1)
+ DRM_DEBUG_KMS("%s: Failed to write aux backlight
frequency: %d\n",
+aux->name, ret);
+ else
+ new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE;
+ }
+
+ if (new_dpcd_buf!=dpcd_buf) {
+ ret =drm_dp_dpcd_writeb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to write aux backlight
mode: %d\n",
+aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }
+ }drivers/gpu/drm/drm_dp_helper.c +14
-0+ + ret = drm_edp_backlight_set_level(aux, bl, level); + if (ret < 0) + return ret; + ret = drm_edp_backlight_set_enable(aux, bl, true); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_enable); + +/** +* drm_edp_backlight_disable() - Disable an eDP backlight using DPCD, if
supported
+ * @aux: The DP AUX channel to use
+ * @bl: Backlight capability info fromdrm_edp_backlight_init()
+ *
+ * This function handles disabling DPCD backlight controls on a panel over
AUX. Note that some
+ * panels have backlights that are enabled/disabled by other means, despite
having their brightness
+ * values controlled through DPCD. On such panels &drm_edp_backlight_info.aux_enable will be set to
+ * %false, this function will become a no-op (and we will skip updating
+ * %DP_EDP_DISPLAY_CONTROL_REGISTER), and the driver must take care to perform it's own
+ * implementation specific step for disabling the backlight.
+ *
+ * Returns: %0 on success or no-op, negative error code on failure.
+ */
+intdrm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl)drivers/gpu/drm/drm_dp_helper.c +13
-0+{ + int ret; + + ret = drm_edp_backlight_set_enable(aux, bl, false); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL (drm_edp_backlight_disable); + +static inline int +drm_edp_backlight_probe_max(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE])drivers/gpu/drm/drm_dp_helper.c +8
-0+{ + int fxp, fxp_min, fxp_max, fxp_actual, f = 1; + int ret; + u8 pn, pn_min, pn_max; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT, &pn); + if (ret != 1) { + DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap:%d\n",
aux->name, ret);
+ return-ENODEV;
+ }drivers/gpu/drm/drm_dp_helper.c +8
-0+ + pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK; + bl->max = (1 << pn) - 1; + if (!driver_pwm_freq_hz) + return 0; + + /* +* Set PWM Frequency divider to match desired frequency provided by
the driver.
+ * 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_SETregister (DPCD Address 00728h)
+ * - Where P = 2^Pn, where Pn is the value programmed by field 4:0
of the
+ *EDP_PWMGEN_BIT_COUNTregister (DPCD Address 00724h)
+ */
+
+ /* 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. + */
+ fxp =DIV_ROUND_CLOSEST(1000 * DP_EDP_BACKLIGHT_FREQ_BASE_KHZ, driver_pwm_freq_hz);
+
+ /* Use highest possible value of Pn for more granularity of brightness adjustment while
+ * satifying the conditions below.
+ * - Pn is in the range ofPn_minandPn_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. + */
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap min:
%d\n",aux->name, ret);
+ return 0;
+ }
+ ret =drm_dp_dpcd_readb(aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read pwmgen bit count cap max:
%d\n",aux->name, ret);
+ return 0;
+ }
+ pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
+ pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
+
+ /* Ensure frequency is within 25% of desired value */ + 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("%s: Driver defined backlight frequency (%d)
out of range\n",
+aux->name,driver_pwm_freq_hz); + return 0;
+ }drivers/gpu/drm/drm_dp_helper.c +11
-0+ + 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; + } + + ret = drm_dp_dpcd_writeb(aux, DP_EDP_PWMGEN_BIT_COUNT, pn); + if (ret != 1) { + DRM_DEBUG_KMS("%s: Failed to write aux pwmgen bit count:%d\n",
aux->name, ret);
+ return 0;
+ }
+ bl->pwmgen_bit_count = pn;
+ bl->max = (1 << pn) - 1;
+
+ if (edp_dpcd[2] &DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) { + bl->pwm_freq_pre_divider = f;
+ DRM_DEBUG_KMS("%s: Using backlight frequency from driver (%dHz)\n",
+aux->name,driver_pwm_freq_hz); + }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + return 0; +} + +static inline int +drm_edp_backlight_probe_level(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u8*current_mode)drivers/gpu/drm/drm_dp_helper.c +6
-0+{ + int ret; + u8 buf[2]; + u8 mode_reg; + + ret = drm_dp_dpcd_readb(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
&mode_reg);
+ if (ret != 1) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight mode: %d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +6
-0+ + *current_mode = (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK); + if (*current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + int size = 1 + bl->lsb_reg_used; + + ret = drm_dp_dpcd_read(aux,
DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,
buf, size);
+ if (ret != size) {
+ DRM_DEBUG_KMS("%s: Failed to read backlight level:
%d\n",aux->name, ret);
+ return ret < 0 ? ret :-EIO;
+ }drivers/gpu/drm/drm_dp_helper.c +9
-0+ + if (bl->lsb_reg_used) + return (buf[0] << 8) | buf[1]; + else + return buf[0]; + } + + /* +* If we're not in DPCD control mode yet, the programmed brightness
value is meaningless and
+ * the driver should assume max brightness + */
+ returnbl->max;drivers/gpu/drm/drm_dp_helper.c +4
-0+} + +/** +* drm_edp_backlight_init() - Probe a display panel's TCON using the standard VESA eDP backlight
+ * interface.
+ * @aux: The DP aux device to use for probing
+ * @bl: The&drm_edp_backlight_infostruct to fill out with information on
the backlight
+ * @driver_pwm_freq_hz: Optional PWM frequency from the driver in hz
+ * @edp_dpcd: A cached copy of the eDP DPCD
+ * @current_level: Where to store the probed brightness level
+ * @current_mode: Where to store the currently set backlight control mode
+ *
+ * Initializes a&drm_edp_backlight_infostruct by probing @aux for it's
backlight capabilities,
+ * along with also probing the current and maximum supported brightness levels.
+ *
+ * If @driver_pwm_freq_hz is non-zero, this will be used as the backlight
frequency. Otherwise, the
+ * default frequency from the panel is used.
+ *
+ * Returns: %0 on success, negative error code on failure.
+ */(quoted diff) +2
-0+int +drm_edp_backlight_init(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
+ u16*current_level, u8*current_mode)drivers/gpu/drm/drm_dp_helper.c +9
-0+{ + int ret; + + if (edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) + bl->aux_enable = true; + if (edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) + bl->lsb_reg_used = true; + + ret = drm_edp_backlight_probe_max(aux, bl, driver_pwm_freq_hz,
edp_dpcd);
+ if (ret < 0)
+ return ret;drivers/gpu/drm/drm_dp_helper.c +7
-0+ + ret = drm_edp_backlight_probe_level(aux, bl, current_mode); + if (ret < 0) + return ret; + *current_level = ret; + + DRM_DEBUG_KMS("%s: Found backlight level=%d/%dpwm_freq_pre_divider=%d mode=%x\n",
+aux->name,*current_level,bl->max, bl-Quoted 1 line
pwm_freq_pre_divider,*current_mode);+ DRM_DEBUG_KMS("%s: Backlight caps: pwmgen_bit_count=%d lsb_reg_used=%d aux_enable=%d\n",
+aux->name,bl->pwmgen_bit_count,bl->lsb_reg_used, bl-Quoted 1 line
aux_enable);+ return 0;
(quoted diff) +2
-0+} +EXPORT_SYMBOL(drm_edp_backlight_init);drivers/gpu/drm/i915/display/intel_display_types.h +1
-4@@ -263,10 +263,7 @@ struct intel_panel { /* DPCD backlight */ union { struct { - u8 pwmgen_bit_count; - u8 pwm_freq_pre_divider; - bool lsb_reg_used; - bool aux_enable; + struct drm_edp_backlight_info info; } vesa; struct { bool sdr_uses_aux;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -270,114 +270,19 @@ intel_dp_aux_hdr_setup_backlight(struct
intel_connector*connector, enum pipe pi
}
/* VESA backlight callbacks */
-static bool intel_dp_aux_vesa_backlight_dpcd_mode(structintel_connector
*connector)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-7-{ - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int ret; - u8 mode_reg; - - ret = drm_dp_dpcd_readb(&intel_dp->aux,
DP_EDP_BACKLIGHT_MODE_SET_REGISTER,&mode_reg);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read backlight mode:
%d\n", ret);
- return false;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-9- - return (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) == - DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; -} - -/* -* Read the current backlight value from DPCD register(s) based -* on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported -*/ static u32
intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enum pipe unused)
{
- structintel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); - int ret;
- u8 read_val[2] = {0x0};
- u16 level = 0;
-
- /*
- * If we're not in DPCD control mode yet, the programmed brightness
- * value is meaningless and we should assume max brightness - */
- if (!intel_dp_aux_vesa_backlight_dpcd_mode(connector)) - returnconnector->panel.backlight.max;
-
- ret = drm_dp_dpcd_read(&intel_dp->aux,DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,&read_val,
-sizeof(read_val));
- if (ret !=sizeof(read_val)) {
- drm_dbg_kms(&i915->drm, "Failed to read brightness level:
%d\n", ret);
- return 0;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-7- - if (connector->panel.backlight.edp.vesa.lsb_reg_used) - level = (read_val[0] << 8 | read_val[1]); - else - level = read_val[0]; - - return level; + return connector->panel.backlight.level;}
-/*
- * Sends the current backlight level over the aux channel, checking if its
using
- * 8-bit or 16 bit value (MSB and LSB)
- */
static void
-intel_dp_aux_vesa_set_backlight(const structdrm_connector_state*conn_state,
- u32 level) +intel_dp_aux_vesa_set_backlight(const structdrm_connector_state*conn_state, u32 level)
{
structintel_connector*connector = to_intel_connector(conn_state-Quoted 1 line
connector);
- struct
intel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); - int ret;
- u8 vals[2] = {0x0};drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-10- - /* Write the MSB and/or LSB */ - if (connector->panel.backlight.edp.vesa.lsb_reg_used) { - vals[0] = (level & 0xFF00) >> 8; - vals[1] = (level & 0xFF); - } else { - vals[0] = level; - } - - ret = drm_dp_dpcd_write(&intel_dp->aux,
DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, vals,
- sizeof(vals));
- if (ret != sizeof(vals)) {
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight
level: %d\n", ret);
- return;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-3-} - -static void set_vesa_backlight_enable(struct intel_connector*connector,
bool enable)drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-7-{ - struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int ret; - u8 reg_val = 0; - - /* Early return when display use other mechanism to enablebacklight. */
- if (!connector->panel.backlight.edp.vesa.aux_enable) - return;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, ®_val);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read eDP display control
register: %d\n", ret);
- return;
- }
-
- if (enable)
- reg_val |=DP_EDP_BACKLIGHT_ENABLE;
- else
- reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE);
+ structintel_panel*panel =&connector->panel;
+ structintel_dp*intel_dp=enc_to_intel_dp(connector->encoder);
- ret =drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, reg_val);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to %s aux backlight:
%d\n",
- enable ? "enable" : "disable", ret); - }
+ drm_edp_backlight_set_level(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info, level);
}
static voiddrivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -385,170 +290,46 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,const struct
drm_connector_state*conn_state, u32 level)
{
structintel_connector*connector = to_intel_connector(conn_state-Quoted 1 line
connector);
- struct
intel_dp*intel_dp=intel_attached_dp(connector); - structdrm_i915_private*i915 =dp_to_i915(intel_dp); structintel_panel*panel =&connector->panel; - int ret;
- u8dpcd_buf,new_dpcd_buf;
- u8pwmgen_bit_count= panel-Quoted 1 line
backlight.edp.vesa.pwmgen_bit_count;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read backlight mode:
%d\n", ret);
- return;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-4- - new_dpcd_buf = dpcd_buf; - - if ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) {
- new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK; - new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD; -
- ret =drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, pwmgen_bit_count);
- if (ret != 1)
- drm_dbg_kms(&i915->drm, "Failed to write aux pwmgen
bit count: %d\n", ret);
- }
-
- if (panel->backlight.edp.vesa.pwm_freq_pre_divider) { - ret = drm_dp_dpcd_writeb(&intel_dp->aux,DP_EDP_BACKLIGHT_FREQ_SET,
- panel-Quoted 1 line
backlight.edp.vesa.pwm_freq_pre_divider);
- if (ret == 1)
- new_dpcd_buf |=DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE;
- else
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight frequency: %d\n",
- ret);
- }
-
- if (new_dpcd_buf!=dpcd_buf) {
- ret = drm_dp_dpcd_writeb(&intel_dp->aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
-new_dpcd_buf);
- if (ret != 1)
- drm_dbg_kms(&i915->drm, "Failed to write aux backlight mode: %d\n", ret);
- }
+ structintel_dp*intel_dp=enc_to_intel_dp(connector->encoder);
- intel_dp_aux_vesa_set_backlight(conn_state, level); - set_vesa_backlight_enable(connector, true);
+ drm_edp_backlight_enable(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info, level);
}
static void intel_dp_aux_vesa_disable_backlight(const structdrm_connector_state*old_conn_state,
u32 level) {
- set_vesa_backlight_enable(to_intel_connector(old_conn_state-Quoted 1 line
connector), false);
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-4-} - -/* -* Compute PWM frequency divider value based off the frequency provided to
us by the 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_SETregister (DPCD Address 00728h)
- * - Where P = 2^Pn, where Pn is the value programmed by field 4:0 of the
- *EDP_PWMGEN_BIT_COUNTregister (DPCD Address 00724h)
- */
-static u32intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connector)
-{
- structdrm_i915_private*i915 =to_i915(connector->base.dev); - structintel_dp*intel_dp=intel_attached_dp(connector); + structintel_connector*connector =to_intel_connector(old_conn_state->connector);
structintel_panel*panel =&connector->panel;
- u32max_backlight= 0;
- int ret, freq, fxp,fxp_min,fxp_max,fxp_actual, f = 1; - u8 pn,pn_min,pn_max;
-
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, &pn);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count
cap: %d\n", ret);
- return 0;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-6- - pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK; - max_backlight = (1 << pn) - 1; - - /* 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 =i915->vbt.backlight.pwm_freq_hz;
- drm_dbg_kms(&i915->drm, "VBT defined backlight frequency %u Hz\n",
- freq);
- if (!freq) {
- drm_dbg_kms(&i915->drm,
- "Use panel default backlight frequency\n"); - returnmax_backlight;
- }
-
- 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 ofPn_minandPn_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. - */
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &pn_min);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap
min: %d\n", ret);
- returnmax_backlight;
- }
- ret =drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX, &pn_max);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap
max: %d\n", ret);
- returnmax_backlight;
- }
- pn_min &=DP_EDP_PWMGEN_BIT_COUNT_MASK;
- pn_max &=DP_EDP_PWMGEN_BIT_COUNT_MASK;drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-8- - /* Ensure frequency is within 25% of desired value */ - 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_dbg_kms(&i915->drm, - "VBT defined backlight frequency out ofrange\n");
- returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-9- - 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; - } - - drm_dbg_kms(&i915->drm, "Using eDP pwmgen bit count of %d\n",pn);
- ret = drm_dp_dpcd_writeb(&intel_dp->aux,DP_EDP_PWMGEN_BIT_COUNT,
pn);
- if (ret != 1) {
- drm_dbg_kms(&i915->drm, "Failed to write aux pwmgen bit
count: %d\n", ret);
- returnmax_backlight;
- }drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1
-6- - panel->backlight.edp.vesa.pwmgen_bit_count = pn; - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) - panel->backlight.edp.vesa.pwm_freq_pre_divider = f; - - max_backlight = (1 << pn) - 1; + struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
- returnmax_backlight;
+ drm_edp_backlight_disable(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info);
}
-static int intel_dp_aux_vesa_setup_backlight(structintel_connector*connector,
- enum pipe pipe) +static intintel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe)
{
structintel_dp*intel_dp=intel_attached_dp(connector); structintel_panel*panel =&connector->panel;
+ structdrm_i915_private*i915 =dp_to_i915(intel_dp); + u16current_level;
+ u8current_mode;
+ int ret;
- if (intel_dp->edp_dpcd[1] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) - panel->backlight.edp.vesa.aux_enable = true; - if (intel_dp->edp_dpcd[2] &DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT)
- panel->backlight.edp.vesa.lsb_reg_used = true; -
- panel->backlight.max =intel_dp_aux_vesa_calc_max_backlight(connector);
- if (!panel->backlight.max)
- return-ENODEV;
+ ret = drm_edp_backlight_init(&intel_dp->aux, &panel-Quoted 1 line
backlight.edp.vesa.info,
+
i915->vbt.backlight.pwm_freq_hz,intel_dp->edp_dpcd,
+¤t_level,¤t_mode); + if (ret < 0)
+ return ret;
+ panel->backlight.max =panel->backlight.edp.vesa.info.max;panel->backlight.min= 0;
- panel->backlight.level = intel_dp_aux_vesa_get_backlight(connector,
pipe);
- panel->backlight.enabled =intel_dp_aux_vesa_backlight_dpcd_mode(connector)&&
-panel->backlight.level!= 0; + if (current_mode==DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + panel->backlight.level =current_level;
+ panel->backlight.enabled =panel->backlight.level!= 0; + } else {
+ panel->backlight.level =panel->backlight.max; + panel->backlight.enabled = false;
+ }
return 0;
}drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +0
-0@@ -559,16 +340,12 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector) struct intel_dp *intel_dp = intel_attached_dp(connector); struct drm_i915_private *i915 = dp_to_i915(intel_dp);
- /* Check the eDP Display control capabilities registers to determine
if
- * the panel can support backlight control over the aux channel. - *
- * TODO: We currently only support AUX only backlight configurations, not backlights which
+ /* TODO: We currently only support AUX only backlight configurations, not backlights which
* require a mix of PWM and AUX controls to work. In the mean time,
these machines typically
* work just fine using normal PWM controls anyway. */
- 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)) {
+ if ((intel_dp->edp_dpcd[1] &DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && +drm_edp_backlight_supported(intel_dp->edp_dpcd)) {drm_dbg_kms(&i915->drm, "AUX Backlight Control Supported!\n");
return true;
}include/drm/drm_dp_helper.h +0
-0@@ -1790,6 +1790,24 @@ drm_dp_sink_can_do_video_without_timing_msa(constu8
dpcd[DP_RECEIVER_CAP_SIZE])
DP_MSA_TIMING_PAR_IGNORED;
}
+/**
+ *drm_edp_backlight_supported()- Check an eDP DPCD for VESA backlight support
+ * @edp_dpcd: The DPCD to check
+ *
+ * Note that currently this function will return %false for panels which
support various DPCD
+ * backlight features but which require the brightness be set through PWM,
and don't support setting
+ * the brightness level via the DPCD. This is a TODO.
+ *
+ * Returns: %True if @edp_dpcd indicates that VESA backlight controls are
supported, %false
+ * otherwise
+ */include/drm/drm_dp_helper.h +2
-0+static inline bool +drm_edp_backlight_supported(const u8edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE])
include/drm/drm_dp_helper.h +5
-0+{ + return (edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && + (edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP); +} +/*
* DisplayPort AUX channel
*/include/drm/drm_dp_helper.h +0
-0@@ -2089,6 +2107,36 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc,enum
drm_dp_quirkquirk)
returndesc->quirks& BIT(quirk);
}
+/**
+ * structdrm_edp_backlight_info- Probed eDP backlight info struct
+ * @pwmgen_bit_count: The pwmgen bit count
+ * @pwm_freq_pre_divider: The PWM frequency pre-divider value being used
for this backlight, if any
+ * @max: The maximum backlight level that may be set
+ * @lsb_reg_used: Do we also write values to theDP_EDP_BACKLIGHT_BRIGHTNESS_LSBregister?
+ * @aux_enable: Does the panel support the AUX enable cap?
+ *
+ * This structure contains various data about an eDP backlight, which can
be populated by using
+ *drm_edp_backlight_init().
+ */include/drm/drm_dp_helper.h +11
-0+struct drm_edp_backlight_info { + u8 pwmgen_bit_count; + u8 pwm_freq_pre_divider; + u16 max; + + bool lsb_reg_used : 1; + bool aux_enable : 1; +}; + +int +drm_edp_backlight_init(struct drm_dp_aux *aux, struct
drm_edp_backlight_info*bl,
+ u16driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
+ u16*current_level, u8*current_mode); +int drm_edp_backlight_set_level(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level);
+int drm_edp_backlight_enable(structdrm_dp_aux*aux, const structdrm_edp_backlight_info*bl,
+ u16 level);
+intdrm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl);
+
#ifdefCONFIG_DRM_DP_CEC
voiddrm_dp_cec_irq(struct drm_dp_aux *aux);
void drm_dp_cec_register_connector(structdrm_dp_aux*aux,
Signature · 13 lines
Sincerely, Lyude Paul (she/her) Software Engineer at Red Hat Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've asked me a question, are waiting for a review/merge on a patch, etc. and I haven't responded in a while, please feel free to send me another email to check on my status. I don't bite! _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Extract DPCD backlight helpers from i915, add support in nouveau (rev5)
In reply to Lyude Paul== Series Details ==
== Series Details ==
Series: drm: Extract DPCD backlight helpers from i915, add support in nouveau (rev5)
URL : https://patchwork.freedesktop.org/series/84754/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 990b106df931 drm/nouveau/kms/nv40-/backlight: Assign prop type once -:7: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one
total: 0 errors, 1 warnings, 0 checks, 22 lines checked755b16f66afc drm/nouveau/kms: Don't probe eDP connectors more then once
-:6: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #6:
eDP doesn't do hotplugging, so there's no reason for us to reprobe it (unless a
-:23: CHECK:CAMELCASE: Avoid CamelCase: <DCB_CONNECTOR_eDP> #23: FILE: drivers/gpu/drm/nouveau/nouveau_connector.c:560:
+ if (nv_connector->type == DCB_CONNECTOR_eDP &&
total: 0 errors, 1 warnings, 1 checks, 12 lines checked948c71628815 drm/i915/dpcd_bl: Remove redundant AUX backlight frequency calculations c05e38fb6b81 drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly e9190019cd99 drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit 8e101f1fa419 drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight d023a0b271b0 drm/i915/dpcd_bl: Move VESA backlight enabling code closer together bb9ab8c80a61 drm/i915/dpcd_bl: Return early in vesa_calc_max_backlight if we can't read PWMGEN_BIT_COUNT 9a5a96645e75 drm/i915/dpcd_bl: Print return codes for VESA backlight failures da4a690db4b7 drm/dp: Extract i915's eDP backlight code into DRM helpers
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm: Extract DPCD backlight helpers from i915, add support in nouveau (rev5)
In reply to Lyude Paul== Series Details ==
== Series Details ==
Series: drm: Extract DPCD backlight helpers from i915, add support in nouveau (rev5)
URL : https://patchwork.freedesktop.org/series/84754/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9741 -> Patchwork_19615
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/index.html
Known issues
------------
Here are the changes found in Patchwork_19615 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s0:
- fi-glk-dsi: [PASS][1] -> [DMESG-WARN][2] ([i915#2943])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/fi-glk-dsi/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-glk-dsi/igt@[email protected]
* igt@i915_selftest@live@hangcheck:
- fi-bxt-dsi: [PASS][3] -> [INCOMPLETE][4] ([i915#2895])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/fi-bxt-dsi/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-bxt-dsi/igt@i915_selftest@[email protected]
* igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7500u: [PASS][5] -> [FAIL][6] ([i915#1372])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-kbl-7500u/igt@[email protected]
* igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y: [PASS][7] -> [DMESG-WARN][8] ([i915#402])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
* igt@runner@aborted:
- fi-bxt-dsi: NOTRUN -> [FAIL][9] ([i915#2426])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-bxt-dsi/igt@[email protected]
#### Possible fixes ####
* igt@debugfs_test@read_all_entries:
- fi-tgl-y: [DMESG-WARN][10] ([i915#402]) -> [PASS][11] +1 similar issue
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/fi-tgl-y/igt@debugfs_test@read_all_entries.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-tgl-y/igt@debugfs_test@read_all_entries.html
* igt@i915_module_load@reload:
- fi-tgl-u2: [FAIL][12] -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/fi-tgl-u2/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/fi-tgl-u2/igt@[email protected]
[i915#1372]: https://gitlab.freedesktop.org/drm/intel/issues/1372
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2895]: https://gitlab.freedesktop.org/drm/intel/issues/2895
[i915#2943]: https://gitlab.freedesktop.org/drm/intel/issues/2943
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
Participating hosts (44 -> 37)
------------------------------
Missing (7): fi-jsl-1 fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus
Build changes
-------------
* Linux: CI_DRM_9741 -> Patchwork_19615
CI-20190529: 20190529
CI_DRM_9741: 439ad4a70b3d6663de543ee56478d64b16cca1cf @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5994: 53268fc5e5dde45a16e7185023a42296e3599e6e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19615: da4a690db4b7aefda5e83942348688dfc37f117f @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
da4a690db4b7 drm/dp: Extract i915's eDP backlight code into DRM helpers9a5a96645e75 drm/i915/dpcd_bl: Print return codes for VESA backlight failures bb9ab8c80a61 drm/i915/dpcd_bl: Return early in vesa_calc_max_backlight if we can't read PWMGEN_BIT_COUNT d023a0b271b0 drm/i915/dpcd_bl: Move VESA backlight enabling code closer together 8e101f1fa419 drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight e9190019cd99 drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit c05e38fb6b81 drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly 948c71628815 drm/i915/dpcd_bl: Remove redundant AUX backlight frequency calculations 755b16f66afc drm/nouveau/kms: Don't probe eDP connectors more then once990b106df931 drm/nouveau/kms/nv40-/backlight: Assign prop type once
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for drm: Extract DPCD backlight helpers from i915, add support in nouveau (rev5)
In reply to Lyude Paul== Series Details ==
== Series Details ==
Series: drm: Extract DPCD backlight helpers from i915, add support in nouveau (rev5)
URL : https://patchwork.freedesktop.org/series/84754/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9741_full -> Patchwork_19615_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Known issues
------------
Here are the changes found in Patchwork_19615_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_balancer@hang:
- shard-iclb: [PASS][1] -> [INCOMPLETE][2] ([i915#1895] / [i915#2295] / [i915#3031])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb2/igt@[email protected]
* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-tglb: [PASS][3] -> [FAIL][4] ([i915#2842]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb2/igt@gem_exec_fair@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb3/igt@gem_exec_fair@[email protected]
* igt@gem_exec_reloc@basic-wide-active@vcs1:
- shard-iclb: NOTRUN -> [FAIL][5] ([i915#2389]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb4/igt@gem_exec_reloc@[email protected]
* igt@gem_exec_schedule@u-fairslice-all:
- shard-tglb: [PASS][6] -> [DMESG-WARN][7] ([i915#2803])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb8/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb5/igt@[email protected]
* igt@gem_render_copy@x-tiled-to-vebox-yf-tiled:
- shard-kbl: NOTRUN -> [SKIP][8] ([fdo#109271]) +103 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@[email protected]
* igt@gem_spin_batch@spin-each:
- shard-skl: [PASS][9] -> [FAIL][10] ([i915#2898])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl8/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl3/igt@[email protected]
* igt@gem_userptr_blits@process-exit-mmap-busy@uc:
- shard-skl: NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#1699]) +3 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@gem_userptr_blits@[email protected]
* igt@gem_userptr_blits@process-exit-mmap@gtt:
- shard-kbl: NOTRUN -> [SKIP][12] ([fdo#109271] / [i915#1699]) +3 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@gem_userptr_blits@[email protected]
* igt@gen7_exec_parse@basic-rejected:
- shard-iclb: NOTRUN -> [SKIP][13] ([fdo#109289])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb4/igt@[email protected]
* igt@i915_module_load@reload:
- shard-skl: [PASS][14] -> [DMESG-WARN][15] ([i915#1982])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl5/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl1/igt@[email protected]
* igt@i915_pm_dc@dc3co-vpb-simulation:
- shard-apl: NOTRUN -> [SKIP][16] ([fdo#109271] / [i915#658])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl6/igt@[email protected]
* igt@kms_async_flips@test-time-stamp:
- shard-tglb: [PASS][17] -> [FAIL][18] ([i915#2597])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb7/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb5/igt@[email protected]
* igt@kms_ccs@pipe-c-bad-aux-stride:
- shard-skl: NOTRUN -> [SKIP][19] ([fdo#109271] / [fdo#111304])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl5/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-for-each-pipe:
- shard-apl: NOTRUN -> [SKIP][20] ([fdo#109271] / [fdo#111827]) +1 similar issue
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl6/igt@[email protected]
* igt@kms_chamelium@vga-hpd-after-suspend:
- shard-skl: NOTRUN -> [SKIP][21] ([fdo#109271] / [fdo#111827]) +6 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@[email protected]
* igt@kms_chamelium@vga-hpd-without-ddc:
- shard-kbl: NOTRUN -> [SKIP][22] ([fdo#109271] / [fdo#111827]) +10 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@[email protected]
* igt@kms_color@pipe-d-ctm-0-5:
- shard-skl: NOTRUN -> [SKIP][23] ([fdo#109271]) +79 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@[email protected]
* igt@kms_content_protection@atomic-dpms:
- shard-apl: NOTRUN -> [TIMEOUT][24] ([i915#1319])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl3/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-suspend:
- shard-apl: [PASS][25] -> [DMESG-WARN][26] ([i915#180])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl8/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl4/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-256x85-random:
- shard-skl: [PASS][27] -> [FAIL][28] ([i915#54]) +4 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl7/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-64x21-onscreen:
- shard-skl: NOTRUN -> [FAIL][29] ([i915#54]) +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-skl: [PASS][30] -> [INCOMPLETE][31] ([i915#2405] / [i915#300])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl3/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl5/igt@[email protected]
* igt@kms_cursor_legacy@cursorb-vs-flipa-atomic-transitions:
- shard-hsw: [PASS][32] -> [SKIP][33] ([fdo#109271])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-hsw7/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-hsw4/igt@[email protected]
* igt@kms_cursor_legacy@flip-vs-cursor-atomic:
- shard-tglb: [PASS][34] -> [FAIL][35] ([i915#2346]) +1 similar issue
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb7/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb5/igt@[email protected]
* igt@kms_fbcon_fbt@fbc-suspend:
- shard-apl: [PASS][36] -> [INCOMPLETE][37] ([i915#180] / [i915#1982])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl1/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl3/igt@[email protected]
* igt@kms_flip@flip-vs-expired-vblank@a-edp1:
- shard-tglb: [PASS][38] -> [FAIL][39] ([i915#2598])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb7/igt@kms_flip@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb5/igt@kms_flip@[email protected]
* igt@kms_flip@plain-flip-fb-recreate-interruptible@b-edp1:
- shard-skl: [PASS][40] -> [FAIL][41] ([i915#2122]) +1 similar issue
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl6/igt@kms_flip@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl1/igt@kms_flip@[email protected]
* igt@kms_flip@plain-flip-fb-recreate@c-edp1:
- shard-skl: NOTRUN -> [FAIL][42] ([i915#2122])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@kms_flip@[email protected]
* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs:
- shard-kbl: NOTRUN -> [FAIL][43] ([i915#2641])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl3/igt@[email protected]
* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-64bpp-ytile:
- shard-skl: NOTRUN -> [SKIP][44] ([fdo#109271] / [i915#2642])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-pri-shrfb-draw-mmap-gtt:
- shard-apl: NOTRUN -> [SKIP][45] ([fdo#109271]) +28 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl6/igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-pri-shrfb-draw-mmap-gtt.html
* igt@kms_hdr@bpc-switch-suspend:
- shard-kbl: [PASS][46] -> [DMESG-WARN][47] ([i915#180]) +6 similar issues
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl2/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl4/igt@[email protected]
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- shard-kbl: NOTRUN -> [SKIP][48] ([fdo#109271] / [i915#533])
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-c-alpha-transparent-fb:
- shard-skl: NOTRUN -> [FAIL][49] ([i915#265])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl2/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
- shard-kbl: NOTRUN -> [FAIL][50] ([fdo#108145] / [i915#265])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@[email protected]
* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-4:
- shard-iclb: NOTRUN -> [SKIP][51] ([i915#658])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb4/igt@[email protected]
* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-5:
- shard-skl: NOTRUN -> [SKIP][52] ([fdo#109271] / [i915#658]) +1 similar issue
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl5/igt@[email protected]
* igt@kms_psr@psr2_suspend:
- shard-iclb: [PASS][53] -> [SKIP][54] ([fdo#109441]) +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb2/igt@kms_psr@psr2_suspend.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb1/igt@kms_psr@psr2_suspend.html
* igt@kms_sysfs_edid_timing:
- shard-apl: NOTRUN -> [FAIL][55] ([IGT#2])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl6/igt@kms_sysfs_edid_timing.html
* igt@kms_vblank@pipe-b-accuracy-idle:
- shard-skl: [PASS][56] -> [FAIL][57] ([i915#43])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl6/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl1/igt@[email protected]
* igt@kms_vblank@pipe-d-query-forked-hang:
- shard-iclb: NOTRUN -> [SKIP][58] ([fdo#109278])
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb4/igt@[email protected]
* igt@kms_writeback@writeback-fb-id:
- shard-skl: NOTRUN -> [SKIP][59] ([fdo#109271] / [i915#2437])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl5/igt@[email protected]
* igt@perf@polling-parameterized:
- shard-skl: [PASS][60] -> [FAIL][61] ([i915#1542])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl1/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl8/igt@[email protected]
* igt@perf_pmu@rc6-suspend:
- shard-kbl: NOTRUN -> [DMESG-WARN][62] ([i915#180])
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl4/igt@[email protected]
#### Possible fixes ####
* igt@gem_ctx_isolation@preservation-s3@vcs0:
- shard-skl: [INCOMPLETE][63] ([i915#198]) -> [PASS][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl2/igt@gem_ctx_isolation@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl5/igt@gem_ctx_isolation@[email protected]
* igt@gem_eio@in-flight-suspend:
- shard-kbl: [DMESG-WARN][65] ([i915#1037] / [i915#180]) -> [PASS][66]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@[email protected]
* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [FAIL][67] ([i915#2842]) -> [PASS][68] +1 similar issue
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-glk4/igt@gem_exec_fair@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-glk9/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fair@basic-pace@vcs0:
- shard-kbl: [SKIP][69] ([fdo#109271]) -> [PASS][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl1/igt@gem_exec_fair@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl6/igt@gem_exec_fair@[email protected]
* igt@gem_exec_schedule@u-fairslice@rcs0:
- shard-skl: [DMESG-WARN][71] ([i915#1610] / [i915#2803]) -> [PASS][72]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl6/igt@gem_exec_schedule@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl7/igt@gem_exec_schedule@[email protected]
* igt@gem_exec_schedule@u-fairslice@vcs1:
- shard-iclb: [DMESG-WARN][73] ([i915#2803]) -> [PASS][74]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb2/igt@gem_exec_schedule@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb4/igt@gem_exec_schedule@[email protected]
* igt@gem_softpin@noreloc-s3:
- shard-kbl: [INCOMPLETE][75] ([i915#180] / [i915#2405]) -> [PASS][76]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl2/igt@[email protected]
* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [FAIL][77] ([i915#454]) -> [PASS][78]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb8/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb7/igt@[email protected]
* igt@i915_pm_rc6_residency@rc6-fence:
- shard-hsw: [WARN][79] ([i915#1519]) -> [PASS][80]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-hsw2/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-hsw2/igt@[email protected]
* igt@i915_suspend@debugfs-reader:
- shard-apl: [DMESG-WARN][81] ([i915#180]) -> [PASS][82] +1 similar issue
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl1/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl3/igt@[email protected]
* igt@i915_suspend@forcewake:
- shard-kbl: [DMESG-WARN][83] ([i915#180]) -> [PASS][84] +2 similar issues
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl6/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl6/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-256x85-offscreen:
- shard-skl: [FAIL][85] ([i915#54]) -> [PASS][86] +6 similar issues
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl7/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl8/igt@[email protected]
* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: [FAIL][87] ([i915#96]) -> [PASS][88]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-hsw1/igt@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-hsw7/igt@[email protected]
* igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size:
- shard-hsw: [FAIL][89] ([i915#2370]) -> [PASS][90]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-hsw1/igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size.html
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-hsw6/igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size.html
* igt@kms_flip@plain-flip-fb-recreate-interruptible@c-edp1:
- shard-skl: [FAIL][91] ([i915#2122]) -> [PASS][92] +1 similar issue
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl6/igt@kms_flip@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl1/igt@kms_flip@[email protected]
* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [FAIL][93] ([i915#1188]) -> [PASS][94]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl6/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl1/igt@[email protected]
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-kbl: [DMESG-WARN][95] ([i915#180] / [i915#533]) -> [PASS][96]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl3/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [FAIL][97] ([fdo#108145] / [i915#265]) -> [PASS][98] +1 similar issue
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-skl3/igt@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-skl5/igt@[email protected]
* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [SKIP][99] ([fdo#109441]) -> [PASS][100] +3 similar issues
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb7/igt@kms_psr@psr2_primary_page_flip.html
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
* igt@sysfs_clients@recycle:
- shard-iclb: [FAIL][101] ([i915#3028]) -> [PASS][102]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb4/igt@[email protected]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb8/igt@[email protected]
* {igt@sysfs_clients@recycle-many}:
- shard-apl: [FAIL][103] ([i915#3028]) -> [PASS][104]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl7/igt@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl1/igt@[email protected]
- shard-glk: [FAIL][105] ([i915#3028]) -> [PASS][106] +1 similar issue
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-glk2/igt@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-glk2/igt@[email protected]
* igt@sysfs_clients@split-10@bcs0:
- shard-apl: [SKIP][107] ([fdo#109271] / [i915#3026]) -> [PASS][108]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl1/igt@sysfs_clients@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl3/igt@sysfs_clients@[email protected]
#### Warnings ####
* igt@gem_exec_fair@basic-pace@vecs0:
- shard-kbl: [FAIL][109] ([i915#2842]) -> [SKIP][110] ([fdo#109271])
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl1/igt@gem_exec_fair@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl6/igt@gem_exec_fair@[email protected]
* igt@i915_pm_rc6_residency@rc6-idle:
- shard-iclb: [WARN][111] ([i915#2681] / [i915#2684]) -> [WARN][112] ([i915#1804] / [i915#2684])
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb8/igt@[email protected]
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb3/igt@[email protected]
* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1:
- shard-iclb: [SKIP][113] ([i915#658]) -> [SKIP][114] ([i915#2920]) +2 similar issues
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb3/igt@[email protected]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb2/igt@[email protected]
* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-5:
- shard-iclb: [SKIP][115] ([i915#2920]) -> [SKIP][116] ([i915#658])
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb2/igt@[email protected]
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb6/igt@[email protected]
* igt@runner@aborted:
- shard-kbl: ([FAIL][117], [FAIL][118], [FAIL][119], [FAIL][120], [FAIL][121], [FAIL][122], [FAIL][123], [FAIL][124], [FAIL][125], [FAIL][126], [FAIL][127], [FAIL][128]) ([i915#1436] / [i915#1814] / [i915#2283] / [i915#2295] / [i915#2505] / [i915#3002]) -> ([FAIL][129], [FAIL][130], [FAIL][131], [FAIL][132], [FAIL][133], [FAIL][134], [FAIL][135], [FAIL][136], [FAIL][137], [FAIL][138]) ([i915#1436] / [i915#1814] / [i915#2283] / [i915#2292] / [i915#2295] / [i915#2505] / [i915#3002])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl7/igt@[email protected]
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl1/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl2/igt@[email protected]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl6/igt@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl7/igt@[email protected]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl7/igt@[email protected]
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl2/igt@[email protected]
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-kbl4/igt@[email protected]
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl4/igt@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl7/igt@[email protected]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl7/igt@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl6/igt@[email protected]
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl6/igt@[email protected]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl4/igt@[email protected]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl7/igt@[email protected]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl4/igt@[email protected]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl7/igt@[email protected]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-kbl4/igt@[email protected]
- shard-iclb: ([FAIL][139], [FAIL][140], [FAIL][141], [FAIL][142], [FAIL][143]) ([i915#2283] / [i915#2295] / [i915#2426] / [i915#2724] / [i915#3002]) -> ([FAIL][144], [FAIL][145], [FAIL][146], [FAIL][147]) ([i915#2283] / [i915#2295] / [i915#2724] / [i915#3002])
[139]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb4/igt@[email protected]
[140]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb2/igt@[email protected]
[141]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb8/igt@[email protected]
[142]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb7/igt@[email protected]
[143]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-iclb1/igt@[email protected]
[144]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb3/igt@[email protected]
[145]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb2/igt@[email protected]
[146]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb2/igt@[email protected]
[147]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-iclb6/igt@[email protected]
- shard-apl: ([FAIL][148], [FAIL][149], [FAIL][150], [FAIL][151], [FAIL][152], [FAIL][153], [FAIL][154]) ([i915#2283] / [i915#2295] / [i915#3002]) -> ([FAIL][155], [FAIL][156], [FAIL][157], [FAIL][158], [FAIL][159], [FAIL][160], [FAIL][161]) ([i915#1814] / [i915#2283] / [i915#2295] / [i915#3002])
[148]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl1/igt@[email protected]
[149]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl6/igt@[email protected]
[150]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl6/igt@[email protected]
[151]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl2/igt@[email protected]
[152]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl6/igt@[email protected]
[153]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl6/igt@[email protected]
[154]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-apl1/igt@[email protected]
[155]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl2/igt@[email protected]
[156]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl4/igt@[email protected]
[157]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl7/igt@[email protected]
[158]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl4/igt@[email protected]
[159]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl3/igt@[email protected]
[160]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl1/igt@[email protected]
[161]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-apl7/igt@[email protected]
- shard-tglb: ([FAIL][162], [FAIL][163], [FAIL][164], [FAIL][165]) ([i915#1602] / [i915#2295] / [i915#2667] / [i915#3002]) -> ([FAIL][166], [FAIL][167], [FAIL][168], [FAIL][169], [FAIL][170]) ([i915#1602] / [i915#2295] / [i915#2426] / [i915#2667] / [i915#2803] / [i915#3002])
[162]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb6/igt@[email protected]
[163]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb8/igt@[email protected]
[164]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb5/igt@[email protected]
[165]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9741/shard-tglb7/igt@[email protected]
[166]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb2/igt@[email protected]
[167]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb5/igt@[email protected]
[168]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb2/igt@[email protected]
[169]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb2/igt@[email protected]
[170]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/shard-tglb5/igt@[email protected]
- shard-skl: ([FAIL][171], [FAIL][172
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19615/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lyude Paul
maintainerthanks for the review comments everyone! I'm going through them now but realized I should probably point out that I somehow sent this patch series and did not realize I did so in the middle of a rebase, and as such completely forgot the parts here that actually started using these helpers in nouveau. lol....
anyway-will fix when I sent out the respin today
Quoted 38 lines · Lyude Paul
This series:
* Cleans up i915's DPCD backlight code a little bit
* Extracts i915's DPCD backlight code into a set of shared DRM helpers
* Starts using those helpers in nouveau to add support to nouveau for DPCD backlight controlv2 series-wide changes:
* Rebase
v3 series-wide changes:
* Split up the changes to intel's backlight code into separate patchesLyude Paul (10):
drm/nouveau/kms/nv40-/backlight: Assign prop type once drm/nouveau/kms: Don't probe eDP connectors more then once drm/i915/dpcd_bl: Remove redundant AUX backlight frequency calculations
drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly drm/i915/dpcd_bl: Cleanupintel_dp_aux_vesa_enable_backlight()a bit drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight
drm/i915/dpcd_bl: Move VESA backlight enabling code closer together drm/i915/dpcd_bl: Return early invesa_calc_max_backlightif we can't readPWMGEN_BIT_COUNT
drm/i915/dpcd_bl: Print return codes for VESA backlight failures drm/dp: Extract i915's eDP backlight code into DRM helpersdrivers/gpu/drm/drm_dp_helper.c | 332 ++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 2 +-
.../drm/i915/display/intel_dp_aux_backlight.c| 329 +++-------------- drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 6 + include/drm/drm_dp_helper.h | 48 +++6 files changed, 428 insertions(+), 293 deletions(-)
Signature · 13 lines
Sincerely, Lyude Paul (she/her) Software Engineer at Red Hat Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've asked me a question, are waiting for a review/merge on a patch, etc. and I haven't responded in a while, please feel free to send me another email to check on my status. I don't bite! _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau