diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-26 07:29:31 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-26 07:29:31 -0400 |
| commit | 8f6862d4bd6a7f936273d94ba58a25946365eac9 (patch) | |
| tree | fd27fef68e99913e70a7d0e48f6cc0eaea59dfdf /include/linux | |
| parent | f76fe059dd5034c55c560d9e0005e19481843726 (diff) | |
| parent | b8575a1143f6d57a791c946291ba4363e07e32a3 (diff) | |
Merge tag 'bypass' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into for-3.7
regulator: Bypass mode support
Allow regulators to be put into a non-regulating mode bypassing the
input straight to the output, mostly used by low power retention modes.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/regulator/consumer.h | 8 | ||||
| -rw-r--r-- | include/linux/regulator/driver.h | 14 | ||||
| -rw-r--r-- | include/linux/regulator/machine.h | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index da339fd8c755..ea3e35816621 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -177,6 +177,8 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode); | |||
| 177 | unsigned int regulator_get_mode(struct regulator *regulator); | 177 | unsigned int regulator_get_mode(struct regulator *regulator); |
| 178 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | 178 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); |
| 179 | 179 | ||
| 180 | int regulator_allow_bypass(struct regulator *regulator, bool allow); | ||
| 181 | |||
| 180 | /* regulator notifier block */ | 182 | /* regulator notifier block */ |
| 181 | int regulator_register_notifier(struct regulator *regulator, | 183 | int regulator_register_notifier(struct regulator *regulator, |
| 182 | struct notifier_block *nb); | 184 | struct notifier_block *nb); |
| @@ -328,6 +330,12 @@ static inline int regulator_set_optimum_mode(struct regulator *regulator, | |||
| 328 | return REGULATOR_MODE_NORMAL; | 330 | return REGULATOR_MODE_NORMAL; |
| 329 | } | 331 | } |
| 330 | 332 | ||
| 333 | static inline int regulator_allow_bypass(struct regulator *regulator, | ||
| 334 | bool allow) | ||
| 335 | { | ||
| 336 | return 0; | ||
| 337 | } | ||
| 338 | |||
| 331 | static inline int regulator_register_notifier(struct regulator *regulator, | 339 | static inline int regulator_register_notifier(struct regulator *regulator, |
| 332 | struct notifier_block *nb) | 340 | struct notifier_block *nb) |
| 333 | { | 341 | { |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index bac4c871f3bd..7274a469e8d9 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -32,6 +32,8 @@ enum regulator_status { | |||
| 32 | REGULATOR_STATUS_NORMAL, | 32 | REGULATOR_STATUS_NORMAL, |
| 33 | REGULATOR_STATUS_IDLE, | 33 | REGULATOR_STATUS_IDLE, |
| 34 | REGULATOR_STATUS_STANDBY, | 34 | REGULATOR_STATUS_STANDBY, |
| 35 | /* The regulator is enabled but not regulating */ | ||
| 36 | REGULATOR_STATUS_BYPASS, | ||
| 35 | /* in case that any other status doesn't apply */ | 37 | /* in case that any other status doesn't apply */ |
| 36 | REGULATOR_STATUS_UNDEFINED, | 38 | REGULATOR_STATUS_UNDEFINED, |
| 37 | }; | 39 | }; |
| @@ -67,6 +69,9 @@ enum regulator_status { | |||
| 67 | * @get_optimum_mode: Get the most efficient operating mode for the regulator | 69 | * @get_optimum_mode: Get the most efficient operating mode for the regulator |
| 68 | * when running with the specified parameters. | 70 | * when running with the specified parameters. |
| 69 | * | 71 | * |
| 72 | * @set_bypass: Set the regulator in bypass mode. | ||
| 73 | * @get_bypass: Get the regulator bypass mode state. | ||
| 74 | * | ||
| 70 | * @enable_time: Time taken for the regulator voltage output voltage to | 75 | * @enable_time: Time taken for the regulator voltage output voltage to |
| 71 | * stabilise after being enabled, in microseconds. | 76 | * stabilise after being enabled, in microseconds. |
| 72 | * @set_ramp_delay: Set the ramp delay for the regulator. The driver should | 77 | * @set_ramp_delay: Set the ramp delay for the regulator. The driver should |
| @@ -133,6 +138,10 @@ struct regulator_ops { | |||
| 133 | unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, | 138 | unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, |
| 134 | int output_uV, int load_uA); | 139 | int output_uV, int load_uA); |
| 135 | 140 | ||
| 141 | /* control and report on bypass mode */ | ||
| 142 | int (*set_bypass)(struct regulator_dev *dev, bool enable); | ||
| 143 | int (*get_bypass)(struct regulator_dev *dev, bool *enable); | ||
| 144 | |||
| 136 | /* the operations below are for configuration of regulator state when | 145 | /* the operations below are for configuration of regulator state when |
| 137 | * its parent PMIC enters a global STANDBY/HIBERNATE state */ | 146 | * its parent PMIC enters a global STANDBY/HIBERNATE state */ |
| 138 | 147 | ||
| @@ -205,6 +214,8 @@ struct regulator_desc { | |||
| 205 | unsigned int vsel_mask; | 214 | unsigned int vsel_mask; |
| 206 | unsigned int enable_reg; | 215 | unsigned int enable_reg; |
| 207 | unsigned int enable_mask; | 216 | unsigned int enable_mask; |
| 217 | unsigned int bypass_reg; | ||
| 218 | unsigned int bypass_mask; | ||
| 208 | 219 | ||
| 209 | unsigned int enable_time; | 220 | unsigned int enable_time; |
| 210 | }; | 221 | }; |
| @@ -253,6 +264,7 @@ struct regulator_dev { | |||
| 253 | int exclusive; | 264 | int exclusive; |
| 254 | u32 use_count; | 265 | u32 use_count; |
| 255 | u32 open_count; | 266 | u32 open_count; |
| 267 | u32 bypass_count; | ||
| 256 | 268 | ||
| 257 | /* lists we belong to */ | 269 | /* lists we belong to */ |
| 258 | struct list_head list; /* list of all regulators */ | 270 | struct list_head list; /* list of all regulators */ |
| @@ -310,6 +322,8 @@ int regulator_disable_regmap(struct regulator_dev *rdev); | |||
| 310 | int regulator_set_voltage_time_sel(struct regulator_dev *rdev, | 322 | int regulator_set_voltage_time_sel(struct regulator_dev *rdev, |
| 311 | unsigned int old_selector, | 323 | unsigned int old_selector, |
| 312 | unsigned int new_selector); | 324 | unsigned int new_selector); |
| 325 | int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable); | ||
| 326 | int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable); | ||
| 313 | 327 | ||
| 314 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); | 328 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); |
| 315 | 329 | ||
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 40dd0a394cfa..36adbc82de6a 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -32,6 +32,7 @@ struct regulator; | |||
| 32 | * board/machine. | 32 | * board/machine. |
| 33 | * STATUS: Regulator can be enabled and disabled. | 33 | * STATUS: Regulator can be enabled and disabled. |
| 34 | * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator. | 34 | * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator. |
| 35 | * BYPASS: Regulator can be put into bypass mode | ||
| 35 | */ | 36 | */ |
| 36 | 37 | ||
| 37 | #define REGULATOR_CHANGE_VOLTAGE 0x1 | 38 | #define REGULATOR_CHANGE_VOLTAGE 0x1 |
| @@ -39,6 +40,7 @@ struct regulator; | |||
| 39 | #define REGULATOR_CHANGE_MODE 0x4 | 40 | #define REGULATOR_CHANGE_MODE 0x4 |
| 40 | #define REGULATOR_CHANGE_STATUS 0x8 | 41 | #define REGULATOR_CHANGE_STATUS 0x8 |
| 41 | #define REGULATOR_CHANGE_DRMS 0x10 | 42 | #define REGULATOR_CHANGE_DRMS 0x10 |
| 43 | #define REGULATOR_CHANGE_BYPASS 0x20 | ||
| 42 | 44 | ||
| 43 | /** | 45 | /** |
| 44 | * struct regulator_state - regulator state during low power system states | 46 | * struct regulator_state - regulator state during low power system states |
