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

regulator: axp20x: fix DCDCA and DCDCD for AXP806

Refactoring of the driver introduced bugs in AXP806's DCDCA and DCDCD
regulator definitions.

In DCDCA case, AXP806_DCDCA_1120mV_STEPS was obtained by subtracting
0x47 and 0x33. This should be 0x14 (hex) and not 14 (dec).

In DCDCD case, axp806_dcdcd_ranges[] contains two ranges with same
start and end macros, which is clearly wrong. Second range starts at
1.6V so it should use AXP806_DCDCD_1600mV_[START|END] macros. They are
already defined but unused.

Fixes: db4a555f7c4c ("regulator: axp20x: use defines for masks")
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Link: https://lore.kernel.org/r/20190713090717.347-2-jernej.skrabec@siol.net
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jernej Skrabec and committed by
Mark Brown
1ef55fed 3c7577d4

+3 -3
+3 -3
drivers/regulator/axp20x-regulator.c
··· 240 240 #define AXP806_DCDCA_600mV_END \ 241 241 (AXP806_DCDCA_600mV_START + AXP806_DCDCA_600mV_STEPS) 242 242 #define AXP806_DCDCA_1120mV_START 0x33 243 - #define AXP806_DCDCA_1120mV_STEPS 14 243 + #define AXP806_DCDCA_1120mV_STEPS 20 244 244 #define AXP806_DCDCA_1120mV_END \ 245 245 (AXP806_DCDCA_1120mV_START + AXP806_DCDCA_1120mV_STEPS) 246 246 #define AXP806_DCDCA_NUM_VOLTAGES 72 ··· 774 774 AXP806_DCDCD_600mV_END, 775 775 20000), 776 776 REGULATOR_LINEAR_RANGE(1600000, 777 - AXP806_DCDCD_600mV_START, 778 - AXP806_DCDCD_600mV_END, 777 + AXP806_DCDCD_1600mV_START, 778 + AXP806_DCDCD_1600mV_END, 779 779 100000), 780 780 }; 781 781