ACPI

From blag.wiki.aktivix.org

Jump to: navigation, search

Contents

INTRO

I've always been happy with Advanced Power Management bios, (APM), as far as power management is concered. It's simple, there's nothing to configure and I as a regular user can forget all about it. The screen blanks when the laptops' been idle or when the lid's closed. I run `/usr/bin/apm` as a regular user to get an idea of the battery's power status. What's more, all of APM's features work out of the box. Those are the kind of tools that I like sometimes. I don't need to know how or why it works, it just does what I tell it to do.

However, having recently upgraded my kernel to 2.6.14, I decided to try out Advanced Configuration and Power Interface (ACPI). The advantage of ACPI is that one can controll power events via the OS. Previously all APM power events where controlled by the BIOS and the OS had no idea when APM would kick in or what it would do. I set aside some time to try things out as a ****regular user**** to see what all the fuss is about. There are loads of command that root can use but I felt that I'd better use my ordinary account as the potentional for causing havoc is greatly reduced. In order to have a resonably safe and hassle-free time, I've used the following documentaion in /usr/src/linux-2.6.14/Documentation/ibm-acpi.txt (ibm-acpi.txt, from hereon), which describes most of the features of this power management system. Note that ibm-acpi.txt also refers to http://ibm-acpi.sf.net/ and one may look at look at the latter doc for the latest news, as well as a compatability matrix.

See any mistakes? Correct them!

/proc/acpi

This is the top - level diretory.Note that these files seem empty. One uses `cat` as a regular user to use them as commands.

jayeola@00:07:01$ cd /proc/acpi/ && l && file *
ac_adapter  button               event  ibm             processor     wakeup
alarm       dsdt                 fadt   info            thermal_zone
battery     embedded_controller  fan    power_resource  video
ac_adapter:          directory
alarm:               empty
battery:             directory
button:              directory
dsdt:                empty
embedded_controller: directory
event:               empty
fadt:                empty
fan:                 directory
ibm:                 directory
info:                empty
power_resource:      directory
processor:           directory
thermal_zone:        directory
video:               directory
wakeup:              empty 

From here on we will try to run as many commands as possible as a regular user. We are sure not to do any damage this way.

jayeola@00:08:06$ cat /proc/acpi/alarm
2005-11-00 19:00:49
jayeola@00:08:11$ cat /proc/acpi/dsdt
cat: dsdt: Permission denied
jayeola@00:09:00$ cat /proc/acpi/info
version:                 20050902
jayeola@00:09:08$ cat /proc/acpi/wakeup
Device  Sleep state     Status
LID        3            * enabled
SLPB       3            * enabled
PCI0       4            disabled
USB        1            disabled
UART       3            disabled

proc/acpi/ac_adapter

This appears to be the ac power for the Thinkpad

jayeola@00:10:51$ cat  /proc/acpi/ac_adapter/AC/state
state:                   on-line

Battery -- /proc/acpi/battery

jayeola@20:31:13$ cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          charging
present rate:            24140 mW
remaining capacity:      2448 mWh
present voltage:         11730 mV
jayeola@20:31:29$ cat /proc/acpi/battery/BAT0/info
present:                 yes
design capacity:         38880 mWh
last full capacity:      23840 mWh
battery technology:      rechargeable
design voltage:          10800 mV
design capacity warning: 1944 mWh
design capacity low:     388 mWh
capacity granularity 1:  1 mWh
capacity granularity 2:  1 mWh
model number:            ThinkPad Battery
serial number:
battery type:            LION
OEM info:                IBM Corporation
jayeola@20:32:52$ cat /proc/acpi/battery/BAT0/alarm
alarm:                   1944 mWh

/proc/acpi/button

jayeola@00:11:33$ cat /proc/acpi/button/lid/LID/info
type:                    Lid Switch
jayeola@00:11:49$ cat /proc/acpi/button/lid/LID/state
state:      open
jayeola@00:12:15$ cat /proc/acpi/button/power/PWRF/info
type:                    Power Button (FF)
jayeola@00:13:10$ cat /proc/acpi/button/sleep/SLPB/info
type:                    Sleep Button (CM)
jayeola@00:13:58$ cat /proc/acpi/embedded_controller/EC/info
gpe bit:                 0x09
ports:                   0x66, 0x62
use global lock:         yes

/proc/acpi/ibm/

jayeola@00:15:14$ l -R /proc/acpi/ibm/
ibm/:
bay  beep  bluetooth  cmos  dock  driver  hotkey  led  light  thermal  video

These are the available commands. test if they work for a regular user below

What driver version am I using? This command has no other options.

