Lines Matching +full:regulator +full:- +full:system +full:- +full:load

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
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
24 * IO and 1mA at idle. Device z draws 100mA when under load and 5mA when
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.
46 * output load. This allows further system power savings by selecting the
47 * best (and most efficient) regulator mode for a desired load.
50 * will probably not match the naming convention of your regulator data sheet
56 * FAST Regulator can handle fast changes in it's load.
58 * load can quickly increase with CPU frequency increases.
60 * NORMAL Normal regulator power supply mode. Most drivers will
63 * IDLE Regulator runs in a more efficient mode for light
67 * to handle fast load switching.
69 * STANDBY Regulator runs in the most efficient mode for very
72 * the most noisy and may not be able to handle fast load
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
134 * Regulator errors that can be queried using regulator_get_error_flags
136 * UNDER_VOLTAGE Regulator output is under voltage.
137 * OVER_CURRENT Regulator output current is too high.
138 * REGULATION_OUT Regulator output is out of regulation.
139 * FAIL Regulator output has failed.
140 * OVER_TEMP Regulator over temp.
157 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
169 struct regulator;
172 * struct regulator_bulk_data - Data used for bulk regulator operations.
175 * using the bulk regulator APIs.
176 * @init_load_uA: After getting the regulator, regulator_set_load() will be
177 * called with this load. Initialised by the user before
178 * using the bulk regulator APIs.
179 * @consumer: The regulator consumer for the supply. This will be managed
182 * The regulator APIs provide a series of regulator_bulk_() API calls as
189 struct regulator *consumer;
197 /* regulator get and put */
198 struct regulator *__must_check regulator_get(struct device *dev,
200 struct regulator *__must_check devm_regulator_get(struct device *dev,
202 struct regulator *__must_check regulator_get_exclusive(struct device *dev,
204 struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
206 struct regulator *__must_check regulator_get_optional(struct device *dev,
208 struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
212 void regulator_put(struct regulator *regulator);
213 void devm_regulator_put(struct regulator *regulator);
238 /* regulator output control and status */
239 int __must_check regulator_enable(struct regulator *regulator);
240 int regulator_disable(struct regulator *regulator);
241 int regulator_force_disable(struct regulator *regulator);
242 int regulator_is_enabled(struct regulator *regulator);
243 int regulator_disable_deferred(struct regulator *regulator, int ms);
265 int regulator_count_voltages(struct regulator *regulator);
266 int regulator_list_voltage(struct regulator *regulator, unsigned selector);
267 int regulator_is_supported_voltage(struct regulator *regulator,
269 unsigned int regulator_get_linear_step(struct regulator *regulator);
270 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
271 int regulator_set_voltage_time(struct regulator *regulator,
273 int regulator_get_voltage(struct regulator *regulator);
274 int regulator_sync_voltage(struct regulator *regulator);
275 int regulator_set_current_limit(struct regulator *regulator,
277 int regulator_get_current_limit(struct regulator *regulator);
279 int regulator_set_mode(struct regulator *regulator, unsigned int mode);
280 unsigned int regulator_get_mode(struct regulator *regulator);
281 int regulator_get_error_flags(struct regulator *regulator,
283 int regulator_set_load(struct regulator *regulator, int load_uA);
285 int regulator_allow_bypass(struct regulator *regulator, bool allow);
287 struct regmap *regulator_get_regmap(struct regulator *regulator);
288 int regulator_get_hardware_vsel_register(struct regulator *regulator,
291 int regulator_list_hardware_vsel(struct regulator *regulator,
294 /* regulator notifier block */
295 int regulator_register_notifier(struct regulator *regulator,
297 int devm_regulator_register_notifier(struct regulator *regulator,
299 int regulator_unregister_notifier(struct regulator *regulator,
301 void devm_regulator_unregister_notifier(struct regulator *regulator,
304 /* regulator suspend */
309 int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
312 /* driver data - core doesn't touch */
313 void *regulator_get_drvdata(struct regulator *regulator);
314 void regulator_set_drvdata(struct regulator *regulator, void *data);
322 bool regulator_is_equal(struct regulator *reg1, struct regulator *reg2);
330 static inline struct regulator *__must_check regulator_get(struct device *dev, in regulator_get()
333 /* Nothing except the stubbed out regulator API should be in regulator_get()
336 * skipping all regulator API calls, but they don't have to. in regulator_get()
344 static inline struct regulator *__must_check
350 static inline struct regulator *__must_check
353 return ERR_PTR(-ENODEV); in regulator_get_exclusive()
356 static inline struct regulator *__must_check
359 return ERR_PTR(-ENODEV); in devm_regulator_get_exclusive()
364 return -ENODEV; in devm_regulator_get_enable()
370 return -ENODEV; in devm_regulator_get_enable_optional()
373 static inline struct regulator *__must_check
376 return ERR_PTR(-ENODEV); in regulator_get_optional()
380 static inline struct regulator *__must_check
383 return ERR_PTR(-ENODEV); in devm_regulator_get_optional()
386 static inline void regulator_put(struct regulator *regulator) in regulator_put() argument
390 static inline void devm_regulator_put(struct regulator *regulator) in devm_regulator_put() argument
443 static inline int regulator_enable(struct regulator *regulator) in regulator_enable() argument
448 static inline int regulator_disable(struct regulator *regulator) in regulator_disable() argument
453 static inline int regulator_force_disable(struct regulator *regulator) in regulator_force_disable() argument
458 static inline int regulator_disable_deferred(struct regulator *regulator, in regulator_disable_deferred() argument
464 static inline int regulator_is_enabled(struct regulator *regulator) in regulator_is_enabled() argument
512 static inline int regulator_set_voltage(struct regulator *regulator, in regulator_set_voltage() argument
518 static inline int regulator_set_voltage_time(struct regulator *regulator, in regulator_set_voltage_time() argument
524 static inline int regulator_get_voltage(struct regulator *regulator) in regulator_get_voltage() argument
526 return -EINVAL; in regulator_get_voltage()
529 static inline int regulator_sync_voltage(struct regulator *regulator) in regulator_sync_voltage() argument
531 return -EINVAL; in regulator_sync_voltage()
534 static inline int regulator_is_supported_voltage(struct regulator *regulator, in regulator_is_supported_voltage() argument
540 static inline unsigned int regulator_get_linear_step(struct regulator *regulator) in regulator_get_linear_step() argument
545 static inline int regulator_set_current_limit(struct regulator *regulator, in regulator_set_current_limit() argument
551 static inline int regulator_get_current_limit(struct regulator *regulator) in regulator_get_current_limit() argument
556 static inline int regulator_set_mode(struct regulator *regulator, in regulator_set_mode() argument
562 static inline unsigned int regulator_get_mode(struct regulator *regulator) in regulator_get_mode() argument
567 static inline int regulator_get_error_flags(struct regulator *regulator, in regulator_get_error_flags() argument
570 return -EINVAL; in regulator_get_error_flags()
573 static inline int regulator_set_load(struct regulator *regulator, int load_uA) in regulator_set_load() argument
578 static inline int regulator_allow_bypass(struct regulator *regulator, in regulator_allow_bypass() argument
584 static inline struct regmap *regulator_get_regmap(struct regulator *regulator) in regulator_get_regmap() argument
586 return ERR_PTR(-EOPNOTSUPP); in regulator_get_regmap()
589 static inline int regulator_get_hardware_vsel_register(struct regulator *regulator, in regulator_get_hardware_vsel_register() argument
593 return -EOPNOTSUPP; in regulator_get_hardware_vsel_register()
596 static inline int regulator_list_hardware_vsel(struct regulator *regulator, in regulator_list_hardware_vsel() argument
599 return -EOPNOTSUPP; in regulator_list_hardware_vsel()
602 static inline int regulator_register_notifier(struct regulator *regulator, in regulator_register_notifier() argument
608 static inline int devm_regulator_register_notifier(struct regulator *regulator, in devm_regulator_register_notifier() argument
614 static inline int regulator_unregister_notifier(struct regulator *regulator, in regulator_unregister_notifier() argument
620 static inline int devm_regulator_unregister_notifier(struct regulator *regulator, in devm_regulator_unregister_notifier() argument
629 return -EINVAL; in regulator_suspend_enable()
635 return -EINVAL; in regulator_suspend_disable()
638 static inline int regulator_set_suspend_voltage(struct regulator *regulator, in regulator_set_suspend_voltage() argument
642 return -EINVAL; in regulator_set_suspend_voltage()
645 static inline void *regulator_get_drvdata(struct regulator *regulator) in regulator_get_drvdata() argument
650 static inline void regulator_set_drvdata(struct regulator *regulator, in regulator_set_drvdata() argument
655 static inline int regulator_count_voltages(struct regulator *regulator) in regulator_count_voltages() argument
660 static inline int regulator_list_voltage(struct regulator *regulator, unsigned selector) in regulator_list_voltage() argument
662 return -EINVAL; in regulator_list_voltage()
673 regulator_is_equal(struct regulator *reg1, struct regulator *reg2) in regulator_is_equal()
679 static inline int regulator_set_voltage_triplet(struct regulator *regulator, in regulator_set_voltage_triplet() argument
683 if (regulator_set_voltage(regulator, target_uV, max_uV) == 0) in regulator_set_voltage_triplet()
686 return regulator_set_voltage(regulator, min_uV, max_uV); in regulator_set_voltage_triplet()
689 static inline int regulator_set_voltage_tol(struct regulator *regulator, in regulator_set_voltage_tol() argument
692 if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0) in regulator_set_voltage_tol()
695 return regulator_set_voltage(regulator, in regulator_set_voltage_tol()
696 new_uV - tol_uV, new_uV + tol_uV); in regulator_set_voltage_tol()
699 static inline int regulator_is_supported_voltage_tol(struct regulator *regulator, in regulator_is_supported_voltage_tol() argument
702 return regulator_is_supported_voltage(regulator, in regulator_is_supported_voltage_tol()
703 target_uV - tol_uV, in regulator_is_supported_voltage_tol()