regulator: axp20x: Add support for AXP313a variant
authorMartin Botka <martin.botka@somainline.org>
Wed, 24 May 2023 00:00:11 +0000 (01:00 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 2 Jun 2023 12:31:09 +0000 (13:31 +0100)
commit60fd7eb89670d2636ac3156881acbd103c6eba6a
tree7600382631a3c6d69b60b77a9391d8a070b7da63
parent75c8cb2f4cb218aaf4ea68cab08d6dbc96eeae15
regulator: axp20x: Add support for AXP313a variant

The AXP313a is your typical I2C controlled PMIC, although in a lighter
fashion compared to the other X-Powers PMICs: it has only three DCDC
rails, three LDOs, and no battery charging support.

The AXP313a datasheet does not describe a register to change the DCDC
switching frequency, and talks of it being fixed at 3 MHz. Check that
the property allowing to change that frequency is absent from the DT,
and bail out otherwise.

The third LDO, RTCLDO, is fixed, and cannot even be turned on or off,
programmatically. On top of that, its voltage is customisable (either
1.8V or 3.3V), which we cannot describe easily using the existing
regulator wrapper functions. This should be fixed properly, using
regulator-{min,max}-microvolt in the DT, but this requires more changes
to the code. As some other PMICs (AXP2xx, AXP803) seem to paper over the
same problem as well, we follow suit here and pretend it's a fixed 1.8V
regulator. A proper fix can follow later. The BSP code seems to ignore
this regulator altogether.

Describe the AXP313A's voltage settings and switch registers, how the
voltages are encoded, and connect this to the MFD device via its
regulator ID.

Signed-off-by: Martin Botka <martin.botka@somainline.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Tested-by: Shengyu Qu <wiagn233@outlook.com>
Link: https://lore.kernel.org/r/20230524000012.15028-3-andre.przywara@arm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/axp20x-regulator.c