Skip to contentSkip to conversation

regulator: axp20x: AXP717: set ramp_delay

PATCH In review Philippe Simons 3 participants 3 messages Dec 8, 2024 – Dec 10, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 regulator: axp20x: AXP717: set ramp_delay

AXP717 datasheet says that regulator ramp delay is 15.625 us/step, which is 10mV in our case.

Add a AXP_DESC_RANGES_DELAY macro and update AXP_DESC_RANGES macro to expand to AXP_DESC_RANGES_DELAY with ramp_delay = 0

For DCDC4, steps is 100mv

Add a AXP_DESC_DELAY macro and update AXP_DESC macro to expand to AXP_DESC_DELAY with ramp_delay = 0

This patch fix crashes when using CPU DVFS.

---
Changes in v2:
- set ramp_delay for AXP717 DCDC4
- Link to v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/regulator/axp20x-regulator.c | 36 ++++++++++++++++++----------
 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/regulator/axp20x-regulator.c +24 -12
index a8e91d9d0..945d2917b 100644
@@ -371,8 +371,8 @@
 		.ops		= &axp20x_ops,					\
 	}
 
-#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
-		 _vmask, _ereg, _emask) 					\
+#define AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
+		 _vmask, _ereg, _emask, _ramp_delay) 				\
 	[_family##_##_id] = {							\
 		.name		= (_match),					\
 		.supply_name	= (_supply),					\
@@ -388,9 +388,15 @@
 		.vsel_mask	= (_vmask),					\
 		.enable_reg	= (_ereg),					\
 		.enable_mask	= (_emask),					\
+		.ramp_delay = (_ramp_delay),					\
 		.ops		= &axp20x_ops,					\
 	}
 
+#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
+		 _vmask, _ereg, _emask) 					\
+	AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
+		 _vmask, _ereg, _emask, 0)
+
 #define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask)		\
 	[_family##_##_id] = {							\
 		.name		= (_match),					\
@@ -419,8 +425,8 @@
 		.ops		= &axp20x_ops_fixed				\
 	}
 
-#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,	\
-			_vreg, _vmask, _ereg, _emask)				\
+#define AXP_DESC_RANGES_DELAY(_family, _id, _match, _supply, _ranges, _n_voltages,	\
+			_vreg, _vmask, _ereg, _emask, _ramp_delay)	\
 	[_family##_##_id] = {							\
 		.name		= (_match),					\
 		.supply_name	= (_supply),					\
@@ -436,9 +442,15 @@
 		.enable_mask	= (_emask),					\
 		.linear_ranges	= (_ranges),					\
 		.n_linear_ranges = ARRAY_SIZE(_ranges),				\
+		.ramp_delay = (_ramp_delay),					\
 		.ops		= &axp20x_ops_range,				\
 	}
 
+#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,	\
+			_vreg, _vmask, _ereg, _emask)				\
+	AXP_DESC_RANGES_DELAY(_family, _id, _match, _supply, _ranges,		\
+		 _n_voltages, _vreg, _vmask, _ereg, _emask, 0)
+
 static const int axp209_dcdc2_ldo3_slew_rates[] = {
 	1600,
 	 800,
@@ -781,21 +793,21 @@ static const struct linear_range axp717_dcdc3_ranges[] = {
 };
 
 static const struct regulator_desc axp717_regulators[] = {
-	AXP_DESC_RANGES(AXP717, DCDC1, "dcdc1", "vin1",
+	AXP_DESC_RANGES_DELAY(AXP717, DCDC1, "dcdc1", "vin1",
 			axp717_dcdc1_ranges, AXP717_DCDC1_NUM_VOLTAGES,
 			AXP717_DCDC1_CONTROL, AXP717_DCDC_V_OUT_MASK,
-			AXP717_DCDC_OUTPUT_CONTROL, BIT(0)),
-	AXP_DESC_RANGES(AXP717, DCDC2, "dcdc2", "vin2",
+			AXP717_DCDC_OUTPUT_CONTROL, BIT(0), 640),
+	AXP_DESC_RANGES_DELAY(AXP717, DCDC2, "dcdc2", "vin2",
 			axp717_dcdc2_ranges, AXP717_DCDC2_NUM_VOLTAGES,
 			AXP717_DCDC2_CONTROL, AXP717_DCDC_V_OUT_MASK,
-			AXP717_DCDC_OUTPUT_CONTROL, BIT(1)),
-	AXP_DESC_RANGES(AXP717, DCDC3, "dcdc3", "vin3",
+			AXP717_DCDC_OUTPUT_CONTROL, BIT(1), 640),
+	AXP_DESC_RANGES_DELAY(AXP717, DCDC3, "dcdc3", "vin3",
 			axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES,
 			AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK,
-			AXP717_DCDC_OUTPUT_CONTROL, BIT(2)),
-	AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
+			AXP717_DCDC_OUTPUT_CONTROL, BIT(2), 640),
+	AXP_DESC_DELAY(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
 		 AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
-		 AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
+		 AXP717_DCDC_OUTPUT_CONTROL, BIT(3), 6400),
 	AXP_DESC(AXP717, ALDO1, "aldo1", "aldoin", 500, 3500, 100,
 		 AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
 		 AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),
Signature · 1 line
2.47.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Philippe Simons

AXP717 datasheet says that regulator ramp delay is 15.625 us/step, which is 10mV in our case.

Add a AXP_DESC_RANGES_DELAY macro and update AXP_DESC_RANGES macro to expand to AXP_DESC_RANGES_DELAY with ramp_delay = 0

For DCDC4, steps is 100mv

Quoted 8 lines

Add a AXP_DESC_DELAY macro and update AXP_DESC macro to expand to AXP_DESC_DELAY with ramp_delay = 0

This patch fix crashes when using CPU DVFS.

The following tags should also be added:

Fixes d2ac3df75c3a ("regulator: axp20x: add support for the AXP717")
Cc <[email protected]> # v6.10+

You probably don't need to send a new version just to add them. The scripts used by maintainers should be able to pick them up together.

Quoted 99 lines

---
Changes in v2:
- set ramp_delay for AXP717 DCDC4
- Link to v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/regulator/axp20x-regulator.c | 36 ++++++++++++++++++----------
 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/regulator/axp20x-regulator.c +24 -13
index a8e91d9d0..945d2917b 100644
@@ -371,8 +371,8 @@
                .ops            = &axp20x_ops,                                  \
        }
 
-#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg,      \
-                _vmask, _ereg, _emask)                                         \
+#define AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg,        \
+                _vmask, _ereg, _emask, _ramp_delay)                            \
        [_family##_##_id] = {                                                   \
                .name           = (_match),                                     \
                .supply_name    = (_supply),                                    \
@@ -388,9 +388,15 @@
                .vsel_mask      = (_vmask),                                     \
                .enable_reg     = (_ereg),                                      \
                .enable_mask    = (_emask),                                     \
+               .ramp_delay = (_ramp_delay),                                    \
                .ops            = &axp20x_ops,                                  \
        }
 
