feat(allwinner): h616: add support for AXP313 PMIC

Many newer boards with the H616 and its sibling H618 are now paired
with the X-Powers AXP313 PMIC. This is a simpler PMIC, with only a few
voltage rails and no extra functionality except the power key support.
In contrast to the AXP305 it can only be controlled via I2C.

Add a check to look for the AXP313 compatible string in the devicetree,
and set the PMIC type and I2C address accordingly, if one is found.
With only very few voltage rails available, all of them are mostly in
use and are thus enabled at reset already, so we can skip the regulator
setup entirely.

Change-Id: I01962854109e43793b4f56553c1ca9e1f752e30d
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
Andre Przywara 2024-03-21 14:18:47 +00:00 committed by André Przywara
parent 044458981f
commit 03851367db

View file

@ -33,6 +33,7 @@ static bool is_using_rsb(void)
static enum pmic_type {
UNKNOWN,
AXP305,
AXP313,
} pmic;
static uint8_t get_rsb_rt_address(uint16_t hw_addr)
@ -146,6 +147,13 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt)
pmic = AXP305;
}
if (pmic == UNKNOWN) {
node = fdt_node_offset_by_compatible(fdt, 0, "x-powers,axp313a");
if (node >= 0) {
pmic = AXP313;
}
}
if (pmic == UNKNOWN) {
INFO("PMIC: No known PMIC in DT, skipping setup.\n");
return -ENODEV;
@ -185,6 +193,16 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt)
pmic = UNKNOWN;
}
break;
case 0x48: /* AXP1530 */
case 0x4b: /* AXP313A */
case 0x4c: /* AXP313B */
if (pmic == AXP313) {
INFO("PMIC: found AXP313\n");
/* no regulators to set up */
} else {
pmic = UNKNOWN;
}
break;
}
if (is_using_rsb()) {
@ -218,6 +236,9 @@ void sunxi_power_down(void)
case AXP305:
axp_setbits(0x32, BIT(7));
break;
case AXP313:
axp_setbits(0x1a, BIT(7));
break;
default:
break;
}