jayeola@00:17:44$ cat driver
driver:         IBM ThinkPad ACPI Extras
version:        0.12a
jayeola@19:23:02$ dmesg | grep acpi
ibm_acpi: IBM ThinkPad ACPI Extras v0.12a
ibm_acpi: http://ibm-acpi.sf.net/
ibm_acpi: dock device not present
Registering sys device 'acpi0'
ACPI: Please implement acpi_video_bus_ROM_seq_show

Note that `dmesg | grep -i acpi` shows a lot more lines, but I only wanted to know the version in this instance.

UltraBay eject -- /proc/acpi/ibm/bay

jayeola@00:16:38$ cat /proc/acpi/ibm/bay
status:         occupied
commands:       eject

I do not have a dosking device. this command is run just to see it's output

ACPI sounds -- /proc/acpi/ibm/beep

jayeola@00:16:19$ cat /proc/acpi/ibm/beep
status:         supported
commands:       <cmd> (<cmd> is 0-17)

Use `echo <number> >/proc/acpi/ibm/beep` as root to send commands to the beep device. A good one to try is

for i in {0..20}; do echo $i > /proc/acpi/ibm/beep ; sleep 2; done

Which will loop through all of the beep sounds

Bluetooth -- /proc/acpi/ibm/bluetooth

jayeola@00:16:43$ cat /proc/acpi/ibm/bluetooth
status:         not supported

There is no built-in bluetooth device. I do have a bluetooth dongle, which works

CMOS control -- /proc/acpi/ibm/cmos

jayeola@00:17:05$ cat /proc/acpi/ibm/cmos
status:         not supported

Docking / undocking -- /proc/acpi/ibm/dock

jayeola@00:17:39$ cat /proc/acpi/ibm/dock
status:         undocked
jayeola@00:17:44$ cat /proc/acpi/ibm/driver
driver:         IBM ThinkPad ACPI Extras
version:        0.12a

For driver name and version only. no other commands can be sent to thos file

jayeola@00:17:57$ cat /proc/acpi/ibm/hotkey
status:         disabled
mask:           not supported
status:         disabled
mask:           not supported
commands:       enable, disable, reset

Hot keys -- /proc/acpi/ibm/hotkey

root@03:11:14# echo enable > /proc/acpi/ibm/hotkey
root@03:11:21# cat /proc/acpi/ibm/hotkey
status:         enabled
mask:           not supported
commands:       enable, disable, reset

Use disable or reset to disable it again

So far when I used this command to enable all of the possible hot keys...

echo 0xffff > /proc/acpi/ibm/hotkey
acpi_listen showed only one event for the hotkeys pressed
button/sleep SLPB 00000080 00000002

which where the <fn><f4> keys.

actions
button/lid LID 00000080 00000001
button/lid LID 00000080 00000002

LED control -- /proc/acpi/ibm/led

jayeola@00:18:24$ cat /proc/acpi/ibm/led
status:         supported
commands:       <led> on, <led> off, <led> blink (<led> is 0-7)

The led refers to the light on thinkpad docking stations. which I do not have

ThinkLight control -- /proc/acpi/ibm/light

jayeola@00:18:28$ cat /proc/acpi/ibm/light
status:         on
commands:       on, off

Turns the think light built into the lid on and off. The same is acheived by pressing <fn><page up>

Temperature sensors -- /proc/acpi/ibm/thermal

jayeola@00:18:49$ cat /proc/acpi/ibm/thermal
temperatures:   49 -128 -128 -128 50 45 -128 -128

There appears to be eight seperate tempature sensors shown here. Acccording to ibm-acpt.txt you'll only be able to access them using ACPI commands. I think this means that not all of them are available, either to the regular user or noobs like me. Also the doc lists the physical location of the sensors in a Thinkpad as observed by Thomas Gruber for his R51:- 1: CPU 2: Mini PCI Module 3: HDD 4: GPU 5: Battery 6: N/A 7: Battery 8: N/A Commands available:- none

Video output control -- /proc/acpi/ibm/video

jayeola@00:18:53$ cat /proc/acpi/ibm/video
status:         supported
lcd:            enabled
crt:            disabled
dvi:            disabled
auto:           enabled
commands:       lcd_enable, lcd_disable
commands:       crt_enable, crt_disable
commands:       dvi_enable, dvi_disable
commands:       auto_enable, auto_disable
commands:       video_switch, expand_toggle

These commands are for the video modes. Not experimenting here.... chickened out ;-)

/proc/acpi/power_resource/PSER/state

jayeola@00:19:57$ cat  /proc/acpi/power_resource/PSER/state
state:                   off
system level:            S0
order:                   0
reference count:         0
jayeola@00:20:27$ cat /proc/acpi/power_resource/PSIO/state
state:                   on
system level:            S0
order:                   0
reference count:         0

