power: supply: axp20x_usb_power: replace current_max with input_current_limit
authorAren Moynihan <aren@peacevolution.org>
Tue, 30 Jan 2024 20:27:57 +0000 (15:27 -0500)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Fri, 2 Feb 2024 22:21:53 +0000 (23:21 +0100)
commitbec924d27a1fda74ec9ae9a1bae1e32723e32bcb
tree2ef63ed444d28182ec0d29a8dc153b21293bdb4e
parentcad1e6df54ca6231a3d1217bc4231d1a7eadbc0c
power: supply: axp20x_usb_power: replace current_max with input_current_limit

The current_max property is supposed to be read-only, and represent the
maximum current the supply can provide. input_current_limit is the
limit that is currently set, which is what we have here.

When determining what value to write to the register, we need to pick a
reasonable value if the requested limit doesn't exactly match one
supported by the hardware. If the requested limit is less than the
lowest value we can set, round up to the lowest value. Otherwise round
down to the nearest value supported by hardware.

Also add a dev field to the axp20x_usb_power struct, so we can use
dev_dbg and dev_err in more places.

Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Link: https://lore.kernel.org/r/20240130203714.3020464-2-aren@peacevolution.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/axp20x_usb_power.c