Bug 193061 - Razer Blaze Stealth laptop battery shows discharging instead of full
Summary: Razer Blaze Stealth laptop battery shows discharging instead of full
Status: CLOSED DOCUMENTED
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Battery (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: Zhang Rui
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-21 04:25 UTC by Jason Dewayne Clinton
Modified: 2017-08-02 09:02 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.9
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Attached acpidump when still charging (905.02 KB, text/plain)
2017-02-08 02:19 UTC, Jason Dewayne Clinton
Details
Attached acpidump when reached full (905.02 KB, text/plain)
2017-02-08 03:00 UTC, Jason Dewayne Clinton
Details

Description Jason Dewayne Clinton 2017-01-21 04:25:15 UTC
Let me state first that AC adapter state is always correct; it reflects the state of the plug.

During *actual* charging or discharging, everything looks as expected. Discharge and charge estimates are also roughly accurate:

$ sudo acpi -b -a
Battery 0: Charging, 96%, 00:17:44 until charged
Adapter 0: on-line

However, when the charge is completed, the battery immediately toggles back to Discharging, 100% while the AC (correctly) still shows online. As expected, it never depletes while AC is still connected:

$ sudo acpi -b -a
Battery 0: Discharging, 100%, discharging at zero rate - will never fully discharge.
Adapter 0: on-line

This causes all kinds of user-space tools to get confused: they enter battery mode or just generally predict infinite discharge time estimates rather than showing that the device is currently on AC power.

Here's the ACPI dmesg:

$ sudo dmesg | grep -i acpi
[    0.000000] BIOS-e820: [mem 0x000000006f093000-0x000000006f093fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x000000007a392000-0x000000007a3fdfff] ACPI data
[    0.000000] BIOS-e820: [mem 0x000000007a3fe000-0x000000007abb7fff] ACPI NVS
[    0.000000] efi:  ESRT=0x7b226f18  ACPI=0x7a3a7000  ACPI 2.0=0x7a3a7000  SMBIOS=0x7b210000  SMBIOS 3.0=0x7b20f000 
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x000000007A3A7000 000024 (v02 ALASKA)
[    0.000000] ACPI: XSDT 0x000000007A3A70B0 0000E4 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: FACP 0x000000007A3CD898 000114 (v06 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: DSDT 0x000000007A3A7228 02666B (v02 ALASKA A M I    01072009 INTL 20160422)
[    0.000000] ACPI: FACS 0x000000007AB9FC40 000040
[    0.000000] ACPI: APIC 0x000000007A3CD9B0 000084 (v03 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: FPDT 0x000000007A3CDA38 000044 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: MCFG 0x000000007A3CDA80 00003C (v01 ALASKA A M I    01072009 MSFT 00000097)
[    0.000000] ACPI: FIDT 0x000000007A3CDAC0 00009C (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: MSDM 0x000000007A3CDB60 000055 (v03 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: SSDT 0x000000007A3CDBB8 003154 (v02 SaSsdt SaSsdt   00003000 INTL 20160422)
[    0.000000] ACPI: HPET 0x000000007A3D0D10 000038 (v01 INTEL  KBL-ULT  00000001 MSFT 0000005F)
[    0.000000] ACPI: SSDT 0x000000007A3D0D48 000E3B (v02 INTEL  Ther_Rvp 00001000 INTL 20160422)
[    0.000000] ACPI: SSDT 0x000000007A3D1B88 0006BB (v02 INTEL  xh_OEMBD 00000000 INTL 20160422)
[    0.000000] ACPI: UEFI 0x000000007A3D2248 000042 (v01 INTEL  EDK2     00000002      01000013)
[    0.000000] ACPI: SSDT 0x000000007A3D2290 000EDE (v02 CpuRef CpuSsdt  00003000 INTL 20160422)
[    0.000000] ACPI: LPIT 0x000000007A3D3170 000094 (v01 INTEL  KBL-ULT  00000000 MSFT 0000005F)
[    0.000000] ACPI: WSMT 0x000000007A3D3208 000028 (v01 INTEL  KBL-ULT  00000000 MSFT 0000005F)
[    0.000000] ACPI: SSDT 0x000000007A3D3230 00029F (v02 INTEL  sensrhub 00000000 INTL 20160422)
[    0.000000] ACPI: SSDT 0x000000007A3D34D0 003002 (v02 INTEL  PtidDevc 00001000 INTL 20160422)
[    0.000000] ACPI: DBGP 0x000000007A3D64D8 000034 (v01 INTEL           00000002 MSFT 0000005F)
[    0.000000] ACPI: DBG2 0x000000007A3D6510 000054 (v00 INTEL           00000002 MSFT 0000005F)
[    0.000000] ACPI: BGRT 0x000000007A3D6568 000038 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: DMAR 0x000000007A3D65A0 000114 (v01 INTEL  KBL      00000001 INTL 00000001)
[    0.000000] ACPI: SSDT 0x000000007A3D66B8 00054D (v01 TbtGfx TbtGfx   00001000 INTL 20160422)
[    0.000000] ACPI: TPM2 0x000000007A3D6C08 000034 (v03        Tpm2Tabl 00000001 AMI  00000000)
[    0.000000] ACPI: ASF! 0x000000007A3D6C40 0000A0 (v32 INTEL   HCG     00000001 TFSM 000F4240)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: PM-Timer IO Port: 0x1808
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x04] high edge lint[0x1])
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000055] ACPI: Core revision 20160831
[    0.031699] ACPI: 8 ACPI AML tables successfully acquired and loaded
[    0.347037] PM: Registering ACPI NVS region [mem 0x6f093000-0x6f093fff] (4096 bytes)
[    0.347038] PM: Registering ACPI NVS region [mem 0x7a3fe000-0x7abb7fff] (8101888 bytes)
[    0.379854] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
[    0.379855] ACPI: bus type PCI registered
[    0.379856] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.396140] ACPI: Added _OSI(Module Device)
[    0.396141] ACPI: Added _OSI(Processor Device)
[    0.396142] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.396142] ACPI: Added _OSI(Processor Aggregator Device)
[    0.397538] ACPI: Executed 30 blocks of module-level executable AML code
[    0.406063] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    0.410522] ACPI: Dynamic OEM Table Load:
[    0.410527] ACPI: SSDT 0xFFFF9A196C32A000 0006D5 (v02 PmRef  Cpu0Ist  00003000 INTL 20160422)
[    0.410660] ACPI: Executed 1 blocks of module-level executable AML code
[    0.410719] ACPI: \_PR_.CPU0: _OSC native thermal LVT Acked
[    0.411853] ACPI: Dynamic OEM Table Load:
[    0.411857] ACPI: SSDT 0xFFFF9A196BD2CC00 0003FF (v02 PmRef  Cpu0Cst  00003001 INTL 20160422)
[    0.411973] ACPI: Executed 1 blocks of module-level executable AML code
[    0.412326] ACPI: Dynamic OEM Table Load:
[    0.412330] ACPI: SSDT 0xFFFF9A196BD71800 00065C (v02 PmRef  ApIst    00003000 INTL 20160422)
[    0.412651] ACPI: Executed 1 blocks of module-level executable AML code
[    0.412793] ACPI: Dynamic OEM Table Load:
[    0.412796] ACPI: SSDT 0xFFFF9A196BD70200 00018A (v02 PmRef  ApCst    00003000 INTL 20160422)
[    0.412912] ACPI: Executed 1 blocks of module-level executable AML code
[    0.414366] ACPI : EC: EC started
[    0.414392] ACPI: \_SB_.PCI0.LPCB.EC0_: Used as first EC
[    0.414393] ACPI: \_SB_.PCI0.LPCB.EC0_: GPE=0x50, EC_CMD/EC_SC=0x66, EC_DATA=0x62
[    0.414394] ACPI: \_SB_.PCI0.LPCB.EC0_: Used as boot DSDT EC to handle transactions
[    0.414395] ACPI: Interpreter enabled
[    0.414433] ACPI: (supports S0 S3 S4 S5)
[    0.414434] ACPI: Using IOAPIC for interrupt routing
[    0.414468] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.456361] ACPI: Power Resource [WRST] (on)
[    0.456687] ACPI: Power Resource [WRST] (on)
[    0.457005] ACPI: Power Resource [WRST] (on)
[    0.457323] ACPI: Power Resource [WRST] (on)
[    0.457641] ACPI: Power Resource [WRST] (on)
[    0.457961] ACPI: Power Resource [WRST] (on)
[    0.458277] ACPI: Power Resource [WRST] (on)
[    0.458643] ACPI: Power Resource [WRST] (on)
[    0.458960] ACPI: Power Resource [WRST] (on)
[    0.459278] ACPI: Power Resource [WRST] (on)
[    0.459594] ACPI: Power Resource [WRST] (on)
[    0.459916] ACPI: Power Resource [WRST] (on)
[    0.460234] ACPI: Power Resource [WRST] (on)
[    0.460551] ACPI: Power Resource [WRST] (on)
[    0.460872] ACPI: Power Resource [WRST] (on)
[    0.461188] ACPI: Power Resource [WRST] (on)
[    0.461504] ACPI: Power Resource [WRST] (on)
[    0.462724] ACPI: Power Resource [WRST] (on)
[    0.463044] ACPI: Power Resource [WRST] (on)
[    0.463361] ACPI: Power Resource [WRST] (on)
[    0.470315] ACPI: Power Resource [FN00] (off)
[    0.470398] ACPI: Power Resource [FN01] (off)
[    0.470477] ACPI: Power Resource [FN02] (off)
[    0.470558] ACPI: Power Resource [FN03] (off)
[    0.470637] ACPI: Power Resource [FN04] (off)
[    0.471664] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-fe])
[    0.471668] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
[    0.471698] acpi PNP0A08:00: _OSC failed (AE_ERROR); disabling ASPM
[    0.473130] pci 0000:00:14.0: System wakeup disabled by ACPI
[    0.475048] pci 0000:00:1c.0: System wakeup disabled by ACPI
[    0.475268] pci 0000:00:1c.4: System wakeup disabled by ACPI
[    0.475491] pci 0000:00:1d.0: System wakeup disabled by ACPI
[    0.477032] pci 0000:00:1f.3: System wakeup disabled by ACPI
[    0.478446] pci 0000:01:00.0: System wakeup disabled by ACPI
[    0.488368] pci 0000:3b:00.0: System wakeup disabled by ACPI
[    0.518453] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.518499] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 *10 11 12 14 15)
[    0.518544] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.518588] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.518631] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.518676] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.518720] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.518763] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.519265] ACPI: Enabled 5 GPEs in block 00 to 7F
[    0.519375] ACPI : EC: event unblocked
[    0.519388] ACPI: \_SB_.PCI0.LPCB.EC0_: GPE=0x50, EC_CMD/EC_SC=0x66, EC_DATA=0x62
[    0.519389] ACPI: \_SB_.PCI0.LPCB.EC0_: Used as boot DSDT EC to handle transactions and events
[    0.538527] PCI: Using ACPI for IRQ routing
[    0.570441] pnp: PnP ACPI init
[    0.570664] system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.570759] pnp 00:01: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.570793] system 00:02: Plug and Play ACPI device, IDs INT3f0d PNP0c02 (active)
[    0.571720] system 00:03: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.571763] system 00:04: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.572031] system 00:05: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.572982] system 00:06: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.573789] pnp: PnP ACPI: found 7 devices
[    0.580605] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.909591] DMAR: ACPI device "device:6d" under DMAR at fed91000 as 00:15.0
[    0.909593] DMAR: ACPI device "device:6e" under DMAR at fed91000 as 00:15.1
[    0.909595] DMAR: ACPI device "device:6f" under DMAR at fed91000 as 00:1e.0
[    1.327379] ACPI: Thermal Zone [TZ00] (28 C)
[    1.327556] ACPI: Thermal Zone [TZ01] (30 C)
[    1.335721] ACPI: bus type USB registered
[   36.022449] ACPI : button: Notify initial lid state as open
[   36.022669] ACPI: Lid Switch [LID0]
[   36.022769] ACPI: Sleep Button [SLPB]
[   36.022811] ACPI: Power Button [PWRB]
[   36.022859] ACPI: Power Button [PWRF]
[   36.075317] ACPI: AC Adapter [AC0] (off-line)
[   36.114949] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[   36.142224] ACPI: Battery Slot [BAT0] (battery present)
Comment 1 Zhang Rui 2017-02-06 02:09:33 UTC
please attach the acpidump output
Comment 2 Jason Dewayne Clinton 2017-02-08 02:19:53 UTC
Created attachment 254531 [details]
Attached acpidump when still charging
Comment 3 Jason Dewayne Clinton 2017-02-08 03:00:14 UTC
Created attachment 254541 [details]
Attached acpidump when reached full
Comment 4 Zhang Rui 2017-03-20 03:11:31 UTC
please attach the output of "grep . /sys/class/power_supply/*/*" both when the battery shows normal and abnormal.
Comment 5 Zhang Rui 2017-03-27 04:11:01 UTC
ping...
Comment 6 Jason Dewayne Clinton 2017-03-29 01:30:06 UTC
===
= Abnormal (charged, AC online but showing discharging)
===