+#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg,      \
+                _vmask, _ereg, _emask)                                         \
+       AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg, \
+                _vmask, _ereg, _emask, 0)
+
 #define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask)              \
        [_family##_##_id] = {                                                   \
                .name           = (_match),                                     \
@@ -419,8 +425,8 @@
                .ops            = &axp20x_ops_fixed                             \
        }
 
-#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,   \
-                       _vreg, _vmask, _ereg, _emask)                           \
+#define AXP_DESC_RANGES_DELAY(_family, _id, _match, _supply, _ranges, _n_voltages,     \
+                       _vreg, _vmask, _ereg, _emask, _ramp_delay)      \
        [_family##_##_id] = {                                                   \
                .name           = (_match),                                     \
                .supply_name    = (_supply),                                    \
@@ -436,9 +442,15 @@
                .enable_mask    = (_emask),                                     \
                .linear_ranges  = (_ranges),                                    \
                .n_linear_ranges = ARRAY_SIZE(_ranges),                         \
+               .ramp_delay = (_ramp_delay),                                    \
                .ops            = &axp20x_ops_range,                            \
        }
 
+#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,   \
+                       _vreg, _vmask, _ereg, _emask)                           \
+       AXP_DESC_RANGES_DELAY(_family, _id, _match, _supply, _ranges,           \
+                _n_voltages, _vreg, _vmask, _ereg, _emask, 0)
+
 static const int axp209_dcdc2_ldo3_slew_rates[] = {
        1600,
         800,
@@ -781,21 +793,21 @@ static const struct linear_range axp717_dcdc3_ranges[] = {
 };
 
 static const struct regulator_desc axp717_regulators[] = {
-       AXP_DESC_RANGES(AXP717, DCDC1, "dcdc1", "vin1",
+       AXP_DESC_RANGES_DELAY(AXP717, DCDC1, "dcdc1", "vin1",
                        axp717_dcdc1_ranges, AXP717_DCDC1_NUM_VOLTAGES,
                        AXP717_DCDC1_CONTROL, AXP717_DCDC_V_OUT_MASK,
-                       AXP717_DCDC_OUTPUT_CONTROL, BIT(0)),
-       AXP_DESC_RANGES(AXP717, DCDC2, "dcdc2", "vin2",
+                       AXP717_DCDC_OUTPUT_CONTROL, BIT(0), 640),
+       AXP_DESC_RANGES_DELAY(AXP717, DCDC2, "dcdc2", "vin2",
                        axp717_dcdc2_ranges, AXP717_DCDC2_NUM_VOLTAGES,
                        AXP717_DCDC2_CONTROL, AXP717_DCDC_V_OUT_MASK,
-                       AXP717_DCDC_OUTPUT_CONTROL, BIT(1)),
-       AXP_DESC_RANGES(AXP717, DCDC3, "dcdc3", "vin3",
+                       AXP717_DCDC_OUTPUT_CONTROL, BIT(1), 640),
+       AXP_DESC_RANGES_DELAY(AXP717, DCDC3, "dcdc3", "vin3",
                        axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES,
                        AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK,
-                       AXP717_DCDC_OUTPUT_CONTROL, BIT(2)),
-       AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
+                       AXP717_DCDC_OUTPUT_CONTROL, BIT(2), 640),
+       AXP_DESC_DELAY(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
                 AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
-                AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
+                AXP717_DCDC_OUTPUT_CONTROL, BIT(3), 6400),
        AXP_DESC(AXP717, ALDO1, "aldo1", "aldoin", 500, 3500, 100,
                 AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
                 AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),
--

2.47.1

maintainer
#2 lore raw
In reply to Philippe Simons
Quoted 9 lines · Philippe Simons

AXP717 datasheet says that regulator ramp delay is 15.625 us/step, which is 10mV in our case.

Add a AXP_DESC_RANGES_DELAY macro and update AXP_DESC_RANGES macro to expand to AXP_DESC_RANGES_DELAY with ramp_delay = 0

For DCDC4, steps is 100mv

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: axp20x: AXP717: set ramp_delay

      commit: f07ae52f5cf6a5584fdf7c8c652f027d90bc8b74

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark