Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Philippe Simons <simons.philippe@gmail.com>
Tested-by: Hironori KIKUCHI <kikuchan98@gmail.com>
Tested-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Fixes: d2ac3df75c3a ("regulator: axp20x: add support for the AXP717")
Link: https://patch.msgid.link/20241208124308.5630-1-simons.philippe@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Philippe Simons and committed by
Mark Brown
f07ae52f 8099b1f7

+24 -12
+24 -12
drivers/regulator/axp20x-regulator.c
··· 371 371 .ops = &axp20x_ops, \ 372 372 } 373 373 374 - #define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ 375 - _vmask, _ereg, _emask) \ 374 + #define AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ 375 + _vmask, _ereg, _emask, _ramp_delay) \ 376 376 [_family##_##_id] = { \ 377 377 .name = (_match), \ 378 378 .supply_name = (_supply), \ ··· 388 388 .vsel_mask = (_vmask), \ 389 389 .enable_reg = (_ereg), \ 390 390 .enable_mask = (_emask), \ 391 + .ramp_delay = (_ramp_delay), \ 391 392 .ops = &axp20x_ops, \ 392 393 } 394 + 395 + #define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ 396 + _vmask, _ereg, _emask) \ 397 + AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ 398 + _vmask, _ereg, _emask, 0) 393 399 394 400 #define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask) \ 395 401 [_family##_##_id] = { \ ··· 425 419 .ops = &axp20x_ops_fixed \ 426 420 } 427 421 428 - #define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages, \ 429 - _vreg, _vmask, _ereg, _emask) \ 422 + #define AXP_DESC_RANGES_DELAY(_family, _id, _match, _supply, _ranges, _n_voltages, \ 423 + _vreg, _vmask, _ereg, _emask, _ramp_delay) \ 430 424 [_family##_##_id] = { \ 431 425 .name = (_match), \ 432 426 .supply_name = (_supply), \ ··· 442 436 .enable_mask = (_emask), \ 443 437 .linear_ranges = (_ranges), \ 444 438 .n_linear_ranges = ARRAY_SIZE(_ranges), \ 439 + .ramp_delay = (_ramp_delay), \ 445 440 .ops = &axp20x_ops_range, \ 446 441 } 442 + 443 + #define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages, \ 444 + _vreg, _vmask, _ereg, _emask) \ 445 + AXP_DESC_RANGES_DELAY(_family, _id, _match, _supply, _ranges, \ 446 + _n_voltages, _vreg, _vmask, _ereg, _emask, 0) 447 447 448 448 static const int axp209_dcdc2_ldo3_slew_rates[] = { 449 449 1600, ··· 793 781 }; 794 782 795 783 static const struct regulator_desc axp717_regulators[] = { 796 - AXP_DESC_RANGES(AXP717, DCDC1, "dcdc1", "vin1", 784 + AXP_DESC_RANGES_DELAY(AXP717, DCDC1, "dcdc1", "vin1", 797 785 axp717_dcdc1_ranges, AXP717_DCDC1_NUM_VOLTAGES, 798 786 AXP717_DCDC1_CONTROL, AXP717_DCDC_V_OUT_MASK, 799 - AXP717_DCDC_OUTPUT_CONTROL, BIT(0)), 800 - AXP_DESC_RANGES(AXP717, DCDC2, "dcdc2", "vin2", 787 + AXP717_DCDC_OUTPUT_CONTROL, BIT(0), 640), 788 + AXP_DESC_RANGES_DELAY(AXP717, DCDC2, "dcdc2", "vin2", 801 789 axp717_dcdc2_ranges, AXP717_DCDC2_NUM_VOLTAGES, 802 790 AXP717_DCDC2_CONTROL, AXP717_DCDC_V_OUT_MASK, 803 - AXP717_DCDC_OUTPUT_CONTROL, BIT(1)), 804 - AXP_DESC_RANGES(AXP717, DCDC3, "dcdc3", "vin3", 791 + AXP717_DCDC_OUTPUT_CONTROL, BIT(1), 640), 792 + AXP_DESC_RANGES_DELAY(AXP717, DCDC3, "dcdc3", "vin3", 805 793 axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES, 806 794 AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK, 807 - AXP717_DCDC_OUTPUT_CONTROL, BIT(2)), 808 - AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100, 795 + AXP717_DCDC_OUTPUT_CONTROL, BIT(2), 640), 796 + AXP_DESC_DELAY(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100, 809 797 AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK, 810 - AXP717_DCDC_OUTPUT_CONTROL, BIT(3)), 798 + AXP717_DCDC_OUTPUT_CONTROL, BIT(3), 6400), 811 799 AXP_DESC(AXP717, ALDO1, "aldo1", "aldoin", 500, 3500, 100, 812 800 AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK, 813 801 AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),