From 11406b8f7e24385ae8ee4065c5a193f2449fc08a Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Thu, 26 Sep 2019 15:43:52 +0800 Subject: dm: regulator: support regulator more state support parse regulator standard property: regulator-off-in-suspend; regulator-init-microvolt; regulator-suspend-microvolt: regulator_get_suspend_enable regulator_set_suspend_enable regulator_get_suspend_value regulator_set_suspend_value Signed-off-by: Joseph Chen Signed-off-by: Elaine Zhang Reviewed-by: Kever Yang --- include/power/regulator.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'include') diff --git a/include/power/regulator.h b/include/power/regulator.h index 6c6e2cd4f99..74938dd61e4 100644 --- a/include/power/regulator.h +++ b/include/power/regulator.h @@ -168,6 +168,7 @@ struct dm_regulator_uclass_platdata { int mode_count; int min_uV; int max_uV; + int init_uV; int min_uA; int max_uA; unsigned int ramp_delay; @@ -177,6 +178,8 @@ struct dm_regulator_uclass_platdata { int flags; u8 ctrl_reg; u8 volt_reg; + bool suspend_on; + u32 suspend_uV; }; /* Regulator device operations */ @@ -193,6 +196,19 @@ struct dm_regulator_ops { int (*get_value)(struct udevice *dev); int (*set_value)(struct udevice *dev, int uV); + /** + * The regulator suspend output value function calls operates + * on a micro Volts. + * + * get/set_suspen_value - get/set suspend mode output value + * @dev - regulator device + * Sets: + * @uV - set the suspend output value [micro Volts] + * @return output value [uV] on success or negative errno if fail. + */ + int (*set_suspend_value)(struct udevice *dev, int uV); + int (*get_suspend_value)(struct udevice *dev); + /** * The regulator output current function calls operates on a micro Amps. * @@ -217,6 +233,19 @@ struct dm_regulator_ops { int (*get_enable)(struct udevice *dev); int (*set_enable)(struct udevice *dev, bool enable); + /** + * The most basic feature of the regulator output is its enable state + * in suspend mode. + * + * get/set_suspend_enable - get/set enable state of the suspend output + * @dev - regulator device + * Sets: + * @enable - set true - enable or false - disable + * @return true/false for get or -errno if fail; 0 / -errno for set. + */ + int (*set_suspend_enable)(struct udevice *dev, bool enable); + int (*get_suspend_enable)(struct udevice *dev); + /** * The 'get/set_mode()' function calls should operate on a driver- * specific mode id definitions, which should be found in: @@ -261,6 +290,23 @@ int regulator_get_value(struct udevice *dev); */ int regulator_set_value(struct udevice *dev, int uV); +/** + * regulator_set_suspend_value: set the suspend microvoltage value of a given regulator. + * + * @dev - pointer to the regulator device + * @uV - the output suspend value to set [micro Volts] + * @return - 0 on success or -errno val if fails + */ +int regulator_set_suspend_value(struct udevice *dev, int uV); + +/** + * regulator_get_suspend_value: get the suspend microvoltage value of a given regulator. + * + * @dev - pointer to the regulator device + * @return - positive output value [uV] on success or negative errno if fail. + */ +int regulator_get_suspend_value(struct udevice *dev); + /** * regulator_set_value_force: set the microvoltage value of a given regulator * without any min-,max condition check @@ -316,6 +362,23 @@ int regulator_set_enable(struct udevice *dev, bool enable); */ int regulator_set_enable_if_allowed(struct udevice *dev, bool enable); +/** + * regulator_set_suspend_enable: set regulator suspend enable state + * + * @dev - pointer to the regulator device + * @enable - set true or false + * @return - 0 on success or -errno val if fails + */ +int regulator_set_suspend_enable(struct udevice *dev, bool enable); + +/** + * regulator_get_suspend_enable: get regulator suspend enable state + * + * @dev - pointer to the regulator device + * @return - true/false of enable state or -errno val if fails + */ +int regulator_get_suspend_enable(struct udevice *dev); + /** * regulator_get_mode: get active operation mode id of a given regulator * -- cgit v1.2.3