Bug 15999 - Remaining capacity is unknown after boot when fully charged on Benq R55
Remaining capacity is unknown after boot when fully charged on Benq R55
Status: CLOSED INVALID
Product: ACPI
Classification: Unclassified
Component: Power-Battery
All Linux
: P1 normal
Assigned To: Zhang Rui
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-19 07:11 UTC by Vladislav Bogdanov
Modified: 2010-06-08 04:27 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.33.4
Tree: Fedora
Regression: Yes


Attachments
Patch to solve battery issue on Benq R55 (1.27 KB, patch)
2010-05-19 07:11 UTC, Vladislav Bogdanov
Details | Diff
dmesg output (41.31 KB, text/plain)
2010-05-19 07:12 UTC, Vladislav Bogdanov
Details
acpidump output (112.00 KB, text/plain)
2010-05-19 07:13 UTC, Vladislav Bogdanov
Details
'grep . /proc/acpi/battery/*/*' output (1.20 KB, text/plain)
2010-05-19 07:14 UTC, Vladislav Bogdanov
Details
'grep . /proc/acpi/battery/*/*' output after AC unplug (1.35 KB, text/plain)
2010-06-03 04:20 UTC, Vladislav Bogdanov
Details
custom UPBS method (3.26 KB, application/octet-stream)
2010-06-04 03:16 UTC, Zhang Rui
Details

Description Vladislav Bogdanov 2010-05-19 07:11:34 UTC
Created attachment 26432 [details]
Patch to solve battery issue on Benq R55

