2006-02-05 18:28:19

by Gerhard Schrenk

[permalink] [raw]
Subject: EC interrupt mode by default breaks power button and lid button

Hi,

the following commit breaks power button and lid button on my centrino
notebook (MSI S260; branded as Medion SIM S2100).

|gps@medusa:~/scratch/kernel-tree$ git bisect good
|53f11d4ff8797bcceaf014e62bd39f16ce84baec is first bad commit
|diff-tree 53f11d4ff8797bcceaf014e62bd39f16ce84baec (from 02b28a33aae93a3b53068e0858d62f8bcaef60a3)
|Author: Len Brown <[email protected]>
|Date: Mon Dec 5 16:46:36 2005 -0500
|
| [ACPI] Enable Embedded Controller (EC) interrupt mode by default
|
| "ec_intr=0" reverts to polling
| "ec_burst=" no longer exists.
|
| Signed-off-by: Len Brown <[email protected]>
| Acked-by: Luming Yu <[email protected]>
|
|:040000 040000 9eec66712c68ebe372b2fb2c8d78bdc99df942ab e7e62cd09983730aee468edd4ba1cce50786b7e5 M Documentation
|:040000 040000 6e7db46918f6124f64a11f6757560078a8a27519 aa8abb1023024902300cb2e7a5bf74acd8c579e8 M drivers

With

git revert 53f11d4ff8797bcceaf014e62bd39f16ce84baec

on top of linus' tree I have no problems with power/lid buttons and my
acpid configuration.

Suspend to disk/mem (at least for some seconds/minutes thereafter) with
an unpatched kernel from linus' tree is another possibility to bring
power/lid events back to life.

On my debian (etch) system I have following acpid(?) 1.0.4-3 configuration:

|gps@medusa$ cat /etc/acpi/events/my_lid
|event=button[ /]lid
|action=/etc/acpi/actions/my_lid.sh %e

|gps@medusa:~$ cat /etc/acpi/actions/my_lid.sh
|#!/bin/sh
|# lid button pressed/released event handler
|
|# echo "lid-event" | wall
|echo platform > /sys/power/disk
|echo disk > /sys/power/state

|gps@medusa:~$ cat /etc/acpi/events/powerbtn
|event=button[ /]power
|action=/etc/acpi/actions/my_powerbtn.sh

|gps@medusa:~$ cat /etc/acpi/actions/my_powerbtn.sh
|#!/bin/sh
|# suspend to disk (hybernation) when the power button has been pressed
|# echo "power-button-event" | wall
|echo mem > /sys/power/state

-- Gerhard


2006-02-06 07:37:57

by Luming Yu

[permalink] [raw]
Subject: RE: EC interrupt mode by default breaks power button and lid button

Please don't revert that patch, and test kernel parameter ec_intr=0
Also, please send me acpidump output.

I'm wondering how ec interrupt mode breaks power & lid button.

Thanks
Luming

