Commit 87e1e0f2 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Mark Brown

regulator: Add mode mapping function to struct regulator_desc

The "regulator-initial-mode" and "regulator-mode" DT properties allows
to configure the regulator operating modes at startup or when a system
enters into a susend state.

But these properties use as valid values the operating modes supported
by each device while the core deals with the standard operating modes.
So a mapping function is needed to translate from the hardware specific
modes to the standard ones.

This mapping is a non-varying configuration for each regulator, so add
a function pointer to struct regulator_desc that will allow drivers to
define their callback to do the modes translation.
Signed-off-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 218094c9
...@@ -243,6 +243,8 @@ enum regulator_type { ...@@ -243,6 +243,8 @@ enum regulator_type {
* *
* @enable_time: Time taken for initial enable of regulator (in uS). * @enable_time: Time taken for initial enable of regulator (in uS).
* @off_on_delay: guard time (in uS), before re-enabling a regulator * @off_on_delay: guard time (in uS), before re-enabling a regulator
*
* @of_map_mode: Maps a hardware mode defined in a DeviceTree to a standard mode
*/ */
struct regulator_desc { struct regulator_desc {
const char *name; const char *name;
...@@ -285,6 +287,8 @@ struct regulator_desc { ...@@ -285,6 +287,8 @@ struct regulator_desc {
unsigned int enable_time; unsigned int enable_time;
unsigned int off_on_delay; unsigned int off_on_delay;
unsigned int (*of_map_mode)(unsigned int mode);
}; };
/** /**
......
Markdown is supported
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