Bug 13671

Summary: LCD backlight brightness maximum not possible after sleep states, ASUS X5AVn laptop
Product: ACPI Reporter: Michael Franzl (michaelfranzl)
Component: Power-VideoAssignee: Zhang Rui (rui.zhang)
Status: REJECTED WILL_NOT_FIX    
Severity: normal CC: acpi-bugzilla, corentin.chary, lenb, rui.zhang, yakui.zhao
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.30 Subsystem:
Regression: No Bisected commit-id:
Attachments: Used Kernel Configuration
Output of acpidump
Output of lspci -vxxx
Output of dmesg
Interrupts before pressing [Fn]+[brightness down]
Interrupts after pressing [Fn]+[brightness down]
interrupts_before
proc_event
interrupts_after
customized DSDT
dmesg after DSDT customization
dmesg after DSDT customization and after sleepstate

Description Michael Franzl 2009-06-29 08:55:56 UTC
Created attachment 22137 [details]
Used Kernel Configuration

[2.] Full description of the problem/report:

When ASUS X5AVn Laptop (see lspci output below) is turned on and no operating system is loaded, LCD backlight brightness can correctly be adjusted to full brightness via the Fn key combination of the laptop.

After the Linux kernel is loaded (with ACPI compiled in, see kernel configuration attached), brightness cannot be adjusted any more -- neither via the Fn keys of the laptop nor by writing to /sys/class/backlight/acpi_video0/brightness. The value of the latter is 0 after startup. It can be written to it, or incremented via Fn key combination, but the brightness of the backlight stays the same.

After going into one of the three sleep states (standby, mem, disk), and waking up the laptop, /sys/class/backlight/acpi_video0/brightness is set to the highest possible value 15. Contrary to before the sleep state, the Fn key combination CAN now change the brightness. But at the maximum value of 15, the maximum optical brightness -- as it was perceived before the sleep state -- cannot be reached again. It is too dark.

Maximum optical brightness can only be restored after a cold restart. Just rebooting doesn't help.

[3.] Keywords:

LCD, backlight, sysfs, ACPI, Power Management


[7.] Environment:

Output of lspci:

00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07)
00:01.0 PCI bridge: Intel Corporation Mobile 4 Series Chipset PCI Express Graphics Port (rev 07)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03)
00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 (rev 03)
00:1c.5 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 6 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation ICH9M/M-E SATA AHCI Controller (rev 03)
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9650M GT] (rev a1)
03:00.0 Network controller: Intel Corporation Wireless WiFi Link 5100
08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
09:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)
09:01.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)
09:01.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 12)
09:01.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)
09:01.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 12)
Comment 1 ykzhao 2009-07-08 09:35:42 UTC
Will you please attach the output of acpidump, lspci -vxxx, dmesg?
Will you please do the following test on your box?
   a. kill the process using the /proc/acpi/event
   b. grep -R . /sys/firmware/acpi/interrupts/* > interrupts_before;
   c. cat /proc/acpi/event > proc_event and press "Ctrl + C" until the step D is finished
   d. press the backlight up/down keys several times
   e. grep -R . /sys/firmware/acpi/interrupts/* > interrupts_after

 
Thanks.
Comment 2 Michael Franzl 2009-07-08 16:00:55 UTC
Created attachment 22258 [details]
Output of acpidump
Comment 3 Michael Franzl 2009-07-08 16:02:11 UTC
Created attachment 22259 [details]
Output of lspci -vxxx
Comment 4 Michael Franzl 2009-07-08 16:03:42 UTC
Created attachment 22260 [details]
Output of dmesg
Comment 5 Michael Franzl 2009-07-08 16:08:52 UTC
Created attachment 22261 [details]
Interrupts before pressing [Fn]+[brightness down]
Comment 6 Michael Franzl 2009-07-08 16:09:19 UTC
Created attachment 22262 [details]
Interrupts after pressing [Fn]+[brightness down]
Comment 7 Michael Franzl 2009-07-08 16:11:46 UTC
>    a. kill the process using the /proc/acpi/event

I'm not sure which process you mean. "event" is missing in my "/proc/acpi"

>    b. grep -R . /sys/firmware/acpi/interrupts/* > interrupts_before

Please find attached.

>    c. cat /proc/acpi/event > proc_event and press "Ctrl + C" until the step D
> is finished

"event" is missing in my "/proc/acpi"

>    d. press the backlight up/down keys several times

OK

>    e. grep -R . /sys/firmware/acpi/interrupts/* > interrupts_after

Please find attached.
Comment 8 Zhang Rui 2009-07-09 01:28:27 UTC
(In reply to comment #7)

> >    c. cat /proc/acpi/event > proc_event and press "Ctrl + C" until the step
> D
> > is finished
> 
> "event" is missing in my "/proc/acpi"
> 
you don't have "/proc/acpi/event" file?
that's bad, please make sure both CONFIG_ACPI_PROCFS and CONFIG_ACPI_PROC_EVENT are set in your kernel config file.

please do the following test:
1. set CONFIG_ASUS_LAPTOP and rebuild your kernel
2. boot with "acpi_backlight=vendor"
can you change the backlight using the /sys/class/backlight I/F?
does the hotkey work this time?
Comment 9 Michael Franzl 2009-07-09 10:57:10 UTC
Created attachment 22290 [details]
interrupts_before
Comment 10 Michael Franzl 2009-07-09 10:57:36 UTC
Created attachment 22291 [details]
proc_event
Comment 11 Michael Franzl 2009-07-09 10:58:05 UTC
Created attachment 22292 [details]
interrupts_after
Comment 12 Michael Franzl 2009-07-09 11:10:32 UTC
> you don't have "/proc/acpi/event" file?
> that's bad, please make sure both CONFIG_ACPI_PROCFS and
> CONFIG_ACPI_PROC_EVENT
> are set in your kernel config file.

It was marked as depreciated in the kernel menuconfig. But now I have /proc/acpi/event. And I was able to do steps (b) to (e) as you suggested. I've attached the corresponding files. In step (a) I don't know what you mean with killing a process?

> please do the following test:
> 1. set CONFIG_ASUS_LAPTOP and rebuild your kernel

CONFIG_ASUS_LAPTOP was not there in the configuration of linux-2.6.30. See for yourself in the attached kernel configuration.

> does the hotkey work this time?

As I described above. Before sleep states, the hotkey influences only the value in /sys/class/backlight/acpi_video0/brightness without affecting the display. Display is at maximum. After sleepstates the hotkey IS affecting the display, although maximum value 15 is not the display brightness maximum (about half of the brightness). A reboot keeps the setting. Switching off and on again restores the maximum brightness.
Comment 13 Zhang Rui 2009-07-10 01:03:06 UTC
(In reply to comment #12)
> > please do the following test:
> > 1. set CONFIG_ASUS_LAPTOP and rebuild your kernel
> 
> CONFIG_ASUS_LAPTOP was not there in the configuration of linux-2.6.30. See
> for
> yourself in the attached kernel configuration.
>
please clear CONFIG_ACPI_ASUS to see the CONFIG_ASUS_LAPTOP option.
 
> > does the hotkey work this time?
> 
> As I described above. Before sleep states, the hotkey influences only the
> value
> in /sys/class/backlight/acpi_video0/brightness without affecting the display.
> Display is at maximum. After sleepstates the hotkey IS affecting the display,
> although maximum value 15 is not the display brightness maximum (about half
> of
> the brightness). A reboot keeps the setting. Switching off and on again
> restores the maximum brightness.

does the hotkey work AFTER you set CONFIG_ASUS_LAPTOP and boot with "acpi_backlight=vendor"?
Comment 14 Michael Franzl 2009-07-10 10:49:56 UTC
> please clear CONFIG_ACPI_ASUS to see the CONFIG_ASUS_LAPTOP option.

OK, works.

> does the hotkey work AFTER you set CONFIG_ASUS_LAPTOP and boot with
> "acpi_backlight=vendor"?

After pressing hotkey it writes on console:

ACPI: Failed to switch the brightness
Comment 15 Zhang Rui 2009-07-13 07:20:28 UTC
Created attachment 22329 [details]
customized DSDT

please apply this customized DSDT.
set CONFIG_ACPI_DEBUG and rebuild your kernel,
boot with log_buf_len=1M acpi.debug_level=0x07, acpi.debug_layer=0xffffffff
and then do the following test.

1. try to change the backlight via sysfs I/F, i.e. /sys/class/backlight/acpi_video0/brightness...
2. suspend and resume
3. redo step 1
4. attach the dmesg output.
Note, the test is done WITHOUT "acpi_backlight=vendor", and you should make sure that the sysfs I/F doesn't work before S3 and works after S3.
Comment 16 Michael Franzl 2009-07-13 09:55:40 UTC
Created attachment 22330 [details]
dmesg after DSDT customization
Comment 17 Michael Franzl 2009-07-13 10:05:59 UTC
Created attachment 22331 [details]
dmesg after DSDT customization and after sleepstate
Comment 18 Michael Franzl 2009-07-13 10:13:52 UTC
> please apply this customized DSDT.
> set CONFIG_ACPI_DEBUG and rebuild your kernel,
> boot with log_buf_len=1M acpi.debug_level=0x07, acpi.debug_layer=0xffffffff
> and then do the following test.

OK, worked.

> 1. try to change the backlight via sysfs I/F, i.e.
> /sys/class/backlight/acpi_video0/brightness...
> 2. suspend and resume
> 3. redo step 1
> 4. attach the dmesg output.

See dmesg3.txt attached.

> Note, the test is done WITHOUT "acpi_backlight=vendor", and you should make
> sure that the sysfs I/F doesn't work before S3 and works after S3.

After enabling CONFIG_ASUS_LAPTOP at the last time of our correspondence, setting of the backlight via sysfs I/F and hotkeys works even before sleepstates.

But the brightness range is still very minor and nearly undetectable. While in BIOS Menu or GRUB menu, the hotkeys work and brightness range is 0-100%. Via sysfs I/F the brightness range is only an estimated 60-80%.
Comment 19 Zhang Rui 2009-08-11 09:05:03 UTC
what about clear both CONFIG_ASUS_LAPTOP and CONFIG_ASUS_ACPI and boot WITHOUT acpi_backlight=vendor.
Comment 20 Michael Franzl 2009-08-13 09:39:31 UTC
I just noticed that the backlight brightness changes after sleepstates even without pressing the brightness buttons. It correlates with the ambient light. And because of this I discovered a small ambient light sensor besides the digital camera on the laptop screen.

Probably this is a complicated issue without accurate hardware specification of ASUS. And I resolved to always restart my laptop to have 100% brightness, using sleepstates only seldom and when needed.

But I could assist further in this issue, if you want to resolve it.
Comment 21 Zhang Rui 2009-08-17 05:57:37 UTC
If you do not load asus-laptop driver, the ALS won't work, right?
Now we need to make clear why ACPI backlight control not work after S3, not the asus-laptop backlight control, so I suggest you re-do the test WITHOUT asus-laptop driver.
Comment 22 Zhang Rui 2009-09-03 06:41:56 UTC
ping Michael...
Comment 23 Michael Franzl 2009-09-04 06:01:49 UTC
64 bytes from 81.189.88.179: icmp_seq=2 ttl=147 time=15 days

What stands ALS for?

I compiled one kernel as you suggested WITHOUT CONFIG_ASUS_LAPTOP and WITHOUT CONFIG_ASUS_ACPI and boot WITHOUT boot parameters. I compiled also a second kernel WITHOUT CONFIG_ASUS_LAPTOP but WITH CONFIG_ASUS_ACPI and boot WITHOUT boot parameters. Result was in both cases identical:

1) Resume from Standby works with maximum brightness, brightness changing afterwards not possible
2) Resume from Memory doesn't work when in console-only, it hangs before coming back. When issued from X11 it does come back, but with brightness controlled by ambient light sensor, brightness changing afterwards not possible.
3) Resume from Disk works with brightness controlled by ambient light sensor, brightness changing afterwards not possible. The reduced brightness is first encountered when the kernel writes the memory onto disk, before switching off.

In all cases, after a soft reboot, the reduced brightness is staying. Only after a hard reboot, the brightness is back to maximum.

The reason why this reduced brightness is so nasty is because it is done with PWM (Pulse Width Modulation, I think all recent laptops do this). And it's aggressive puling, like 20% on time, 80% off time, and is really noticeable, and my eyes get tired fast, me unable to concentrate any more.

Michael
Comment 24 Zhang Rui 2009-12-04 03:34:07 UTC
hmm, to make the problem clear, let's disable the ambient light sensor first.
what is the ambient controlled by?
I thought it's controlled by asus platform driver, because I do see such code in asus-laptop, and that's why I asked you to clear CONFIG_ASUS_LAPTOP, but now it seems that it's stilling working.
so could you please check your BIOS and see if there is any option that refers disabling the ambient light sensor?
If no, is there any hotkey in the laptop that can be used to enable/disable the ambient light sensor? I saw one HP laptop with such hotkeys working in windows.

cc Corentin, the maintainer of asus-laptop driver. :)
Comment 25 Corentin Chary 2009-12-04 07:53:10 UTC
I forgot to document the light sens thing in Documentation/ABI/testing/sysfs-platform-asus-laptop :/
You can use ls_switch and ls_level to control the light sensor under /sys/devices/platform/asus-laptop/
Comment 26 Michael Franzl 2009-12-07 15:40:54 UTC
(In reply to comment #24)
> so could you please check your BIOS and see if there is any option that
> refers
> disabling the ambient light sensor?

there is no setting in the BIOS.

> If no, is there any hotkey in the laptop that can be used to enable/disable
> the
> ambient light sensor? I saw one HP laptop with such hotkeys working in
> windows.

I searched a bit on the net and found the key combination Fn+a, but it didn't change anything. seems to be an OS thing.
Comment 27 Michael Franzl 2009-12-07 15:58:57 UTC
(In reply to comment #25)
> I forgot to document the light sens thing in
> Documentation/ABI/testing/sysfs-platform-asus-laptop :/
> You can use ls_switch and ls_level to control the light sensor under
> /sys/devices/platform/asus-laptop/

Ah, THAT worked!

What did we apparently find out?

When CONFIG_ASUS_LAPTOP is NOT compiled in the kernel, the light sensor is switched OFF by default. The sleepstates mem and disk somehow switch the ambient light sensor ON. And then it cannot be switched off again.

When CONFIG_ASUS_LAPTOP IS compiled in the kernel, the light sensor is switched ON by default, which leads to screen brightness controlled by PWM (pulse width modulation). But now we know how to switch off this annoying PWM, which caused me headaches when looking at it the whole day!

Thank you both for your assistance!
Comment 28 Zhang Rui 2009-12-09 07:20:09 UTC
I read the AML code and "ALAE" is only set in \\_SB.ATKD.ALSC.
And the backlight switching only works if ALAE is cleared, which mean the light sensor is turned off, right?

so the problem seems to be that ALAE is set automatically after s3, which IMO can not be fixed in Linux kernel.

Close this bug and Mark it as WON'T_FIX.
please correct me and re-open the bug if I said something wrong.
Comment 29 Zhang Rui 2009-12-09 07:22:09 UTC
hah, seems we can workaround this in asus-laptop driver.
say save the light sensor state in .suspend and restore the state in .resume.

Corentin,
what do you think?
Comment 30 Corentin Chary 2009-12-09 07:39:31 UTC
I already sent a patch do disable the light sens when the module load, and also set the sensitivity level to 5 (which should be ok, it was 0 before).

I think it's ok to restore the state in .resume, I'll do that. But it may not be in 2.6.33, because I'm refactoring a lot of thing in asus-laptop, and I'll also add a method to get the current light sens status from the dsdt (using GALS, or something like that).
Comment 31 Len Brown 2009-12-17 03:40:05 UTC
commit d951d4cc84e8b5ddb8e0ab81cf6a72cc73fdd668
Author: Corentin Chary <corentincj@iksaif.net>
Date:   Mon Dec 7 22:05:50 2009 +0100

    asus-laptop: change light sens default values.


shipped in 2.6.33 before -rc1
Comment 32 Len Brown 2010-01-16 04:12:02 UTC
re: comment 14

28c32e99bdf5ab838e7179c1aaca5a35a07f2a2b
Author: Zhang Rui <rui.zhang@intel.com>

   ACPI video: no warning message if "acpi_backlight=vendor" is used

shipped in 2.6.33-rc3