>-----Original Message-----
>From: Gerhard Schrenk [mailto:[email protected]]
>Sent: 2006??2??6?? 2:04
>To: Brown, Len
>Cc: Yu, Luming; [email protected]
>Subject: EC interrupt mode by default breaks power button and
>lid button
>
>Hi,
>
>the following commit breaks power button and lid button on my centrino
>notebook (MSI S260; branded as Medion SIM S2100).
>
>|gps@medusa:~/scratch/kernel-tree$ git bisect good
>|53f11d4ff8797bcceaf014e62bd39f16ce84baec is first bad commit
>|diff-tree 53f11d4ff8797bcceaf014e62bd39f16ce84baec (from
>02b28a33aae93a3b53068e0858d62f8bcaef60a3)
>|Author: Len Brown <[email protected]>
>|Date: Mon Dec 5 16:46:36 2005 -0500
>|
>| [ACPI] Enable Embedded Controller (EC) interrupt mode by default
>|
>| "ec_intr=0" reverts to polling
>| "ec_burst=" no longer exists.
>|
>| Signed-off-by: Len Brown <[email protected]>
>| Acked-by: Luming Yu <[email protected]>
>|
>|:040000 040000 9eec66712c68ebe372b2fb2c8d78bdc99df942ab
>e7e62cd09983730aee468edd4ba1cce50786b7e5 M Documentation
>|:040000 040000 6e7db46918f6124f64a11f6757560078a8a27519
>aa8abb1023024902300cb2e7a5bf74acd8c579e8 M drivers
>
>With
>
> git revert 53f11d4ff8797bcceaf014e62bd39f16ce84baec
>
>on top of linus' tree I have no problems with power/lid buttons and my
>acpid configuration.
>
>Suspend to disk/mem (at least for some seconds/minutes thereafter) with
>an unpatched kernel from linus' tree is another possibility to bring
>power/lid events back to life.
>
>On my debian (etch) system I have following acpid(?) 1.0.4-3
>configuration:
>
>|gps@medusa$ cat /etc/acpi/events/my_lid
>|event=button[ /]lid
>|action=/etc/acpi/actions/my_lid.sh %e
>
>|gps@medusa:~$ cat /etc/acpi/actions/my_lid.sh
>|#!/bin/sh
>|# lid button pressed/released event handler
>|
>|# echo "lid-event" | wall
>|echo platform > /sys/power/disk
>|echo disk > /sys/power/state
>
>|gps@medusa:~$ cat /etc/acpi/events/powerbtn
>|event=button[ /]power
>|action=/etc/acpi/actions/my_powerbtn.sh
>
>|gps@medusa:~$ cat /etc/acpi/actions/my_powerbtn.sh
>|#!/bin/sh
>|# suspend to disk (hybernation) when the power button has
>been pressed
>|# echo "power-button-event" | wall
>|echo mem > /sys/power/state
>
>-- Gerhard
>

2006-02-06 13:38:44

by Gerhard Schrenk

[permalink] [raw]
Subject: Re: EC interrupt mode by default breaks power button and lid button

* Yu, Luming <[email protected]> [2006-02-06 13:35]:

> Please don't revert that patch, and test kernel parameter ec_intr=0

