more backlight stuff, x61, kernel 2.6.26.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I upgraded to 2.6.26.1 and my X61 backlight (which has never really
worked right) gave me more troubles than usual, so I started to try to
track things down a little more, and found a mess that I'd like some
help sorting out.

I think most of these are userspace issues but I think the kernel is
having some troubles as well.  For the userspace stuff, I'd like to
get some input from people more knowledgeable before I go filing bugs.
It's insanely complicated how all of this software works together 
so I'll just explain everything I've found:

- I need to load thinkpad-acpi with experimental=1 so I can control
  WAN power with /proc/acpi/ibm/wan.   Other than that thinkpad-acpi
  seems to be doing its job correctly for brightness control:

  thinkpad_acpi: ThinkPad ACPI Extras v0.20
  thinkpad_acpi: http://ibm-acpi.sf.net/
  thinkpad_acpi: ThinkPad BIOS 7NETA6WW (2.06 ), EC 7MHT25WW-1.03
  thinkpad_acpi: Lenovo ThinkPad X61, model 7675CTO
  thinkpad_acpi: radio switch found; radios are enabled
  thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
  thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
  thinkpad_acpi: Lenovo BIOS switched to ACPI backlight control mode
  thinkpad_acpi: standard ACPI backlight interface available, not loading native one...

- I'm loading ACPI video.ko too.  It generates hotkey events correctly:

  video LCD0 00000086 00000000
  video LCD0 00000087 00000000

- Bug: two backlight devices show up:
    /sys/class/backlight/acpi_video0
    /sys/class/backlight/acpi_video1

- Pressing the brightness hotkeys (single-user mode, no hal, no
  gnome-power-manager, no acpid) causes both actual_brightness
  values to change, but the backlight does not physically change
  brightness.

- Similarly, manually writing to these controls acts strangely:

  # cat acpi_video0/actual_brightness
  15
  # cat acpi_video1/actual_brightness
  15

  # echo 8 > acpi_video0/brightness     # the backlight does NOT change

  # cat acpi_video0/actual_brightness
  8
  # cat acpi_video1/actual_brightness
  8

  # echo 10 > acpi_video1/brightness     # the backlight DOES change

  # cat acpi_video0/actual_brightness
  8
  # cat acpi_video1/actual_brightness
  10

- It seems that:

  - Writing to acpi_video0/brightness changes actual_brightness for
    both, but has no actual effect.

  - Pressing hotkey buttons is the same as writing to
    acpi_video0/brightness.

  - Writing to acpi_video1/brightness changes actual_brightness for
    only acpi_video1, and actually works.

- Gnome-power-manager saw the hotkeys but didn't change the 
  backlight.

  When hal & gnome-power-manager & acpid are running, the brightness
  key ACPI events are delivered as fake keystrokes which g-p-m
  receives.  When it wants to change brightness, it invokes the HAL
  GetBrightness function to check, then uses SetBrightness to set,
  but ONLY if they differ.

  Roughly, GetBrightness = cat acpi_videoX/actual_brightness
           SetBrightness = echo > acpi_videoX/brightness

- Since pressing hotkey buttons DOES change
  acpi_video1/actual_brightness, g-p-m thinks someone already
  set the proper brightness, and so it never calls SetBrightness.
  Result: backlight does not change.

- But, it still half-worked, sometimes.  Why?  Because of the terrible
  Debian package "hotkey-setup".  This package first writes 0xffffffff
  to /proc/acpi/ibm/hotkey at startup, which is not good.  Then, it
  runs a program "thinkpad_keys" which directly polls /dev/nvram for
  hotkeys, and sends brightness keys as fake keyboard inputs using
  /dev/input/uinput.  g-p-m was therefore receiving brightness keys
  TWICE (one from acpid, one from thinkpad_keys).  This means
  the bug with actual_brightness didn't matter because g-p-m wanted
  the value to change twice, so it would still do a SetBrightness.
  (It was still buggy, though; I think thinkpad_keys missed some of
  the keypresses).

  I've since purged this hotkey-setup package from my system because
  I definitely don't want it to change /proc/acpi/ibm/hotkey or 
  do its own nvram polling.

- With hotkey-setup gone, I can make g-p-m work correctly by:
    echo N > /sys/module/video/parameters/brightness_switch_enabled
  This causes acpi_video1/actual_brightness to NOT change when I hit
  hotkeys, so now g-p-m does the right thing (sees that it is
  unchanged, and changes it.  Good!)

  It seems like this option should be unnecessary.  It's as if the
  BIOS thinks it's changing the brightness but failing to do so.
  Is this a DSDT bug maybe?  Or a bug in video.ko?

- After all this, brightness mostly works.  There is still an issue with
  plugging/unplugging the AC adapter.  In single-user-mode:

  On AC:
  # echo 0  > acpi_video1/brightness     # dark
  # echo 15 > acpi_video1/brightness     # fully bright
  Unplugged AC here                      # no change
  # echo 15 > acpi_video1/brightness     # no change
  # echo 0  > acpi_video1/brightness     # dark
  # echo 15 > acpi_video1/brightness     # --HALF-- bright
  Plugged AC here                        # no change
  # echo 15 > acpi_video1/brightness     # no change
  # echo 0  > acpi_video1/brightness     # dark
  # echo 15 > acpi_video1/brightness     # fully bright
  
  Basically removing the AC adapter reduces the available brightness
  range, BUT doesn't take effect until I actually try to change the
  brightness.
  
  I don't know what should change the brightness in this case.
  I could add an ACPI hook, but I'd need something like:

  b=$(((`cat acpi_video1/brightness` + 8) % 16))
  echo $(($b + 1) % 16)) > acpi_video1/brightness
  echo $b > acpi_video1/brightness

  to ensure that the value actually gets changed, which just seems
  like a hack.


By the way, the Debian package "acpi-support" also sets up a
modprobe.d file containing:
  options thinkpad_acpi hotkey=enable,0xffffbf experimental=1
which I have removed.  Another broken userspace package? 
Apparently this file was placed here to fix problems on someone's
x60; this whole setup is so complicated it seems like it would
be an endless problem of fixing one laptop by breaking another.

-jim


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel

[Index of Archives]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite Photos]     [Yosemite Advice]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux