Lines Matching +full:regulator +full:- +full:mode
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * consumer.h -- SoC Regulator consumer support.
9 * Regulator Consumer Interface.
11 * A Power Management Regulator framework for SoC based devices.
12 * Features:-
14 * o Operating mode control.
15 * o Regulator status.
19 * Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
20 * to use most efficient operating mode depending upon voltage and load and
23 * e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during
25 * idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA
26 * but this drops rapidly to 60% when below 100mA. Regulator r has > 90%
27 * efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate
28 * in normal mode for loads > 10mA and in IDLE mode for load <= 10mA.
43 * Regulator operating modes.
47 * best (and most efficient) regulator mode for a desired load.
50 * will probably not match the naming convention of your regulator data sheet
55 * Mode Description
56 * FAST Regulator can handle fast changes in it's load.
60 * NORMAL Normal regulator power supply mode. Most drivers will
61 * use this mode.
63 * IDLE Regulator runs in a more efficient mode for light
65 * requirement during periods of inactivity. This mode
69 * STANDBY Regulator runs in the most efficient mode for very
71 * in a sleep/standby state. This mode is likely to be
88 * Regulator notifier events.
90 * UNDER_VOLTAGE Regulator output is under voltage.
91 * OVER_CURRENT Regulator output current is too high.
92 * REGULATION_OUT Regulator output is out of regulation.
93 * FAIL Regulator output has failed.
94 * OVER_TEMP Regulator over temp.
95 * FORCE_DISABLE Regulator forcibly shut down by software.
96 * VOLTAGE_CHANGE Regulator voltage changed.
98 * DISABLE Regulator was disabled.
99 * PRE_VOLTAGE_CHANGE Regulator is about to have voltage changed.
101 * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.
103 * PRE_DISABLE Regulator is about to be disabled
104 * ABORT_DISABLE Regulator disable failed for some reason
124 * Regulator errors that can be queried using regulator_get_error_flags
126 * UNDER_VOLTAGE Regulator output is under voltage.
127 * OVER_CURRENT Regulator output current is too high.
128 * REGULATION_OUT Regulator output is out of regulation.
129 * FAIL Regulator output has failed.
130 * OVER_TEMP Regulator over temp.
143 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
155 struct regulator;
158 * struct regulator_bulk_data - Data used for bulk regulator operations.
161 * using the bulk regulator APIs.
162 * @consumer: The regulator consumer for the supply. This will be managed
165 * The regulator APIs provide a series of regulator_bulk_() API calls as
171 struct regulator *consumer;
179 /* regulator get and put */
180 struct regulator *__must_check regulator_get(struct device *dev,
182 struct regulator *__must_check devm_regulator_get(struct device *dev,
184 struct regulator *__must_check regulator_get_exclusive(struct device *dev,
186 struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
188 struct regulator *__must_check regulator_get_optional(struct device *dev,
190 struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
192 void regulator_put(struct regulator *regulator);
193 void devm_regulator_put(struct regulator *regulator);
223 /* regulator output control and status */
224 int __must_check regulator_enable(struct regulator *regulator);
225 int regulator_disable(struct regulator *regulator);
226 int regulator_force_disable(struct regulator *regulator);
227 int regulator_is_enabled(struct regulator *regulator);
228 int regulator_disable_deferred(struct regulator *regulator, int ms);
243 int regulator_count_voltages(struct regulator *regulator);
244 int regulator_list_voltage(struct regulator *regulator, unsigned selector);
245 int regulator_is_supported_voltage(struct regulator *regulator,
247 unsigned int regulator_get_linear_step(struct regulator *regulator);
248 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
249 int regulator_set_voltage_time(struct regulator *regulator,
251 int regulator_get_voltage(struct regulator *regulator);
252 int regulator_sync_voltage(struct regulator *regulator);
253 int regulator_set_current_limit(struct regulator *regulator,
255 int regulator_get_current_limit(struct regulator *regulator);
257 int regulator_set_mode(struct regulator *regulator, unsigned int mode);
258 unsigned int regulator_get_mode(struct regulator *regulator);
259 int regulator_get_error_flags(struct regulator *regulator,
261 int regulator_set_load(struct regulator *regulator, int load_uA);
263 int regulator_allow_bypass(struct regulator *regulator, bool allow);
265 struct regmap *regulator_get_regmap(struct regulator *regulator);
266 int regulator_get_hardware_vsel_register(struct regulator *regulator,
269 int regulator_list_hardware_vsel(struct regulator *regulator,
272 /* regulator notifier block */
273 int regulator_register_notifier(struct regulator *regulator,
275 int devm_regulator_register_notifier(struct regulator *regulator,
277 int regulator_unregister_notifier(struct regulator *regulator,
279 void devm_regulator_unregister_notifier(struct regulator *regulator,
282 /* regulator suspend */
287 int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
290 /* driver data - core doesn't touch */
291 void *regulator_get_drvdata(struct regulator *regulator);
292 void regulator_set_drvdata(struct regulator *regulator, void *data);
300 bool regulator_is_equal(struct regulator *reg1, struct regulator *reg2);
308 static inline struct regulator *__must_check regulator_get(struct device *dev, in regulator_get()
311 /* Nothing except the stubbed out regulator API should be in regulator_get()
314 * skipping all regulator API calls, but they don't have to. in regulator_get()
322 static inline struct regulator *__must_check
328 static inline struct regulator *__must_check
331 return ERR_PTR(-ENODEV); in regulator_get_exclusive()
334 static inline struct regulator *__must_check
337 return ERR_PTR(-ENODEV); in regulator_get_optional()
341 static inline struct regulator *__must_check
344 return ERR_PTR(-ENODEV); in devm_regulator_get_optional()
347 static inline void regulator_put(struct regulator *regulator) in regulator_put() argument
351 static inline void devm_regulator_put(struct regulator *regulator) in devm_regulator_put() argument
410 static inline int regulator_enable(struct regulator *regulator) in regulator_enable() argument
415 static inline int regulator_disable(struct regulator *regulator) in regulator_disable() argument
420 static inline int regulator_force_disable(struct regulator *regulator) in regulator_force_disable() argument
425 static inline int regulator_disable_deferred(struct regulator *regulator, in regulator_disable_deferred() argument
431 static inline int regulator_is_enabled(struct regulator *regulator) in regulator_is_enabled() argument
472 static inline int regulator_set_voltage(struct regulator *regulator, in regulator_set_voltage() argument
478 static inline int regulator_set_voltage_time(struct regulator *regulator, in regulator_set_voltage_time() argument
484 static inline int regulator_get_voltage(struct regulator *regulator) in regulator_get_voltage() argument
486 return -EINVAL; in regulator_get_voltage()
489 static inline int regulator_is_supported_voltage(struct regulator *regulator, in regulator_is_supported_voltage() argument
495 static inline unsigned int regulator_get_linear_step(struct regulator *regulator) in regulator_get_linear_step() argument
500 static inline int regulator_set_current_limit(struct regulator *regulator, in regulator_set_current_limit() argument
506 static inline int regulator_get_current_limit(struct regulator *regulator) in regulator_get_current_limit() argument
511 static inline int regulator_set_mode(struct regulator *regulator, in regulator_set_mode() argument
512 unsigned int mode) in regulator_set_mode() argument
517 static inline unsigned int regulator_get_mode(struct regulator *regulator) in regulator_get_mode() argument
522 static inline int regulator_get_error_flags(struct regulator *regulator, in regulator_get_error_flags() argument
525 return -EINVAL; in regulator_get_error_flags()
528 static inline int regulator_set_load(struct regulator *regulator, int load_uA) in regulator_set_load() argument
533 static inline int regulator_allow_bypass(struct regulator *regulator, in regulator_allow_bypass() argument
539 static inline struct regmap *regulator_get_regmap(struct regulator *regulator) in regulator_get_regmap() argument
541 return ERR_PTR(-EOPNOTSUPP); in regulator_get_regmap()
544 static inline int regulator_get_hardware_vsel_register(struct regulator *regulator, in regulator_get_hardware_vsel_register() argument
548 return -EOPNOTSUPP; in regulator_get_hardware_vsel_register()
551 static inline int regulator_list_hardware_vsel(struct regulator *regulator, in regulator_list_hardware_vsel() argument
554 return -EOPNOTSUPP; in regulator_list_hardware_vsel()
557 static inline int regulator_register_notifier(struct regulator *regulator, in regulator_register_notifier() argument
563 static inline int devm_regulator_register_notifier(struct regulator *regulator, in devm_regulator_register_notifier() argument
569 static inline int regulator_unregister_notifier(struct regulator *regulator, in regulator_unregister_notifier() argument
575 static inline int devm_regulator_unregister_notifier(struct regulator *regulator, in devm_regulator_unregister_notifier() argument
581 static inline void *regulator_get_drvdata(struct regulator *regulator) in regulator_get_drvdata() argument
586 static inline void regulator_set_drvdata(struct regulator *regulator, in regulator_set_drvdata() argument
591 static inline int regulator_count_voltages(struct regulator *regulator) in regulator_count_voltages() argument
596 static inline int regulator_list_voltage(struct regulator *regulator, unsigned selector) in regulator_list_voltage() argument
598 return -EINVAL; in regulator_list_voltage()
609 regulator_is_equal(struct regulator *reg1, struct regulator *reg2) in regulator_is_equal()
615 static inline int regulator_set_voltage_triplet(struct regulator *regulator, in regulator_set_voltage_triplet() argument
619 if (regulator_set_voltage(regulator, target_uV, max_uV) == 0) in regulator_set_voltage_triplet()
622 return regulator_set_voltage(regulator, min_uV, max_uV); in regulator_set_voltage_triplet()
625 static inline int regulator_set_voltage_tol(struct regulator *regulator, in regulator_set_voltage_tol() argument
628 if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0) in regulator_set_voltage_tol()
631 return regulator_set_voltage(regulator, in regulator_set_voltage_tol()
632 new_uV - tol_uV, new_uV + tol_uV); in regulator_set_voltage_tol()
635 static inline int regulator_is_supported_voltage_tol(struct regulator *regulator, in regulator_is_supported_voltage_tol() argument
638 return regulator_is_supported_voltage(regulator, in regulator_is_supported_voltage_tol()
639 target_uV - tol_uV, in regulator_is_supported_voltage_tol()