regulator: axp20x: add support for the AXP323

The X-Powers AXP323 is a very close sibling of the AXP313A. The only
difference seems to be the ability to dual-phase the first two DC/DC
converters.

Place the new AXP323 ID next to the existing AXP313A checks, to let
them share most code.
The only difference is the poly-phase detection code, which gets
extended to check the respective bit in a newly used register.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20241007001408.27249-6-andre.przywara@arm.com
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
Andre Przywara 2024-10-07 01:14:08 +01:00 committed by Lee Jones
parent 35fec94afe
commit a0f8a8898e

View File

@ -1341,6 +1341,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
step = 150; step = 150;
break; break;
case AXP313A_ID: case AXP313A_ID:
case AXP323_ID:
case AXP717_ID: case AXP717_ID:
case AXP15060_ID: case AXP15060_ID:
/* The DCDC PWM frequency seems to be fixed to 3 MHz. */ /* The DCDC PWM frequency seems to be fixed to 3 MHz. */
@ -1527,6 +1528,15 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
} }
break; break;
case AXP323_ID:
regmap_read(axp20x->regmap, AXP323_DCDC_MODE_CTRL2, &reg);
switch (id) {
case AXP313A_DCDC2:
return !!(reg & BIT(1));
}
break;
default: default:
return false; return false;
} }
@ -1565,6 +1575,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
"x-powers,drive-vbus-en"); "x-powers,drive-vbus-en");
break; break;
case AXP313A_ID: case AXP313A_ID:
case AXP323_ID:
regulators = axp313a_regulators; regulators = axp313a_regulators;
nregulators = AXP313A_REG_ID_MAX; nregulators = AXP313A_REG_ID_MAX;
break; break;