aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2019-12-10 10:57:52 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-12-16 11:16:57 +0100
commitff3154d1d89a2343fd5f82e65bc0cf1d4e6659b3 (patch)
tree06ccc665ff65047d050609745bf864d9714292a8 /drivers/thermal
parentACPI / battery: Use design-cap for capacity calculations if full-cap is not available (diff)
downloadlinux-dev-ff3154d1d89a2343fd5f82e65bc0cf1d4e6659b3.tar.xz
linux-dev-ff3154d1d89a2343fd5f82e65bc0cf1d4e6659b3.zip
ACPI / battery: Deal better with neither design nor full capacity not being reported
Commit b41901a2cf06 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity") added support for some (broken) devices which always report 0 for both design_capacity and full_charge_capacity. Since the device that commit was written as a fix for is not reporting any form of "full" capacity we cannot calculate the value for the POWER_SUPPLY_PROP_CAPACITY, this is worked around by using an alternative array of available properties which does not contain this property. This is necessary because userspace (upower) treats us returning -ENODEV as 0 and then typically will trigger an emergency shutdown because of that. Userspace does not do this if the capacity sysfs attribute is not present at all. There are two potential problems with that commit: 1) It assumes that both full_charge- and design-capacity are broken at the same time and only checks if full_charge- is broken. 2) It assumes that this only ever happens for devices which report energy units rather then charge units. This commit fixes both issues by only using the alternative array of available properties if both full_charge- and design-capacity are broken and by also adding an alternative array of available properties for devices using mA units. Fixes: b41901a2cf06 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity") Cc: 4.19+ <stable@vger.kernel.org> # 4.19+ Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal')
0 files changed, 0 insertions, 0 deletions