regulator: Add a routine to set the current limit for QCOM PMIC VBUS
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Tue, 27 Apr 2021 13:07:11 +0000 (14:07 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 10 May 2021 12:06:50 +0000 (13:06 +0100)
commit67823d9dadd4dddee4b6bd075f6852b6ade5604a
tree20080e1937ff02b3fb47845781ea530acbca7e9d
parent6efb943b8616ec53a5e444193dccf1af9ad627b5
regulator: Add a routine to set the current limit for QCOM PMIC VBUS

Add hooks to regulator_get_current_limit_regmap() and
regulator_set_current_limit_regmap() with an accompanying map of amperages.

This lets us use the existing helper functions to map requested current
settings to register bit-map/indicies.

This change is required to elevate the default 2 Amps set by the bootloader
to 3 Amps or indeed to constrain the value lower as the system design may
dictate.

The valid range is 500 mA to 3 A in increments of 500 mA.

Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20210427130712.2005456-2-bryan.odonoghue@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/qcom_usb_vbus-regulator.c