regulator: qcom-labibb: Implement current limiting
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Tue, 19 Jan 2021 17:44:16 +0000 (18:44 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 20 Jan 2021 18:48:15 +0000 (18:48 +0000)
commit8056704ba948c1c54c7a67d78a8399a749f2d04b
tree65eddea759bcfff6c0c8760b9199c2f72d94e7f7
parent9a12eb704ea27826ece4414cb8822388ec54883c
regulator: qcom-labibb: Implement current limiting

LAB and IBB regulators can be current-limited by setting the
appropriate registers, but this operation is granted only after
sending an unlock code for secure access.

Besides the secure access, it would be possible to use the
regmap helper for get_current_limit, as there is no security
blocking reads, but I chose not to as to avoid having a very
big array containing current limits, especially for IBB.

That said, these regulators support current limiting for:
- LAB (pos): 200-1600mA, with 200mA per step (8 steps),
- IBB (neg):   0-1550mA, with  50mA per step (32 steps).

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210119174421.226541-3-angelogioacchino.delregno@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/qcom-labibb-regulator.c