$ grep . /sys/class/power_supply/*/*
grep: /sys/class/power_supply/AC0/device: Is a directory
/sys/class/power_supply/AC0/online:1
grep: /sys/class/power_supply/AC0/power: Is a directory
grep: /sys/class/power_supply/AC0/subsystem: Is a directory
/sys/class/power_supply/AC0/type:Mains
/sys/class/power_supply/AC0/uevent:POWER_SUPPLY_NAME=AC0
/sys/class/power_supply/AC0/uevent:POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:96
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/charge_full:4584000
/sys/class/power_supply/BAT0/charge_full_design:4640000
/sys/class/power_supply/BAT0/charge_now:4408000
/sys/class/power_supply/BAT0/current_now:0
/sys/class/power_supply/BAT0/cycle_count:0
grep: /sys/class/power_supply/BAT0/device: Is a directory
/sys/class/power_supply/BAT0/manufacturer:Razer
/sys/class/power_supply/BAT0/model_name:Razer Blade Stealth
grep: /sys/class/power_supply/BAT0/power: Is a directory
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:cnb1rc30019669501218
/sys/class/power_supply/BAT0/status:Discharging
grep: /sys/class/power_supply/BAT0/subsystem: Is a directory
/sys/class/power_supply/BAT0/technology:Unknown
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Discharging
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11550000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=12976000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CURRENT_NOW=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=4640000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=4584000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=4408000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=96
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=Razer Blade Stealth
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Razer
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=cnb1rc300...
/sys/class/power_supply/BAT0/voltage_min_design:11550000
/sys/class/power_supply/BAT0/voltage_now:12976000

===
= Normal (charging, AC online)
===

$ grep . /sys/class/power_supply/*/*
grep: /sys/class/power_supply/AC0/device: Is a directory
/sys/class/power_supply/AC0/online:1
grep: /sys/class/power_supply/AC0/power: Is a directory
grep: /sys/class/power_supply/AC0/subsystem: Is a directory
/sys/class/power_supply/AC0/type:Mains
/sys/class/power_supply/AC0/uevent:POWER_SUPPLY_NAME=AC0
/sys/class/power_supply/AC0/uevent:POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:91
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/charge_full:4573000
/sys/class/power_supply/BAT0/charge_full_design:4640000
/sys/class/power_supply/BAT0/charge_now:4178000
/sys/class/power_supply/BAT0/current_now:195000
/sys/class/power_supply/BAT0/cycle_count:0
grep: /sys/class/power_supply/BAT0/device: Is a directory
/sys/class/power_supply/BAT0/manufacturer:Razer
/sys/class/power_supply/BAT0/model_name:Razer Blade Stealth
grep: /sys/class/power_supply/BAT0/power: Is a directory
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:cnb1rc30019669501218
/sys/class/power_supply/BAT0/status:Charging
grep: /sys/class/power_supply/BAT0/subsystem: Is a directory
/sys/class/power_supply/BAT0/technology:Unknown
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Charging
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11550000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=12475000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CURRENT_NOW=195000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=4640000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=4573000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=4178000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=91
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=Razer Blade Stealth
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Razer
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=cnb1rc300...
/sys/class/power_supply/BAT0/voltage_min_design:11550000
/sys/class/power_supply/BAT0/voltage_now:12475000
Comment 7 Zhang Rui 2017-03-29 02:34:25 UTC
            Method (_BST, 0, NotSerialized)  // _BST: Battery Status
            {
                If (^^EC0.ECON == One)
                {
                    BFB0 [Zero] = ^^EC0.BST0 /* \_SB_.PCI0.LPCB.EC0_.BST0 */
                    BFB0 [One] = ^^EC0.BST1 /* \_SB_.PCI0.LPCB.EC0_.BST1 */
                    BFB0 [0x02] = ^^EC0.BST2 /* \_SB_.PCI0.LPCB.EC0_.BST2 */
                    BFB0 [0x03] = ^^EC0.BST3 /* \_SB_.PCI0.LPCB.EC0_.BST3 */
                    Local0 = ^^EC0.PSTA /* \_SB_.PCI0.LPCB.EC0_.PSTA */
                    Local0 &= 0x83
                    If (Local0 == 0x82)
                    {
                        Return (BFB0) /* \_SB_.PCI0.LPCB.BAT0.BFB0 */
                    }

                    If (Local0 == 0x83)
                    {
                        Return (BFB0) /* \_SB_.PCI0.LPCB.BAT0.BFB0 */
                    }

                    If (Local0 == 0x81)
                    {
                        Return (BFB1) /* \_SB_.PCI0.LPCB.BAT0.BFB1 */
                    }

                    Return (BFB1) /* \_SB_.PCI0.LPCB.BAT0.BFB1 */
                }
                Else
                {
                    Return (BFB1) /* \_SB_.PCI0.LPCB.BAT0.BFB1 */
                }
            }

