Bug 19022

Summary: Kontron COMExpress-PC battery hotplugging not working
Product: ACPI Reporter: Marc Ferland (marc.ferland)
Component: Power-BatteryAssignee: Zhang Rui (rui.zhang)
Status: REJECTED DOCUMENTED    
Severity: normal CC: rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35.4 Subsystem:
Regression: No Bisected commit-id:
Attachments: disassmebled DSDT
ADP1 info plugged
ADP1 info unplugged
acpidump
battery info (no battery present)
battery info (one battery present)
battery info (two battery present)
BIOS decode
dmesg with i2c-i820
dmesg with i2c-scim
dmidecode
lspci -v output
lspci -vxxx output
acpi-interrupt-1
acpi-interrupt-2
dmesg
interrupts-1
interrupts-2
dmesg60

Description Marc Ferland 2010-09-24 14:35:50 UTC
I am working on a Kontron COMExpress-PC computer on module board. This board uses the MARS smart battery system from Kontron.

The status of the batteries is not updated when plugging or unplugging a battery.

I have to manually poll the /proc interface for update to happen. Batteries are correctly detected at boot time but not after unless I read /proc/acpi/battery/BAT[12]/*. 

From the MARS documentation users guide, I see that the COM SM-Bus is connected to the smart battery system manager which is an LTC1760 chip.

I've tried with different acpi_os_name and acpi_os with no luck.

I've also tried putting some printk's in the acpi_battery_notify and I can confirm that it is never called.

I've also noticed that the i2c-i820 module conflicts with a region claimed by ACPI. This region seems to be related to the battery system. Disabling the module removes the message but the batteries still aren't working as expected (I will put the dmesg of the kernel configured with i2c-i820 and i2c-scim).

See attached files for more information.
Comment 1 Marc Ferland 2010-09-24 14:40:21 UTC
Created attachment 31292 [details]
disassmebled DSDT
Comment 2 Marc Ferland 2010-09-24 14:41:27 UTC
Created attachment 31302 [details]
ADP1 info plugged
Comment 3 Marc Ferland 2010-09-24 14:41:50 UTC
Created attachment 31312 [details]
ADP1 info unplugged
Comment 4 Marc Ferland 2010-09-24 14:42:16 UTC
Created attachment 31322 [details]
acpidump
Comment 5 Marc Ferland 2010-09-24 14:43:01 UTC
Created attachment 31332 [details]
battery info (no battery present)
Comment 6 Marc Ferland 2010-09-24 14:43:25 UTC
Created attachment 31342 [details]
battery info (one battery present)
Comment 7 Marc Ferland 2010-09-24 14:43:48 UTC
Created attachment 31352 [details]
battery info (two battery present)
Comment 8 Marc Ferland 2010-09-24 14:44:15 UTC
Created attachment 31362 [details]
BIOS decode
Comment 9 Marc Ferland 2010-09-24 14:45:17 UTC
Created attachment 31372 [details]
dmesg with i2c-i820
Comment 10 Marc Ferland 2010-09-24 14:45:55 UTC
Created attachment 31382 [details]
dmesg with i2c-scim
Comment 11 Marc Ferland 2010-09-24 14:46:15 UTC
Created attachment 31392 [details]
dmidecode
Comment 12 Marc Ferland 2010-09-24 14:46:57 UTC
Created attachment 31402 [details]
lspci -v output
Comment 13 Marc Ferland 2010-09-24 14:47:22 UTC
Created attachment 31412 [details]
lspci -vxxx output
Comment 14 Zhang Rui 2010-09-27 02:27:03 UTC
please boot with the latest upstream kernel,
and do the following test:
1. echo 1 > /sys/module/acpi/aml_debug_output && dmesg -c
2. cat /proc/interrupts > interrupts-1 && grep . /sys/firmware/acpi/interrupts/* > acpi-interrupt-1
3. unplug or plug the battery
4. cat /proc/interrupts > interrupts-2 && grep . /sys/firmware/acpi/interrupts/* > acpi-interrupt-2 && dmesg > dmesg

and attach these five files here.
Comment 15 Marc Ferland 2010-09-27 15:55:02 UTC
Created attachment 31612 [details]
acpi-interrupt-1
Comment 16 Marc Ferland 2010-09-27 15:55:23 UTC
Created attachment 31622 [details]
acpi-interrupt-2
Comment 17 Marc Ferland 2010-09-27 15:55:47 UTC
Created attachment 31632 [details]
dmesg
Comment 18 Marc Ferland 2010-09-27 15:56:08 UTC
Created attachment 31642 [details]
interrupts-1
Comment 19 Marc Ferland 2010-09-27 15:56:28 UTC
Created attachment 31652 [details]
interrupts-2
Comment 20 Marc Ferland 2010-09-27 16:05:03 UTC
Created attachment 31662 [details]
dmesg60

A series of ACPI debug messages keep popping up in the log. See the attachment for an example.
Comment 21 Zhang Rui 2010-09-29 03:01:32 UTC
Bad news.
There is no interrupt when plugging/unplugging the battery...
By reading the AML code, GPE 07 should be fired when AC/Battery is plugged/unplugged, but it doesn't. I guess the AC adapter status is not changed neither when AC is plugged/unplugged, right?

This seems like an firmware problem to me and we can do nothing in Linux kernel to fix/workaround this.
BTW: IMO, windows should have the same problem. It would be great if you can verify this.
Comment 22 Marc Ferland 2010-09-29 15:55:50 UTC
(In reply to comment #21)
> Bad news.
> There is no interrupt when plugging/unplugging the battery...
> By reading the AML code, GPE 07 should be fired when AC/Battery is
> plugged/unplugged, but it doesn't. I guess the AC adapter status is not
> changed
> neither when AC is plugged/unplugged, right?
> 
Right plugging/unplugging the AC doesn't change it's status.

> This seems like an firmware problem to me and we can do nothing in Linux
> kernel
> to fix/workaround this.
> BTW: IMO, windows should have the same problem. It would be great if you can
> verify this.

The board manufacturer says it should work under windows but I haven't tested it.