Bug 94561 - Lenovo E330 backlight keys stopped working, unless acpi_osi="!Windows 2012"
Summary: Lenovo E330 backlight keys stopped working, unless acpi_osi="!Windows 2012"
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Video (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Aaron Lu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-08 20:57 UTC by Andreas Radke
Modified: 2015-05-03 10:23 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.19
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg (56.82 KB, text/plain)
2015-03-08 20:57 UTC, Andreas Radke
Details
acpidump (339.86 KB, application/octet-stream)
2015-03-08 20:59 UTC, Andreas Radke
Details
Debug patch for acpi video event functionality (1.25 KB, patch)
2015-03-18 02:26 UTC, Aaron Lu
Details | Diff
debug dmesg (60.17 KB, text/plain)
2015-03-18 20:19 UTC, Andreas Radke
Details
Toshiba Portege Z30 acpidump (403.86 KB, application/octet-stream)
2015-03-31 07:19 UTC, Carlos F.M.
Details
Add some debug statements to check value (621 bytes, patch)
2015-04-10 08:12 UTC, Aaron Lu
Details | Diff
dmesg after Aaron debug patch (49.53 KB, text/plain)
2015-04-11 09:29 UTC, Carlos F.M.
Details

Description Andreas Radke 2015-03-08 20:57:29 UTC
Created attachment 169901 [details]
dmesg

Keyboard hardware keys stopped working to adjust backlight level unless acpi_osi="!Windows 2012" is passed to the kernel boot line. I guess something like this patch should be applied to the kernel: https://launchpadlibrarian.net/136156000/linux3.7.xup_thinkpad_brightness.patch - see also https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1098216 where the e330 model is also affected. I've avoided the backlight issues in the past using acpi_osi=Linux acpi_backlight=vendor and blacklisting thinkpad_acpi module but this doesn't work anymore as of 3.19.
Comment 1 Andreas Radke 2015-03-08 20:59:08 UTC
Created attachment 169911 [details]
acpidump
Comment 2 Aaron Lu 2015-03-13 05:20:21 UTC
With v3.19+, if you do not add any backlight related kernel cmdline options, what is the problem regarding backlight? Does the hotkey work? Is there an intel_backlight interface available under the /sys/class/backlight directory?
Comment 3 Andreas Radke 2015-03-13 18:56:55 UTC
Without any kernel cmdline option the hotkeys Fn + F7/F8 don't work here. I can change the backlight though with xbacklight -set xx.

[root@laptop64 andyrtr]# ls -lha /sys/class/backlight/*
lrwxrwxrwx 1 root root 0 13. Mär 19:53 /sys/class/backlight/intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
Comment 4 Aaron Lu 2015-03-18 02:26:16 UTC
Created attachment 170971 [details]
Debug patch for acpi video event functionality

Please apply this debug patch on top of v3.19 and after booted, press hotkey and then attach dmesg.
Comment 5 Andreas Radke 2015-03-18 20:19:06 UTC
Created attachment 171141 [details]
debug dmesg

[   29.084679] acpi device:46: acpi_video_device_notify: event=0x87
[   29.250836] acpi device:46: acpi_video_device_notify: event=0x86


86 is key for "brighter" (Fn+F8) and 87 for "darker" (Fn+F7).
Comment 6 Aaron Lu 2015-03-19 01:56:21 UTC
Yes, that means the hotkey works. Perhaps you are not using an GUI environment?
With the 0x86/0x87 notification codes and intel_backlight interface, you should have a working backlight functionality.
Comment 7 Andreas Radke 2015-03-19 19:54:09 UTC
I'm using AwesomeWM - the keys seem to be recognized but the brightness doesn't change anymore since kernel 3.19 unless I apply acpi_osi="!Windows 2012" to the kernel append line. I doubt this is the new wanted behaviour. So this is still a bug?
Comment 8 Aaron Lu 2015-03-20 02:08:05 UTC
The WM you use doesn't handle backlight change keys, and that caused problems. 
I'm trying to understand how things worked for you previously, please let me know which kernel it is and what command line options you have used and which interfaces are under /sys/class/backlight and if they are broken. You can test if an interface is broken by echoing some value to its brightness file to see if the backlight changes.
Comment 9 Andreas Radke 2015-03-20 17:31:20 UTC
With kernels up to 3.18 I can change the brightness using the keys even in tty outside X using acpi_backlight=vendor. This gives under currently used fallback LTS 3.14.36 kernel

[root@laptop64 andyrtr]# ls -lha /sys/class/backlight/intel_backlight
lrwxrwxrwx 1 root root 0 20. Mär 18:20 /sys/class/backlight/intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
[root@laptop64 andyrtr]# ls -lha /sys/class/backlight/intel_backlight/
insgesamt 0
drwxr-xr-x 3 root root    0 20. Mär 18:28 .
drwxr-xr-x 4 root root    0 20. Mär 18:20 ..
-r--r--r-- 1 root root 4,0K 20. Mär 18:28 actual_brightness
-rw-r--r-- 1 root root 4,0K 20. Mär 18:20 bl_power
-rw-r--r-- 1 root root 4,0K 20. Mär 18:20 brightness
lrwxrwxrwx 1 root root    0 20. Mär 18:28 device -> ../../card0-LVDS-1
-r--r--r-- 1 root root 4,0K 20. Mär 18:20 max_brightness
drwxr-xr-x 2 root root    0 20. Mär 18:28 power
lrwxrwxrwx 1 root root    0 20. Mär 18:20 subsystem -> ../../../../../../../class/backlight
-r--r--r-- 1 root root 4,0K 20. Mär 18:20 type
-rw-r--r-- 1 root root 4,0K 20. Mär 18:20 uevent

xbacklight -set 0...100 works well.
Comment 10 Andreas Radke 2015-03-20 17:40:20 UTC
With kernel 3.19.x the keys won't change the brightness with acpi_backlight=vendor or without any option given. But I can change brightness using xbacklight -set 0...100 (where 0 isn't fully dark anymore).

