[PATCH] drm/i915: minor corner case fix to respect user's backlight setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When enabling panel backlight, if the current backlight level
setting matches the panel's minimal, it would apply default policy to
override the current level by the panel's maximum until next request
to update brightness, this leads unexpected user confusion with
temporary full power backlight.

This odd could be reproduced as commands like these:
 $ xbacklight -set 0
 $ sudo sh -c 'echo mem > /sys/power/state'
 (resume)

To fix this, slightly tinker the backlight level comparison from
'less-and-equal-to' to 'less-than'.

Before: (dmesg | grep backlight # with drm.debug=0xe)
[   82.249265] [drm:intel_backlight_device_update_status [i915]] updating intel_backlight, brightness=0/5273
[   82.249282] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 207
[   82.249306] [drm:intel_edp_backlight_power [i915]] panel power control backlight disable
[   92.066041] [drm:intel_edp_backlight_off [i915]]
[   92.270489] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 0
[   94.080434] [drm:intel_edp_backlight_on.part.25 [i915]]
[   94.080476] [drm:intel_panel_enable_backlight [i915]] pipe A
[   94.080539] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 5273

After:
[   72.874465] [drm:intel_backlight_device_update_status [i915]] updating intel_backlight, brightness=0/5273
[   72.874499] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 207
[   72.874540] [drm:intel_edp_backlight_power [i915]] panel power control backlight disable
[   86.807928] [drm:intel_edp_backlight_off [i915]]
[   87.013227] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 0
[   89.001829] [drm:intel_edp_backlight_on.part.25 [i915]]
[   89.001859] [drm:intel_panel_enable_backlight [i915]] pipe A
[   89.001926] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 207

Fixes: 13f3fbe827d0 ("fix inconsistent brightness after resume")

Signed-off-by: Harry Pan <harry.pan@xxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 08ab6d7..e882139 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1104,7 +1104,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 
 	WARN_ON(panel->backlight.max == 0);
 
-	if (panel->backlight.level <= panel->backlight.min) {
+	if (panel->backlight.level < panel->backlight.min) {
 		panel->backlight.level = panel->backlight.max;
 		if (panel->backlight.device)
 			panel->backlight.device->props.brightness =
-- 
2.6.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux