Bug 42833

Summary: Setting brightness doesn't work out of the box on Acer Extensa 5235
Product: ACPI Reporter: lukacs.bence1
Component: Power-VideoAssignee: Zhang Rui (rui.zhang)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: acpi-bugzilla, alan, florian, jlee, lenb
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.2.0-17-generic-pae Subsystem:
Regression: No Bisected commit-id:
Attachments: 0001-acer-wmi-add-Acer-Extensa-5235-to-video-backlight-ve.patch

Description lukacs.bence1 2012-02-28 16:38:25 UTC
I use this laptop since 2010 and I always have to write something into /etc/default/grub, to make the bríghtness changeable.
Now on Ubuntu 12.04 it is properly working if I write "acpi_backlight=vendor" to this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
I tried the latest upstream kernel, but this bug is still exist in it.
Is it possible to fix this bug, to make the brightness change working out of the box?
I hope I attached everything which necessary, if not please let me know what I should send.
Comment 1 Len Brown 2012-03-06 02:31:45 UTC
the problem is that the BIOS advertises ACPI video brightness control,
and so Linux loads the acpi_video driver, but the support is not
working.

This could be a problem either in the BIOS or in the acpi_video driver,
but is is most likely a BIOS issue.

please attach the output from acpidump so we can confirm.
Comment 2 lukacs.bence1 2012-03-07 13:04:02 UTC
If I try running this command I get this message:
"acpi_os_map_memory: cannot open /dev/me"
Any idea?
Comment 3 Lee, Chun-Yi 2012-03-15 09:38:48 UTC
Please attach your acpidump and dmidecode log:
  
 #acpidump > acpidump.dat
 #dmidecode > dmidecode.log

And, please try the following command to test _BCM available:

 echo 5 > /sys/class/backlight/acpi_video0/brightness


Thanks
Comment 4 Lee, Chun-Yi 2012-03-15 09:39:57 UTC
Please use root.
Comment 5 lukacs.bence1 2012-03-15 13:22:02 UTC
Here is the output of the acpidump: http://pastebin.com/gyPzdt5i, and the dmidecode: http://pastebin.com/2xUeu8Uf
When I try to run this (echo 5 > /sys/class/backlight/acpi_video0/brightness) command it said that the directory didn't exist.
I run these commands when I boot the kernel with the "acpi_backlight=vendor" flag.
Comment 6 Lee, Chun-Yi 2012-03-15 15:02:13 UTC
(In reply to comment #5)
> Here is the output of the acpidump: http://pastebin.com/gyPzdt5i, and the
> dmidecode: http://pastebin.com/2xUeu8Uf
> When I try to run this (echo 5 > /sys/class/backlight/acpi_video0/brightness)
> command it said that the directory didn't exist.
> I run these commands when I boot the kernel with the "acpi_backlight=vendor"
> flag.

Sorry for cause you confuse.

Please REMOVE 'acpi_backlight=vendor' then run 'echo 5 > /sys/class/backlight/acpi_video0/brightness' again.

Thanks

Per your description of bug, 
I think 'acpi_backlight=vendor' works to you for brightness control, right?
Comment 7 lukacs.bence1 2012-03-17 11:38:10 UTC
I run 'echo 5 > /sys/class/backlight/acpi_video0/brightness' but I get an error message again, that this directory doesn't exist, however it exists. In the "brightness" file there was a 0, I change it to 5, save it but nothing happend.
Finally you are right, if I boot the system with "acpi_backlight=vendor" everything works fine.
Comment 8 Lee, Chun-Yi 2012-03-19 03:54:58 UTC
(In reply to comment #7)
> I run 'echo 5 > /sys/class/backlight/acpi_video0/brightness' but I get an
> error
> message again, that this directory doesn't exist, however it exists. In the
> "brightness" file there was a 0, I change it to 5, save it but nothing
> happend.
> Finally you are right, if I boot the system with "acpi_backlight=vendor"
> everything works fine.

Please kindly list /sys/class/backlight to here:

When REMOVED "acpi_backlight=vendor"
 # ls /sys/class/backlight

When ADD "acpi_backlight=vendor"
 # ls /sys/class/backlight


And, 
Please try the following 2 command when ADD "acpi_backlight=vendor":

# echo 5 > /sys/class/backlight/acer-wmi/brightness 
# echo 5 > /sys/class/backlight/intel_backlight/brightness 

Which one works to change brightness on your machine?

Thanks
Comment 9 Zhang Rui 2012-03-19 08:17:15 UTC
I'm confused by the ACPI brightness control implement on this machine.

                        Method (_BCM, 1, NotSerialized)
                        {
                            If (LEqual (BOWN, Zero))
                            {
                                Store (Subtract (Divide (Arg0, 0x0A, ), One), Local0)
                                Store (Local0, BRTN)
                                Acquire (^^^^LPCB.EC0.MUT1, 0xFFFF)
                                Store (Local0, ^^^^LPCB.EC0.BLVL)
                                Release (^^^^LPCB.EC0.MUT1)

                                If (LEqual (OSYS, 0x03E8))
                                {
                                /* update IGD LBES field in case it's "Linux" */
                                }

                                If (LLess (OSYS, 0x07D6))
                                {
                                /* Need wmi support if it is not Vista or Win7 */
                                }
                            }
                        }
Does this mean that updating EC0.BLVL can change the backlight in Windows Vista and Win7? Or windows Vista and Win7 doesn't use ACPI backlight control at all?

Hi, Lukacs,
will you please check
1) if the brightness works when you boot the kernel with both acpi_osi="!Windows 2009" and acpi_osi="!Windows 2006" ?
2) if the brightness works when you boot the kernel with acpi_osi="Linux"?
Comment 10 lukacs.bence1 2012-03-19 19:09:19 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > I run 'echo 5 > /sys/class/backlight/acpi_video0/brightness' but I get an
> error
> > message again, that this directory doesn't exist, however it exists. In the
> > "brightness" file there was a 0, I change it to 5, save it but nothing
> happend.
> > Finally you are right, if I boot the system with "acpi_backlight=vendor"
> > everything works fine.
> 
> Please kindly list /sys/class/backlight to here:
> 
> When REMOVED "acpi_backlight=vendor"
>  # ls /sys/class/backlight
> 
> When ADD "acpi_backlight=vendor"
>  # ls /sys/class/backlight
> 
> 
> And, 
> Please try the following 2 command when ADD "acpi_backlight=vendor":
> 
> # echo 5 > /sys/class/backlight/acer-wmi/brightness 
> # echo 5 > /sys/class/backlight/intel_backlight/brightness 
> 
> Which one works to change brightness on your machine?
> 
> Thanks

This is the result of the "ls /sys/class/backlight" with "acpi_backlight=vendor":
acer-wmi
intel_backlight
and without it:
acpi_video0
intel_backlight

And the second command change my brightness: echo 5 > /sys/class/backlight/intel_backlight/brightness, although the 5 is very small value, there is a very big number in the file, when I write 5 into it the screen turns blank.
Comment 11 lukacs.bence1 2012-03-19 19:26:35 UTC
(In reply to comment #9)
> I'm confused by the ACPI brightness control implement on this machine.
> 
>                         Method (_BCM, 1, NotSerialized)
>                         {
>                             If (LEqual (BOWN, Zero))
>                             {
>                                 Store (Subtract (Divide (Arg0, 0x0A, ), One),
> Local0)
>                                 Store (Local0, BRTN)
>                                 Acquire (^^^^LPCB.EC0.MUT1, 0xFFFF)
>                                 Store (Local0, ^^^^LPCB.EC0.BLVL)
>                                 Release (^^^^LPCB.EC0.MUT1)
> 
>                                 If (LEqual (OSYS, 0x03E8))
>                                 {
>                                 /* update IGD LBES field in case it's "Linux"
> */
>                                 }
> 
>                                 If (LLess (OSYS, 0x07D6))
>                                 {
>                                 /* Need wmi support if it is not Vista or
>                                 Win7
> */
>                                 }
>                             }
>                         }
> Does this mean that updating EC0.BLVL can change the backlight in Windows
> Vista
> and Win7? Or windows Vista and Win7 doesn't use ACPI backlight control at
> all?
> 
> Hi, Lukacs,
> will you please check
> 1) if the brightness works when you boot the kernel with both
> acpi_osi="!Windows 2009" and acpi_osi="!Windows 2006" ?
> 2) if the brightness works when you boot the kernel with acpi_osi="Linux"?

Both with acpi_osi="!Windows 2009" and with acpi_osi="!Windows 2006" boot the system, but the problem still exist.

Luckily with acpi_osi="Linux" everything works fine just like with "acpi_backlight=vendor", however, when the system boots it starts with the lowest backlight level.
Comment 12 Lee, Chun-Yi 2012-03-20 03:58:03 UTC
(In reply to comment #11)
> (In reply to comment #9)
> > I'm confused by the ACPI brightness control implement on this machine.
> > 
> >                         Method (_BCM, 1, NotSerialized)
> >                         {
> >                             If (LEqual (BOWN, Zero))
> >                             {
> >                                 Store (Subtract (Divide (Arg0, 0x0A, ),
> One),
> > Local0)
> >                                 Store (Local0, BRTN)
> >                                 Acquire (^^^^LPCB.EC0.MUT1, 0xFFFF)
> >                                 Store (Local0, ^^^^LPCB.EC0.BLVL)
> >                                 Release (^^^^LPCB.EC0.MUT1)
> > 
> >                                 If (LEqual (OSYS, 0x03E8))
> >                                 {
> >                                 /* update IGD LBES field in case it's
> "Linux"
> > */
> >                                 }
> > 
> >                                 If (LLess (OSYS, 0x07D6))
> >                                 {
> >                                 /* Need wmi support if it is not Vista or
> Win7
> > */
> >                                 }
> >                             }
> >                         }
> > Does this mean that updating EC0.BLVL can change the backlight in Windows
> Vista
> > and Win7? Or windows Vista and Win7 doesn't use ACPI backlight control at
> all?
> > 
> > Hi, Lukacs,
> > will you please check
> > 1) if the brightness works when you boot the kernel with both
> > acpi_osi="!Windows 2009" and acpi_osi="!Windows 2006" ?
> > 2) if the brightness works when you boot the kernel with acpi_osi="Linux"?
> 
> Both with acpi_osi="!Windows 2009" and with acpi_osi="!Windows 2006" boot the
> system, but the problem still exist.
> 

Yes, you are not the first one, that because Acer ODM provide a broken _BCM implementation:

"BIOS guy" should do something like this:

Method (AINT, 2, NotSerialized)
{
...
        If (LEqual (Arg0, One))
        {
            Store (Divide (Multiply (Arg1, 0xFF), 0x64, ), BCLP)
            Or (BCLP, 0x80000000, BCLP)         <=== touch BCLP register
            Store (0x02, ASLC)
        }

    Method (_BCM, 1, NotSerialized)
    {
        If (LAnd (LGreaterEqual (Arg0, Zero), LLessEqual (Arg0, 0x64)))
        {
            AINT (One, Arg0)     <=== call AINT method
            Store (Arg0, BRTL)
        }
    }

 Just for reference, they should do that when EC didn't wire to
 backlight.

But,
Why they didn't find _BCM not work?

My guess is:

Because the backlight control is through WDDM driver on Windows platform
but not through standard ACPI method _BCM. They only test Windows
platform, so, they didn't find _BCM broken.

And, they also didn't really follow Microsoft WDDM spec:

http://msdn.microsoft.com/en-us/windows/hardware/gg487382.aspx

Per spec,
ODM should keep _BCM works fine for any other OS didn't support WDDM
driver, but they didn't.

At last year, I told Acer PM one time for this issue, they said will
check but finally didn't response me.

> Luckily with acpi_osi="Linux" everything works fine just like with
> "acpi_backlight=vendor", however, when the system boots it starts with the
> lowest backlight level.

I prefer "acpi_backlight=vendor" but not acpi_osi="Linux", because ODM didn't test the code path with acpi_osi="Linux", they always only test Windows platform.
Comment 13 Lee, Chun-Yi 2012-04-18 09:07:20 UTC
Created attachment 72951 [details]
0001-acer-wmi-add-Acer-Extensa-5235-to-video-backlight-ve.patch

Finally, we choice add a quirk table to acer-wmi driver for set those broken machines to video vender mode. (means auto set to "acpi_backlight=vendor")

After this patch accepted by upstream, then we can remove acpi_backlight=vendor or acpi_osi="Linux" from kernel parameter on Acer Extensa 5235 .
Comment 14 lukacs.bence1 2012-04-18 11:31:12 UTC
(In reply to comment #13)
> Created an attachment (id=72951) [details]
> 0001-acer-wmi-add-Acer-Extensa-5235-to-video-backlight-ve.patch
> 
> Finally, we choice add a quirk table to acer-wmi driver for set those broken
> machines to video vender mode. (means auto set to "acpi_backlight=vendor")
> 
> After this patch accepted by upstream, then we can remove
> acpi_backlight=vendor
> or acpi_osi="Linux" from kernel parameter on Acer Extensa 5235 .

Thanks a lot Lee!
I hope it'll be accepted soon!
Comment 15 Florian Mickler 2012-07-01 09:45:58 UTC
A patch referencing this bug report has been merged in Linux v3.5-rc1:

commit 050eff39af6a395104df85b7ca59f0a4245e04f8
Author: Lee, Chun-Yi <joeyli.kernel@gmail.com>
Date:   Mon May 21 23:19:51 2012 +0800

    acer-wmi: add 3 laptops to video backlight vendor mode quirk table
Comment 16 lukacs.bence1 2012-07-11 09:14:36 UTC
I use Ubuntu 12.10 Quantal with kernel 3.5.0-4-generic. This kernel is build from kernel v3.5-rc6, but the bug still exist in it. Setting the brightness still doesn't work out of the box.
Is this my bad, or the patch doesn't implemented yet?
Comment 17 Lee, Chun-Yi 2012-07-11 10:09:16 UTC
The 050eff39af6 patch already merged in v3.5-rc1. 

Please give the following information:
 + dmesg:
      dmesg > dmesg.log

 + the result of 'ls /sys/class/backlight', please do NOT put "acpi_backlight=vendor"


Thanks
Comment 18 lukacs.bence1 2012-07-11 10:40:10 UTC
(In reply to comment #17)
> The 050eff39af6 patch already merged in v3.5-rc1. 
> 
> Please give the following information:
>  + dmesg:
>       dmesg > dmesg.log
> 
>  + the result of 'ls /sys/class/backlight', please do NOT put
> "acpi_backlight=vendor"
> 
> 
> Thanks

Here it is: http://pastebin.com/bSm14tRP
Comment 19 Lee, Chun-Yi 2012-07-11 14:51:16 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > The 050eff39af6 patch already merged in v3.5-rc1. 
> > 
> > Please give the following information:
> >  + dmesg:
> >       dmesg > dmesg.log
> > 
> >  + the result of 'ls /sys/class/backlight', please do NOT put
> > "acpi_backlight=vendor"
> > 
> > 
> > Thanks
> 
> Here it is: http://pastebin.com/bSm14tRP

Looks the dmesg from acer-wmi is right:

[   15.958563] acer_wmi: Brightness must be controlled by generic video driver


What's the result of "ls /sys/class/backlight" WITHOUT "acpi_backlight=vendor" ?

Does "echo 5 > /sys/class/backlight/intel_backlight/brightness" still work to you on your v3.5-rc kernel?
Comment 20 lukacs.bence1 2012-07-12 11:39:17 UTC
For "ls /sys/class/backlight" I got this:

lukibeni@quantal-laptop:~$ ls /sys/class/backlight
intel_backlight

For "echo 5 > /sys/class/backlight/intel_backlight/brightness" I always got a Permission denied message, so I can't change it (of course I use sudo).
There is a number in the /sys/class/backlight/intel_backlight/brightness: 2771085
Comment 21 lukacs.bence1 2012-07-23 11:14:18 UTC
Any idea why it doesn't work?
Comment 22 lukacs.bence1 2012-07-28 18:50:48 UTC
I did a kernel update and now the brightness adjustment works out-of-the-box with version 3.5.0-6. Thanks a lot guys!