Lines Matching +full:regulator +full:- +full:state +full:- +full:standby

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:-
15 * o Regulator status.
19 * Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
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
36 #include <regulator/regulator.h>
44 * Regulator operating modes.
48 * best (and most efficient) regulator mode for a desired load.
51 * will probably not match the naming convention of your regulator data sheet
57 * FAST Regulator can handle fast changes in it's load.
61 * NORMAL Normal regulator power supply mode. Most drivers will
64 * IDLE Regulator runs in a more efficient mode for light
70 * STANDBY Regulator runs in the most efficient mode for very
72 * in a sleep/standby state. This mode is likely to be
89 * Regulator errors that can be queried using regulator_get_error_flags
91 * UNDER_VOLTAGE Regulator output is under voltage.
92 * OVER_CURRENT Regulator output current is too high.
93 * REGULATION_OUT Regulator output is out of regulation.
94 * FAIL Regulator output has failed.
95 * OVER_TEMP Regulator over temp.
112 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
124 struct regulator;
127 * struct regulator_bulk_data - Data used for bulk regulator operations.
130 * using the bulk regulator APIs.
131 * @consumer: The regulator consumer for the supply. This will be managed
133 * @init_load_uA: After getting the regulator, regulator_set_load() will be
135 * using the bulk regulator APIs.
137 * The regulator APIs provide a series of regulator_bulk_() API calls as
143 struct regulator *consumer;
152 /* regulator get and put */
153 struct regulator *__must_check regulator_get(struct device *dev,
155 struct regulator *__must_check devm_regulator_get(struct device *dev,
157 struct regulator *__must_check regulator_get_exclusive(struct device *dev,
159 struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
161 struct regulator *__must_check regulator_get_optional(struct device *dev,
163 struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
168 void regulator_put(struct regulator *regulator);
169 void devm_regulator_put(struct regulator *regulator);
194 /* regulator output control and status */
195 int __must_check regulator_enable(struct regulator *regulator);
196 int regulator_disable(struct regulator *regulator);
197 int regulator_force_disable(struct regulator *regulator);
198 int regulator_is_enabled(struct regulator *regulator);
199 int regulator_disable_deferred(struct regulator *regulator, int ms);
225 int regulator_count_voltages(struct regulator *regulator);
226 int regulator_list_voltage(struct regulator *regulator, unsigned selector);
227 int regulator_is_supported_voltage(struct regulator *regulator,
229 unsigned int regulator_get_linear_step(struct regulator *regulator);
230 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
231 int regulator_set_voltage_time(struct regulator *regulator,
233 int regulator_get_voltage(struct regulator *regulator);
234 int regulator_sync_voltage(struct regulator *regulator);
235 int regulator_set_current_limit(struct regulator *regulator,
237 int regulator_get_current_limit(struct regulator *regulator);
239 int regulator_set_mode(struct regulator *regulator, unsigned int mode);
240 unsigned int regulator_get_mode(struct regulator *regulator);
241 int regulator_get_error_flags(struct regulator *regulator,
243 int regulator_set_load(struct regulator *regulator, int load_uA);
245 int regulator_allow_bypass(struct regulator *regulator, bool allow);
247 struct regmap *regulator_get_regmap(struct regulator *regulator);
248 int regulator_get_hardware_vsel_register(struct regulator *regulator,
251 int regulator_list_hardware_vsel(struct regulator *regulator,
253 int regulator_hardware_enable(struct regulator *regulator, bool enable);
255 /* regulator notifier block */
256 int regulator_register_notifier(struct regulator *regulator,
258 int devm_regulator_register_notifier(struct regulator *regulator,
260 int regulator_unregister_notifier(struct regulator *regulator,
262 void devm_regulator_unregister_notifier(struct regulator *regulator,
265 /* regulator suspend */
267 suspend_state_t state);
269 suspend_state_t state);
270 int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
271 int max_uV, suspend_state_t state);
273 /* driver data - core doesn't touch */
274 void *regulator_get_drvdata(struct regulator *regulator);
275 void regulator_set_drvdata(struct regulator *regulator, void *data);
283 bool regulator_is_equal(struct regulator *reg1, struct regulator *reg2);
291 static inline struct regulator *__must_check regulator_get(struct device *dev, in regulator_get()
294 /* Nothing except the stubbed out regulator API should be in regulator_get()
297 * skipping all regulator API calls, but they don't have to. in regulator_get()
305 static inline struct regulator *__must_check
311 static inline struct regulator *__must_check
314 return ERR_PTR(-ENODEV); in regulator_get_exclusive()
317 static inline struct regulator *__must_check
320 return ERR_PTR(-ENODEV); in devm_regulator_get_exclusive()
337 return -ENODEV; in devm_regulator_get_enable_read_voltage()
340 static inline struct regulator *__must_check
343 return ERR_PTR(-ENODEV); in regulator_get_optional()
347 static inline struct regulator *__must_check
350 return ERR_PTR(-ENODEV); in devm_regulator_get_optional()
353 static inline void regulator_put(struct regulator *regulator) in regulator_put() argument
357 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
493 static inline int regulator_set_voltage(struct regulator *regulator, in regulator_set_voltage() argument
499 static inline int regulator_set_voltage_time(struct regulator *regulator, in regulator_set_voltage_time() argument
505 static inline int regulator_get_voltage(struct regulator *regulator) in regulator_get_voltage() argument
507 return -EINVAL; in regulator_get_voltage()
510 static inline int regulator_sync_voltage(struct regulator *regulator) in regulator_sync_voltage() argument
512 return -EINVAL; in regulator_sync_voltage()
515 static inline int regulator_is_supported_voltage(struct regulator *regulator, in regulator_is_supported_voltage() argument
521 static inline unsigned int regulator_get_linear_step(struct regulator *regulator) in regulator_get_linear_step() argument
526 static inline int regulator_set_current_limit(struct regulator *regulator, in regulator_set_current_limit() argument
532 static inline int regulator_get_current_limit(struct regulator *regulator) in regulator_get_current_limit() argument
537 static inline int regulator_set_mode(struct regulator *regulator, in regulator_set_mode() argument
543 static inline unsigned int regulator_get_mode(struct regulator *regulator) in regulator_get_mode() argument
548 static inline int regulator_get_error_flags(struct regulator *regulator, in regulator_get_error_flags() argument
551 return -EINVAL; in regulator_get_error_flags()
554 static inline int regulator_set_load(struct regulator *regulator, int load_uA) in regulator_set_load() argument
559 static inline int regulator_allow_bypass(struct regulator *regulator, in regulator_allow_bypass() argument
565 static inline struct regmap *regulator_get_regmap(struct regulator *regulator) in regulator_get_regmap() argument
567 return ERR_PTR(-EOPNOTSUPP); in regulator_get_regmap()
570 static inline int regulator_get_hardware_vsel_register(struct regulator *regulator, in regulator_get_hardware_vsel_register() argument
574 return -EOPNOTSUPP; in regulator_get_hardware_vsel_register()
577 static inline int regulator_list_hardware_vsel(struct regulator *regulator, in regulator_list_hardware_vsel() argument
580 return -EOPNOTSUPP; in regulator_list_hardware_vsel()
583 static inline int regulator_hardware_enable(struct regulator *regulator, in regulator_hardware_enable() argument
586 return -EOPNOTSUPP; in regulator_hardware_enable()
589 static inline int regulator_register_notifier(struct regulator *regulator, in regulator_register_notifier() argument
595 static inline int devm_regulator_register_notifier(struct regulator *regulator, in devm_regulator_register_notifier() argument
601 static inline int regulator_unregister_notifier(struct regulator *regulator, in regulator_unregister_notifier() argument
607 static inline int devm_regulator_unregister_notifier(struct regulator *regulator, in devm_regulator_unregister_notifier() argument
614 suspend_state_t state) in regulator_suspend_enable() argument
616 return -EINVAL; in regulator_suspend_enable()
620 suspend_state_t state) in regulator_suspend_disable() argument
622 return -EINVAL; in regulator_suspend_disable()
625 static inline int regulator_set_suspend_voltage(struct regulator *regulator, in regulator_set_suspend_voltage() argument
627 suspend_state_t state) in regulator_set_suspend_voltage() argument
629 return -EINVAL; in regulator_set_suspend_voltage()
632 static inline void *regulator_get_drvdata(struct regulator *regulator) in regulator_get_drvdata() argument
637 static inline void regulator_set_drvdata(struct regulator *regulator, in regulator_set_drvdata() argument
642 static inline int regulator_count_voltages(struct regulator *regulator) in regulator_count_voltages() argument
647 static inline int regulator_list_voltage(struct regulator *regulator, unsigned selector) in regulator_list_voltage() argument
649 return -EINVAL; in regulator_list_voltage()
660 regulator_is_equal(struct regulator *reg1, struct regulator *reg2) in regulator_is_equal()
666 static inline int regulator_set_voltage_triplet(struct regulator *regulator, in regulator_set_voltage_triplet() argument
670 if (regulator_set_voltage(regulator, target_uV, max_uV) == 0) in regulator_set_voltage_triplet()
673 return regulator_set_voltage(regulator, min_uV, max_uV); in regulator_set_voltage_triplet()
676 static inline int regulator_set_voltage_tol(struct regulator *regulator, in regulator_set_voltage_tol() argument
679 if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0) in regulator_set_voltage_tol()
682 return regulator_set_voltage(regulator, in regulator_set_voltage_tol()
683 new_uV - tol_uV, new_uV + tol_uV); in regulator_set_voltage_tol()
686 static inline int regulator_is_supported_voltage_tol(struct regulator *regulator, in regulator_is_supported_voltage_tol() argument
689 return regulator_is_supported_voltage(regulator, in regulator_is_supported_voltage_tol()
690 target_uV - tol_uV, in regulator_is_supported_voltage_tol()