Skip to content

Commit 0057222

Browse files
Andre-ARMbroonie
authored andcommitted
regulator: axp20x: AXP717: fix LDO supply rails and off-by-ones
The X-Powers AXP717 PMIC has separate input supply pins for each group of LDOs, so they are not all using the same DCDC1 input, as described currently. Replace the "supply" member of each LDO description with the respective group supply name, so that the supply dependencies can be correctly described in the devicetree. Also fix two off-by-ones in the regulator macros, after some double checking the numbers against the datasheet. This uncovered a bug in the datasheet: add a comment to document this. Fixes: d2ac3df ("regulator: axp20x: add support for the AXP717") Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: John Watts <contact@jookia.org> Link: https://lore.kernel.org/r/20240418000736.24338-3-andre.przywara@arm.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4cac29b commit 0057222

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

drivers/regulator/axp20x-regulator.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140

141141
#define AXP717_DCDC1_NUM_VOLTAGES 88
142142
#define AXP717_DCDC2_NUM_VOLTAGES 107
143-
#define AXP717_DCDC3_NUM_VOLTAGES 104
143+
#define AXP717_DCDC3_NUM_VOLTAGES 103
144144
#define AXP717_DCDC_V_OUT_MASK GENMASK(6, 0)
145145
#define AXP717_LDO_V_OUT_MASK GENMASK(4, 0)
146146

@@ -763,10 +763,15 @@ static const struct linear_range axp717_dcdc1_ranges[] = {
763763
REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
764764
};
765765

766+
/*
767+
* The manual says that the last voltage is 3.4V, encoded as 0b1101011 (107),
768+
* but every other method proves that this is wrong, so it's really 106 that
769+
* programs the final 3.4V.
770+
*/
766771
static const struct linear_range axp717_dcdc2_ranges[] = {
767772
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
768773
REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
769-
REGULATOR_LINEAR_RANGE(1600000, 88, 107, 100000),
774+
REGULATOR_LINEAR_RANGE(1600000, 88, 106, 100000),
770775
};
771776

772777
static const struct linear_range axp717_dcdc3_ranges[] = {
@@ -790,40 +795,40 @@ static const struct regulator_desc axp717_regulators[] = {
790795
AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
791796
AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
792797
AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
793-
AXP_DESC(AXP717, ALDO1, "aldo1", "vin1", 500, 3500, 100,
798+
AXP_DESC(AXP717, ALDO1, "aldo1", "aldoin", 500, 3500, 100,
794799
AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
795800
AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),
796-
AXP_DESC(AXP717, ALDO2, "aldo2", "vin1", 500, 3500, 100,
801+
AXP_DESC(AXP717, ALDO2, "aldo2", "aldoin", 500, 3500, 100,
797802
AXP717_ALDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
798803
AXP717_LDO0_OUTPUT_CONTROL, BIT(1)),
799-
AXP_DESC(AXP717, ALDO3, "aldo3", "vin1", 500, 3500, 100,
804+
AXP_DESC(AXP717, ALDO3, "aldo3", "aldoin", 500, 3500, 100,
800805
AXP717_ALDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
801806
AXP717_LDO0_OUTPUT_CONTROL, BIT(2)),
802-
AXP_DESC(AXP717, ALDO4, "aldo4", "vin1", 500, 3500, 100,
807+
AXP_DESC(AXP717, ALDO4, "aldo4", "aldoin", 500, 3500, 100,
803808
AXP717_ALDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
804809
AXP717_LDO0_OUTPUT_CONTROL, BIT(3)),
805-
AXP_DESC(AXP717, BLDO1, "bldo1", "vin1", 500, 3500, 100,
810+
AXP_DESC(AXP717, BLDO1, "bldo1", "bldoin", 500, 3500, 100,
806811
AXP717_BLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
807812
AXP717_LDO0_OUTPUT_CONTROL, BIT(4)),
808-
AXP_DESC(AXP717, BLDO2, "bldo2", "vin1", 500, 3500, 100,
813+
AXP_DESC(AXP717, BLDO2, "bldo2", "bldoin", 500, 3500, 100,
809814
AXP717_BLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
810815
AXP717_LDO0_OUTPUT_CONTROL, BIT(5)),
811-
AXP_DESC(AXP717, BLDO3, "bldo3", "vin1", 500, 3500, 100,
816+
AXP_DESC(AXP717, BLDO3, "bldo3", "bldoin", 500, 3500, 100,
812817
AXP717_BLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
813818
AXP717_LDO0_OUTPUT_CONTROL, BIT(6)),
814-
AXP_DESC(AXP717, BLDO4, "bldo4", "vin1", 500, 3500, 100,
819+
AXP_DESC(AXP717, BLDO4, "bldo4", "bldoin", 500, 3500, 100,
815820
AXP717_BLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
816821
AXP717_LDO0_OUTPUT_CONTROL, BIT(7)),
817-
AXP_DESC(AXP717, CLDO1, "cldo1", "vin1", 500, 3500, 100,
822+
AXP_DESC(AXP717, CLDO1, "cldo1", "cldoin", 500, 3500, 100,
818823
AXP717_CLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
819824
AXP717_LDO1_OUTPUT_CONTROL, BIT(0)),
820-
AXP_DESC(AXP717, CLDO2, "cldo2", "vin1", 500, 3500, 100,
825+
AXP_DESC(AXP717, CLDO2, "cldo2", "cldoin", 500, 3500, 100,
821826
AXP717_CLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
822827
AXP717_LDO1_OUTPUT_CONTROL, BIT(1)),
823-
AXP_DESC(AXP717, CLDO3, "cldo3", "vin1", 500, 3500, 100,
828+
AXP_DESC(AXP717, CLDO3, "cldo3", "cldoin", 500, 3500, 100,
824829
AXP717_CLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
825830
AXP717_LDO1_OUTPUT_CONTROL, BIT(2)),
826-
AXP_DESC(AXP717, CLDO4, "cldo4", "vin1", 500, 3500, 100,
831+
AXP_DESC(AXP717, CLDO4, "cldo4", "cldoin", 500, 3500, 100,
827832
AXP717_CLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
828833
AXP717_LDO1_OUTPUT_CONTROL, BIT(3)),
829834
AXP_DESC(AXP717, CPUSLDO, "cpusldo", "vin1", 500, 1400, 50,

0 commit comments

Comments
 (0)