[ltp] ibm-acpi brightness problems on the X60 (and Z61t)

Fredrik Wendt linux-thinkpad@linux-thinkpad.org
Thu, 08 Mar 2007 22:28:10 +0100


Henrique de Moraes Holschuh wrote:
> On Thu, 08 Mar 2007, Fredrik Wendt wrote:
> > Using the key combinations it's clear that we actually have 8 different
> > levels (on the eightth (8th) key hit, nothing happens), the proc-acpi
> > file says there are 7 levels.
> 
> I am *always* interested in these reports! (I am the ibm-acpi maintainer),
> so, unfortunately for you, I have noticed the thread and will now bug you to
> find out about all of your ibm-acpi bugs ;-)

Perfect! I'm very happy to assist in whatever way possible. (I've got
three 600E laptops as well.)

First of all - forget the issue with "7 or 8 brightness levels" - that's
just my memory playing me a trick. The machine has 8 levels and have
always been like that (no difference with power cable plugged in or
not).

> Ok, so, please boot the machine in single user mode, and don't let the
> Xserver start.  Please remove the ACPI video module (rmmod video) *and*
> ibm-acpi (rmmod ibm-acpi).  After all this, the thinkpad firmware is all that
> is commanding the brightness buttons.
> 
> How many levels do you see when playing with the brightness keyboard
> buttons, 7 or 8?
> 
> Now, please go into battery mode.  How many levels do you see?

As I said, this was just my own poor memory ... There are 8 levels, in
both battery mode and not.

> Now please load ibm-acpi (modprobe ibm-acpi experimental=1).   Repeat the
> tests, does anything change?

No. Works as expected.

> If you are feeling generous AND using 2.6.20, please load the video module
> and repeat the tests, does anything change?

As of now, I don't have a 2.6.20 kernel compiled. Guess I can download
it of some server and compile it with default settings? (It was
literally years ago since I last compiled a kernel of my own, Ubuntu is
very "handy" :)

> > I can dim the screen using "echo level 1 > /proc/acpi/ibm/brightness"
> > but it only lowers the brightness to a fix level no matter if I echo
> > level 1 or level 5 for instance. (It only takes one Fn+Home key stroke
> > to get back to full brightness (no matter what "level" I echoed into the
> > file).)
> 
> This is also interesting, and it shows a bug somewhere (might be in
> ibm-acpi, or elsewhere).
> 
> Please boot the machine in single user mode, and don't let the Xserver
> start.  Please remove the ACPI video module (rmmod video), but make sure
> ibm-acpi is still loaded.
> 
> Does /proc/acpi/ibm/brightness work correctly, or does it still show the bug
> you described?

In this environment, the bug is partly gone. This is what I did:
Booted into single user, X has not loaded (I logged in as root when my
ubuntu machine asked me to enter root password for maintanance, or CTRL
+D to continue).

lsmod | grep video  shows nothing - the module isn't there. Same thing
with ibm_acpi. The brightness levels are toggled as expected with Fn key
combinations.

I then "modprobe ibm_acpi experimental=1". Then (a couple of times) 
	for i in `seq 0 7` ; do 
		echo level $i > /proc/acpi/ibm/brightness;
		echo "level should be:$i";
		cat /proc/acpi/ibm/brightness;
	done
and it works just as it should.

I then used Fn combinations to toggle the brightness level, and used cat
to read the brightness file. Again, the brightness level is affected by
the key combinations pressed (correctly), but the brightness file still
contains that same rock solid "level: 7" no matter how many times I push
the Fn+Home/End. The content of the brightness file simply won't change
until I write something to it. Just like before.

However, when I previously wrote "level 1" to the file and the current
level was 7, it only took one single Fn+Home to get back to level 7.
That is not the case now (while in single user ibm_acpi loaded, no X, no
video). Instead it works as expted.

> > cat /proc/acpi/ibm/brightness always shows whatever was written/echoed
> > to the file last - it's value doesn't change after hitting Fn+Home/End.
> 
> It should, as we ask the EC directly about the brightness level.  This is
> bad.  Please send me the output of /proc/acpi/ibm/ecdump right before, and
> right after you hit a Fn+Home/End that *did* change the display brightness,
> but for which /proc/acpi/ibm/brightness doesn't show the correct value.
> Does it happen only for level 7/8 or 0/1?  Or does it also happen on level
> 4?

Just to be sure, I've done this in two ways: by write to the brightness
file, and by using key strokes.

The dump from test one is located at
wendt.se/software/linux/ibm_acpi/070308/dmp1 and the second in dmp2.

Both runs were performed in single user mode, ibm_acpi loaded, no X, no
video.

        #!/bin/sh
        # Test 1 is basically:
        
        cd /proc/acpi/ibm/
        
        ( for i in `seq 0 7`; do echo "level $i" > brightness ; 
          cat brightness ; cat ecdump ; done ) >> /tmp/dmp1
        
        echo "Test 2 is almost the same:";
        echo "level 0" > brightness;
        
        for i in `seq 0 7`; do echo "level $i" ; sleep 2 ;
          cat brightness ecdump >> /tmp/dmp2 ; done
        
        cd -

The second run produce output to the terminal, and as soon as I could
read "level X" I pressed Fn+Home (except after the first step, level 0).
(I should tell you that I released the Fn key every time, if it
matters ... guess that it shouldn't.)


Hope this helps, and again, I've not run this under 2.6.20. The linux
kernel used was 
        uname -a
        Linux wendt-se-z61t 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux
which should be the current Ubuntu Edgy Eft linux kernel.

/ Fredrik Wendt