linux-stable/drivers
Hans de Goede ec025feb39 power: supply: axp288_charger: Add special handling for HP Pavilion x2 10
commit 9c80662a74 upstream.

Some HP Pavilion x2 10 models use an AXP288 for charging and fuel-gauge.
We use a native power_supply / PMIC driver in this case, because on most
models with an AXP288 the ACPI AC / Battery code is either completely
missing or relies on custom / proprietary ACPI OpRegions which Linux
does not implement.

The native drivers mostly work fine, but there are 2 problems:

1. These model uses a Type-C connector for charging which the AXP288 does
not support. As long as a Type-A charger (which uses the USB data pins for
charger type detection) is used everything is fine. But if a Type-C
charger is used (such as the charger shipped with the device) then the
charger is not recognized.

So we end up slowly discharging the device even though a charger is
connected, because we are limiting the current from the charger to 500mA.
To make things worse this happens with the device's official charger.

Looking at the ACPI tables HP has "solved" the problem of the AXP288 not
being able to recognize Type-C chargers by simply always programming the
input-current-limit at 3000mA and relying on a Vhold setting of 4.7V
(normally 4.4V) to limit the current intake if the charger cannot handle
this.

2. If no charger is connected when the machine boots then it boots with the
vbus-path disabled. On other devices this is done when a 5V boost converter
is active to avoid the PMIC trying to charge from the 5V boost output.
This is done when an OTG host cable is inserted and the ID pin on the
micro-B receptacle is pulled low, the ID pin has an ACPI event handler
associated with it which re-enables the vbus-path when the ID pin is pulled
high when the OTG cable is removed. The Type-C connector has no ID pin,
there is no ID pin handler and there appears to be no 5V boost converter,
so we end up not charging because the vbus-path is disabled, until we
unplug the charger which automatically clears the vbus-path disable bit and
then on the second plug-in of the adapter we start charging.

The HP Pavilion x2 10 models with an AXP288 do have mostly working ACPI
AC / Battery code which does not rely on custom / proprietary ACPI
OpRegions. So one possible solution would be to blacklist the AXP288
native power_supply drivers and add the HP Pavilion x2 10 with AXP288
DMI ids to the list of devices which should use the ACPI AC / Battery
code even though they have an AXP288 PMIC. This would require changes to
4 files: drivers/acpi/ac.c, drivers/power/supply/axp288_charger.c,
drivers/acpi/battery.c and drivers/power/supply/axp288_fuel_gauge.c.

Beside needing adding the same DMI matches to 4 different files, this
approach also triggers problem 2. from above, but then when suspended,
during suspend the machine will not wakeup because the vbus path is
disabled by the AML code when not charging, so the Vbus low-to-high
IRQ is not triggered, the CPU never wakes up and the device does not
charge even though the user likely things it is charging, esp. since
the charge status LED is directly coupled to an adapter being plugged
in and does not reflect actual charging.

This could be worked by enabling vbus-path explicitly from say the
axp288_charger driver's suspend handler.

So neither situation is ideal, in both cased we need to explicitly enable
the vbus-path to work around different variants of problem 2 above, this
requires a quirk in the axp288_charger code.

If we go the route of using the ACPI AC / Battery drivers then we need
modifications to 3 other drivers; and we need to partially disable the
axp288_charger code, while at the same time keeping it around to enable
vbus-path on suspend.