Yes, boot option ec_initr=0 helps power/lid buttons. (Tested with
yesterdays newest kernel from linus' tree.)

> Also, please send me acpidump output.

Attached. Generated with following error message

|gps@medusa:~$ sudo acpidump > acpidump.txt
|Wrong checksum for generic table!

I can only boot with pci=noacpi (or acpi=off). My current boot options are

|gps@medusa:~$ cat /proc/cmdline
|root=/dev/hda8 ro pci=noacpi resume=/dev/hda2 video=intelfb:mode=1280x800-32@60 ec_intr=0


Thanks,
-- Gerhard


BTW (I): With newest kernel. I believe since v2.6.16-rc2 rebooting ("sudo
reboot") my system fails/hangs somtimes. But thats not reproducible...

BTW (II): intelfb never worked for me. dmesg always says:

|gps@medusa:~$ dmesg | grep intelfb
|intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM chipsets
|intelfb: Version 0.9.2
|intelfb: 00:02.0: Intel(R) 915GM, aperture size 128MB, stolen memory 32636kB
|intelfb: Non-CRT device is enabled ( LVDS port ). Disabling mode switching.
|intelfb: Video mode must be programmed at boot time.



Attachments:
(No filename) (1.17 kB)
acpidump.txt (76.59 kB)
Download all attachments

2006-02-07 06:52:39

by Luming Yu

[permalink] [raw]
Subject: RE: EC interrupt mode by default breaks power button and lid button

>> Please don't revert that patch, and test kernel parameter ec_intr=0
>
>Yes, boot option ec_initr=0 helps power/lid buttons. (Tested with
>yesterdays newest kernel from linus' tree.)

Any difference with ec_initr=1 with this kernel ?
If pressing power button, can you see acpi interrupt increases?

2006-02-07 14:08:59

by Gerhard Schrenk

[permalink] [raw]
Subject: Re: EC interrupt mode by default breaks power button and lid button

* Yu, Luming <[email protected]> [2006-02-07 13:33]:
> >> Please don't revert that patch, and test kernel parameter ec_intr=0
> >
> >Yes, boot option ec_initr=0 helps power/lid buttons. (Tested with
> >yesterdays newest kernel from linus' tree.)
>
> Any difference with ec_initr=1 with this kernel ?

No. Neither powerbutton nor lidbutton works with ec_initr=1.

> If pressing power button, can you see acpi interrupt increases?

Where do I find this? Do you mean interrupt 9 "IO-APIC-edge acpi" in
/proc/interrupts?

With ec_initr=1 I don't see that interrupt 9 increases.

--- tmp/ec1/interrupts 2006-02-07 14:31:54.000000000 +0100
+++ tmp/ec1/interrupts-after-powerbutton 2006-02-07 14:33:07.000000000 +0100
@@ -1,10 +1,10 @@
CPU0
- 0: 42181 IO-APIC-edge timer
- 1: 446 IO-APIC-edge i8042
+ 0: 60423 IO-APIC-edge timer
+ 1: 676 IO-APIC-edge i8042
2: 0 XT-PIC cascade
9: 1 IO-APIC-edge acpi
- 12: 2177 IO-APIC-edge i8042
- 14: 6494 IO-APIC-edge ide0
+ 12: 3221 IO-APIC-edge i8042
+ 14: 6547 IO-APIC-edge ide0
16: 0 IO-APIC-level uhci_hcd:usb5, i915@pci:0000:00:02.0
17: 1 IO-APIC-level Intel ICH6, ipw2200
18: 0 IO-APIC-level uhci_hcd:usb4
@@ -12,6 +12,6 @@
20: 0 IO-APIC-level yenta, Intel ICH6 Modem
23: 0 IO-APIC-level ehci_hcd:usb1, uhci_hcd:usb2
NMI: 0
-LOC: 42140
+LOC: 60383
ERR: 0
MIS: 0


With ec_initr=1 /proc/acpi/button/lid/LID0/state seems to work sane:

gps@medusa:~$ cat /proc/acpi/button/lid/LID0/state # lid opened
state: open
gps@medusa:~$ sleep 5 && cat /proc/acpi/button/lid/LID0/state # closing lid quicker than 5 seconds
state: closed

With ec_initr=0 (and acpid *stopped*) I see interrupt 9 increases.

--- tmp/ec0/acpid-off/interrupts 2006-02-07 14:40:55.000000000 +0100
+++ tmp/ec0/acpid-off/interrupts-after-powerbutton 2006-02-07 14:42:13.000000000 +0100
@@ -1,10 +1,10 @@
CPU0
- 0: 27910 IO-APIC-edge timer
- 1: 375 IO-APIC-edge i8042
+ 0: 47228 IO-APIC-edge timer
+ 1: 599 IO-APIC-edge i8042
2: 0 XT-PIC cascade
- 9: 27 IO-APIC-edge acpi
- 12: 755 IO-APIC-edge i8042
- 14: 6259 IO-APIC-edge ide0
+ 9: 28 IO-APIC-edge acpi
+ 12: 2105 IO-APIC-edge i8042
+ 14: 6465 IO-APIC-edge ide0
16: 0 IO-APIC-level uhci_hcd:usb5, i915@pci:0000:00:02.0
17: 1 IO-APIC-level Intel ICH6, ipw2200
18: 0 IO-APIC-level uhci_hcd:usb4
@@ -12,6 +12,6 @@
20: 0 IO-APIC-level yenta, Intel ICH6 Modem
23: 0 IO-APIC-level ehci_hcd:usb1, uhci_hcd:usb2
NMI: 0
-LOC: 27872
+LOC: 47191
ERR: 0
MIS: 0

With ec_initr=0 and acpid *started* I see this change in /var/log/acpid

--- tmp/ec0/acpid-after-boot 2006-02-07 14:20:21.000000000 +0100
+++ tmp/ec0/acpid-after-powerbutton-and-lid-switch 2006-02-07 15:01:50.000000000 +0100
@@ -327,3 +327,20 @@
[Tue Feb 7 14:13:41 2006] exiting
[Tue Feb 7 14:18:44 2006] starting up
[Tue Feb 7 14:18:44 2006] 8 rules loaded
+[Tue Feb 7 14:20:25 2006] received event "button/power PWRF 00000080 00000001"
+[Tue Feb 7 14:20:25 2006] executing action "/etc/acpi/actions/my_powerbtn.sh"
+[Tue Feb 7 14:20:25 2006] BEGIN HANDLER MESSAGES
+[Tue Feb 7 14:20:37 2006] END HANDLER MESSAGES
+[Tue Feb 7 14:20:37 2006] action exited with status 0
+[Tue Feb 7 14:20:37 2006] completed event "button/power PWRF 00000080 00000001"
+[Tue Feb 7 14:23:20 2006] received event "button/lid LID0 00000080 00000001"
+[Tue Feb 7 14:23:20 2006] executing action "/etc/acpi/actions/lm_lid.sh button/lid LID0 00000080 00000001"
+[Tue Feb 7 14:23:20 2006] BEGIN HANDLER MESSAGES
+[Tue Feb 7 14:23:20 2006] END HANDLER MESSAGES
+[Tue Feb 7 14:23:20 2006] action exited with status 0
+[Tue Feb 7 14:23:20 2006] executing action "/etc/acpi/actions/my_lid.sh button/lid LID0 00000080 00000001"
+[Tue Feb 7 14:23:20 2006] BEGIN HANDLER MESSAGES
+[Tue Feb 7 14:24:27 2006] END HANDLER MESSAGES
+[Tue Feb 7 14:24:27 2006] action exited with status 0
+[Tue Feb 7 14:24:27 2006] completed event "button/lid LID0 00000080 00000001"

Hope this helps
-- Gerhard

2006-02-09 01:29:25

by Luming Yu

[permalink] [raw]
Subject: RE: EC interrupt mode by default breaks power button and lid button

It's interesting. Could you file a bug in ACPI category on
bugzilla.kernel.org?
I don't want it be lost, because it's so interesting.

BTW, does battery work?

Thanks,
Luming

>
>* Yu, Luming <[email protected]> [2006-02-07 13:33]:
>> >> Please don't revert that patch, and test kernel parameter
>ec_intr=0
>> >
>> >Yes, boot option ec_initr=0 helps power/lid buttons. (Tested with
>> >yesterdays newest kernel from linus' tree.)
>>
>> Any difference with ec_initr=1 with this kernel ?
>
>No. Neither powerbutton nor lidbutton works with ec_initr=1.
>
>> If pressing power button, can you see acpi interrupt increases?
>
>Where do I find this? Do you mean interrupt 9 "IO-APIC-edge acpi" in
>/proc/interrupts?
>
>With ec_initr=1 I don't see that interrupt 9 increases.
>
>--- tmp/ec1/interrupts 2006-02-07 14:31:54.000000000 +0100
>+++ tmp/ec1/interrupts-after-powerbutton 2006-02-07
>14:33:07.000000000 +0100
>@@ -1,10 +1,10 @@
> CPU0
>- 0: 42181 IO-APIC-edge timer
>- 1: 446 IO-APIC-edge i8042
>+ 0: 60423 IO-APIC-edge timer
>+ 1: 676 IO-APIC-edge i8042
> 2: 0 XT-PIC cascade
> 9: 1 IO-APIC-edge acpi
>- 12: 2177 IO-APIC-edge i8042
>- 14: 6494 IO-APIC-edge ide0
>+ 12: 3221 IO-APIC-edge i8042
>+ 14: 6547 IO-APIC-edge ide0
> 16: 0 IO-APIC-level uhci_hcd:usb5, i915@pci:0000:00:02.0
> 17: 1 IO-APIC-level Intel ICH6, ipw2200
> 18: 0 IO-APIC-level uhci_hcd:usb4
>@@ -12,6 +12,6 @@
> 20: 0 IO-APIC-level yenta, Intel ICH6 Modem
> 23: 0 IO-APIC-level ehci_hcd:usb1, uhci_hcd:usb2
> NMI: 0
>-LOC: 42140
>+LOC: 60383
> ERR: 0
> MIS: 0
>
>
>With ec_initr=1 /proc/acpi/button/lid/LID0/state seems to work sane:
>
>gps@medusa:~$ cat /proc/acpi/button/lid/LID0/state # lid opened
>state: open
>gps@medusa:~$ sleep 5 && cat /proc/acpi/button/lid/LID0/state
># closing lid quicker than 5 seconds
>state: closed
>
>With ec_initr=0 (and acpid *stopped*) I see interrupt 9 increases.
>
>--- tmp/ec0/acpid-off/interrupts 2006-02-07
>14:40:55.000000000 +0100
>+++ tmp/ec0/acpid-off/interrupts-after-powerbutton
>2006-02-07 14:42:13.000000000 +0100
>@@ -1,10 +1,10 @@
> CPU0
>- 0: 27910 IO-APIC-edge timer
>- 1: 375 IO-APIC-edge i8042
>+ 0: 47228 IO-APIC-edge timer
>+ 1: 599 IO-APIC-edge i8042
> 2: 0 XT-PIC cascade
>- 9: 27 IO-APIC-edge acpi
>- 12: 755 IO-APIC-edge i8042
>- 14: 6259 IO-APIC-edge ide0
>+ 9: 28 IO-APIC-edge acpi
>+ 12: 2105 IO-APIC-edge i8042
>+ 14: 6465 IO-APIC-edge ide0
> 16: 0 IO-APIC-level uhci_hcd:usb5, i915@pci:0000:00:02.0
> 17: 1 IO-APIC-level Intel ICH6, ipw2200
> 18: 0 IO-APIC-level uhci_hcd:usb4
>@@ -12,6 +12,6 @@
> 20: 0 IO-APIC-level yenta, Intel ICH6 Modem
> 23: 0 IO-APIC-level ehci_hcd:usb1, uhci_hcd:usb2
> NMI: 0
>-LOC: 27872
>+LOC: 47191
> ERR: 0
> MIS: 0
>
>With ec_initr=0 and acpid *started* I see this change in /var/log/acpid
>
>--- tmp/ec0/acpid-after-boot 2006-02-07 14:20:21.000000000 +0100
>+++ tmp/ec0/acpid-after-powerbutton-and-lid-switch
>2006-02-07 15:01:50.000000000 +0100
>@@ -327,3 +327,20 @@
> [Tue Feb 7 14:13:41 2006] exiting
> [Tue Feb 7 14:18:44 2006] starting up
> [Tue Feb 7 14:18:44 2006] 8 rules loaded
>+[Tue Feb 7 14:20:25 2006] received event "button/power PWRF
>00000080 00000001"
>+[Tue Feb 7 14:20:25 2006] executing action
>"/etc/acpi/actions/my_powerbtn.sh"
>+[Tue Feb 7 14:20:25 2006] BEGIN HANDLER MESSAGES
>+[Tue Feb 7 14:20:37 2006] END HANDLER MESSAGES
>+[Tue Feb 7 14:20:37 2006] action exited with status 0
>+[Tue Feb 7 14:20:37 2006] completed event "button/power PWRF
>00000080 00000001"
>+[Tue Feb 7 14:23:20 2006] received event "button/lid LID0
>00000080 00000001"
>+[Tue Feb 7 14:23:20 2006] executing action
>"/etc/acpi/actions/lm_lid.sh button/lid LID0 00000080 00000001"
>+[Tue Feb 7 14:23:20 2006] BEGIN HANDLER MESSAGES
>+[Tue Feb 7 14:23:20 2006] END HANDLER MESSAGES
>+[Tue Feb 7 14:23:20 2006] action exited with status 0
>+[Tue Feb 7 14:23:20 2006] executing action
>"/etc/acpi/actions/my_lid.sh button/lid LID0 00000080 00000001"
>+[Tue Feb 7 14:23:20 2006] BEGIN HANDLER MESSAGES
>+[Tue Feb 7 14:24:27 2006] END HANDLER MESSAGES
>+[Tue Feb 7 14:24:27 2006] action exited with status 0
>+[Tue Feb 7 14:24:27 2006] completed event "button/lid LID0
>00000080 00000001"
>
>Hope this helps
>-- Gerhard
>

2006-02-10 05:17:58

by Gerhard Schrenk

[permalink] [raw]
Subject: Re: EC interrupt mode by default breaks power button and lid button

* Yu, Luming <[email protected]> [2006-02-10 00:37]:

> It's interesting. Could you file a bug in ACPI category on
> bugzilla.kernel.org?

http://bugzilla.kernel.org/show_bug.cgi?id=6049

BTW with ec_initr=1 I cannot toggle the hardware based rf_kill (for ipw2200).
But with ec_initr=0 I can toggle it. This is reflected by the blue "WLAN" led and

/sys/devices/pci0000:00/0000:00:1e.0/0000:01:09.0/rf_kill

> BTW, does battery work?

Mmmh. I see interrupt 9 "IO-APIC-edge acpi" in /proc/interrupts
increase for ec_intr=0. But it seems to increase all the time so I'm not
sure if it's triggered by battery (un)plug events.

However I cannot see any acpid-events in /var/log/acpid with ec_initr=0 when
(un)plugging the battery. (battery was present and correctly detected on boot.)

For ec_intr=1 interrupt 9 "IO-APIC-edge acpi in /proc/interrupts is
definitely always constant to 1. No acpid-events, too.


Interestingly the following battery problem is independant of ec_intr:

/proc/acpi/battery/BAT1/{info,state} shows only sensible battery data, if the
battery was **present at boot time**. When unplugging the battery it still says
"present: yes" and /proc/acpi/battery/BAT1/info does not change at all.
/proc/acpi/battery/BAT1/state does change like this:

--- ec1-plugged-state 2006-02-10 04:40:54.000000000 +0100
+++ ec1-unplugged-state 2006-02-10 04:42:31.000000000 +0100
@@ -1,6 +1,6 @@
present: yes
capacity state: ok
-charging state: charging
-present rate: 1930 mA
-remaining capacity: 2433 mAh
-present voltage: 16202 mV
+charging state: charged
+present rate: unknown
+remaining capacity: unknown
+present voltage: 10000 mV


If the battery was **not present at boot time** and is plugged in *after* booting
the system, it will never be detected by /proc/acpi/battery/BAT1/{info,state}.
It always says "present: no". With Kernel v2.6.15 compiling the acpi drivers as modules, i.e.
CONFIG_ACPI_BATTERY=m and same fo other acpi drivers helps. But I have to

$ rmmod battery
$ modprobe battery

first. No chance with statically compiled acpi-drivers. :(

-- Gerhard

2006-02-11 10:33:37

by Jiri Slaby

[permalink] [raw]
Subject: RE: EC interrupt mode by default breaks power button and lid button

Luming Yu wrote:
>Please don't revert that patch, and test kernel parameter ec_intr=0
>Also, please send me acpidump output.
>
>I'm wondering how ec interrupt mode breaks power & lid button.
Hello, I have some problems too:
ACPI: write EC, IB not empty
ACPI: write EC, IB not empty
ACPI: write EC, IB not empty
ACPI Exception (evregion-0409): AE_TIME, Returned by Handler for [EmbeddedControl] [20060127]
ACPI Error (psparse-0517): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.RDC3] (Node ddf13fa8), AE_TIME
ACPI Error (psparse-0517): Method parse/execution failed [\ECIO] (Node ddf13628), AE_TIME
ACPI Error (psparse-0517): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.ACPS] (Node ddf11228), AE_TIME
ACPI Error (psparse-0517): Method parse/execution failed [\ACPS] (Node ddf0b368), AE_TIME
ACPI Error (psparse-0517): Method parse/execution failed [\_SB_.PCI0.AC0_._PSR] (Node ddf10228), AE_TIME
acpi_ac-0095 [10] ac_get_state : Error reading AC Adapter state

acpidump here:
http://www.fi.muni.cz/~xslaby/sklad/adump

dmesgs here:
http://www.fi.muni.cz/~xslaby/sklad/intr0 ec_intr=0
http://www.fi.muni.cz/~xslaby/sklad/intr1 ec_intr=1
http://www.fi.muni.cz/~xslaby/sklad/intrx without ec_intr param

acpi irqs with ec_intr1 increments by touching the button, but acpi_listen says
nothing.

I had to use ec_burst=1 in latest kernels, now there is no option such this.
I had to use patch from bug 4980 (if the number is correct), but they become to
kernel in 2.6.16-rc1-git8, so I tried rc2, but with this error.

regards,
--
Jiri Slaby http://www.fi.muni.cz/~xslaby
\_.-^-._ [email protected] _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E