Bug 77091
Summary: | brightness changes to minimum on AC plug/unplug and whenever thinkpad_acpi detects EC Thermal Table has changed | ||
---|---|---|---|
Product: | ACPI | Reporter: | Anton Gubarkov (anton.gubarkov) |
Component: | Power-Video | Assignee: | Aaron Lu (aaron.lu) |
Status: | CLOSED CODE_FIX | ||
Severity: | normal | CC: | aaron.lu, rui.zhang |
Priority: | P1 | ||
Hardware: | x86-64 | ||
OS: | Linux | ||
See Also: | https://bugzilla.kernel.org/show_bug.cgi?id=78011 | ||
Kernel Version: | 3.15-rc7 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
acpidump
log of external monitor connection connection of external display - backlight debug on |
Description
Anton Gubarkov
2014-05-29 10:27:28 UTC
Created attachment 137671 [details]
acpidump
Situation when backlight is normal r9-008cln ~ # grep -r . /sys/class/backlight/* /sys/class/backlight/intel_backlight/type:raw /sys/class/backlight/intel_backlight/brightness:2876 /sys/class/backlight/intel_backlight/power/control:auto /sys/class/backlight/intel_backlight/power/async:disabled /sys/class/backlight/intel_backlight/power/runtime_enabled:disabled /sys/class/backlight/intel_backlight/power/runtime_active_kids:0 /sys/class/backlight/intel_backlight/power/runtime_active_time:0 grep: /sys/class/backlight/intel_backlight/power/autosuspend_delay_ms: Input/output error /sys/class/backlight/intel_backlight/power/runtime_status:unsupported /sys/class/backlight/intel_backlight/power/runtime_usage:0 /sys/class/backlight/intel_backlight/power/runtime_suspended_time:0 /sys/class/backlight/intel_backlight/bl_power:0 /sys/class/backlight/intel_backlight/max_brightness:4794 /sys/class/backlight/intel_backlight/actual_brightness:2876 Situation after thinkpad_acpi: EC reports that Thermal Table has changed r9-008cln ~ # grep -r . /sys/class/backlight/* /sys/class/backlight/intel_backlight/type:raw /sys/class/backlight/intel_backlight/brightness:56 /sys/class/backlight/intel_backlight/power/control:auto /sys/class/backlight/intel_backlight/power/async:disabled /sys/class/backlight/intel_backlight/power/runtime_enabled:disabled /sys/class/backlight/intel_backlight/power/runtime_active_kids:0 /sys/class/backlight/intel_backlight/power/runtime_active_time:0 grep: /sys/class/backlight/intel_backlight/power/autosuspend_delay_ms: Input/output error /sys/class/backlight/intel_backlight/power/runtime_status:unsupported /sys/class/backlight/intel_backlight/power/runtime_usage:0 /sys/class/backlight/intel_backlight/power/runtime_suspended_time:0 /sys/class/backlight/intel_backlight/bl_power:0 /sys/class/backlight/intel_backlight/max_brightness:4794 /sys/class/backlight/intel_backlight/actual_brightness:56 with drm.debug=0x4 May 30 12:11:11 r9-008cln kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 May 30 12:11:12 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed May 30 12:11:12 r9-008cln kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 May 30 12:11:13 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed how can I affect this behavior? first question: is there an thinkpad "Thermal Table has changed" notification every time when you plug/unplug the AC? Second question: what if you change the following code in drivers/platform/x86/thinkpad_acpi.c case TP_HKEY_EV_THM_TABLE_CHANGED: pr_info("EC reports that Thermal Table has changed\n"); /* recommended action: do nothing, we don't have * Lenovo ATM information */ return true; to make it return false instead, does the problem still exists? 1. "Thermal Table has changed" does appear every time AC power is plugged/unplugged 2. I changed the code. The problem is still there. Unplug: Jun 03 12:12:52 r9-008cln.766.adsl.cifra1.ru kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 Jun 03 12:12:52 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 03 12:12:52 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: unhandled HKEY event 0x6030 Jun 03 12:12:52 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net Plug: Jun 03 12:12:55 r9-008cln.766.adsl.cifra1.ru kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 Jun 03 12:12:56 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 03 12:12:56 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: unhandled HKEY event 0x6030 Jun 03 12:12:56 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net It occured to me that backlight adjustment happens before thinkpad_acpi code. I don't think mangling thinkpad_acpi can affect backlight behavior. First of all, you're using intel_backlight for backlight control, right? Does ACPI backlight work for you? Because every time you plug/unplug the AC, AML will try to restore the backlight level to a default value, which will not be initialized if you do not use ACPI backlight. well, frankly speaking I don't know which mechanism I use for backlight adjustment. It just reacts to the backlight adjustment buttons. I don't know which way it goes. currently I have both acpi and intel backlight enabled. I would appreciate your advice here. anton@r9-008cln ~ $ grep -r . /sys/class/backlight/* /sys/class/backlight/acpi_video0/type:firmware /sys/class/backlight/acpi_video0/brightness:39 /sys/class/backlight/acpi_video0/power/control:auto /sys/class/backlight/acpi_video0/power/async:disabled /sys/class/backlight/acpi_video0/power/runtime_enabled:disabled /sys/class/backlight/acpi_video0/power/runtime_active_kids:0 /sys/class/backlight/acpi_video0/power/runtime_active_time:0 grep: /sys/class/backlight/acpi_video0/power/autosuspend_delay_ms: Input/output error /sys/class/backlight/acpi_video0/power/runtime_status:unsupported /sys/class/backlight/acpi_video0/power/runtime_usage:0 /sys/class/backlight/acpi_video0/power/runtime_suspended_time:0 /sys/class/backlight/acpi_video0/bl_power:0 /sys/class/backlight/acpi_video0/max_brightness:100 /sys/class/backlight/acpi_video0/actual_brightness:39 /sys/class/backlight/acpi_video1/type:firmware /sys/class/backlight/acpi_video1/brightness:100 /sys/class/backlight/acpi_video1/power/control:auto /sys/class/backlight/acpi_video1/power/async:disabled /sys/class/backlight/acpi_video1/power/runtime_enabled:disabled /sys/class/backlight/acpi_video1/power/runtime_active_kids:0 /sys/class/backlight/acpi_video1/power/runtime_active_time:0 grep: /sys/class/backlight/acpi_video1/power/autosuspend_delay_ms: Input/output error /sys/class/backlight/acpi_video1/power/runtime_status:unsupported /sys/class/backlight/acpi_video1/power/runtime_usage:0 /sys/class/backlight/acpi_video1/power/runtime_suspended_time:0 /sys/class/backlight/acpi_video1/bl_power:0 /sys/class/backlight/acpi_video1/max_brightness:100 /sys/class/backlight/acpi_video1/actual_brightness:100 /sys/class/backlight/intel_backlight/type:raw /sys/class/backlight/intel_backlight/brightness:789 /sys/class/backlight/intel_backlight/power/control:auto /sys/class/backlight/intel_backlight/power/async:disabled /sys/class/backlight/intel_backlight/power/runtime_enabled:disabled /sys/class/backlight/intel_backlight/power/runtime_active_kids:0 /sys/class/backlight/intel_backlight/power/runtime_active_time:0 grep: /sys/class/backlight/intel_backlight/power/autosuspend_delay_ms: Input/output error /sys/class/backlight/intel_backlight/power/runtime_status:unsupported /sys/class/backlight/intel_backlight/power/runtime_usage:0 /sys/class/backlight/intel_backlight/power/runtime_suspended_time:0 /sys/class/backlight/intel_backlight/bl_power:0 /sys/class/backlight/intel_backlight/max_brightness:4794 /sys/class/backlight/intel_backlight/actual_brightness:789 r9-008cln ~ # echo 5 >/sys/class/backlight/acpi_video0/brightness r9-008cln ~ # echo 60 >/sys/class/backlight/acpi_video0/brightness r9-008cln ~ # echo 5 >/sys/class/backlight/acpi_video1/brightness r9-008cln ~ # echo 60 >/sys/class/backlight/acpi_video1/brightness r9-008cln ~ # echo 60 >/sys/class/backlight/intel_backlight/brightness r9-008cln ~ # echo 2000 >/sys/class/backlight/intel_backlight/brightness all commands result in changing the backlight brightness. okay, please run # echo 100 >/sys/class/backlight/acpi_video0/brightness # echo 100 >/sys/class/backlight/acpi_video1/brightness and then plug/unplug the AC adapter, does the problem still exist this time? running echo 100 >/sys/class/backlight/acpi_video0/brightness boosted backlight to max. Unplugging AC immediately brought it back to min. Jun 03 17:42:43 r9-008cln.766.adsl.cifra1.ru kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 Jun 03 17:42:43 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 03 17:42:43 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: unhandled HKEY event 0x6030 Jun 03 17:42:43 r9-008cln.766.adsl.cifra1.ru kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net IMO, this is a duplicate of bug 76491. Please re-open it if you don't think so. *** This bug has been marked as a duplicate of bug 76491 *** Indeed these 2 bugs have something in common. Probably even the root cause might turn out to be common. I did study bug 76491 before opening mine and I did try to apply some troubleshooting suggested there. However there are several considerations that make think I observe a different bug: 1. 76491 is a regression bug. there is a kernel version known to work as expected. Mine never worked as expected. 2. a reporter of 76491 can achieve the desired behaviour using acpi_video as the backlight control interface. I cannot. Brightness is always brought to the value of 3/255. 3. the worst of my troubles: sometimes the brightness is dropped to 3/255 in the mid-air. I don't do any AC plugs/unplugs, however I see the same messages in the log that appear when I plug/unplug AC and the brightness is dropped. The power led flashes 3 times at the same moment like it does when I plug/unplug AC. I never observed this when I run on battery though. This brightness drop can haunt me 5-10 times a minute sometimes and then it can be stable for another 30 minutes. Based on these considerations I kindly ask you to consider re-opening this bug as separate. please reboot the kernel with boot option acpi_osi="!Windows 200" and check if ACPI backlight interface works for you or not, and if the problem still exists. I did a boot with acpi_osi="!Windows 200". I observe no change in behavior. F5/F6 change the brightness as expected. echo 100 > /sys/class/backlight/acpi_video{0|1}/brightness change the brightness as expected. AC plug/unplug bring brightness to 3/255 as before. Jun 05 11:47:35 r9-008cln kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 Jun 05 11:47:35 r9-008cln vgl-helper.sh[414]: /usr/libexec/vgl-helper.sh: line 16: set_xauth: command not found Jun 05 11:47:35 r9-008cln upowerd[498]: (upowerd:498): UPower-Linux-WARNING **: energy 98.000000 bigger than full 97.980000 Jun 05 11:47:36 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 05 11:47:36 r9-008cln kernel: thinkpad_acpi: unhandled HKEY event 0x6030 Jun 05 11:47:36 r9-008cln kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net (In reply to Anton Gubarkov from comment #14) > I did a boot with acpi_osi="!Windows 200". Oops, my fault, please boot with acpi_osi="!Windows 2012" instead. And echo some number smaller than the value in /sys/class/backlight/acpi_video{0/1}/max_brightness. BTW, can you please test the patch at https://bugzilla.kernel.org/show_bug.cgi?id=76491#c58 and see if it helps? booted with acpi_osi="!Windows 2012" echo 60 > /sys/class/backlight/acpi_video{0,1}/brightness results in Jun 06 08:47:10 r9-008cln kernel: [drm:intel_crtc_cursor_set] cursor off Jun 06 08:47:11 r9-008cln kernel: [drm:asle_set_backlight] updating opregion backlight 82/255 Jun 06 08:47:20 r9-008cln kernel: [drm:asle_set_backlight] updating opregion backlight 82/255 AC plug/unplug dimmed the display to a min value again Jun 06 08:50:20 r9-008cln kernel: [drm:asle_set_backlight] updating opregion backlight 3/255 Jun 06 08:50:21 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 08:50:21 r9-008cln kernel: thinkpad_acpi: unhandled HKEY event 0x6030 Jun 06 08:50:21 r9-008cln kernel: thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net When testing patch from https://bugzilla.kernel.org/show_bug.cgi?id=76491#c58, please add video.use_native_backlight=1 to kernel cmdline and do not add acpi_osi="!Windows 2012". BTW, do you have Windows and does it have this problem? The proposed patch works for me. Brightness no longer changes on AC plug/unplug. I will check if midair brightness changes stopped during today. They happen most of the time when my battery is fully charged. I also noticed that now I'm able to turn off backlight completely by F5 button when I drive the brightness to a minimum value. This is minor thing, but anyway, I think that some minimum brightness should remain at the lower end. (In reply to Anton Gubarkov from comment #20) > The proposed patch works for me. Brightness no longer changes on AC > plug/unplug. I will check if midair brightness changes stopped during today. > They happen most of the time when my battery is fully charged. > > I also noticed that now I'm able to turn off backlight completely by F5 > button when I drive the brightness to a minimum value. This is minor thing, > but anyway, I think that some minimum brightness should remain at the lower > end. If your acpi_video interface works and has 100 levels, I suppose it also has this behaviour? # cd /sys/class/backlight/acpi_video # echo 0 > brightness BTW, what is midair brightness change? (In reply to Aaron Lu from comment #19) > BTW, do you have Windows and does it have this problem? I do have windows on this machine. It does have problems with brightness, but they exhibit differently. I received a lot of updates for Lenovo power manager recently. It seems that Lenovo tries to address the firmware problem with OS/userland utilities. The brightness also drops when I plug/unplug AC, but only for a split second. After that it is restored to the previous value. I presume it's userland power manager who is watching over this. (In reply to Anton Gubarkov from comment #22) > (In reply to Aaron Lu from comment #19) > > BTW, do you have Windows and does it have this problem? > I do have windows on this machine. It does have problems with brightness, > but they exhibit differently. > I received a lot of updates for Lenovo power manager recently. It seems that > Lenovo tries to address the firmware problem with OS/userland utilities. > > The brightness also drops when I plug/unplug AC, but only for a split > second. After that it is restored to the previous value. I presume it's > userland power manager who is watching over this. Yes, sounds like this, thanks for confirming. Oh, I think this can be verified by removing the Lenovo power manager entirely? (In reply to Aaron Lu from comment #21) > > BTW, what is midair brightness change? Please look in my comment #13 https://bugzilla.kernel.org/show_bug.cgi?id=77091#c12 in short - when my battery is fully charged and AC is connected, brightness may drop with no apparent reason - i.e. no AC plug/unplug, no power state changes from user's side. I presume that buggy firmware requests this change. If the change request is from firmware, then the patch should be able to handle it as what it does is to ignore all firmware requests if the acpi_video interface is not exposed(achieved by adding video.use_native_backlight=1 currently, but we are making this default in v3.16). Actually, I think solving it in user space is also a good idea: the GUI can provide user with options to specify which backlight level he wants when AC plug/unplug and when such events fired, the firmware will unconditionally set a level but then user space will set the pre-specified level. Also works I think. Anyway, let's try the kernel patch first and if the maintainer doesn't like it, we can try to convince GUI developers. (In reply to Aaron Lu from comment #24) > Oh, I think this can be verified by removing the Lenovo power manager > entirely? I removed the power manager from Windows. The reaction to AC plug/unplug didn't change - apparently something else is giving firmware a hand. However, the brightness is reset to a min during boot process (both windows and linux), and power manager restored some comfortable level after user logon. It no longer happens. Pressing F6 restores previous brightness immediately rather than gradually from min. I had that many times power events that usually resulted in my brightness dropping to a minimum, but after the patch was applied, I didn't see any single drop. Thank you very much. This bug is fixed for me by the patch. Let's hope it will be accepted by the maintainer. Jun 06 14:07:20 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:07:21 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:07:39 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:07:40 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:07:41 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:07:42 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:09:54 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:09:55 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:10:01 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:10:02 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:18:28 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:18:29 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:45:40 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:45:41 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:47:18 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:47:19 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:56:53 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 14:56:54 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 15:01:46 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Jun 06 15:01:47 r9-008cln kernel: thinkpad_acpi: EC reports that Thermal Table has changed Will send the patch out when v3.16 merge window closed as the maintainers are busy dealing with merge stuffs and do not have time dealing with this right now I think. Thanks for testing! Created attachment 138831 [details]
log of external monitor connection
I identified one more scenario when brightness is dropped to 0 when it shouldn't. It happens when I connect an external monitor to a VGA connector. Please search for "brightness=0/4794"
Maybe this behavior deserves a separate bug - please advise.
Please also enable backlight module's debug message: # cd /sys/kernel/debug/dynamic_debug # echo 'module backlight +fpt' > control And then connect the external monitor to VGA, let's see who did the backlight level change. Created attachment 139041 [details]
connection of external display - backlight debug on
backlight adjustment at Jun 11 10:29:04 was manual - I had to turn it up to see my screen.
Looks like this is caused by: gdm-Xorg-:0[497], seems to be gnome program. You can use: $ ps -p 497 to get the full name of the program. Anyway, looks like an user space behaviour to me. (In reply to Aaron Lu from comment #33) > Looks like this is caused by: gdm-Xorg-:0[497], seems to be gnome program. > You can use: > $ ps -p 497 > to get the full name of the program. > > Anyway, looks like an user space behaviour to me. Aaron, can you have a look at https://bugzilla.gnome.org/show_bug.cgi?id=731504 ? GNOME developers don't seem to agree to your conclusions. OK I see. Seems to be i915 driver related, please file a new bug under component Drivers/DRM-intel for this issue. Patch sent out: https://patchwork.kernel.org/patch/4406151/ commit 0b9f7d93ca6109048a4eb06332b666b6e29df4fe Author: Aaron Lu <aaron.lu@intel.com> Date: Mon Jul 7 15:43:51 2014 +0800 ACPI / i915: ignore firmware requests for backlight change |