Skip to content
Commit 469b640e authored by Boris Brezillon's avatar Boris Brezillon Committed by Mark Brown
Browse files

regulator: reorder initialization steps in regulator_register()



device_register() is calling ->get_voltage() as part of it's sysfs attribute
initialization process, and this functions might need to know the regulator
constraints to return a valid value.
This is at least true for the pwm regulator driver (when operating in
continuous mode) which needs to know the minimum and maximum voltage values
to calculate the current voltage:

min_uV + (((max_uV - min_uV) * dutycycle) / 100);

Move device_register() after set_machine_constraints() to make sure those
constraints are correctly initialized when ->get_voltage() is called.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: default avatarStephen Barber <smbarber@chromium.org>
Tested-by: default avatarCaesar Wang <wxt@rock-chips.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f55532a0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment