regulator: spacemit-p1: Support board power tree

Merge series from Guodong Xu <guodong@riscstar.com>:

Patch 1, 2 and 3 (previously 2-4) enable flexible power tree
configurations for the SpacemiT P1 PMIC. Hardcoded supply assumptions
are replaced with explicit devicetree properties. PMIC supply connections
are board-design decisions. Moving this to DT allows supporting varied
topologies without driver modifications.

The supply binding change is an ABI change. The breakage is acceptable:
Yixun Lan checked the DTS tree queued for v6.20 and found no consumers
of the P1/PMIC regulator yet [1]. For the two K1 boards in-tree
(BPI-F3 and Jupiter), initial power settings come from boot firmware and
a probe failure of pmic node "spacemit,p1" has minimal impact.

In v4, the old "vin-supply" property is dropped from the binding
document as the updated driver no longer parses it and there is no
fallback logic. Only the per-rail names ("vin1-supply", "vin2-supply",
...) are supported going forward.

Intermittent dtbs_check warnings are expected while the binding and DTS
changes land through different trees, but will resolve once both are
merged.

Link: https://lore.kernel.org/lkml/20260125110333-GYD71302@gentoo.org/ [1]
This commit is contained in:
Mark Brown 2026-02-23 14:49:44 +00:00
commit f308205e3b
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 61 additions and 13 deletions

View File

@ -27,8 +27,41 @@ properties:
interrupts:
maxItems: 1
vin-supply:
description: Input supply phandle.
vin1-supply:
description:
Power supply for BUCK1. Required if BUCK1 is defined.
vin2-supply:
description:
Power supply for BUCK2. Required if BUCK2 is defined.
vin3-supply:
description:
Power supply for BUCK3. Required if BUCK3 is defined.
vin4-supply:
description:
Power supply for BUCK4. Required if BUCK4 is defined.
vin5-supply:
description:
Power supply for BUCK5. Required if BUCK5 is defined.
vin6-supply:
description:
Power supply for BUCK6. Required if BUCK6 is defined.
aldoin-supply:
description:
Power supply for ALDO1-4. Required if any are defined.
dldoin1-supply:
description:
Power supply for DLDO1-4. Required if any are defined.
dldoin2-supply:
description:
Power supply for DLDO5-7. Required if any are defined.
regulators:
type: object
@ -58,6 +91,10 @@ examples:
compatible = "spacemit,p1";
reg = <0x41>;
interrupts = <64>;
vin1-supply = <&reg_vcc_5v>;
vin5-supply = <&reg_vcc_5v>;
aldoin-supply = <&reg_vcc_5v>;
dldoin1-supply = <&buck5>;
regulators {
buck1 {
@ -68,6 +105,14 @@ examples:
regulator-always-on;
};
buck5: buck5 {
regulator-name = "buck5";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3450000>;
regulator-ramp-delay = <5000>;
regulator-always-on;
};
aldo1 {
regulator-name = "aldo1";
regulator-min-microvolt = <500000>;

View File

@ -87,13 +87,16 @@ static const struct linear_range p1_ldo_ranges[] = {
}
#define P1_BUCK_DESC(_n) \
P1_REG_DESC(BUCK, buck, _n, "vin", 0x47, BUCK_MASK, 255, p1_buck_ranges)
P1_REG_DESC(BUCK, buck, _n, "vin" #_n, 0x47, BUCK_MASK, 255, p1_buck_ranges)
#define P1_ALDO_DESC(_n) \
P1_REG_DESC(ALDO, aldo, _n, "vin", 0x5b, LDO_MASK, 128, p1_ldo_ranges)
P1_REG_DESC(ALDO, aldo, _n, "aldoin", 0x5b, LDO_MASK, 128, p1_ldo_ranges)
#define P1_DLDO_DESC(_n) \
P1_REG_DESC(DLDO, dldo, _n, "buck5", 0x67, LDO_MASK, 128, p1_ldo_ranges)
#define P1_DLDO1_DESC(_n) \
P1_REG_DESC(DLDO, dldo, _n, "dldoin1", 0x67, LDO_MASK, 128, p1_ldo_ranges)
#define P1_DLDO2_DESC(_n) \
P1_REG_DESC(DLDO, dldo, _n, "dldoin2", 0x67, LDO_MASK, 128, p1_ldo_ranges)
static const struct regulator_desc p1_regulator_desc[] = {
P1_BUCK_DESC(1),
@ -108,13 +111,13 @@ static const struct regulator_desc p1_regulator_desc[] = {
P1_ALDO_DESC(3),
P1_ALDO_DESC(4),
P1_DLDO_DESC(1),
P1_DLDO_DESC(2),
P1_DLDO_DESC(3),
P1_DLDO_DESC(4),
P1_DLDO_DESC(5),
P1_DLDO_DESC(6),
P1_DLDO_DESC(7),
P1_DLDO1_DESC(1),
P1_DLDO1_DESC(2),
P1_DLDO1_DESC(3),
P1_DLDO1_DESC(4),
P1_DLDO2_DESC(5),
P1_DLDO2_DESC(6),
P1_DLDO2_DESC(7),
};
static int p1_regulator_probe(struct platform_device *pdev)