mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:31:02 +07:00
9c80662a74
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> |
||
---|---|---|
.. | ||
88pm860x_battery.c | ||
88pm860x_charger.c | ||
ab8500_bmdata.c | ||
ab8500_btemp.c | ||
ab8500_charger.c | ||
ab8500_fg.c | ||
abx500_chargalg.c | ||
act8945a_charger.c | ||
adp5061.c | ||
apm_power.c | ||
axp20x_ac_power.c | ||
axp20x_battery.c | ||
axp20x_usb_power.c | ||
axp288_charger.c | ||
axp288_fuel_gauge.c | ||
bd70528-charger.c | ||
bq27xxx_battery_hdq.c | ||
bq27xxx_battery_i2c.c | ||
bq27xxx_battery.c | ||
bq2415x_charger.c | ||
bq24190_charger.c | ||
bq24257_charger.c | ||
bq24735-charger.c | ||
bq25890_charger.c | ||
charger-manager.c | ||
collie_battery.c | ||
cpcap-battery.c | ||
cpcap-charger.c | ||
cros_usbpd-charger.c | ||
da9030_battery.c | ||
da9052-battery.c | ||
da9150-charger.c | ||
da9150-fg.c | ||
ds2760_battery.c | ||
ds2780_battery.c | ||
ds2781_battery.c | ||
ds2782_battery.c | ||
generic-adc-battery.c | ||
goldfish_battery.c | ||
gpio-charger.c | ||
ingenic-battery.c | ||
ipaq_micro_battery.c | ||
isp1704_charger.c | ||
Kconfig | ||
lego_ev3_battery.c | ||
lp8727_charger.c | ||
lp8788-charger.c | ||
lt3651-charger.c | ||
ltc2941-battery-gauge.c | ||
Makefile | ||
max1721x_battery.c | ||
max8903_charger.c | ||
max8925_power.c | ||
max8997_charger.c | ||
max8998_charger.c | ||
max14577_charger.c | ||
max14656_charger_detector.c | ||
max17040_battery.c | ||
max17042_battery.c | ||
max77650-charger.c | ||
max77693_charger.c | ||
olpc_battery.c | ||
pcf50633-charger.c | ||
pda_power.c | ||
pm2301_charger.c | ||
pm2301_charger.h | ||
pmu_battery.c | ||
power_supply_core.c | ||
power_supply_hwmon.c | ||
power_supply_leds.c | ||
power_supply_sysfs.c | ||
power_supply.h | ||
qcom_smbb.c | ||
rt5033_battery.c | ||
rt9455_charger.c | ||
rx51_battery.c | ||
s3c_adc_battery.c | ||
sbs-battery.c | ||
sbs-charger.c | ||
sbs-manager.c | ||
sc27xx_fuel_gauge.c | ||
sc2731_charger.c | ||
smb347-charger.c | ||
test_power.c | ||
tosa_battery.c | ||
tps65090-charger.c | ||
tps65217_charger.c | ||
twl4030_charger.c | ||
twl4030_madc_battery.c | ||
ucs1002_power.c | ||
wilco-charger.c | ||
wm97xx_battery.c | ||
wm831x_backup.c | ||
wm831x_power.c | ||
wm8350_power.c | ||
z2_battery.c |