• Martin Botka's avatar
    regulator: axp20x: Add support for AXP313a variant · 60fd7eb8
    Martin Botka authored
    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: default avatarMartin Botka <martin.botka@somainline.org>
    Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
    Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
    Reviewed-by: default avatarMark Brown <broonie@kernel.org>
    Tested-by: default avatarShengyu Qu <wiagn233@outlook.com>
    Link: https://lore.kernel.org/r/20230524000012.15028-3-andre.przywara@arm.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    60fd7eb8
axp20x-regulator.c 49.9 KB