Bug 194811

Summary: Two batteries is detected on DEXP Ursus 7W tablet instead of one
Product: Drivers Reporter: RussianNeuroMancer (russianneuromancer)
Component: OtherAssignee: drivers_other
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan90000, jwrdegoede, sergei.a.trusov
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.11rc1 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg 4.11rc1 log
dsdt.dsl
acpi: battery: Add acpi_battery_unregister() function
power: supply: axp288_fuel_gauge: Unregister duplicate acpi battery supply

Description RussianNeuroMancer 2017-03-07 15:47:27 UTC
Created attachment 255113 [details]
dmesg 4.11rc1 log

Two batteries is detected on DEXP Ursus 7W tablet while physically there is only one battery.

~$ acpi 
Battery 0: Charging, 84%, 00:49:39 until charged
Battery 1: Unknown, 0%, rate information unavailable

Kernel config and patches: http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc1/ 

/sys/class/power_supply$ ls
ADP1  axp288_fuel_gauge  BMBT

/sys/class/power_supply/BMBT$ cat model_name
SR Real Battery

dmesg is attached.
Comment 1 RussianNeuroMancer 2017-03-07 15:51:20 UTC
Created attachment 255117 [details]
dsdt.dsl
Comment 2 Hans de Goede 2017-03-08 09:20:25 UTC
As mentioned in bug 88471 if we were to implement the BMOP opregion for the battery acpi device that would fix the BMBT power_supply device from not working, but we would still have 2 batteries being reported to userspace instead of one...
Comment 3 Hans de Goede 2017-03-11 10:13:06 UTC
Created attachment 255181 [details]
acpi: battery: Add acpi_battery_unregister() function
Comment 4 Hans de Goede 2017-03-11 10:15:04 UTC
Created attachment 255183 [details]
power: supply: axp288_fuel_gauge: Unregister duplicate acpi battery supply
Comment 5 Hans de Goede 2017-03-11 10:15:36 UTC
Ok, the 2 attachments I've just added should fix this, if someone can build a kernel with them and confirm, that would be great.
Comment 6 Sergei Trusov 2017-03-12 05:20:02 UTC
Thanks!

4.11-rc1 with both patches applied:

# ls /sys/class/power_supply/
ADP1  axp288_fuel_gauge

# dmesg | egrep 'BMBT|fuel'
[   16.616882] ACPI: Battery Slot [BMBT] (battery present)
[   17.372188] axp288_fuel_gauge axp288_fuel_gauge: HW IRQ 16 -> VIRQ 220
...

As I can see the invalid battery is unregistered by the working driver.

# acpi
Battery 0: Discharging, 91%, discharging at zero rate - will never fully discharge.
Comment 7 Hans de Goede 2017-03-12 13:16:51 UTC
HI,

(In reply to Sergei Trusov from comment #6)
> Thanks!
> 
> 4.11-rc1 with both patches applied:
> 
> # ls /sys/class/power_supply/
> ADP1  axp288_fuel_gauge
> 
> # dmesg | egrep 'BMBT|fuel'
> [   16.616882] ACPI: Battery Slot [BMBT] (battery present)
> [   17.372188] axp288_fuel_gauge axp288_fuel_gauge: HW IRQ 16 -> VIRQ 220
> ...
> 
> As I can see the invalid battery is unregistered by the working driver.
> 
> # acpi
> Battery 0: Discharging, 91%, discharging at zero rate - will never fully
> discharge.

Great. Is it ok if I add a:

Tested-by: Segei Trusov <t.rus76@redacted.ru>

To the commit msg of both patches (but then with your actual email address) ?

Regards,

Hans
Comment 8 Sergei Trusov 2017-03-12 14:57:44 UTC
(In reply to Hans de Goede from comment #7)

> Tested-by: 

Yes it is (and as I just understood it would be better to post test reports with this remark already added).
Comment 9 alan 2017-03-14 09:43:53 UTC
Hi,

@Hans de Goede: Your two patches work. The battery support seems to work 'out-of-the-box' now. 

Thank you very much for your work. ;-)
Comment 10 Hans de Goede 2017-03-16 16:22:29 UTC
Hi All,

I've just submitted the patches for this upstream.

Regards,

Hans
Comment 11 RussianNeuroMancer 2017-03-16 17:31:45 UTC
Hi, it's targeting 4.12 or may get into 4.11?
Comment 12 Hans de Goede 2017-03-17 07:40:42 UTC
(In reply to RussianNeuroMancer from comment #11)
> Hi, it's targeting 4.12 or may get into 4.11?

4.12
Comment 13 RussianNeuroMancer 2017-03-24 06:26:16 UTC
As I understand since patches are pushed into upstream I can close this.

P.S. Also working on DEXP Ursus 7W and Irbis NB41.