Skip to content

power: supply: axp20x_usb_power: cleanup input current limit handling

Aren Moynihan linux-pm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 6 repliesIn review
  2. v13 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- Values less than the lowest supported limit are rounded up instead of returning -EINVAL when setting the input current limit.
- Rename existing current_max logic to input_current_limit. This also makes it possible to reuse some of that logic.
- Split current limit register and bc race condition fixes into different commits.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5power: supply: axp20x_usb_power: replace current_max with input_current_limitdrivers/power/supply/axp20x_usb_power.c+18 -110 replies
2/5power: supply: axp20x_usb_power: use correct register for input current limitdrivers/power/supply/axp20x_usb_power.c+18 -40 replies
3/5power: supply: axp20x_usb_power: fix race condition with usb bcdrivers/power/supply/axp20x_usb_power.c+23 -00 replies
4/5power: supply: axp20x_usb_power: enable usb_type reportingdrivers/power/supply/axp20x_usb_power.c+72 -10 replies
5/5power: supply: axp20x_usb_power: set input current limit in probedrivers/power/supply/axp20x_usb_power.c+13 -06 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] power: supply: axp20x_usb_power: cleanup input current limit handling

Proper handling of the input current limit will be necessary to implement usb power delivery on the Pine64 PinePhone. The PinePhone has a separate chip (anx7688) that handles usb power delivery (among other things), so we will need a way to apply the current limit which that negotiates.

The new logic to get/set the input current limit, and get the usb type is originally based on code Ondřej Jirman wrote[1], but I have significantly refactored it.

While working on this, I also discovered that the axp803 pmic sets a current limit of 3A on the usb port without any negotiation if it doesn't detect a battery.

v1 of this patch can be found at:
https://lore.kernel.org/lkml/[email protected]/

1: https://xff.cz/git/linux/commit/?h=axp-6.7&id=3dcd33dfd1ae58db159427365dcb6d0d2b12f06d

Changes in v2:
- Values less than the lowest supported limit are rounded up instead of returning -EINVAL when setting the input current limit.
- Rename existing current_max logic to input_current_limit. This also makes it possible to reuse some of that logic.
- Split current limit register and bc race condition fixes into different commits.

Aren Moynihan (5):
power: supply: axp20x_usb_power: replace current_max with
input_current_limit
power: supply: axp20x_usb_power: use correct register for input
current limit
power: supply: axp20x_usb_power: fix race condition with usb bc
power: supply: axp20x_usb_power: enable usb_type reporting
power: supply: axp20x_usb_power: set input current limit in probe

 drivers/power/supply/axp20x_usb_power.c | 160 +++++++++++++++++++++---
 1 file changed, 144 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.0