Bug 198177

Summary: Acer SW5-173 Battery not detected
Product: Drivers Reporter: Andrea Tosti (andrea.tosti)
Component: I2CAssignee: Drivers/I2C virtual user (drivers-i2c)
Status: RESOLVED CODE_FIX    
Severity: high CC: rui.zhang
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.9.66-1-MANJARO Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg -l err output
acpidump output
acpidump output (using root)
dmesg output
Extracted ACPI tables
iasl -d dsdt.dat output
DSDT compilation output
upower -d output

Description Andrea Tosti 2017-12-16 10:38:31 UTC
Created attachment 261203 [details]
dmesg -l err output

My laptop's battery (Acer Switch 11V SW5-173) is not recognized under Linux.
Everything else (touchscreen, touchpad, brightness, wifi, bluetooth) works out of the box

Intel Core M-5Y10C, 4GB RAM, 128GB SSD
Bios: 1.09 (latest avaiable), using UEFI mode.
Battery: 4420 mAh Lithium Polymer

The battery is detected correctly in Windows 10 (i can see remaining battery time).
I tried the following kernels, all tested under Manjaro, but none of them helped me with the battery:

4.15.r171130.g9e0600f-1
4.14.3-1
4.13.16-2
4.12.14-1
4.11.12_rt16-1
4.9.65_rt56-1
4.9.66-1
4.4.103-1
4.1.46-1
3.18.85-1
3.16.51-1

I also tried different distributions like the latest Fedora, Ubuntu 14, Ubuntu 16, Ubuntu 17, latest KDE Neon without success.
I am currently using Manjaro KDE with all packages up to date.

I attached some information, let me know if you need something else.
Thank you in advance.
Comment 1 Andrea Tosti 2017-12-16 10:40:43 UTC
Created attachment 261205 [details]
acpidump output
Comment 2 Andrea Tosti 2017-12-16 10:45:59 UTC
Comment on attachment 261205 [details]
acpidump output

>Could not open table file: /sys/firmware/acpi/tables/SSDT6
>Could not get ACPI tables, AE_ACCESS

edit: i attached another acpidump (this time i used root)
Comment 3 Andrea Tosti 2017-12-16 10:46:52 UTC
Created attachment 261207 [details]
acpidump output (using root)
Comment 4 Andrea Tosti 2017-12-16 10:50:10 UTC
Created attachment 261209 [details]
dmesg output
Comment 5 Andrea Tosti 2017-12-16 10:59:23 UTC
Created attachment 261211 [details]
Extracted ACPI tables
Comment 6 Andrea Tosti 2017-12-16 11:01:13 UTC
Created attachment 261213 [details]
iasl -d dsdt.dat output
Comment 7 Andrea Tosti 2017-12-16 11:03:23 UTC
Created attachment 261215 [details]
DSDT compilation output
Comment 8 Andrea Tosti 2017-12-16 11:32:14 UTC
Created attachment 261217 [details]
upower -d output
Comment 9 Zhang Rui 2017-12-18 09:00:17 UTC
    Scope (_SB.PCI0.I2C1)
    {
        Device (BAT1)
        {
            Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */)  // _HID: Hardware ID
            Name (_UID, One)  // _UID: Unique ID
            Name (_DEP, Package (0x01)  // _DEP: Dependencies
            {
                I2C1
            })
            Name (_PCL, Package (0x01)  // _PCL: Power Consumer List
            {
                _SB
            })
            Name (BMDL, Zero)
            Name (BASC, One)
            Name (BFFW, Zero)
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x1F)
            }

This battery is a I2C device, and let' check if the battery problem still exists after the I2C errors resolved.
Comment 10 Andrea Tosti 2017-12-21 15:30:51 UTC
Good, now my question is: can i help somehow to solve this problem sooner or later? I don't know where to start sincerely.
Comment 11 Andrea Tosti 2018-01-09 06:40:49 UTC
I changed some related  parts in my DSDT to see if it was accepted by the kernel:

Method (_BIF, 0, NotSerialized) {
                Return (Package {
                    0x01,               // power unit: mAh
                    0x0E10,             // capacity
                    0x0E10,             // last full capacity
                    0x01,               // rechargeable
                    0x2A30,             // voltage
                    0x6C,               // warning voltage
                    0x4B,               // low voltage
                    0x08,               // steps [warning to low]
                    0x09,               // steps [warning to full]
                    "Li-Ion 3600mA ",   // model number
                    "jfrimmel",         // serial number
                    "Lion",             // type
                    "Acer "             // OEM
                })

And now, the Kernel shows the "serial number" "jfrimmel" and the Vendor "Acer". So the static data is transmitted fine.

The same works, if I change the _BST-method t a method, that returns static data:

        Method (_BST, 0, NotSerialized) {
                Return (Package {
                    0x00,
                    0xDEAD,
                    0x0E10, // reports 100% charge
                    0x2A30
                })
            }

These values are correct transmitted and displayed.

But none of the I2C-transmits are working.
I guess that the eror is somewhere in methods like "ECNR()", these are responsible for the I2C transmission.
But until now, I cannot get it working
Comment 12 Andrea Tosti 2018-04-30 07:06:14 UTC
The problem persists even with Kernels 4.16.4-1 and 4.17.r180422.
No new BIOS updates from Acer.
Comment 13 Andrea Tosti 2018-05-25 19:25:36 UTC
As a fix someone made this kernel module 
https://github.com/jfrimmel/Acer-Switch-Battery-Module
I tested it and works flawlessly, i reccomend this to anyone.
Comment 14 Andrea Tosti 2019-03-24 12:07:06 UTC
Today i installed the newest versions of Manjaro KDE (Kernel 4.19.28-1-MANJARO) and KaOS and they provide battery drivers out of box, so this is even better. Really good, marking as RESOLVED