Latest working kernel version: NONE Earliest failing kernel version: 2.6.25 Distribution: Fedora 9 (All updates installed) Hardware Environment: lspci output: http://wklej.org/id/18142/ Software Environment: lsmod output: http://wklej.org/id/18141/ dmesg output: http://wklej.org/id/18144/ acpidump output: http://wklej.org/id/18154/ Problem Description: Event "ac_adapter ACAD 00000080 00000000" doesn't appear in output of acpi_listen when I unplug AC adapter. After several plug in and plug out event appears. For example: battery BAT0 00000080 00000001 battery BAT0 00000081 00000001 ac_adapter ACAD 00000080 00000001 battery BAT0 00000080 00000001 battery BAT0 00000080 00000001 battery BAT0 00000081 00000001 battery BAT0 00000080 00000001 ac_adapter ACAD 00000080 00000001 battery BAT0 00000080 00000001 battery BAT0 00000081 00000001 battery BAT0 00000080 00000001 battery BAT0 00000080 00000001 battery BAT0 00000081 00000001 ac_adapter ACAD 00000080 00000001 battery BAT0 00000080 00000001 ac_adapter ACAD 00000080 00000000 battery BAT0 00000080 00000001 Exept it value of /sys/class/power_supply/ACAD/online is still "1", but value of /proc/acpi/ac_adapter/ACAD/state is "off-line". My notebook is HP Pavilion dv6700t us. I have latest BIOS from HP website. This problem appeared also in Gentoo (gentoo-sources) and ARCH. Steps to reproduce: Start up acpi_listen command and plug out AC adapter.
From the problemd description it seems that there exists the ACPI event when AC adapter is pluged. The problem is that there is no ACPI event when AC adapter is unplugged. Will you please enable the CONFIG_ACPI_DEBUG in kernel configuration and do the following test? a. echo 0x030004 > /sys/module/acpi/parameters/debug_layer ; echo 0x1F > /sys/module/acpi/parameters/debug_level b. kill the process which is using the /proc/acpi/event(use the command of "lsof /proc/acpi/event" to get the process ID). c. cat /proc/acpi/event >event_log and don't press CTRL+C until the step d is finished d. plug/unplug the AC adapter three times After the test, please attach the output of dmesg, event_log Thanks.
Created attachment 18883 [details] patch: update AC status in sysfs I/F (In reply to comment #0) > Exept it value of /sys/class/power_supply/ACAD/online is still "1", but value > of /proc/acpi/ac_adapter/ACAD/state is "off-line". AC status in sysfs I/F is not updates in time. please try this patch to see if this problem is fixed
(In reply to comment #1) > From the problemd description it seems that there exists the ACPI event when > AC > adapter is pluged. The problem is that there is no ACPI event when AC adapter > is unplugged. > Will you please enable the CONFIG_ACPI_DEBUG in kernel configuration and > do > the following test? > a. echo 0x030004 > /sys/module/acpi/parameters/debug_layer ; echo 0x1F > > /sys/module/acpi/parameters/debug_level > b. kill the process which is using the /proc/acpi/event(use the command of > "lsof /proc/acpi/event" to get the process ID). > c. cat /proc/acpi/event >event_log and don't press CTRL+C until the step d > is finished > d. plug/unplug the AC adapter three times > > After the test, please attach the output of dmesg, event_log > Thanks. > > event_log output: http://wklej.org/id/19147/ dmesg output: http://wklej.org/id/19148/ debug_level: http://wklej.org/id/19149/ (should ACPI_LV_EVENTS be enable?) I have started up test on 2.6.28-rc5. (In reply to comment #2) > Created an attachment (id=18883) [details] > patch: update AC status in sysfs I/F > > (In reply to comment #0) > > Exept it value of /sys/class/power_supply/ACAD/online is still "1", but > value > > of /proc/acpi/ac_adapter/ACAD/state is "off-line". > AC status in sysfs I/F is not updates in time. > please try this patch to see if this problem is fixed > Compilation with this patch on kernels 2.6.28-rc5 and 2.6.27-r5 have failed. I forgot add, that this error appears only, when the event doesn't appear (I'am sorry). CC drivers/acpi/thermal.o CC drivers/acpi/power.o CC drivers/acpi/system.o CC drivers/acpi/event.o CC drivers/acpi/debug.o CC drivers/acpi/numa.o CC drivers/acpi/cm_sbs.o LD drivers/acpi/built-in.o CC [M] drivers/acpi/ac.o drivers/acpi/ac.c: In function ‘get_ac_property’: drivers/acpi/ac.c:107: warning: ISO C90 forbids mixed declarations and code drivers/acpi/ac.c:111: error: implicit declaration of function ‘acpi_ac_get_state’ drivers/acpi/ac.c: At top level: drivers/acpi/ac.c:128: error: static declaration of ‘acpi_ac_get_state’ follows non-static declaration drivers/acpi/ac.c:111: error: previous implicit declaration of ‘acpi_ac_get_state’ was here make[2]: *** [drivers/acpi/ac.o] Błąd 1 make[1]: *** [drivers/acpi] Błąd 2 make: *** [drivers] Błąd 2
Created attachment 18900 [details] refreshed patch please try this one. :)
Hi, Lukasz Thanks for the test. From the event_log in comment #3 it seems that the AC event is reported correctly after the AC adapter is plugged out. What is the problem about your laptop? Is no AC event reported after unplugging the AC adapter? Or the problem is that the AC status can't be reflected by the sys I/F interface? In fact this issue will exist only when sometimes no AC event is reported. Of course the issue can be fixed by the patch in comment #5. Will you please confirm the problem again? Thanks.
(In reply to comment #5) > Created an attachment (id=18900) [details] > refreshed patch > > please try this one. :) > It seems to work every time, even when it doesn't have event "ac_adapter ACAD 00000080 00000000" when ac_adapter is pluged out. Thanks you very much :) (In reply to comment #6) > Hi, Lukasz > Thanks for the test. From the event_log in comment #3 it seems that the > AC > event is reported correctly after the AC adapter is plugged out. > What is the problem about your laptop? Is no AC event reported after > unplugging the AC adapter? > Or the problem is that the AC status can't be reflected by the sys I/F > interface? In fact this issue will exist only when sometimes no AC event is > reported. Of course the issue can be fixed by the patch in comment #5. > Will you please confirm the problem again? > Thanks. > Yes, AC event is not reported by acpi_listen (acpid package) after unplugging AC adapter, but values of /sys/class/power_supply/ACAD/online and /proc/acpi/ac_adapter/ACAD/state are changed (from 1 to 0 and from on-line to off-line). I thnik it isn't problem with my laptop. It could be bug in acpid?
I forget to add. Patch works with 2.6.28-rc5, I will try it with 2.6.27.5. Will the patch be add to mainline of kernel?
and Issue most often appears after system start up and not always. Sometimes everything works perfectly, but sometimes event appears seldom.
Patch works with kernel 2.6.27.5.
patch in comment #5 is sent to ACPI mail list and I think it can be upstream soon. so let's focus on the "lack of AC event" problem. please 0. attach the acpidump output. 1. echo 0x44 > /sys/module/acpi/parameters/debug_layer 2. echo 0x88000007 > /sys/module/acpi/parameters/debug_level 3. run acpi_listen 4. dmesg -c 5. plug/unplug the AC adapter 6. attach the dmesg output in these two cases, a) no AC event reported by acpi_listen b) AC event reported by acpi_listen BTW: remember to run dmesg -c before each time you plug/unplug the AC adapter. BTW: in order to get the acpidump output, you can use the latest pmtools at http://www.lesswatts.org/downloads/#acpi
acpidump output: http://wklej.org/id/19799/ (20071116 version, from fedora repo) dmesg output before unplug: http://wklej.org/id/19810/ dmesg output after unplug (no event): http://wklej.org/id/19801/ dmesg output afrer plug: http://wklej.org/id/19803/ I add extra (It may be helpful): dmesg output after unplug (event): http://wklej.org/id/19804/ (After several unplug/plug) acpi_listen output: http://wklej.org/id/19806/
Plain text: acpidump output: http://wklej.org/id/19799/txt dmesg output after unplug (no event): http://wklej.org/id/19810/txt dmesg output after plug: http://wklej.org/id/19803/txt dmesg output after unplug (event): http://wklej.org/id/19804/txt acpi_listen output: http://wklej.org/id/19806/txt
Created attachment 19010 [details] customized DSDT: debug info for EC please rebuild the kernel with this customized DSDT and with CONFIG_ACPI_DEBUG set. please re-do the tests and attach the dmesg output. how to override a DSDT can be found at: http://www.lesswatts.org/projects/acpi/overridingDSDT.php
outputs: acpidump: http://wklej.org/id/22222/txt dmesg before unplug: http://wklej.org/id/22224/txt dmesg after unplug (no event): http://wklej.org/id/22226/txt dmesg after unplug (event): http://wklej.org/id/22228/txt dmesg after plug: http://wklej.org/id/22229/txt acpi_listen: http://wklej.org/id/22230/txt
weird, it seems that the customized DSDT is not applied, could you please attach the dmesg output after boot please? there should be something like "DSDT replaced by host OS" in the dmesg.
short output: (dmesg | grep DSDT) ACPI: DSDT BFED703C, 8BBC (r1 HP 30D2 6040000 INTL 20061109) ACPI: Override [DSDT-30D2 ], this is unsafe: tainting kernel ACPI: Table DSDT replaced by host OS ACPI: DSDT 00000000, 8C02 (r1 HP 30D2 6040000 INTL 20080729) ACPI: DSDT override uses original SSDTs unless "acpi_no_auto_ssdt" ACPI: EC: Look up EC in DSDT full output: http://wklej.org/id/22410/txt
okay, please "echo 0x03 > /sys/module/acpi/parameters/debug_level" "echo 0xffffffff > /sys/module/acpi/parameters/debug_layer" and then attach the 1.dmesg after unplug (no event) 2.dmesg after unplug (event)
no event: http://wklej.org/id/22456/txt event: http://wklej.org/id/22458/txt
from the dmesg attach above, whether the AC event is sent or not is determined by the switch "SW2S" in EC address space. And in some cases, when AC is unplugged, SW2S is still off and thus no AC event is sent out, and this is apparently wrong. Unfortunately, I don't know what SW2S stands for and when it should be set/cleared. IMO, this is rather a firmware issue than an Linux/ACPI bug. will you please upgrade your BIOS and see if it's fixed? BTW, we can workaround this problem easily by using a customized DSDT, if there is no BIOS upgrade.
Created attachment 19084 [details] customized DSDT: always send AC notifications this can workaround the problem for you
I am facing the same problem with my HP dv6500t, adapter disconnect is detected intermittently. Could you possibly post a diff of the two .dsl files so that I can patch my own file ?
In the _Q20 method, @@ -7100,8 +7101,8 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, If (And (0x02, BATF)) { Notify (\_PR.CPU0, 0x80) - Notify (ACAD, 0x80) } + Notify (ACAD, 0x80) Notify (BAT0, 0x80) BPOL (0x05) I don't know if this works for you or not. please attach the acpidump output of your laptop.
Created attachment 20590 [details] acpidump acidump output
patch seems to work for me. original failure was intermittent for me, sometimes the adapter disconnect was detected, sometimes not so can't comment for sure without observing for a more extended period of time.
fixed for me