mbox series

[v3,0/8] X-Powers Power Supply Improvements

Message ID 20200113035310.18950-1-samuel@sholland.org (mailing list archive)
Headers show
Series X-Powers Power Supply Improvements | expand

Message

Samuel Holland Jan. 13, 2020, 3:53 a.m. UTC
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 v2:
 - Patch 1 was merged
 - Only check ACIN_PATH_SEL when necessary (1)
 - Update commit message (5)
 - Avoided reordering lines until/unless necessary (5, 7)
 - Update comment and add ID check in axp20x_usb_power_set_property
   (it seemed more correct than adding another comment) (6)
 - Add Reviewed-by where there were no comments (2-4, 7-8)

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 (8):
  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/power/supply/axp20x_ac_power.c  | 131 +++++++++++---
 drivers/power/supply/axp20x_usb_power.c | 219 ++++++++++++++++++------
 2 files changed, 276 insertions(+), 74 deletions(-)

Comments

Sebastian Reichel Jan. 14, 2020, 12:17 a.m. UTC | #1
Hi,

I queued patches 1-4, patch 5 does not apply and seems to be based
on an older tree.

-- Sebastian

On Sun, Jan 12, 2020 at 09:53:02PM -0600, Samuel Holland wrote:
> 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 v2:
>  - Patch 1 was merged
>  - Only check ACIN_PATH_SEL when necessary (1)
>  - Update commit message (5)
>  - Avoided reordering lines until/unless necessary (5, 7)
>  - Update comment and add ID check in axp20x_usb_power_set_property
>    (it seemed more correct than adding another comment) (6)
>  - Add Reviewed-by where there were no comments (2-4, 7-8)
> 
> 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 (8):
>   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/power/supply/axp20x_ac_power.c  | 131 +++++++++++---
>  drivers/power/supply/axp20x_usb_power.c | 219 ++++++++++++++++++------
>  2 files changed, 276 insertions(+), 74 deletions(-)
> 
> -- 
> 2.23.0
>