• L
    ACPI: battery: do not export degraded capacity values over 100 · a20136a6
    Laszlo Toth 提交于
    With a degraded battery, full_charge_capacity can be less
    than design_capacity, however it's not sure that capacity_now's
    max will follow.
    
    Example from an affected machine:
    /sys/class/power_supply/BAT0/charge_full        -> 4290000
    /sys/class/power_supply/BAT0/charge_full_design -> 5900000
    /sys/class/power_supply/BAT0/charge_now         -> 5900000
    /sys/class/power_supply/BAT0/capacity           -> 137
    
    The battery is a degraded one with a full charge, and
    charge_now is the value of charge_full_design instead of
    charge_full.
    
    Added a new quirk to test and correct this, and
    a new function to check if the battery is a degraded one
    or not. This keeps the possibility to be over 100 if
    it's really the case.
    Signed-off-by: NLaszlo Toth <laszlth@gmail.com>
    Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    a20136a6
battery.c 45.5 KB