linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] power: supply: axp20x_usb_power: cleanup input current limit handling
@ 2024-01-30 20:27 Aren Moynihan
  2024-01-30 20:27 ` [PATCH v2 1/5] power: supply: axp20x_usb_power: replace current_max with input_current_limit Aren Moynihan
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Aren Moynihan @ 2024-01-30 20:27 UTC (permalink / raw)
  To: linux-pm, linux-kernel
  Cc: Ondřej Jirman, Hans de Goede, Aidan MacDonald, Aren Moynihan,
	Chen-Yu Tsai, Quentin Schulz, Sebastian Reichel

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/20240121014057.1042466-1-aren@peacevolution.org/

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(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-03-23 21:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30 20:27 [PATCH v2 0/5] power: supply: axp20x_usb_power: cleanup input current limit handling Aren Moynihan
2024-01-30 20:27 ` [PATCH v2 1/5] power: supply: axp20x_usb_power: replace current_max with input_current_limit Aren Moynihan
2024-01-30 20:27 ` [PATCH v2 2/5] power: supply: axp20x_usb_power: use correct register for input current limit Aren Moynihan
2024-01-30 20:27 ` [PATCH v2 3/5] power: supply: axp20x_usb_power: fix race condition with usb bc Aren Moynihan
2024-01-30 20:28 ` [PATCH v2 4/5] power: supply: axp20x_usb_power: enable usb_type reporting Aren Moynihan
2024-01-30 20:28 ` [PATCH v2 5/5] power: supply: axp20x_usb_power: set input current limit in probe Aren Moynihan
2024-01-30 21:13   ` Ondřej Jirman
2024-01-31  4:20     ` Aren
2024-02-10 23:27       ` Ondřej Jirman
2024-03-14 22:39         ` Aren
2024-03-20  0:12           ` Ondřej Jirman
2024-03-23 21:36             ` Aren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).