[PATCH v2 0/9] X-Powers Power Supply Improvements

From: Samuel Holland
Date: Sat Jan 04 2020 - 20:25:01 EST


This series adds some improvements to the axp20x* power supply drivers
to better support suspend/resume and use on mobile devices.

The first two patches fix bugs I found while testing the ONLINE control
added in later patches.

Patches 3 and 7 allow userspace to take the power supplies offline.
Patches 4 and 8 allow userspace to control the wakeup behavior.

Patch 9 avoids polling USB VBUS presence when possible. While working on
the RSB driver, I was seeing ~50 transfers per second, while idle and
tracked it down to this VBUS polling (20 reads/second). The polling
often caused the CPU to clock up and back down, which triggered the
remaining transfers (changes to the CPU voltage).

Unfortunately, I don't see a way to avoid the polling when running on
battery (where it matters most), other than to move the polling back to
the USB PHY driver.

Changes since v1:
- Add patches 1-2
- Shift value properly in calls to regmap_update_bits (3, 7)
- Use #ifdef instead of #if to avoid -Wundef warnings (4, 8)
- Poll once after an IRQ, instead of setting power->online in the IRQ (9)
- Poll once on resume, in case the state changed during suspend (9)

Samuel Holland (9):
mfd: axp20x: Mark AXP20X_VBUS_IPSOUT_MGMT as volatile
power: supply: axp20x_ac_power: Fix reporting online status
power: supply: axp20x_ac_power: Allow offlining
power: supply: axp20x_ac_power: Add wakeup control
power: supply: axp20x_usb_power: Remove unused device_node
power: supply: axp20x_usb_power: Use a match structure
power: supply: axp20x_usb_power: Allow offlining
power: supply: axp20x_usb_power: Add wakeup control
power: supply: axp20x_usb_power: Only poll while offline

drivers/mfd/axp20x.c | 2 +-
drivers/power/supply/axp20x_ac_power.c | 131 +++++++++++---
drivers/power/supply/axp20x_usb_power.c | 220 ++++++++++++++++++------
3 files changed, 276 insertions(+), 77 deletions(-)

--
2.23.0