regulator: core: add guard delay between calling regulator_disable and _enable
Some regulator require a minimum delay between its disable and next enable. This is to avoid damages when out-of-range frequent disable/enable of a single regulator can bring to the regulator chip. Add @off_on_delay to struct regulator_desc. Device drivers' can use this field to set this guard time. Add @last_off_jiffy to struct regulator_dev. When @off_on_delay is set by driver, regulator core can store its last off (disable) time into this field. Signed-off-by: Guodong Xu <guodong.xu@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
@@ -238,6 +238,7 @@ enum regulator_type {
|
||||
* @bypass_val_off: Disabling value for control when using regmap set_bypass
|
||||
*
|
||||
* @enable_time: Time taken for initial enable of regulator (in uS).
|
||||
* @off_on_delay: guard time (in uS), before re-enabling a regulator
|
||||
*/
|
||||
struct regulator_desc {
|
||||
const char *name;
|
||||
@@ -276,6 +277,8 @@ struct regulator_desc {
|
||||
unsigned int bypass_val_off;
|
||||
|
||||
unsigned int enable_time;
|
||||
|
||||
unsigned int off_on_delay;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -348,6 +351,9 @@ struct regulator_dev {
|
||||
|
||||
struct regulator_enable_gpio *ena_pin;
|
||||
unsigned int ena_gpio_state:1;
|
||||
|
||||
/* time when this regulator was disabled last time */
|
||||
unsigned long last_off_jiffy;
|
||||
};
|
||||
|
||||
struct regulator_dev *
|
||||
|
Reference in New Issue
Block a user