This is the control method that ACPI uses to get Battery status. And we can see that it may either return a package containing information get from EC firmware (BFB0), or a dummy packages containing invalid information (BFB1).

And from the log attached above, we can see that _BST still returns valid voltage_now/current_now/charge_now information, so I think the problem is that EC firmware does not return proper battery status information, and Linux kernel just translate the bogus battery status information to user space.
Comment 8 Jason Dewayne Clinton 2017-03-29 02:37:47 UTC
Any guesses as to why a fresh Windows 10 install on the same hardware (no additional driver installation) has the UI showing the correct information? Did maybe Razer get a hack into Windows 10 base image for the EC firmware bug?
Comment 9 Zhang Rui 2017-03-29 02:49:42 UTC
And in order to make kernel return 'charged', we need
1. ^^EC0.BST0 returns 0, which indicates the battery is neither charging, nor discharging
2. ^^EC0.BST2 returns the battery remaining capacity either equals "Design full capacity" or "Last full charge capacity"

Bug closed as this is a firmware issue to me. Unless another battery driver is used instead of the standard ACPI battery driver, in which case, it is a gap that we need another battery driver in Linux, rather than an ACPI battery driver bug.
Comment 10 Zhang Rui 2017-03-29 02:52:00 UTC
(In reply to Jason Dewayne Clinton from comment #8)
> Any guesses as to why a fresh Windows 10 install on the same hardware (no
> additional driver installation) has the UI showing the correct information?

Hah, good catch, can you please check windows device manager and see what battery device windows is using?
Comment 11 Zhang Rui 2017-03-29 02:53:23 UTC
and does it help if you boot with kernel parameters acpi_osi=! acpi_osi="Windows 2015"?
Comment 12 Jason Dewayne Clinton 2017-03-29 03:02:35 UTC
Device Manager in Windows 10: Microsoft ACPI-Compliant Control Method Battery version 10.0.14393.0. 

Under right-click Properties > Details > Property "BIOS device name": \_SB.PCI0.LPCB.BAT0

I will post kernel boot option next.
Comment 13 Jason Dewayne Clinton 2017-03-29 03:12:15 UTC
$ cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-4.11.0-0.rc3.git0.2.fc26.x86_64 root=/dev/mapper/fedora_jclinton--laptop-root ro rd.lvm.lv=fedora_jclinton-laptop/root rd.luks.uuid=... rd.lvm.lv=fedora_jclinton-laptop/swap acpi_osi=! "acpi_osi=Windows 2015" rhgb quiet LANG=en_US.UTF-8

$ grep . /sys/class/power_supply/*/*
grep: /sys/class/power_supply/AC0/device: Is a directory
/sys/class/power_supply/AC0/online:1
grep: /sys/class/power_supply/AC0/power: Is a directory
grep: /sys/class/power_supply/AC0/subsystem: Is a directory
/sys/class/power_supply/AC0/type:Mains
/sys/class/power_supply/AC0/uevent:POWER_SUPPLY_NAME=AC0
/sys/class/power_supply/AC0/uevent:POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:99
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/charge_full:4573000
/sys/class/power_supply/BAT0/charge_full_design:4640000
/sys/class/power_supply/BAT0/charge_now:4572000
/sys/class/power_supply/BAT0/current_now:0
/sys/class/power_supply/BAT0/cycle_count:0
grep: /sys/class/power_supply/BAT0/device: Is a directory
/sys/class/power_supply/BAT0/manufacturer:Razer
/sys/class/power_supply/BAT0/model_name:Razer Blade Stealth
grep: /sys/class/power_supply/BAT0/power: Is a directory
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:cnb1rc30019669501218
/sys/class/power_supply/BAT0/status:Discharging
grep: /sys/class/power_supply/BAT0/subsystem: Is a directory
/sys/class/power_supply/BAT0/technology:Unknown
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Discharging
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11550000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=13110000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CURRENT_NOW=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=4640000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=4573000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=4572000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=99
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=Razer Blade Stealth
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Razer
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=cnb1rc30019669501218
/sys/class/power_supply/BAT0/voltage_min_design:11550000
/sys/class/power_supply/BAT0/voltage_now:13110000
Comment 14 Jason Dewayne Clinton 2017-03-29 03:13:09 UTC
That is, per Comment 13, no change when set to "Windows 2015".
Comment 15 Zhang Rui 2017-03-29 03:15:58 UTC
hmm, so we're using the same device.

This makes me doubt that windows may use a different logic to determine battery status, and the logic is "battery can not be discharging while it's on AC",
say, battery status is 'Charged' if AC is online and battery is not charging.

But this is just a guess right now. If we have some proof that windows is doing in this way, maybe we can convince the user space people to follow the same logic.

But anyway, this can not be handled in Linux kernel.
Comment 16 Jason Dewayne Clinton 2017-03-29 15:24:05 UTC
Now that you mentioned it, in my day job, I remember a discussion about the challenges of implementing USB Type-C that involved the possibility that someone could be charging a laptop off of a cell phone charger (5V, 1.5A). In this scenario, technically the AC is online but the battery could still be discharging to make up the difference as this isn't enough power to run laptop hardware.

I think you are correct: the userspace UI logic hasn't been updated to account for AC online while battery discharging (or not, as the case may be per Comment 9).
Comment 17 Zhang Rui 2017-03-30 01:03:04 UTC
(In reply to Jason Dewayne Clinton from comment #16)
> Now that you mentioned it, in my day job, I remember a discussion about the
> challenges of implementing USB Type-C that involved the possibility that
> someone could be charging a laptop off of a cell phone charger (5V, 1.5A).
> In this scenario, technically the AC is online but the battery could still
> be discharging to make up the difference as this isn't enough power to run
> laptop hardware.
> 
Hmm, sounds interesting, but this is not true today, right?

problem is that, if windows follows the logic as I describe in comment #15, it is possible that some laptops shipped with a buggy battery status, and relies on windows user space to handle it, and these laptops confuses Linux User space.

> I think you are correct: the userspace UI logic hasn't been updated to
> account for AC online while battery discharging (or not, as the case may be
> per Comment 9).

In any case, this does not seem to be a kernel problem to me, thus close it.

I think we'd
1. raise the problem to RazerBlaze as its firmware does not return correct battery status as the other laptops (but I'm not sure if it can be fixed or not, as Windows works...)
OR
2. raise the problem to user space to make it smart enough to handle the buggy firmware

$ grep . /sys/class/power_supply/*/*
/sys/class/power_supply/AC0/online:1
/sys/class/power_supply/BAT0/charge_full:4584000
/sys/class/power_supply/BAT0/charge_full_design:4640000
/sys/class/power_supply/BAT0/charge_now:4408000
/sys/class/power_supply/BAT0/current_now:0
/sys/class/power_supply/BAT0/status:Discharging

I think these information (AC on-line, Battery' discharging rate is 0) is sufficient to say the battery is charged instead of discharging.

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