[root@laptop64 andyrtr]# ls -lha /sys/class/backlight/intel_backlight
lrwxrwxrwx 1 root root 0 20. Mär 18:32 /sys/class/backlight/intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
[root@laptop64 andyrtr]# ls -lha /sys/class/backlight/intel_backlight/
insgesamt 0
drwxr-xr-x 3 root root    0 20. Mär 18:33 .
drwxr-xr-x 4 root root    0 20. Mär 18:32 ..
-r--r--r-- 1 root root 4,0K 20. Mär 18:33 actual_brightness
-rw-r--r-- 1 root root 4,0K 20. Mär 18:32 bl_power
-rw-r--r-- 1 root root 4,0K 20. Mär 18:32 brightness
lrwxrwxrwx 1 root root    0 20. Mär 18:33 device -> ../../card0-LVDS-1
-r--r--r-- 1 root root 4,0K 20. Mär 18:32 max_brightness
drwxr-xr-x 2 root root    0 20. Mär 18:33 power
lrwxrwxrwx 1 root root    0 20. Mär 18:32 subsystem -> ../../../../../../../class/backlight
-r--r--r-- 1 root root 4,0K 20. Mär 18:32 type
-rw-r--r-- 1 root root 4,0K 20. Mär 18:32 uevent

Only when applying acpi_osi="!Windows 2012" the keys work almost like before and allow direct changing the brightness again even outside X.
Comment 11 Aaron Lu 2015-03-23 02:22:03 UTC
(In reply to a.radke from comment #9)
> With kernels up to 3.18 I can change the brightness using the keys even in
> tty outside X using acpi_backlight=vendor. This gives under currently used
> fallback LTS 3.14.36 kernel
> 
> [root@laptop64 andyrtr]# ls -lha /sys/class/backlight/intel_backlight

What about: ls /sys/class/backlight?
Comment 12 Aaron Lu 2015-03-23 02:28:03 UTC
(In reply to a.radke from comment #10)
> With kernel 3.19.x the keys won't change the brightness with
> acpi_backlight=vendor or without any option given. But I can change
> brightness using xbacklight -set 0...100 (where 0 isn't fully dark anymore).
> 
> Only when applying acpi_osi="!Windows 2012" the keys work almost like before
> and allow direct changing the brightness again even outside X.

Please list: ls /sys/class/backlight with acpi_osi="!Windows 2012".

Also, please add backlight.dyndbg=+pft to your kernel cmdline option, together with acpi_osi="!Windows 2012", boot the system and press backlight hotkey inside X and outside X, then attach the dmesg, let's see who changed the brightness inside and outside X.
Comment 13 Andreas Radke 2015-03-24 18:05:07 UTC
With 3.14 kernel I get only intel_backlight but with 3.19 + acpi_osi="!Windows 2012" and backlight.dyndbg=+pft it's this:

lrwxrwxrwx  1 root root 0 24. Mär 19:00 acpi_video0 -> ../../devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
lrwxrwxrwx  1 root root 0 24. Mär 19:00 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight

inside X:

Mär 24 19:03:03 laptop64 kernel: acpi device:46: acpi_video_device_notify: event=0x87
Mär 24 19:03:04 laptop64 kernel: acpi device:46: acpi_video_device_notify: event=0x86

outside X in tty:

Mär 24 19:03:31 laptop64 systemd[1]: Started Getty on tty2.
Mär 24 19:03:31 laptop64 systemd[1]: Starting Getty on tty2...
Mär 24 19:03:33 laptop64 kernel: acpi device:46: acpi_video_device_notify: event=0x87
Mär 24 19:03:34 laptop64 kernel: acpi device:46: acpi_video_device_notify: event=0x86

This seems to me that with 3.19 intel_backlight isn't used anymore but acpi_backlight, right?
Comment 14 Aaron Lu 2015-03-25 02:47:59 UTC
acpi_video will appear once you add the acpi_osi="!Windows 2012" cmdline option.

Also, from the dmesg, it doesn't seem anyone tries to modify the backlight level on hotkey events, which normally is the job of the GUI environment.

I'm confused with kernel 3.14, if all you have is intel_backlight and your GUI environment don't react to backlight events, how can the backlight level change on hotkey press?

Anyway, with the latest kernel, on hotkey press, the events are sent out and there is a working interface /sys/class/backlight/intel_backlight. So if you use a GUI environment like GNOME, everything should work.
Comment 15 Carlos F.M. 2015-03-30 21:00:59 UTC
Hi,

I think the problem is the 3.19 kernel creates an additional backlight interface (acpi_video0), and somehow X prefers it instead of intel_backlight.

This Xorg config solves the problem for me (Toshiba Portege Z30 & Satellite Z30):

Section "Device"
Identifier "card0"
Driver "intel"
Option "Backlight" "intel_backlight"
EndSection

Thanks to Marcus from ubuntuforus: http://ubuntuforums.org/showthread.php?t=2271203&p=13254359#post13254359

Hope this helps somebody
Comment 16 Aaron Lu 2015-03-31 02:19:45 UTC
Carlos,

Can you please attach your acpidump? We didn't do any quirk for Toshiba Z30 so I don't see why acpi_video0 re-appeared from v3.19.

BTW, is it the distro kernel or the upstream kernel?
Comment 17 Carlos F.M. 2015-03-31 07:19:53 UTC
Created attachment 172771 [details]
Toshiba Portege Z30 acpidump

Hi,

This is with the distro kernel (Fedora 21 3.19.2-201.fc21.x86_64), but with Arch Linux or other distros is the same.

I haven't tried vanilla kernel sorry.
Comment 18 Aaron Lu 2015-03-31 08:06:58 UTC
Do you have any kernel cmdline option that is backlight/video related?
Comment 19 Carlos F.M. 2015-03-31 08:17:16 UTC
Nothing at all:

$ cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-3.19.2-201.fc21.x86_64 root=UUID=f47a858b-6748-4356-acc3-c5d6ba6a723f ro rhgb quiet LANG=es_ES.UTF-8
Comment 20 Aaron Lu 2015-03-31 08:39:56 UTC
I have checked the 3.19.2-201.fc21 source code, I don't see a quirk anywhere for Toshiba Z30, no idea why this would occur. If you have the time, I can prepare a debug patch to see what happened. Let me know if you want to do this.
Comment 21 Carlos F.M. 2015-03-31 09:28:27 UTC
I'll be happy to help, but won't be able till next week :)
Comment 22 Aaron Lu 2015-03-31 13:12:26 UTC
(In reply to Carlos F.M. from comment #21)
> I'll be happy to help, but won't be able till next week :)

No problem, I'll start vocation tomorrow and start working next Tuesday :-)
Comment 23 Aaron Lu 2015-04-10 08:12:23 UTC
Created attachment 173701 [details]
Add some debug statements to check value

Please apply this debug patch and then attach dmesg, thanks.
Comment 24 Carlos F.M. 2015-04-11 09:29:59 UTC
Created attachment 173761 [details]
dmesg after Aaron debug patch

Hi Aaron,

This is the dmesg with the kernel patched, hope it helps.

Regards
Comment 25 Aaron Lu 2015-04-13 01:48:27 UTC
(In reply to Carlos F.M. from comment #24)
> Created attachment 173761 [details]
> dmesg after Aaron debug patch
> 
> Hi Aaron,
> 
> This is the dmesg with the kernel patched, hope it helps.
> 
> Regards

Thanks for the dmesg. I wonder if you still have acpi_videoX with this kernel?
Comment 26 Carlos F.M. 2015-04-13 18:26:51 UTC
You are right, acpi_video0 has dissapeared, but I think that the problem is now "toshiba". Supposedly is the keyboard backlight, but it doesn't work (that's another problem):

ls -l /sys/class/backlight/
total 0
lrwxrwxrwx 1 root root 0 abr 13 20:22 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
lrwxrwxrwx 1 root root 0 abr 13 20:22 toshiba -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/TOS6208:00/backlight/toshiba

Regards
Comment 27 Aaron Lu 2015-04-15 07:53:51 UTC
Hans has a patch for this, can you please try it?
https://bugzilla.kernel.org/show_bug.cgi?id=86521#c20
Comment 28 juukemb 2015-05-02 07:56:12 UTC
Toshiba Z30 here, same issue with kernels 3.19 and 4.0. I tried Carlos' solution (option intel_backlight in the xorg config) but backlight is not working. I can see both intel_backlight and toshiba in /sys/class/backlight/
Comment 29 Aaron Lu 2015-05-03 10:23:03 UTC
commit 358d6a2c3ecae2b22c7d7e61f9d5672557446dfb
Author: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 21 Apr 2015 12:01:32 +0200

toshiba_acpi: Do not register vendor backlight when acpi_video bl is available

Entered linus tree as of v4.1-rc1, you can test that kernel instead.

Note You need to log in before you can comment on or make changes to this bug.