android_kernel_motorola_sm6225/drivers/acpi
Hans de Goede 70435409ce ACPI / battery: Deal better with neither design nor full capacity not being reported
commit ff3154d1d89a2343fd5f82e65bc0cf1d4e6659b3 upstream.

Commit b41901a2cf ("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: b41901a2cf ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:33:59 -08:00
..
acpica ACPICA: Never run _REG on system_memory and system_IO 2019-11-24 08:20:07 +01:00
apei ACPI / APEI: Switch estatus pool to use vmalloc memory 2019-12-05 09:21:20 +01:00
arm64 ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id() 2019-08-16 10:12:48 +02:00
dptf
nfit acpi/nfit: Always dump _DSM output payload 2019-05-16 19:41:19 +02:00
pmic ACPI / PMIC: xpower: Fix TS-pin current-source handling 2019-01-16 22:04:34 +01:00
x86 x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
ac.c ACPI updates for 4.18-rc1 2018-06-05 10:08:27 -07:00
acpi_amba.c
acpi_apd.c ACPI: APD: Add AMD misc clock handler support 2018-05-17 12:44:06 +02:00
acpi_cmos_rtc.c
acpi_configfs.c
acpi_dbg.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
acpi_extlog.c
acpi_ipmi.c
acpi_lpat.c
acpi_lpit.c ACPI / PM: LPIT: Register sysfs attributes based on FADT 2018-11-13 11:08:24 -08:00
acpi_lpss.c ACPI: PM: Introduce "poweroff" callbacks for ACPI PM domain and LPSS 2020-01-27 14:51:00 +01:00
acpi_memhotplug.c mm/memory_hotplug: make remove_memory() take the device_hotplug_lock 2020-01-29 16:43:24 +01:00
acpi_pad.c ACPI: acpi_pad: Fix memory leak in power saving threads 2018-03-30 12:04:58 +02:00
acpi_platform.c ACPI / platform: Add SMB0001 HID to forbidden_id_list 2018-11-27 16:13:10 +01:00
acpi_pnp.c
acpi_processor.c ACPI / processor: don't print errors for processorIDs == 0xff 2019-10-05 13:09:38 +02:00
acpi_tad.c ACPI: Add Time and Alarm Device (TAD) driver 2018-03-20 10:36:04 +01:00
acpi_video.c ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 2019-10-01 08:26:11 +02:00
acpi_watchdog.c ACPI / watchdog: Prefer iTCO_wdt always when WDAT table uses RTC SRAM 2018-05-24 10:52:49 +02:00
battery.c ACPI / battery: Deal better with neither design nor full capacity not being reported 2020-02-11 04:33:59 -08:00
bgrt.c
blacklist.c ACPI: blacklist: fix clang warning for unused DMI table 2019-08-06 19:06:50 +02:00
bus.c ACPI: bus: Fix NULL pointer check in acpi_bus_get_private_data() 2019-12-17 20:35:05 +01:00
button.c ACPI: button: reinitialize button state upon resume 2020-01-27 14:50:38 +01:00
cm_sbs.c
container.c
cppc_acpi.c ACPI: CPPC: Set pcc_data[pcc_ss_id] to NULL in acpi_cppc_processor_exit() 2019-10-29 09:19:52 +01:00
custom_method.c ACPI: custom_method: fix memory leaks 2019-10-05 13:09:53 +02:00
debugfs.c
device_pm.c ACPI: PM: Introduce "poweroff" callbacks for ACPI PM domain and LPSS 2020-01-27 14:51:00 +01:00
device_sysfs.c ACPI / device_sysfs: Avoid OF modalias creation for removed device 2019-03-23 20:09:57 +01:00
dock.c
ec.c Revert "ACPI / EC: Remove old CLEAR_ON_RESUME quirk" 2019-04-20 09:16:04 +02:00
ec_sys.c ACPI: EC: Fix debugfs_create_*() usage 2018-01-04 13:54:51 +01:00
event.c
evged.c ACPI: GED: unregister interrupts during shutdown 2017-12-16 03:05:37 +01:00
fan.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
glue.c
hed.c
internal.h ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle 2019-04-20 09:16:03 +02:00
ioapic.c
irq.c
Kconfig ACPI: fix menuconfig presentation of ACPI submenu 2018-08-23 10:20:07 +02:00
Makefile ACPI: Enable PPTT support on ARM64 2018-05-17 17:28:09 +01:00
numa.c ACPI: NUMA: Use correct type for printing addresses on i386-PAE 2019-02-20 10:25:39 +01:00
nvs.c
osi.c ACPI / OSI: Add OEM _OSI string to enable NVidia HDMI audio 2018-07-20 10:12:41 +02:00
osl.c ACPI: OSL: only free map once in osl.c 2019-12-17 20:35:05 +01:00
pci_irq.c ACPI / PCI: fix acpi_pci_irq_enable() memory leak 2019-10-05 13:09:53 +02:00
pci_link.c ACPI / PCI: pci_link: Allow the absence of _PRS and change log level 2018-02-27 17:15:39 +01:00
pci_mcfg.c
pci_root.c PCI/ACPI: Correct error message for ASPM disabling 2019-11-20 18:46:52 +01:00
pci_slot.c
power.c ACPI: power: Skip duplicate power resource references in _PRx 2019-01-16 22:04:33 +01:00
pptt.c ACPI/PPTT: Add support for ACPI 6.3 thread flag 2019-10-17 13:45:34 -07:00
proc.c
processor_core.c xen/ACPI: don't upload Px/Cx data for disabled processors 2018-08-20 14:46:18 -04:00
processor_driver.c
processor_idle.c More ACPI updates for v4.16-rc1 2018-02-09 09:44:25 -08:00
processor_pdc.c
processor_perflib.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
processor_thermal.c
processor_throttling.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
property.c ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() 2019-05-31 06:46:11 -07:00
reboot.c ACPI: add missing newline to printk 2018-05-02 13:01:08 +02:00
resource.c
sbs.c ACPI / SBS: Fix GPE storm on recent MacBookPro's 2019-04-20 09:16:01 +02:00
sbshc.c ACPI / SBS: Fix rare oops when removing modules 2019-11-24 08:20:31 +01:00
sbshc.h
scan.c ACPI / scan: Create platform device for INT33FE ACPI nodes 2019-12-01 09:16:35 +01:00
sleep.c ACPI: PM: Set enable_for_wake for wakeup GPEs during suspend-to-idle 2019-05-22 07:37:41 +02:00
sleep.h
spcr.c ACPI: SPCR: Consider baud rate 0 as preconfigured state 2019-02-12 19:47:02 +01:00
sysfs.c ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100 2020-01-09 10:19:04 +01:00
tables.c arm64 updates for 4.18: 2018-06-08 11:10:58 -07:00
thermal.c
utils.c ACPI / utils: Drop reference in test for device presence 2019-04-20 09:15:58 +02:00
video_detect.c ACPI: video: Do not export a non working backlight interface on MSI MS-7721 boards 2020-02-11 04:33:59 -08:00
wakeup.c