OTOH we can copy the hardcoding of 3A input-current-limit (we never touch
Vhold, so that would stay at 4.7V) to the axp288_charger code, which needs
changes regardless, then we concentrate all special handling of this
interesting device model in the axp288_charger code. That is what this
commit does.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1791098
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 10:45:04 +02:00
..
accessibility
acpi x86/mm: split vmalloc_sync_all() 2020-03-25 08:06:13 +01:00
amba
android
ata ahci: Add Intel Comet Lake H RAID PCI ID 2020-04-02 15:28:21 +02:00
atm fore200e: Fix incorrect checks of NULL pointer dereference 2020-02-24 08:34:42 +01:00
auxdisplay
base driver core: Fix creation of device links with PM-runtime flags 2020-03-20 11:55:58 +01:00
bcma
block virtio-blk: fix hw_queue stopped on arbitrary error 2020-03-18 07:14:19 +01:00
bluetooth
bus
cdrom
char ipmi:ssif: Handle a possible NULL pointer reference 2020-03-05 16:42:12 +01:00
clk clk: uniphier: Add SCSSI clock gate for each channel 2020-02-24 08:34:45 +01:00
clocksource clocksource/drivers/bcm2835_timer: Fix memory leak of timer 2020-02-24 08:34:37 +01:00
connector
cpufreq
cpuidle
crypto crypto: chtls - Fixed memory leak 2020-02-24 08:34:44 +01:00
dax
dca
devfreq Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs" 2020-03-05 16:42:18 +01:00
dio
dma dmaengine: coh901318: Fix a double lock bug in dma_tc_handle() 2020-03-11 14:15:12 +01:00
dma-buf
edac EDAC/amd64: Set grain per DIMM 2020-03-11 14:14:45 +01:00
eisa
extcon extcon: axp288: Add wakeup support 2020-04-13 10:45:03 +02:00
firewire
firmware efi: Fix debugobjects warning on 'efi_rts_work' 2020-03-20 11:56:00 +01:00
fmc
fpga
fsi
gnss
gpio gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 CHT + AXP288 model 2020-04-02 15:28:23 +02:00
gpu drm/etnaviv: replace MMU flush marker with flush sequence 2020-04-13 10:45:01 +02:00
hid HID: google: add moonball USB id 2020-03-20 11:55:59 +01:00
hsi
hv
hwmon hwmon: (adt7462) Fix an error return in ADT7462_REG_VOLT() 2020-03-11 14:15:12 +01:00
hwspinlock
hwtracing intel_th: pci: Add Elkhart Lake CPU support 2020-03-25 08:06:11 +01:00
i2c i2c: hix5hd2: add missed clk_disable_unprepare in remove 2020-04-02 15:28:16 +02:00
ide ide: serverworks: potential overflow in svwks_set_pio_mode() 2020-02-24 08:34:49 +01:00
idle
iio iio: light: vcnl4000: update sampling periods for vcnl4200 2020-03-25 08:06:13 +01:00
infiniband RDMA/mlx5: Block delay drop to unprivileged users 2020-04-02 15:28:18 +02:00
input Input: synaptics - enable RMI on HP Envy 13-ad105ng 2020-04-02 15:28:16 +02:00
iommu iommu/vt-d: Ignore devices with out-of-spec domain number 2020-03-18 07:14:24 +01:00
ipack
irqchip irqchip/gic-v3-its: Fix misuse of GENMASK macro 2020-03-05 16:42:12 +01:00
isdn
leds leds: pca963x: Fix open-drain initialization 2020-02-24 08:34:35 +01:00
lightnvm
macintosh macintosh: windfarm: fix MODINFO regression 2020-03-18 07:14:21 +01:00
mailbox
mcb
md dm integrity: use dm_bio_record and dm_bio_restore 2020-03-25 08:06:07 +01:00
media media: rc: IR signal for Panasonic air conditioner too long 2020-04-13 10:45:01 +02:00
memory
memstick
message
mfd mfd: rn5t618: Mark ADC control register volatile 2020-02-11 04:34:14 -08:00
misc mei: me: add cedar fork device ids 2020-04-13 10:45:03 +02:00
mmc mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY 2020-04-02 15:28:10 +02:00
mtd mtd: sharpslpart: Fix unsigned comparison to zero 2020-02-14 16:33:27 -05:00
mux
net net: ks8851-ml: Fix IO operations, again 2020-04-02 15:28:23 +02:00
nfc NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() 2020-04-02 15:28:12 +02:00
ntb
nubus
nvdimm
nvme nvme-rdma: Avoid double freeing of async event data 2020-04-13 10:44:58 +02:00
nvmem
of drivers/of/of_mdio.c:fix of_mdiobus_register() 2020-04-02 15:28:14 +02:00
opp
oprofile
parisc
parport
pci PCI: Increase D3 delay for AMD Ryzen5/7 XHCI controllers 2020-02-24 08:34:41 +01:00
pcmcia
perf drivers/perf: arm_pmu_acpi: Fix incorrect checking of gicc pointer 2020-03-25 08:06:07 +01:00
phy phy: mapphone-mdm6600: Fix write timeouts with shorter GPIO toggle interval 2020-03-11 14:15:10 +01:00
pinctrl pinctrl: core: Remove extra kref_get which blocks hogs being freed 2020-03-18 07:14:23 +01:00
platform platform/x86: pmc_atom: Add Lex 2I385SW to critclk_systems DMI table 2020-04-02 15:28:23 +02:00
pnp
power power: supply: axp288_charger: Add special handling for HP Pavilion x2 10 2020-04-13 10:45:04 +02:00
powercap
pps
ps3
ptp
pwm pwm: omap-dmtimer: put_device() after of_find_device_by_node() 2020-03-05 16:42:22 +01:00
rapidio
ras
regulator regulator: rk808: Lower log level on optional GPIOs being not available 2020-02-24 08:34:40 +01:00
remoteproc remoteproc: Initialize rproc_class before use 2020-02-24 08:34:50 +01:00
reset reset: uniphier: Add SCSSI reset control for each channel 2020-02-24 08:34:44 +01:00
rpmsg
rtc rtc: max8907: add missing select REGMAP_IRQ 2020-03-25 08:06:12 +01:00
s390 s390/qeth: handle error when backing RX buffer 2020-04-02 15:28:15 +02:00
sbus
scsi scsi: sd: Fix optimal I/O size for devices that change reported values 2020-04-02 15:28:17 +02:00
sfi
sh
siox
slimbus
sn
soc soc/tegra: fuse: Fix build with Tegra194 configuration 2020-03-05 16:42:13 +01:00
soundwire
spi spi/zynqmp: remove entry that causes a cs glitch 2020-03-25 08:06:06 +01:00
spmi
ssb
staging staging: wlan-ng: fix use-after-free Read in hfa384x_usbin_callback 2020-04-02 15:28:21 +02:00
target scsi: Revert "target: iscsi: Wait for all commands to finish before freeing a session" 2020-02-28 16:38:58 +01:00
tc
tee
thermal thermal: brcmstb_thermal: Do not use DT coefficients 2020-03-05 16:42:22 +01:00
thunderbolt thunderbolt: Prevent crash if non-active NVMem file is read 2020-02-28 16:38:44 +01:00
tty vt: vt_ioctl: fix use-after-free in vt_in_use() 2020-04-02 15:28:23 +02:00
uio uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol() 2020-02-24 08:34:37 +01:00
usb usb: musb: fix crash with highmen PIO and usbmon 2020-04-02 15:28:20 +02:00
uwb
vfio
vhost vhost: Check docket sk_family instead of call getname 2020-03-05 16:42:18 +01:00
video vgacon: Fix a UAF in vgacon_invert_region 2020-03-11 14:15:00 +01:00
virt
virtio virtio_balloon: prevent pfn array overflow 2020-02-24 08:34:54 +01:00
visorbus visorbus: fix uninitialized variable access 2020-02-24 08:34:47 +01:00
vlynq
vme vme: bridges: reduce stack usage 2020-02-24 08:34:47 +01:00
w1
watchdog watchdog: da9062: do not ping the hw during stop() 2020-03-11 14:14:53 +01:00
xen xenbus: req->err should be updated before req->state 2020-03-25 08:06:08 +01:00
zorro
Kconfig
Makefile