Bug 60765

Summary: Asus L4R: Battery is not detected because a parsing error
Product: ACPI Reporter: Daniele Esposti (expo)
Component: ECAssignee: Lan Tianyu (tianyu.lan)
Status: CLOSED CODE_FIX    
Severity: normal CC: expo, tianyu.lan
Priority: P1    
Hardware: i386   
OS: Linux   
Kernel Version: 3.8.14 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg
ACPI dump
dmesg 3.11-rc6
dmesg 3.11-rc6 with EC debug on
dmesg 3.11 with log_buf_len=1M
ec.patch
dmidecode
debug.patch

Description Daniele Esposti 2013-08-18 18:36:06 UTC
Created attachment 107237 [details]
dmesg

The battery on a Asus L4R laptop is not detected because the following error:

    ACPI Error: Method parse/execution failed [\_SB_.PCI0.BAT0._STA] (Node f5426600), AE_TIME (20121018/psparse-537)
Comment 1 Lan Tianyu 2013-08-19 01:37:47 UTC
Please try latest v3.11-rc6 kernel and provide the output of acpidump.
Comment 2 Daniele Esposti 2013-08-20 20:29:46 UTC
With kernel 3.11-rc6 the error now is:

    ACPI Error: Method parse/execution failed [\_SB_.PCI0.BAT0._STA] (Node f5827600), AE_TIME (20130517/psparse-536)
Comment 3 Daniele Esposti 2013-08-20 20:30:20 UTC
Created attachment 107255 [details]
ACPI dump
Comment 4 Daniele Esposti 2013-08-20 20:31:06 UTC
Created attachment 107256 [details]
dmesg 3.11-rc6
Comment 5 Lan Tianyu 2013-08-21 01:42:59 UTC
[    1.124009] ACPI: EC: input buffer is not empty, aborting transaction

This is caused by EC. So please apply the following patch and test again. Attach the dmesg.

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d45b287..34189f4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -27,7 +27,7 @@
  */

 /* Uncomment next line to get verbose printout */
-/* #define DEBUG */
+#define DEBUG

 #include <linux/kernel.h>
 #include <linux/module.h>
Comment 6 Daniele Esposti 2013-08-21 11:46:19 UTC
Created attachment 107270 [details]
dmesg 3.11-rc6 with EC debug on
Comment 7 Lan Tianyu 2013-08-22 02:26:26 UTC
Ok. The log shows EC doesn't work at the start time. I can't see the whole log.
Please add kernel param "log_buf_len=1M" and attach dmesg again.

You also can try making the battery driver as module and check whether this can work.
Comment 8 Daniele Esposti 2013-08-22 21:02:12 UTC
Created attachment 107283 [details]
dmesg 3.11 with log_buf_len=1M

Set log_buf_len=1M and build battery driver as module
Comment 9 Lan Tianyu 2013-08-23 06:45:02 UTC
Created attachment 107287 [details]
ec.patch

Please provide the output of dmidecode and try this patch.
Comment 10 Daniele Esposti 2013-08-23 18:44:28 UTC
Created attachment 107292 [details]
dmidecode

With the previous patch the battery is now finally detected. 

I'm attaching the output of dmidecode anyway
Comment 11 Lan Tianyu 2013-08-24 13:32:36 UTC
Created attachment 107297 [details]
debug.patch

Please test this patch. Thanks.
Comment 12 Daniele Esposti 2013-08-24 19:07:04 UTC
Do I need to apply this patch over the previous ec.c patch?
Comment 13 Lan Tianyu 2013-08-25 03:10:15 UTC
No, just apply the patch in the comment 11.
Comment 14 Daniele Esposti 2013-08-25 10:46:57 UTC
Whit just the debug.patch the battery is detected fine
Comment 15 Lan Tianyu 2013-08-26 05:27:53 UTC
The fix patch has been sent to ACPI maillist.
https://patchwork.kernel.org/patch/2849363/
Comment 16 Lan Tianyu 2013-09-05 01:31:59 UTC
This patch has been merged into linux upstream tree.

commit: 524f42fab787a9510be826ce3d736b56d454ac6d

ACPI / EC: Add ASUSTEK L4R to quirk list in order to validate ECDT
The ECDT of ASUSTEK L4R doesn't provide correct command and data
I/O ports.  The DSDT provides the correct information instead.

For this reason, add this machine to quirk list for ECDT validation
and use the EC information from the DSDT.

[rjw: Changelog]
References: https://bugzilla.kernel.org/show_bug.cgi?id=60765
Reported-and-tested-by: Daniele Esposti <expo@expobrain.net>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Cc: All <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>