Bug 66501

Summary: 8086:2a42 [Asus UL80VT] Backlight control does not work with Intel integrated card, but there are entries in /sys/class/backlight
Product: Drivers Reporter: Guillaume Millet (gmillet3)
Component: Platform_x86Assignee: drivers_platform_x86 (drivers_platform_x86)
Status: NEEDINFO ---    
Severity: normal CC: aaron.lu
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.11.0-14-generic #21-Ubuntu Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg
acpidump
dmidecode
Xorg.0.log
dmesg with acpi_osi=Linux and kernel 3.12
Xorg.0.log with acpi_osi=Linux and kernel 3.12
Debug patch to use native backlight for a Win7 system
Debug patch to use native backlight for a Win7 system, v2
dmesg with patch v2
dmesg with patch v2

Description Guillaume Millet 2013-12-04 15:49:28 UTC
Created attachment 117421 [details]
dmesg

The screen brightness control has apparently never worked off-the-shelf on this laptop released in 2009, Asus UL80VT-A1, which is an NVIDIA Optimus laptop (2 graphic cards). The use of the discrete Nvidia card is managed by Bumblebee (https://wiki.ubuntu.com/Bumblebee). It used to work with the workaround suggested at http://wiki.daviddarts.com/Ubuntu_Maverick_on_the_Asus_UL30VT#Screen_Brightness which modifies asus-brn-down.sh to use the "setpci" method. When the hotkeys are triggered, there is no brightness change but the KDE popup notification appears.

$ ls /sys/class/backlight/
acpi_video0  acpi_video1  intel_backlight

$ cat /sys/class/backlight/intel_backlight/max_brightness
2583660
$ cat /sys/class/backlight/intel_backlight/brightness
121584

The intel_backlight interface works, by echoing a value between 0 and 2583660.

$ cat /sys/class/backlight/acpi_video0/brightness
6
$ cat /sys/class/backlight/acpi_video0/max_brightness 
15
$ cat /sys/class/backlight/acpi_video0/device/device
0x2a42

$ cat /sys/class/backlight/acpi_video1/brightness 
15
$ cat /sys/class/backlight/acpi_video1/max_brightness 
15
$ cat /sys/class/backlight/acpi_video1/device/device
0x0a74

By echoing a value between 0 and 15, the two acpi_video interfaces do not change the screen brightness.
Comment 1 Guillaume Millet 2013-12-04 15:50:14 UTC
Created attachment 117431 [details]
acpidump
Comment 2 Guillaume Millet 2013-12-04 15:51:35 UTC
Created attachment 117441 [details]
dmidecode
Comment 3 Guillaume Millet 2013-12-04 15:53:04 UTC
Created attachment 117451 [details]
Xorg.0.log

$ cat /etc/X11/xorg.conf

Section "Screen"
        Identifier      "Default Screen"
        DefaultDepth    24
EndSection


Section "Device"
        Identifier      "Default Device"
EndSection
Comment 4 Guillaume Millet 2013-12-04 15:55:31 UTC
Previous thread on linux-acpi http://marc.info/?t=138600362800003&r=1&w=2

Launchpad downstream bug report on https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1178796
Comment 5 Aaron Lu 2013-12-05 02:34:42 UTC
I saw the kernel you used is a distro kernel v3.11, is it the same case with v3.12?
Comment 6 Guillaume Millet 2013-12-07 11:43:33 UTC
Same problem with 3.12.0-031200-generic from http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12-saucy/. I can attach dmesg and Xorg.0.log, they seem similar.
Comment 7 Aaron Lu 2013-12-09 08:57:42 UTC
Does adding acpi_osi="Linux" to kernel cmdline make any difference?
Comment 8 Guillaume Millet 2013-12-13 15:06:43 UTC
No difference. The hotkeys change the value in /sys/class/backlight/acpi_video0/brightness but the brightness doesn't change.
I attach dmesg and Xorg.0.log with 3.12.0-031200-generic and acpi_osi="Linux" in case it would be useful.
Comment 9 Guillaume Millet 2013-12-13 15:07:51 UTC
Created attachment 118291 [details]
dmesg with acpi_osi=Linux and kernel 3.12
Comment 10 Guillaume Millet 2013-12-13 15:08:16 UTC
Created attachment 118301 [details]
Xorg.0.log with acpi_osi=Linux and kernel 3.12
Comment 11 Aaron Lu 2013-12-16 02:19:39 UTC
I've no idea why ACPI brightness control method doesn't work.
Please add acpi_backlight=vendor to kernel cmdline, see if there is only one interface(intel_backlight) left under /sys/class/backlight. If so, I can add your system into a blacklist table.

BTW, is there a firmware update for your laptop from ASUS?
Comment 12 Guillaume Millet 2013-12-16 13:24:25 UTC
With acpi_backlight=vendor, there are two interfaces: asus_laptop and intel_backlight. asus_laptop reacts like acpi_video0 did when a brightness hotkey is pressed: the value of /sys/class/backlight/asus_laptop/brightness chnages but the brightness doesn't.

The BIOS is already at the last version released by ASUS on https://www.asus.com/Notebooks_Ultrabooks/UL80Vt/#support, version 214.
Comment 13 Aaron Lu 2014-01-02 01:43:40 UTC
Created attachment 120561 [details]
Debug patch to use native backlight for a Win7 system

Sorry for replying late.
Can you please test this patch on top of a v3.13 kernel? Thanks.
Comment 14 Guillaume Millet 2014-01-13 15:41:10 UTC
Thanks. Patch tested on kernel 3.13.0-rc8 for Saucy:

$ modinfo video
filename:       /lib/modules/3.13.0-031300rc8-generic/kernel/drivers/acpi/video.ko
license:        GPL
description:    ACPI Video Driver
author:         Bruno Ducrot
srcversion:     7F3F9A0CC7554649507A11E
alias:          acpi*:LNXVIDEO:*
depends:        
vermagic:       3.13.0-031300rc8-generic SMP mod_unload modversions 
parm:           brightness_switch_enabled:bool
parm:           allow_duplicates:bool
parm:           use_native_backlight:bool

It doesn't seem to work and there is still a ACPI_video0 interface.

$ dmesg | grep video
[    0.253443] pci 0000:00:02.0: Boot video device
[    1.380146] Modules linked in: ahci(+) libahci atl1c i915(+) i2c_algo_bit drm_kms_helper video drm
[   16.952911] asus_laptop: Backlight controlled by ACPI video driver

What other debug information can I provide?
Comment 15 Aaron Lu 2014-01-14 03:11:09 UTC
Oh, that probably because I didn't fill in the DMI entry correctly. Can you please check the value of use_native_backlight? It's located at:
/sys/module/video/parameters/use_native_backlight
And if it is N, please add video.use_native_backlight=1 to the patched kernel's cmdline and test again. Thanks.
Comment 16 Guillaume Millet 2014-01-15 10:39:36 UTC
It was N.

With the additional parameter, the acpi interface is still created:

$ dmesg | grep -i backlight
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.13.0-031300rc8-generic root=UUID=d92f3a31-9e9c-4c19-98be-6fbc82629a36 ro quiet splash video.use_native_backlight=1 vt.handoff=7
[   18.806833] asus_laptop: Backlight controlled by ACPI video driver

$ cat /sys/module/video/parameters/use_native_backlight
Y
Comment 17 Aaron Lu 2014-01-20 08:46:31 UTC
Created attachment 122671 [details]
Debug patch to use native backlight for a Win7 system, v2

Please test this patch on top of a v3.13 kernel, attach the dmesg after boot up, thanks.
Comment 18 Guillaume Millet 2014-01-24 10:00:43 UTC
Created attachment 123271 [details]
dmesg with patch v2
Comment 19 Guillaume Millet 2014-01-24 10:05:40 UTC
With the kernel option, dmesg is similar and it doesn't work.
Comment 20 Aaron Lu 2014-01-26 01:15:54 UTC
Did you apply the patch? I saw your kernel cmdline has: BOOT_IMAGE=/boot/vmlinuz-3.13.0-031300-generic, is the image the patched one? I've added a print in the video module's init function and it has to be printed but I didn't see it in the attached dmesg, so I'm confused.
Comment 21 Guillaume Millet 2014-02-03 22:01:03 UTC
Sorry for the late reply, I was trying to understand why the modifications did not change anything whereas I changed video.ko. Could it be about the built-in property of the module, that is, can't I compile only video.ko as described in http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html ?
Comment 22 Aaron Lu 2014-02-07 06:21:07 UTC
If video.ko is built in, then I don't think you can rmmod video and then modprobe it...
Comment 23 Guillaume Millet 2014-02-12 01:06:26 UTC
Well, I'm lost. After adding some printk without any change, I deleted the module video.ko just to check if it is used... no change, the system works the same. On the other end, the kernel package installed video.ko and CONFIG_ACPI_VIDEO=m is present in /boot/config-3.13.0-031300-generic, doesn't it mean that video is a loadable module?

Moreover, lsmod displays an entry video:
video                  19859  1 i915
whereas $ modprobe video
FATAL: Module video not found.

Where does that video module listed by lsmod comes from?

Could the problem be related to the bug in drm module which logs a trace in dmesg, starting with [drm:intel_pipe_config_compare] *ERROR* mismatch in gmch_pfit.lvds_border_bits (expected 32768, found 0)?
Comment 24 Aaron Lu 2014-02-12 02:13:33 UTC
(In reply to Guillaume Millet from comment #23)
> Well, I'm lost. After adding some printk without any change, I deleted the
> module video.ko just to check if it is used... no change, the system works
> the same. On the other end, the kernel package installed video.ko and
> CONFIG_ACPI_VIDEO=m is present in /boot/config-3.13.0-031300-generic,
> doesn't it mean that video is a loadable module?
> 
> Moreover, lsmod displays an entry video:
> video                  19859  1 i915
> whereas $ modprobe video
> FATAL: Module video not found.
> 
> Where does that video module listed by lsmod comes from?

Maybe from initrd.

> 
> Could the problem be related to the bug in drm module which logs a trace in
> dmesg, starting with [drm:intel_pipe_config_compare] *ERROR* mismatch in
> gmch_pfit.lvds_border_bits (expected 32768, found 0)?

Not sure about the drm driver.

Could you just build the entire kernel tree instead of only the video module?
Comment 25 Guillaume Millet 2014-02-16 10:38:25 UTC
Created attachment 126321 [details]
dmesg with patch v2
Comment 26 Guillaume Millet 2014-02-16 10:48:13 UTC
It took me some time as I didn't have 11 GB free to build the entire kernel tree... Anyway, the patch works and the dmesg is attached.
Comment 27 Aaron Lu 2014-02-17 03:16:24 UTC
OK, thanks.
Comment 28 Aaron Lu 2014-02-17 05:40:38 UTC
I think this should be solved the same way we did for Win8 systems though this laptop's firmware doesn't claim Win8 support but Matthew doesn't agree. The ACPI video control interface is broken and the reason is beyond me, so I'll re-assign this bug to Drivers/Platform-x86 for more analysis.

Guillaume,
You can continue to use the xorg.conf to select intel_backlight for your laptop.
Comment 29 Guillaume Millet 2017-04-14 13:55:28 UTC
Hi Aaron, I continue to use the xorg.conf as suggested. I wondered whether the issue could have been solved without update of this thread, so I have tried kernel 4.10.10-041010-generic from http://kernel.ubuntu.com/~kernel-ppa/mainline without the xorg.conf, but the issue is still present as initially described. I suppose that this thread or the bug status will change is something happened.
Comment 30 Aaron Lu 2017-05-27 02:12:26 UTC
There is a new quick mechanism in kernel now.

Can you try adding acpi_backlight=native to kernel cmdline? With this cmdline option, you should have only one interface under /sys/class/backlight that is intel_backlight and xorg.conf modification isn't necessary. If everything works, I can add your machine to a quirk table for this to happen automatically so that you do not need to add that cmdline option.
Comment 31 Guillaume Millet 2017-08-27 15:13:04 UTC
Hi Aaron,
I have just tried the native module option on 4.4.0-92 generic Ubuntu kernel (10-Aug-2017), after removing the xorg.conf modification, and it works. Thanks.
Comment 32 Guillaume Millet 2019-08-03 19:23:57 UTC
Hi Aaron, I have just installed Debian Buster, kernel 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u1. Without the cmdline option, the backlight control does not work. Has UL80VT been added to the quirk table you mentioned?