Everything worked fine on CentOS5 (2.6.18) but broke after upgrade to Fedora.
Now remaining capacity is shown as 'unknown' right after boot, but charging state is 'charged'. 
Attached patch solves problem (copies last full capacity to remaining capacity).
Comment 1 Vladislav Bogdanov 2010-05-19 07:12:46 UTC
Created attachment 26433 [details]
dmesg output
Comment 2 Vladislav Bogdanov 2010-05-19 07:13:22 UTC
Created attachment 26434 [details]
acpidump output
Comment 3 Vladislav Bogdanov 2010-05-19 07:14:00 UTC
Created attachment 26435 [details]
'grep . /proc/acpi/battery/*/*' output
Comment 4 Zhang Rui 2010-05-28 03:25:25 UTC
(In reply to comment #0)
> Everything worked fine on CentOS5 (2.6.18) but broke after upgrade to Fedora.
> Now remaining capacity is shown as 'unknown' right after boot, but charging
> state is 'charged'. 

So the problem only exists when AC is plugged and the battery is full charged, right?
Please unplug the AC for a while and attach the output of "grep . /proc/acpi/battery/*/*"
Comment 5 Vladislav Bogdanov 2010-06-03 04:20:29 UTC
Created attachment 26632 [details]
'grep . /proc/acpi/battery/*/*' output after AC unplug
Comment 6 Vladislav Bogdanov 2010-06-03 04:24:26 UTC
(In reply to comment #4)
> So the problem only exists when AC is plugged and the battery is full charged,
> right?
Yes. And only right after boot.
If I unplug AC for several seconds (until KDE powerdevil shows green dashes) and then plug it back, then battery capacity is detected correctly until next reboot in all states (charged,charging,discharging).
Attached is a battery state two seconds after AC unplug.
Comment 7 Zhang Rui 2010-06-04 02:58:39 UTC
This seems to be an AML code problem to me.

This is the package that contains the battery status.
            Name (PBST, Package (0x04)
            {
                0x00,
                0xFFFFFFFF,
                0xFFFFFFFF, /* battery remaining capacity */
                0x2710
            })

And this is the AML code that returns the battery remaining capacity,
                If (LEqual (Local1, 0x01))
                {
                    If (And (0x04, \_SB.PCI0.LPCB.EC0.BATF))
                    {
                        Store (\_SB.PCI0.LPCB.EC0.B1FC, Index (PBST, 0x02))
                    }
                    Else
                    {
                    }
                }
                Else
                {
                    Store (\_SB.PCI0.LPCB.EC0.MBRM, Index (PBST, 0x02))
                }
we can see that the battery remaining capacity field is not set in some cases(maybe the ACPI plugged && battery full charged case?)
And battery remaining capacity 0xFFFFFFFF may be reported to OS in this case.

To verify this, I'll attach a custom DSDT and it would be great if you can apply it and see if the problem goes away.
Comment 8 Zhang Rui 2010-06-04 03:16:17 UTC
Created attachment 26645 [details]
custom UPBS method

please boot a kernel that newer than 2.6.33.
mount debug fs.
run "cat custom_UPBS.hen > /sys/kernel/debug/acpi/custom_method".
and then see if the battery status is reported correctly.

custom UPBS ASL code:
DefinitionBlock ("", "UPBS", 1, "", "", 0x20080715)
{
  External (\_SB_.BAT1.PBST, PkgObj)
  External (\_SB_.POSW, MethodObj)
  External (\_SB.PCI0.LPCB.EC0.MCUR)
  External (\_SB.PCI0.LPCB.EC0.BFFG)
  External (\_SB.PCI0.LPCB.EC0.BATF)
  External (\_SB.PCI0.LPCB.EC0.B1FC)
  External (\_SB.PCI0.LPCB.EC0.MBRM)
  External (\_SB.PCI0.LPCB.EC0.BA1C)
  External (\_SB.CM26)
  External (\_SB.PCI0.LPCB.EC0.MBVG)
  External (\_SB.PCI0.LPCB.EC0.MBTC)

  Method (\_SB_.BAT1.UPBS, 0, NotSerialized)
  {
                Store (\_SB.PCI0.LPCB.EC0.MCUR, Local5)
                Store (POSW (Local5), Index (PBST, 0x01))
                Store (\_SB.PCI0.LPCB.EC0.BFFG, Local1)
                If (LEqual (Local1, 0x01))
                {
                        Store (\_SB.PCI0.LPCB.EC0.B1FC, Index (PBST, 0x02))
                }
                Else
                {
                    Store (\_SB.PCI0.LPCB.EC0.MBRM, Index (PBST, 0x02))
                }

                Store (\_SB.PCI0.LPCB.EC0.BA1C, Local1)
                Store (Local1, \_SB.CM26)
                Store (\_SB.PCI0.LPCB.EC0.MBVG, Index (PBST, 0x03))
                If (LNotEqual (Local5, 0x00))
                {
                    If (\_SB.PCI0.LPCB.EC0.MBTC)
                    {
                        Store (0x02, Index (PBST, 0x00))
                    }
                    Else
                    {
                        Store (0x01, Index (PBST, 0x00))
                    }
                }
                Else
                {
                    Store (0x00, Index (PBST, 0x00))
                }
  }
}
Comment 9 Vladislav Bogdanov 2010-06-05 06:56:16 UTC
Hi,

Are you sure about version?

[root@localhost debug]# uname -a
Linux localhost 2.6.34-20.fc14.i686.PAE #1 SMP Wed Jun 2 12:53:34 UTC 2010 i686 i686 i386 GNU/Linux
[root@localhost debug]# pwd
/sys/kernel/debug
[root@localhost debug]# LANG=C ls -l
total 0
drwxr-xr-x.  3 root root 0 Jun  5 09:45 ath5k
drwxr-xr-x. 35 root root 0 Jun  5 09:45 bdi
drwxr-xr-x.  3 root root 0 Jun  5 09:45 boot_params
drwxr-xr-x.  4 root root 0 Jun  5 09:45 dri
drwxr-xr-x.  2 root root 0 Jun  5 09:45 dynamic_debug
-r--r--r--.  1 root root 0 Jun  5 09:45 gpio
drwxr-xr-x.  3 root root 0 Jun  5 09:45 hid
drwxr-xr-x.  3 root root 0 Jun  5 09:45 ieee80211
drwxr-xr-x.  2 root root 0 Jun  5 09:45 kprobes
drwxr-xr-x.  2 root root 0 Jun  5 09:45 mce
drwxr-xr-x.  2 root root 0 Jun  5 09:45 mmc0
-rw-r--r--.  1 root root 0 Jun  5 09:45 sched_features
drwxr-xr-x.  2 root root 0 Jun  5 09:45 slow_work
drwxr-xr-x.  6 root root 0 Jun  5 09:45 tracing
drwxr-xr-x.  3 root root 0 Jun  5 09:45 usb
drwxr-xr-x.  2 root root 0 Jun  5 09:45 virtio-ports
drwxr-xr-x.  2 root root 0 Jun  5 09:45 x86
drwxr-xr-x.  4 root root 0 Jun  5 09:45 xen


It seems that 2.6.34 doesn't have this feature yet.
Comment 10 Zhang Rui 2010-06-07 06:45:44 UTC
Oh, you need to set CONFIG_ACPI_DEBUG first.
Comment 11 Vladislav Bogdanov 2010-06-08 04:27:28 UTC
It seems to me that upgrade to the latest Intel's Verified reference BIOS for Quanta TW3A (which Benq R55E apparently is) platform solved this problem.

Thanks for indirectly pointing me to a solution.

Note You need to log in before you can comment on or make changes to this bug.