Latest working kernel version: unknown, maybe not a regression Earliest failing kernel version: Distribution: Gentoo Hardware Environment: Acer Aspire 2000 Laptop Software Environment: Problem Description: Hi all, when booting my laptop the state of the ac_adapter appears to be off. I think it's off because when e2fsck is called (and when the time for a file system check has come) it defers the check thinking the laptop's running on battery. I put [options] defer_check_on_battery = false in /etc/e2fsck.conf but that means that the check will happen anyway, but I like the idea of the defer_check_on_battery feature and would like to use it. Is there something that can be done to set the state of ac_adapter earlier? Kind regards Sebastian
Created attachment 16892 [details] acpidump.txt
Created attachment 16893 [details] dmesg-s64000.txt
Hi, Sebastian Do you mean that the AC adapter appears to be off although it is present? From the attached acpidump it seems that it is related with the bios. The status of AC adapter is gotten by evaluating the following object(_PSR) > Method (_PSR, 0, NotSerialized) { If (LAnd (\_SB.PCI0.LPC0.EC0.ECOK, LEqual (ECDY, 0x00))) { If (\_SB.PCI0.LPC0.EC0.BTCH) { Return (0x01) } If (\_SB.PCI0.LPC0.EC0.BDCH) { Return (0x00) } Return (0x01) } Else { Return (0x00) } } In the boot phase the initial value of ECDY is 0x03. In such case the _PSR object will return 0, which means that ac adapter is absent. If ECDY is decreased to zero in the _BST object of battery device, the _PSR ojbect can return the correct status of AC adapter. >Method (_BST, 0, NotSerialized) { Store ("==Main Battery Status _BST==", Debug) If (LGreater (ECDY, 0x00)) { Decrement (ECDY) Notify (\_SB.PCI0.LPC0.BAT1, 0x81) } Will you please check whether the AC adapter is still off after catting /proc/acpi/battery/BAT1/states several times? (At lease three times). Thanks.
Created attachment 16983 [details] Try the customed DSDT Will you please try the custom DSDT to see whether the status of AC adapter is correct? How to use the custom DSDT can be found in http://www.lesswatts.org/projects/acpi/faq.php Will you please attach the output of dmesg? Thanks.
Hello ykzhao, whenever I cat the state file _after_ booting the ac_adapter is indicated as present: sk@jigsaw:/proc/acpi/battery/BAT1$ cat /proc/acpi/battery/BAT1/state present: yes capacity state: ok charging state: charged present rate: 0 mA remaining capacity: 2218 mAh present voltage: 16574 mV sk@jigsaw:/proc/acpi/battery/BAT1$ cat /proc/acpi/ac_adapter/ACAD/state state: on-line With regards to the DSDT please give me a while. I switched to Ubuntu a few days ago and I have to figure out how to foist a modified DSDT on the Ubuntu kernel. Anyway, thanks for taking the time! Kind regards Sebastian
Is that a complete DSDT? The ones I looked at earlier were "bigger" ...
Created attachment 16988 [details] dmesg-default-dsdt.txt.bz2 Here's my dmesg output with the default DSDT. When the ac adapter ACPI driver is loaded the initial state is off-line although the adapter is plugged in and powered: bzcat dmesg-default-dsdt.txt.bz2 |grep -i adap [ 24.433369] ACPI: AC Adapter [ACAD] (off-line)
With Gentoo I only had had to change the file /etc/e2fsck.conf. With Ubuntu I had to work around two init script hooks in /etc/init.d/checkroot.sh and /etc/init.d/checkfs.sh that call the script "on_ac_power" (which of course says that my laptop isn't running on AC although it is). :p
Created attachment 16999 [details] try the custom DSDT Sorry that I attached the incorrect file. It should be DSDT.dsl but I attached DBGP.dsl. Will you please try again? Thanks.
Created attachment 17001 [details] dmesg-ykzhao.txt.bz2 Hello Yakui, thanks! Tried your DSDT and now it works, status for the ac adapter is correct while plugged _and_ unplugged. Is this something that could go into the mainline kernel as a quirk so anybody who wants the fix doesn't have to setup a fixed DSDT? Kind regards
Method (_BST, 0, NotSerialized) { Store ("==Main Battery Status _BST==", Debug) If (LGreater (ECDY, 0x00)) { Decrement (ECDY) Notify (\_SB.PCI0.LPC0.BAT1, 0x81) } IMO, the value of ECDY is really meaningless in this BIOS, and we can reset it to 0 freely. But I'm afraid it's hard to get it fixed in the upstream kernel as 1. it's a BIOS issue. 2. a possible workaround is to evaluate _BST method for 3 times when Linux tries to get the AC state for the first time. but unfortunately mixing up two drivers won't be accepted by upstream kernel. :( so please make sure if you're using the latest BIOS release. If yes, either you can use the customized DSDT or Yakui can generate a patch for you to workaround this issue, which will not be upstream.
Hi, Sebastian Thanks for the test. Now it is very clear that it is a BIOS issue . And what Rui said in comment #11 is right. Mixing up two drivers won't be accepted by upstream kernel. This bug had better be fixed by upgrading BIOS. Of course you can use the custom DSDT or read the status of the battery three times in init script(the time interval between two reading is at least 1 second). IMO it is not reasonable to fix it by workaround patch. Thanks.
Hello Zhang and Yakui! You're right. It's an old laptop anyway so I guess not many people use it. It is the latest BIOS, but using the fixed DSDT is fine with me. Thanks again for fixing it and taking the time! Kind regards Sebastian