Skip to content

Commit f2db78e

Browse files
committed
drm/dp: Modify drm_edp_backlight_set_level
Modify drm_edp_backlight_set_level to be able to set the value for register in DP_EDP_PANEL_TARGET_LUMINANCE_VALUE. We multiply the level with 1000 since we get the value in Nits and the register accepts it in milliNits. --v2 -Add comment regarding the unit [Arun] Signed-off-by: Suraj Kandpal <[email protected]> Reviewed-by: Arun R Murthy <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2ff7f0c commit f2db78e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/gpu/drm/display/drm_dp_helper.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3944,20 +3944,28 @@ int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_bac
39443944
u32 level)
39453945
{
39463946
int ret;
3947-
u8 buf[2] = { 0 };
3947+
unsigned int offset = DP_EDP_BACKLIGHT_BRIGHTNESS_MSB;
3948+
u8 buf[3] = { 0 };
39483949

39493950
/* The panel uses the PWM for controlling brightness levels */
3950-
if (!bl->aux_set)
3951+
if (!(bl->aux_set || bl->luminance_set))
39513952
return 0;
39523953

3953-
if (bl->lsb_reg_used) {
3954+
if (bl->luminance_set) {
3955+
level = level * 1000;
3956+
level &= 0xffffff;
3957+
buf[0] = (level & 0x0000ff);
3958+
buf[1] = (level & 0x00ff00) >> 8;
3959+
buf[2] = (level & 0xff0000) >> 16;
3960+
offset = DP_EDP_PANEL_TARGET_LUMINANCE_VALUE;
3961+
} else if (bl->lsb_reg_used) {
39543962
buf[0] = (level & 0xff00) >> 8;
39553963
buf[1] = (level & 0x00ff);
39563964
} else {
39573965
buf[0] = level;
39583966
}
39593967

3960-
ret = drm_dp_dpcd_write_data(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, sizeof(buf));
3968+
ret = drm_dp_dpcd_write_data(aux, offset, buf, sizeof(buf));
39613969
if (ret < 0) {
39623970
drm_err(aux->drm_dev,
39633971
"%s: Failed to write aux backlight level: %d\n",

0 commit comments

Comments
 (0)