/proc/acpi/processor/CPU/

jayeola@00:21:05$ l /proc/acpi/processor/CPU/
info  limit  power  throttling
jayeola@00:21:36$ cat /proc/acpi/processor/CPU/info
processor id:            0
acpi id:                 1
bus mastering control:   yes
power management:        yes
throttling control:      yes
limit interface:         yes
jayeola@00:21:51$ cat /proc/acpi/processor/CPU/limit
active limit:            P0:T0
user limit:              P0:T0
thermal limit:           P0:T0
jayeola@00:22:15$ cat /proc/acpi/processor/CPU/power
active state:            C3
max_cstate:              C8
bus master activity:     00000000
states:
   C1:                  type[C1] promotion[C2] demotion[--] latency[000] usage[00083320]
   C2:                  type[C2] promotion[C3] demotion[C1] latency[001] usage[00086489]
  *C3:                  type[C3] promotion[--] demotion[C2] latency[065] usage[04195414]
jayeola@00:22:39$ cat /proc/acpi/processor/CPU/throttling
state count:             8
active state:            T0
states:
  *T0:                  00%
   T1:                  12%
   T2:                  25%
   T3:                  37%
   T4:                  50%
   T5:                  62%
   T6:                  75%
   T7:                  87%

/proc/acpi/thermal_zone/

jayeola@00:23:19$ l -R /proc/acpi/thermal_zone/
thermal_zone/:
THM0
thermal_zone/THM0:
cooling_mode  polling_frequency  state  temperature  trip_points
jayeola@00:24:12$ cat /proc/acpi/thermal_zone/cooling_mode
<setting not supported>
cooling mode:   passive
jayeola@00:24:15$ cat /proc/acpi/thermal_zone/polling_frequency
<polling disabled>
jayeola@00:24:32$ cat /proc/acpi/thermal_zone/state
state:                   ok
jayeola@00:24:51$ cat /proc/acpi/thermal_zone/temperature
temperature:             50 C
jayeola@00:25:00$ cat /proc/acpi/thermal_zone/trip_points
critical (S5):           97 C
passive:                 92 C: tc1=5 tc2=3 tsp=600 devices=0xd7fed820

Possibly an upper temperature beyond which the machine is switched off?

/proc/acpi/video/

jayeola@00:26:02$ l -R /proc/acpi/video/
video/:
VID
video/VID:
CRT0  DOS  info  LCD0  POST  POST_info  ROM  TV0
video/VID/CRT0:
brightness  EDID  info  state
video/VID/LCD0:
brightness  EDID  info  state
video/VID/TV0:
brightness  EDID  info  state
jayeola@00:27:20$ cat /proc/acpi/video/VID/DOS
DOS setting: <1>
jayeola@00:28:12$ cat /proc/acpi/video/VID/info
Switching heads:              yes
Video ROM:                    no
Device to be POSTed on boot:  no
jayeola@00:28:31$ cat /proc/acpi/video/VID/POST
<not supported>
jayeola@00:28:54$ cat /proc/acpi/video/VID/POST_info
<not supported>
jayeola@00:28:59$ cat /proc/acpi/video/VID/ROM
<TODO>
jayeola@00:29:22$ cat /proc/acpi/video/VID/CRT0/
brightness  EDID        info        state
jayeola@00:29:22$ cat /proc/acpi/video/VID/CRT0/brightness
<not supported>
jayeola@00:29:43$ cat /proc/acpi/video/VID/CRT0/EDID
#nothing happens
jayeola@00:29:52$ cat /proc/acpi/video/VID/CRT0/info
device_id:    0x0100
type:         CRT
known by bios: no
jayeola@00:29:57$ cat /proc/acpi/video/VID/CRT0/state
state:     0x0d
query:     0x00
jayeola@00:30:02$ cat /proc/acpi/video/VID/LCD0/info
device_id:    0x0110
type:         UNKNOWN
known by bios: no
jayeola@00:31:00$ cat /proc/acpi/video/VID/LCD0/brightness
<not supported>
jayeola@00:31:49$ cat /proc/acpi/video/VID/TV0/
brightness  EDID        info        state
jayeola@00:31:49$ cat /proc/acpi/video/VID/TV0/brightness
<not supported>
jayeola@00:32:16$ cat /proc/acpi/video/VID/TV0/info
device_id:    0x0200
type:         TVOUT
known by bios: no
jayeola@00:32:27$ cat /proc/acpi/video/VID/TV0/state
state:     0x1d
query:     0x00
Personal tools