1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2e2ce4eaaSLiam Girdwood /*
3e2ce4eaaSLiam Girdwood * consumer.h -- SoC Regulator consumer support.
4e2ce4eaaSLiam Girdwood *
5e2ce4eaaSLiam Girdwood * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
6e2ce4eaaSLiam Girdwood *
71dd68f01SLiam Girdwood * Author: Liam Girdwood <[email protected]>
8e2ce4eaaSLiam Girdwood *
9e2ce4eaaSLiam Girdwood * Regulator Consumer Interface.
10e2ce4eaaSLiam Girdwood *
11e2ce4eaaSLiam Girdwood * A Power Management Regulator framework for SoC based devices.
12e2ce4eaaSLiam Girdwood * Features:-
13e2ce4eaaSLiam Girdwood * o Voltage and current level control.
14e2ce4eaaSLiam Girdwood * o Operating mode control.
15e2ce4eaaSLiam Girdwood * o Regulator status.
16e2ce4eaaSLiam Girdwood * o sysfs entries for showing client devices and status
17e2ce4eaaSLiam Girdwood *
18e2ce4eaaSLiam Girdwood * EXPERIMENTAL FEATURES:
19e2ce4eaaSLiam Girdwood * Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
20e2ce4eaaSLiam Girdwood * to use most efficient operating mode depending upon voltage and load and
21e2ce4eaaSLiam Girdwood * is transparent to client drivers.
22e2ce4eaaSLiam Girdwood *
23e2ce4eaaSLiam Girdwood * e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during
24e2ce4eaaSLiam Girdwood * IO and 1mA at idle. Device z draws 100mA when under load and 5mA when
25e2ce4eaaSLiam Girdwood * idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA
26e2ce4eaaSLiam Girdwood * but this drops rapidly to 60% when below 100mA. Regulator r has > 90%
27e2ce4eaaSLiam Girdwood * efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate
28e2ce4eaaSLiam Girdwood * in normal mode for loads > 10mA and in IDLE mode for load <= 10mA.
29e2ce4eaaSLiam Girdwood */
30e2ce4eaaSLiam Girdwood
31e2ce4eaaSLiam Girdwood #ifndef __LINUX_REGULATOR_CONSUMER_H_
32e2ce4eaaSLiam Girdwood #define __LINUX_REGULATOR_CONSUMER_H_
33e2ce4eaaSLiam Girdwood
34174e964eSGuenter Roeck #include <linux/err.h>
35da669076SLee Jones #include <linux/suspend.h>
3616e5ac12SNaresh Solanki #include <regulator/regulator.h>
37174e964eSGuenter Roeck
38313162d0SPaul Gortmaker struct device;
39313162d0SPaul Gortmaker struct notifier_block;
4004eca28cSTuomas Tynkkynen struct regmap;
41da669076SLee Jones struct regulator_dev;
42b56daf13SLiam Girdwood
43e2ce4eaaSLiam Girdwood /*
44e2ce4eaaSLiam Girdwood * Regulator operating modes.
45e2ce4eaaSLiam Girdwood *
46e2ce4eaaSLiam Girdwood * Regulators can run in a variety of different operating modes depending on
47e2ce4eaaSLiam Girdwood * output load. This allows further system power savings by selecting the
48e2ce4eaaSLiam Girdwood * best (and most efficient) regulator mode for a desired load.
49e2ce4eaaSLiam Girdwood *
50e2ce4eaaSLiam Girdwood * Most drivers will only care about NORMAL. The modes below are generic and
51e2ce4eaaSLiam Girdwood * will probably not match the naming convention of your regulator data sheet
52e2ce4eaaSLiam Girdwood * but should match the use cases in the datasheet.
53e2ce4eaaSLiam Girdwood *
54e2ce4eaaSLiam Girdwood * In order of power efficiency (least efficient at top).
55e2ce4eaaSLiam Girdwood *
56e2ce4eaaSLiam Girdwood * Mode Description
57e2ce4eaaSLiam Girdwood * FAST Regulator can handle fast changes in it's load.
58e2ce4eaaSLiam Girdwood * e.g. useful in CPU voltage & frequency scaling where
59e2ce4eaaSLiam Girdwood * load can quickly increase with CPU frequency increases.
60e2ce4eaaSLiam Girdwood *
61e2ce4eaaSLiam Girdwood * NORMAL Normal regulator power supply mode. Most drivers will
62e2ce4eaaSLiam Girdwood * use this mode.
63e2ce4eaaSLiam Girdwood *
64e2ce4eaaSLiam Girdwood * IDLE Regulator runs in a more efficient mode for light
65e2ce4eaaSLiam Girdwood * loads. Can be used for devices that have a low power
66e2ce4eaaSLiam Girdwood * requirement during periods of inactivity. This mode
67e2ce4eaaSLiam Girdwood * may be more noisy than NORMAL and may not be able
68e2ce4eaaSLiam Girdwood * to handle fast load switching.
69e2ce4eaaSLiam Girdwood *
70e2ce4eaaSLiam Girdwood * STANDBY Regulator runs in the most efficient mode for very
71e2ce4eaaSLiam Girdwood * light loads. Can be used by devices when they are
72e2ce4eaaSLiam Girdwood * in a sleep/standby state. This mode is likely to be
73e2ce4eaaSLiam Girdwood * the most noisy and may not be able to handle fast load
74e2ce4eaaSLiam Girdwood * switching.
75e2ce4eaaSLiam Girdwood *
76e2ce4eaaSLiam Girdwood * NOTE: Most regulators will only support a subset of these modes. Some
77e2ce4eaaSLiam Girdwood * will only just support NORMAL.
78e2ce4eaaSLiam Girdwood *
79e2ce4eaaSLiam Girdwood * These modes can be OR'ed together to make up a mask of valid register modes.
80e2ce4eaaSLiam Girdwood */
81e2ce4eaaSLiam Girdwood
8202f37039SDouglas Anderson #define REGULATOR_MODE_INVALID 0x0
83e2ce4eaaSLiam Girdwood #define REGULATOR_MODE_FAST 0x1
84e2ce4eaaSLiam Girdwood #define REGULATOR_MODE_NORMAL 0x2
85e2ce4eaaSLiam Girdwood #define REGULATOR_MODE_IDLE 0x4
86e2ce4eaaSLiam Girdwood #define REGULATOR_MODE_STANDBY 0x8
87e2ce4eaaSLiam Girdwood
88e2ce4eaaSLiam Girdwood /*
891b5b4221SAxel Haslam * Regulator errors that can be queried using regulator_get_error_flags
901b5b4221SAxel Haslam *
911b5b4221SAxel Haslam * UNDER_VOLTAGE Regulator output is under voltage.
921b5b4221SAxel Haslam * OVER_CURRENT Regulator output current is too high.
931b5b4221SAxel Haslam * REGULATION_OUT Regulator output is out of regulation.
941b5b4221SAxel Haslam * FAIL Regulator output has failed.
951b5b4221SAxel Haslam * OVER_TEMP Regulator over temp.
961b5b4221SAxel Haslam *
971b5b4221SAxel Haslam * NOTE: These errors can be OR'ed together.
981b5b4221SAxel Haslam */
991b5b4221SAxel Haslam
1001b5b4221SAxel Haslam #define REGULATOR_ERROR_UNDER_VOLTAGE BIT(1)
1011b5b4221SAxel Haslam #define REGULATOR_ERROR_OVER_CURRENT BIT(2)
1021b5b4221SAxel Haslam #define REGULATOR_ERROR_REGULATION_OUT BIT(3)
1031b5b4221SAxel Haslam #define REGULATOR_ERROR_FAIL BIT(4)
1041b5b4221SAxel Haslam #define REGULATOR_ERROR_OVER_TEMP BIT(5)
1051b5b4221SAxel Haslam
106e6c3092dSMatti Vaittinen #define REGULATOR_ERROR_UNDER_VOLTAGE_WARN BIT(6)
107e6c3092dSMatti Vaittinen #define REGULATOR_ERROR_OVER_CURRENT_WARN BIT(7)
108e6c3092dSMatti Vaittinen #define REGULATOR_ERROR_OVER_VOLTAGE_WARN BIT(8)
109e6c3092dSMatti Vaittinen #define REGULATOR_ERROR_OVER_TEMP_WARN BIT(9)
1101b5b4221SAxel Haslam
1117179569aSHeiko Stübner /**
1127179569aSHeiko Stübner * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
1137179569aSHeiko Stübner *
1147179569aSHeiko Stübner * @old_uV: Current voltage before change.
1157179569aSHeiko Stübner * @min_uV: Min voltage we'll change to.
1167179569aSHeiko Stübner * @max_uV: Max voltage we'll change to.
1177179569aSHeiko Stübner */
1187179569aSHeiko Stübner struct pre_voltage_change_data {
1197179569aSHeiko Stübner unsigned long old_uV;
1207179569aSHeiko Stübner unsigned long min_uV;
1217179569aSHeiko Stübner unsigned long max_uV;
1227179569aSHeiko Stübner };
123e2ce4eaaSLiam Girdwood
124e2ce4eaaSLiam Girdwood struct regulator;
125e2ce4eaaSLiam Girdwood
126e2ce4eaaSLiam Girdwood /**
127e2ce4eaaSLiam Girdwood * struct regulator_bulk_data - Data used for bulk regulator operations.
128e2ce4eaaSLiam Girdwood *
12969279fb9SMark Brown * @supply: The name of the supply. Initialised by the user before
130e2ce4eaaSLiam Girdwood * using the bulk regulator APIs.
1317a147670SChristophe JAILLET * @consumer: The regulator consumer for the supply. This will be managed
1327a147670SChristophe JAILLET * by the bulk API.
1336eabfc01SDouglas Anderson * @init_load_uA: After getting the regulator, regulator_set_load() will be
1346eabfc01SDouglas Anderson * called with this load. Initialised by the user before
1356eabfc01SDouglas Anderson * using the bulk regulator APIs.
136e2ce4eaaSLiam Girdwood *
137e2ce4eaaSLiam Girdwood * The regulator APIs provide a series of regulator_bulk_() API calls as
138e2ce4eaaSLiam Girdwood * a convenience to consumers which require multiple supplies. This
139e2ce4eaaSLiam Girdwood * structure is used to manage data for these calls.
140e2ce4eaaSLiam Girdwood */
141e2ce4eaaSLiam Girdwood struct regulator_bulk_data {
142e2ce4eaaSLiam Girdwood const char *supply;
143e2ce4eaaSLiam Girdwood struct regulator *consumer;
1447a147670SChristophe JAILLET int init_load_uA;
145f21e0e81SMark Brown
146bff747c5SRandy Dunlap /* private: Internal use */
147f21e0e81SMark Brown int ret;
148e2ce4eaaSLiam Girdwood };
149e2ce4eaaSLiam Girdwood
150e2ce4eaaSLiam Girdwood #if defined(CONFIG_REGULATOR)
151e2ce4eaaSLiam Girdwood
152e2ce4eaaSLiam Girdwood /* regulator get and put */
153e2ce4eaaSLiam Girdwood struct regulator *__must_check regulator_get(struct device *dev,
154e2ce4eaaSLiam Girdwood const char *id);
155070b9079SStephen Boyd struct regulator *__must_check devm_regulator_get(struct device *dev,
156070b9079SStephen Boyd const char *id);
1575ffbd136SMark Brown struct regulator *__must_check regulator_get_exclusive(struct device *dev,
1585ffbd136SMark Brown const char *id);
1599efdd276SMatthias Kaehlcke struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
1609efdd276SMatthias Kaehlcke const char *id);
161de1dd9fdSMark Brown struct regulator *__must_check regulator_get_optional(struct device *dev,
162de1dd9fdSMark Brown const char *id);
163de1dd9fdSMark Brown struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
164de1dd9fdSMark Brown const char *id);
165da279e69SMatti Vaittinen int devm_regulator_get_enable(struct device *dev, const char *id);
166da279e69SMatti Vaittinen int devm_regulator_get_enable_optional(struct device *dev, const char *id);
167b250c20bSDavid Lechner int devm_regulator_get_enable_read_voltage(struct device *dev, const char *id);
168e2ce4eaaSLiam Girdwood void regulator_put(struct regulator *regulator);
1692950c4bbSAxel Lin void devm_regulator_put(struct regulator *regulator);
170e2ce4eaaSLiam Girdwood
171a06ccd9cSCharles Keepax int regulator_register_supply_alias(struct device *dev, const char *id,
172a06ccd9cSCharles Keepax struct device *alias_dev,
173a06ccd9cSCharles Keepax const char *alias_id);
174a06ccd9cSCharles Keepax void regulator_unregister_supply_alias(struct device *dev, const char *id);
175a06ccd9cSCharles Keepax
1769f8c0fe9SLee Jones int regulator_bulk_register_supply_alias(struct device *dev,
1779f8c0fe9SLee Jones const char *const *id,
178a06ccd9cSCharles Keepax struct device *alias_dev,
1799f8c0fe9SLee Jones const char *const *alias_id,
1809f8c0fe9SLee Jones int num_id);
181a06ccd9cSCharles Keepax void regulator_bulk_unregister_supply_alias(struct device *dev,
1829f8c0fe9SLee Jones const char * const *id, int num_id);
183a06ccd9cSCharles Keepax
184a06ccd9cSCharles Keepax int devm_regulator_register_supply_alias(struct device *dev, const char *id,
185a06ccd9cSCharles Keepax struct device *alias_dev,
186a06ccd9cSCharles Keepax const char *alias_id);
187a06ccd9cSCharles Keepax
188a06ccd9cSCharles Keepax int devm_regulator_bulk_register_supply_alias(struct device *dev,
1899f8c0fe9SLee Jones const char *const *id,
190a06ccd9cSCharles Keepax struct device *alias_dev,
1919f8c0fe9SLee Jones const char *const *alias_id,
192a06ccd9cSCharles Keepax int num_id);
193a06ccd9cSCharles Keepax
194e2ce4eaaSLiam Girdwood /* regulator output control and status */
195c8801a8eSMark Brown int __must_check regulator_enable(struct regulator *regulator);
196e2ce4eaaSLiam Girdwood int regulator_disable(struct regulator *regulator);
197e2ce4eaaSLiam Girdwood int regulator_force_disable(struct regulator *regulator);
198e2ce4eaaSLiam Girdwood int regulator_is_enabled(struct regulator *regulator);
199da07ecd9SMark Brown int regulator_disable_deferred(struct regulator *regulator, int ms);
200e2ce4eaaSLiam Girdwood
201c8801a8eSMark Brown int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
202e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers);
203c8801a8eSMark Brown int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
204e6e74030SMark Brown struct regulator_bulk_data *consumers);
205da279e69SMatti Vaittinen void devm_regulator_bulk_put(struct regulator_bulk_data *consumers);
206fd184506SZev Weiss int __must_check devm_regulator_bulk_get_exclusive(struct device *dev, int num_consumers,
207fd184506SZev Weiss struct regulator_bulk_data *consumers);
2081de452a0SDouglas Anderson int __must_check devm_regulator_bulk_get_const(
2091de452a0SDouglas Anderson struct device *dev, int num_consumers,
2101de452a0SDouglas Anderson const struct regulator_bulk_data *in_consumers,
2111de452a0SDouglas Anderson struct regulator_bulk_data **out_consumers);
212c8801a8eSMark Brown int __must_check regulator_bulk_enable(int num_consumers,
213e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers);
214da279e69SMatti Vaittinen int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers,
215da279e69SMatti Vaittinen const char * const *id);
216e2ce4eaaSLiam Girdwood int regulator_bulk_disable(int num_consumers,
217e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers);
218e1de2f42SDonggeun Kim int regulator_bulk_force_disable(int num_consumers,
219e1de2f42SDonggeun Kim struct regulator_bulk_data *consumers);
220e2ce4eaaSLiam Girdwood void regulator_bulk_free(int num_consumers,
221e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers);
222e2ce4eaaSLiam Girdwood
2234367cfdcSDavid Brownell int regulator_count_voltages(struct regulator *regulator);
2244367cfdcSDavid Brownell int regulator_list_voltage(struct regulator *regulator, unsigned selector);
225a7a1ad90SMark Brown int regulator_is_supported_voltage(struct regulator *regulator,
226a7a1ad90SMark Brown int min_uV, int max_uV);
2272a668a8bSPaul Walmsley unsigned int regulator_get_linear_step(struct regulator *regulator);
228e2ce4eaaSLiam Girdwood int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
22988cd222bSLinus Walleij int regulator_set_voltage_time(struct regulator *regulator,
23088cd222bSLinus Walleij int old_uV, int new_uV);
231e2ce4eaaSLiam Girdwood int regulator_get_voltage(struct regulator *regulator);
232606a2562SMark Brown int regulator_sync_voltage(struct regulator *regulator);
233e2ce4eaaSLiam Girdwood int regulator_set_current_limit(struct regulator *regulator,
234e2ce4eaaSLiam Girdwood int min_uA, int max_uA);
235e2ce4eaaSLiam Girdwood int regulator_get_current_limit(struct regulator *regulator);
23642d7c87bSKory Maincent int regulator_get_unclaimed_power_budget(struct regulator *regulator);
23742d7c87bSKory Maincent int regulator_request_power_budget(struct regulator *regulator,
23842d7c87bSKory Maincent unsigned int pw_req);
23942d7c87bSKory Maincent void regulator_free_power_budget(struct regulator *regulator,
24042d7c87bSKory Maincent unsigned int pw);
241e2ce4eaaSLiam Girdwood
242e2ce4eaaSLiam Girdwood int regulator_set_mode(struct regulator *regulator, unsigned int mode);
243e2ce4eaaSLiam Girdwood unsigned int regulator_get_mode(struct regulator *regulator);
2441b5b4221SAxel Haslam int regulator_get_error_flags(struct regulator *regulator,
2451b5b4221SAxel Haslam unsigned int *flags);
246e39ce48fSBjorn Andersson int regulator_set_load(struct regulator *regulator, int load_uA);
247e2ce4eaaSLiam Girdwood
248f59c8f9fSMark Brown int regulator_allow_bypass(struct regulator *regulator, bool allow);
249f59c8f9fSMark Brown
25004eca28cSTuomas Tynkkynen struct regmap *regulator_get_regmap(struct regulator *regulator);
25104eca28cSTuomas Tynkkynen int regulator_get_hardware_vsel_register(struct regulator *regulator,
25204eca28cSTuomas Tynkkynen unsigned *vsel_reg,
25304eca28cSTuomas Tynkkynen unsigned *vsel_mask);
25404eca28cSTuomas Tynkkynen int regulator_list_hardware_vsel(struct regulator *regulator,
25504eca28cSTuomas Tynkkynen unsigned selector);
2561cb7d291SBiju Das int regulator_hardware_enable(struct regulator *regulator, bool enable);
25704eca28cSTuomas Tynkkynen
258e2ce4eaaSLiam Girdwood /* regulator notifier block */
259e2ce4eaaSLiam Girdwood int regulator_register_notifier(struct regulator *regulator,
260e2ce4eaaSLiam Girdwood struct notifier_block *nb);
261046db763SCharles Keepax int devm_regulator_register_notifier(struct regulator *regulator,
262046db763SCharles Keepax struct notifier_block *nb);
263e2ce4eaaSLiam Girdwood int regulator_unregister_notifier(struct regulator *regulator,
264e2ce4eaaSLiam Girdwood struct notifier_block *nb);
265046db763SCharles Keepax void devm_regulator_unregister_notifier(struct regulator *regulator,
266046db763SCharles Keepax struct notifier_block *nb);
267e2ce4eaaSLiam Girdwood
268da669076SLee Jones /* regulator suspend */
269da669076SLee Jones int regulator_suspend_enable(struct regulator_dev *rdev,
270da669076SLee Jones suspend_state_t state);
271da669076SLee Jones int regulator_suspend_disable(struct regulator_dev *rdev,
272da669076SLee Jones suspend_state_t state);
273da669076SLee Jones int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
274da669076SLee Jones int max_uV, suspend_state_t state);
275da669076SLee Jones
276e2ce4eaaSLiam Girdwood /* driver data - core doesn't touch */
277e2ce4eaaSLiam Girdwood void *regulator_get_drvdata(struct regulator *regulator);
278e2ce4eaaSLiam Girdwood void regulator_set_drvdata(struct regulator *regulator, void *data);
279e2ce4eaaSLiam Girdwood
280d0087e72SBartosz Golaszewski /* misc helpers */
281d0087e72SBartosz Golaszewski
282d0087e72SBartosz Golaszewski void regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
283d0087e72SBartosz Golaszewski const char *const *supply_names,
284d0087e72SBartosz Golaszewski unsigned int num_supplies);
285d0087e72SBartosz Golaszewski
286b059b7e0SMarek Vasut bool regulator_is_equal(struct regulator *reg1, struct regulator *reg2);
287b059b7e0SMarek Vasut
288e2ce4eaaSLiam Girdwood #else
289e2ce4eaaSLiam Girdwood
290e2ce4eaaSLiam Girdwood /*
291e2ce4eaaSLiam Girdwood * Make sure client drivers will still build on systems with no software
292e2ce4eaaSLiam Girdwood * controllable voltage or current regulators.
293e2ce4eaaSLiam Girdwood */
regulator_get(struct device * dev,const char * id)294e2ce4eaaSLiam Girdwood static inline struct regulator *__must_check regulator_get(struct device *dev,
295e2ce4eaaSLiam Girdwood const char *id)
296e2ce4eaaSLiam Girdwood {
297e2ce4eaaSLiam Girdwood /* Nothing except the stubbed out regulator API should be
298e2ce4eaaSLiam Girdwood * looking at the value except to check if it is an error
299be1a50d4SJean Delvare * value. Drivers are free to handle NULL specifically by
300be1a50d4SJean Delvare * skipping all regulator API calls, but they don't have to.
301be1a50d4SJean Delvare * Drivers which don't, should make sure they properly handle
302be1a50d4SJean Delvare * corner cases of the API, such as regulator_get_voltage()
303be1a50d4SJean Delvare * returning 0.
304e2ce4eaaSLiam Girdwood */
305be1a50d4SJean Delvare return NULL;
306e2ce4eaaSLiam Girdwood }
307070b9079SStephen Boyd
308070b9079SStephen Boyd static inline struct regulator *__must_check
devm_regulator_get(struct device * dev,const char * id)309070b9079SStephen Boyd devm_regulator_get(struct device *dev, const char *id)
310070b9079SStephen Boyd {
311070b9079SStephen Boyd return NULL;
312070b9079SStephen Boyd }
313070b9079SStephen Boyd
314de1dd9fdSMark Brown static inline struct regulator *__must_check
regulator_get_exclusive(struct device * dev,const char * id)3154bdfb272SMark Brown regulator_get_exclusive(struct device *dev, const char *id)
3164bdfb272SMark Brown {
31770b946f9SMark Brown return ERR_PTR(-ENODEV);
3184bdfb272SMark Brown }
3194bdfb272SMark Brown
320de1dd9fdSMark Brown static inline struct regulator *__must_check
devm_regulator_get_exclusive(struct device * dev,const char * id)32151dfb6caSDmitry Osipenko devm_regulator_get_exclusive(struct device *dev, const char *id)
32251dfb6caSDmitry Osipenko {
32351dfb6caSDmitry Osipenko return ERR_PTR(-ENODEV);
32451dfb6caSDmitry Osipenko }
32551dfb6caSDmitry Osipenko
devm_regulator_get_enable(struct device * dev,const char * id)326da279e69SMatti Vaittinen static inline int devm_regulator_get_enable(struct device *dev, const char *id)
327da279e69SMatti Vaittinen {
32896e20adcSMatti Vaittinen return 0;
329da279e69SMatti Vaittinen }
330da279e69SMatti Vaittinen
devm_regulator_get_enable_optional(struct device * dev,const char * id)331da279e69SMatti Vaittinen static inline int devm_regulator_get_enable_optional(struct device *dev,
332da279e69SMatti Vaittinen const char *id)
333da279e69SMatti Vaittinen {
334ff331326SMatti Vaittinen return 0;
335da279e69SMatti Vaittinen }
336da279e69SMatti Vaittinen
devm_regulator_get_enable_read_voltage(struct device * dev,const char * id)337b250c20bSDavid Lechner static inline int devm_regulator_get_enable_read_voltage(struct device *dev,
338b250c20bSDavid Lechner const char *id)
339b250c20bSDavid Lechner {
340b250c20bSDavid Lechner return -ENODEV;
341b250c20bSDavid Lechner }
342b250c20bSDavid Lechner
34351dfb6caSDmitry Osipenko static inline struct regulator *__must_check
regulator_get_optional(struct device * dev,const char * id)344de1dd9fdSMark Brown regulator_get_optional(struct device *dev, const char *id)
345de1dd9fdSMark Brown {
346df7926ffSTim Kryger return ERR_PTR(-ENODEV);
347de1dd9fdSMark Brown }
348de1dd9fdSMark Brown
3494bdfb272SMark Brown
3504bdfb272SMark Brown static inline struct regulator *__must_check
devm_regulator_get_optional(struct device * dev,const char * id)351de1dd9fdSMark Brown devm_regulator_get_optional(struct device *dev, const char *id)
352e2ce4eaaSLiam Girdwood {
353df7926ffSTim Kryger return ERR_PTR(-ENODEV);
354e2ce4eaaSLiam Girdwood }
355e2ce4eaaSLiam Girdwood
regulator_put(struct regulator * regulator)356e2ce4eaaSLiam Girdwood static inline void regulator_put(struct regulator *regulator)
357e2ce4eaaSLiam Girdwood {
358e2ce4eaaSLiam Girdwood }
359e2ce4eaaSLiam Girdwood
devm_regulator_put(struct regulator * regulator)3602950c4bbSAxel Lin static inline void devm_regulator_put(struct regulator *regulator)
3612950c4bbSAxel Lin {
3622950c4bbSAxel Lin }
3632950c4bbSAxel Lin
devm_regulator_bulk_put(struct regulator_bulk_data * consumers)364da279e69SMatti Vaittinen static inline void devm_regulator_bulk_put(struct regulator_bulk_data *consumers)
365da279e69SMatti Vaittinen {
366da279e69SMatti Vaittinen }
367da279e69SMatti Vaittinen
regulator_register_supply_alias(struct device * dev,const char * id,struct device * alias_dev,const char * alias_id)368a06ccd9cSCharles Keepax static inline int regulator_register_supply_alias(struct device *dev,
369a06ccd9cSCharles Keepax const char *id,
370a06ccd9cSCharles Keepax struct device *alias_dev,
371a06ccd9cSCharles Keepax const char *alias_id)
372a06ccd9cSCharles Keepax {
373a06ccd9cSCharles Keepax return 0;
374a06ccd9cSCharles Keepax }
375a06ccd9cSCharles Keepax
regulator_unregister_supply_alias(struct device * dev,const char * id)376a06ccd9cSCharles Keepax static inline void regulator_unregister_supply_alias(struct device *dev,
377a06ccd9cSCharles Keepax const char *id)
378a06ccd9cSCharles Keepax {
379a06ccd9cSCharles Keepax }
380a06ccd9cSCharles Keepax
regulator_bulk_register_supply_alias(struct device * dev,const char * const * id,struct device * alias_dev,const char * const * alias_id,int num_id)381a06ccd9cSCharles Keepax static inline int regulator_bulk_register_supply_alias(struct device *dev,
3829f8c0fe9SLee Jones const char *const *id,
383a06ccd9cSCharles Keepax struct device *alias_dev,
3849f8c0fe9SLee Jones const char * const *alias_id,
385a06ccd9cSCharles Keepax int num_id)
386a06ccd9cSCharles Keepax {
387a06ccd9cSCharles Keepax return 0;
388a06ccd9cSCharles Keepax }
389a06ccd9cSCharles Keepax
regulator_bulk_unregister_supply_alias(struct device * dev,const char * const * id,int num_id)390a06ccd9cSCharles Keepax static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
3919f8c0fe9SLee Jones const char * const *id,
392a06ccd9cSCharles Keepax int num_id)
393a06ccd9cSCharles Keepax {
394a06ccd9cSCharles Keepax }
395a06ccd9cSCharles Keepax
devm_regulator_register_supply_alias(struct device * dev,const char * id,struct device * alias_dev,const char * alias_id)396a06ccd9cSCharles Keepax static inline int devm_regulator_register_supply_alias(struct device *dev,
397a06ccd9cSCharles Keepax const char *id,
398a06ccd9cSCharles Keepax struct device *alias_dev,
399a06ccd9cSCharles Keepax const char *alias_id)
400a06ccd9cSCharles Keepax {
401a06ccd9cSCharles Keepax return 0;
402a06ccd9cSCharles Keepax }
403a06ccd9cSCharles Keepax
devm_regulator_bulk_register_supply_alias(struct device * dev,const char * const * id,struct device * alias_dev,const char * const * alias_id,int num_id)4049f8c0fe9SLee Jones static inline int devm_regulator_bulk_register_supply_alias(struct device *dev,
4059f8c0fe9SLee Jones const char *const *id,
4069f8c0fe9SLee Jones struct device *alias_dev,
4079f8c0fe9SLee Jones const char *const *alias_id,
4089f8c0fe9SLee Jones int num_id)
409a06ccd9cSCharles Keepax {
410a06ccd9cSCharles Keepax return 0;
411a06ccd9cSCharles Keepax }
412a06ccd9cSCharles Keepax
regulator_enable(struct regulator * regulator)413e2ce4eaaSLiam Girdwood static inline int regulator_enable(struct regulator *regulator)
414e2ce4eaaSLiam Girdwood {
415e2ce4eaaSLiam Girdwood return 0;
416e2ce4eaaSLiam Girdwood }
417e2ce4eaaSLiam Girdwood
regulator_disable(struct regulator * regulator)418e2ce4eaaSLiam Girdwood static inline int regulator_disable(struct regulator *regulator)
419e2ce4eaaSLiam Girdwood {
420e2ce4eaaSLiam Girdwood return 0;
421e2ce4eaaSLiam Girdwood }
422e2ce4eaaSLiam Girdwood
regulator_force_disable(struct regulator * regulator)423935a5210SMyungJoo Ham static inline int regulator_force_disable(struct regulator *regulator)
424935a5210SMyungJoo Ham {
425935a5210SMyungJoo Ham return 0;
426935a5210SMyungJoo Ham }
427935a5210SMyungJoo Ham
regulator_disable_deferred(struct regulator * regulator,int ms)428da07ecd9SMark Brown static inline int regulator_disable_deferred(struct regulator *regulator,
429da07ecd9SMark Brown int ms)
430da07ecd9SMark Brown {
431da07ecd9SMark Brown return 0;
432da07ecd9SMark Brown }
433da07ecd9SMark Brown
regulator_is_enabled(struct regulator * regulator)434e2ce4eaaSLiam Girdwood static inline int regulator_is_enabled(struct regulator *regulator)
435e2ce4eaaSLiam Girdwood {
436e2ce4eaaSLiam Girdwood return 1;
437e2ce4eaaSLiam Girdwood }
438e2ce4eaaSLiam Girdwood
regulator_bulk_get(struct device * dev,int num_consumers,struct regulator_bulk_data * consumers)439e2ce4eaaSLiam Girdwood static inline int regulator_bulk_get(struct device *dev,
440e2ce4eaaSLiam Girdwood int num_consumers,
441e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers)
442e2ce4eaaSLiam Girdwood {
443e2ce4eaaSLiam Girdwood return 0;
444e2ce4eaaSLiam Girdwood }
445e2ce4eaaSLiam Girdwood
devm_regulator_bulk_get(struct device * dev,int num_consumers,struct regulator_bulk_data * consumers)446e24abd6eSAxel Lin static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers,
447e24abd6eSAxel Lin struct regulator_bulk_data *consumers)
448e24abd6eSAxel Lin {
449e24abd6eSAxel Lin return 0;
450e24abd6eSAxel Lin }
451e24abd6eSAxel Lin
devm_regulator_bulk_get_const(struct device * dev,int num_consumers,const struct regulator_bulk_data * in_consumers,struct regulator_bulk_data ** out_consumers)4521a5caec7SDouglas Anderson static inline int devm_regulator_bulk_get_const(
4531a5caec7SDouglas Anderson struct device *dev, int num_consumers,
4541a5caec7SDouglas Anderson const struct regulator_bulk_data *in_consumers,
4551a5caec7SDouglas Anderson struct regulator_bulk_data **out_consumers)
4561a5caec7SDouglas Anderson {
4571a5caec7SDouglas Anderson return 0;
4581a5caec7SDouglas Anderson }
4591a5caec7SDouglas Anderson
regulator_bulk_enable(int num_consumers,struct regulator_bulk_data * consumers)460e2ce4eaaSLiam Girdwood static inline int regulator_bulk_enable(int num_consumers,
461e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers)
462e2ce4eaaSLiam Girdwood {
463e2ce4eaaSLiam Girdwood return 0;
464e2ce4eaaSLiam Girdwood }
465e2ce4eaaSLiam Girdwood
devm_regulator_bulk_get_enable(struct device * dev,int num_consumers,const char * const * id)466da279e69SMatti Vaittinen static inline int devm_regulator_bulk_get_enable(struct device *dev,
467da279e69SMatti Vaittinen int num_consumers,
468da279e69SMatti Vaittinen const char * const *id)
469da279e69SMatti Vaittinen {
470da279e69SMatti Vaittinen return 0;
471da279e69SMatti Vaittinen }
472da279e69SMatti Vaittinen
regulator_bulk_disable(int num_consumers,struct regulator_bulk_data * consumers)473e2ce4eaaSLiam Girdwood static inline int regulator_bulk_disable(int num_consumers,
474e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers)
475e2ce4eaaSLiam Girdwood {
476e2ce4eaaSLiam Girdwood return 0;
477e2ce4eaaSLiam Girdwood }
478e2ce4eaaSLiam Girdwood
regulator_bulk_force_disable(int num_consumers,struct regulator_bulk_data * consumers)479e1de2f42SDonggeun Kim static inline int regulator_bulk_force_disable(int num_consumers,
480e1de2f42SDonggeun Kim struct regulator_bulk_data *consumers)
481e1de2f42SDonggeun Kim {
482e1de2f42SDonggeun Kim return 0;
483e1de2f42SDonggeun Kim }
484e1de2f42SDonggeun Kim
regulator_bulk_free(int num_consumers,struct regulator_bulk_data * consumers)485e2ce4eaaSLiam Girdwood static inline void regulator_bulk_free(int num_consumers,
486e2ce4eaaSLiam Girdwood struct regulator_bulk_data *consumers)
487e2ce4eaaSLiam Girdwood {
488e2ce4eaaSLiam Girdwood }
489e2ce4eaaSLiam Girdwood
regulator_set_voltage(struct regulator * regulator,int min_uV,int max_uV)490e2ce4eaaSLiam Girdwood static inline int regulator_set_voltage(struct regulator *regulator,
491e2ce4eaaSLiam Girdwood int min_uV, int max_uV)
492e2ce4eaaSLiam Girdwood {
493e2ce4eaaSLiam Girdwood return 0;
494e2ce4eaaSLiam Girdwood }
495e2ce4eaaSLiam Girdwood
regulator_set_voltage_time(struct regulator * regulator,int old_uV,int new_uV)496d660e92aSViresh Kumar static inline int regulator_set_voltage_time(struct regulator *regulator,
497d660e92aSViresh Kumar int old_uV, int new_uV)
498d660e92aSViresh Kumar {
499d660e92aSViresh Kumar return 0;
500d660e92aSViresh Kumar }
501d660e92aSViresh Kumar
regulator_get_voltage(struct regulator * regulator)502e2ce4eaaSLiam Girdwood static inline int regulator_get_voltage(struct regulator *regulator)
503e2ce4eaaSLiam Girdwood {
50408aed2f6SMark Brown return -EINVAL;
505e2ce4eaaSLiam Girdwood }
506e2ce4eaaSLiam Girdwood
regulator_sync_voltage(struct regulator * regulator)50751dfb6caSDmitry Osipenko static inline int regulator_sync_voltage(struct regulator *regulator)
50851dfb6caSDmitry Osipenko {
50951dfb6caSDmitry Osipenko return -EINVAL;
51051dfb6caSDmitry Osipenko }
51151dfb6caSDmitry Osipenko
regulator_is_supported_voltage(struct regulator * regulator,int min_uV,int max_uV)5124fe23791SPhilip Rakity static inline int regulator_is_supported_voltage(struct regulator *regulator,
5134fe23791SPhilip Rakity int min_uV, int max_uV)
5144fe23791SPhilip Rakity {
5154fe23791SPhilip Rakity return 0;
5164fe23791SPhilip Rakity }
5174fe23791SPhilip Rakity
regulator_get_linear_step(struct regulator * regulator)5187287275bSArnd Bergmann static inline unsigned int regulator_get_linear_step(struct regulator *regulator)
5197287275bSArnd Bergmann {
5207287275bSArnd Bergmann return 0;
5217287275bSArnd Bergmann }
5227287275bSArnd Bergmann
regulator_set_current_limit(struct regulator * regulator,int min_uA,int max_uA)523e2ce4eaaSLiam Girdwood static inline int regulator_set_current_limit(struct regulator *regulator,
524e2ce4eaaSLiam Girdwood int min_uA, int max_uA)
525e2ce4eaaSLiam Girdwood {
526e2ce4eaaSLiam Girdwood return 0;
527e2ce4eaaSLiam Girdwood }
528e2ce4eaaSLiam Girdwood
regulator_get_current_limit(struct regulator * regulator)529e2ce4eaaSLiam Girdwood static inline int regulator_get_current_limit(struct regulator *regulator)
530e2ce4eaaSLiam Girdwood {
531e2ce4eaaSLiam Girdwood return 0;
532e2ce4eaaSLiam Girdwood }
533e2ce4eaaSLiam Girdwood
regulator_get_unclaimed_power_budget(struct regulator * regulator)53442d7c87bSKory Maincent static inline int regulator_get_unclaimed_power_budget(struct regulator *regulator)
53542d7c87bSKory Maincent {
53642d7c87bSKory Maincent return INT_MAX;
53742d7c87bSKory Maincent }
53842d7c87bSKory Maincent
regulator_request_power_budget(struct regulator * regulator,unsigned int pw_req)53942d7c87bSKory Maincent static inline int regulator_request_power_budget(struct regulator *regulator,
54042d7c87bSKory Maincent unsigned int pw_req)
54142d7c87bSKory Maincent {
54242d7c87bSKory Maincent return -EOPNOTSUPP;
54342d7c87bSKory Maincent }
54442d7c87bSKory Maincent
regulator_free_power_budget(struct regulator * regulator,unsigned int pw)54542d7c87bSKory Maincent static inline void regulator_free_power_budget(struct regulator *regulator,
54642d7c87bSKory Maincent unsigned int pw)
54742d7c87bSKory Maincent {
54842d7c87bSKory Maincent }
54942d7c87bSKory Maincent
regulator_set_mode(struct regulator * regulator,unsigned int mode)550e2ce4eaaSLiam Girdwood static inline int regulator_set_mode(struct regulator *regulator,
551e2ce4eaaSLiam Girdwood unsigned int mode)
552e2ce4eaaSLiam Girdwood {
553e2ce4eaaSLiam Girdwood return 0;
554e2ce4eaaSLiam Girdwood }
555e2ce4eaaSLiam Girdwood
regulator_get_mode(struct regulator * regulator)556e2ce4eaaSLiam Girdwood static inline unsigned int regulator_get_mode(struct regulator *regulator)
557e2ce4eaaSLiam Girdwood {
558e2ce4eaaSLiam Girdwood return REGULATOR_MODE_NORMAL;
559e2ce4eaaSLiam Girdwood }
560e2ce4eaaSLiam Girdwood
regulator_get_error_flags(struct regulator * regulator,unsigned int * flags)56130103b5bSDavid Lechner static inline int regulator_get_error_flags(struct regulator *regulator,
56230103b5bSDavid Lechner unsigned int *flags)
5631b5b4221SAxel Haslam {
5641b5b4221SAxel Haslam return -EINVAL;
5651b5b4221SAxel Haslam }
5661b5b4221SAxel Haslam
regulator_set_load(struct regulator * regulator,int load_uA)567e39ce48fSBjorn Andersson static inline int regulator_set_load(struct regulator *regulator, int load_uA)
568e2ce4eaaSLiam Girdwood {
569f1abf672SMark Brown return 0;
570e2ce4eaaSLiam Girdwood }
571e2ce4eaaSLiam Girdwood
regulator_allow_bypass(struct regulator * regulator,bool allow)572f59c8f9fSMark Brown static inline int regulator_allow_bypass(struct regulator *regulator,
573f59c8f9fSMark Brown bool allow)
574f59c8f9fSMark Brown {
575f59c8f9fSMark Brown return 0;
576f59c8f9fSMark Brown }
577f59c8f9fSMark Brown
regulator_get_regmap(struct regulator * regulator)5783bc0312eSMark Brown static inline struct regmap *regulator_get_regmap(struct regulator *regulator)
57904eca28cSTuomas Tynkkynen {
58004eca28cSTuomas Tynkkynen return ERR_PTR(-EOPNOTSUPP);
58104eca28cSTuomas Tynkkynen }
58204eca28cSTuomas Tynkkynen
regulator_get_hardware_vsel_register(struct regulator * regulator,unsigned * vsel_reg,unsigned * vsel_mask)5833bc0312eSMark Brown static inline int regulator_get_hardware_vsel_register(struct regulator *regulator,
58404eca28cSTuomas Tynkkynen unsigned *vsel_reg,
58504eca28cSTuomas Tynkkynen unsigned *vsel_mask)
58604eca28cSTuomas Tynkkynen {
58704eca28cSTuomas Tynkkynen return -EOPNOTSUPP;
58804eca28cSTuomas Tynkkynen }
58904eca28cSTuomas Tynkkynen
regulator_list_hardware_vsel(struct regulator * regulator,unsigned selector)5903bc0312eSMark Brown static inline int regulator_list_hardware_vsel(struct regulator *regulator,
59104eca28cSTuomas Tynkkynen unsigned selector)
59204eca28cSTuomas Tynkkynen {
59304eca28cSTuomas Tynkkynen return -EOPNOTSUPP;
59404eca28cSTuomas Tynkkynen }
59504eca28cSTuomas Tynkkynen
regulator_hardware_enable(struct regulator * regulator,bool enable)5961cb7d291SBiju Das static inline int regulator_hardware_enable(struct regulator *regulator,
5971cb7d291SBiju Das bool enable)
5981cb7d291SBiju Das {
5991cb7d291SBiju Das return -EOPNOTSUPP;
6001cb7d291SBiju Das }
6011cb7d291SBiju Das
regulator_register_notifier(struct regulator * regulator,struct notifier_block * nb)602e2ce4eaaSLiam Girdwood static inline int regulator_register_notifier(struct regulator *regulator,
603e2ce4eaaSLiam Girdwood struct notifier_block *nb)
604e2ce4eaaSLiam Girdwood {
605e2ce4eaaSLiam Girdwood return 0;
606e2ce4eaaSLiam Girdwood }
607e2ce4eaaSLiam Girdwood
devm_regulator_register_notifier(struct regulator * regulator,struct notifier_block * nb)608046db763SCharles Keepax static inline int devm_regulator_register_notifier(struct regulator *regulator,
609046db763SCharles Keepax struct notifier_block *nb)
610046db763SCharles Keepax {
611046db763SCharles Keepax return 0;
612046db763SCharles Keepax }
613046db763SCharles Keepax
regulator_unregister_notifier(struct regulator * regulator,struct notifier_block * nb)614e2ce4eaaSLiam Girdwood static inline int regulator_unregister_notifier(struct regulator *regulator,
615e2ce4eaaSLiam Girdwood struct notifier_block *nb)
616e2ce4eaaSLiam Girdwood {
617e2ce4eaaSLiam Girdwood return 0;
618e2ce4eaaSLiam Girdwood }
619e2ce4eaaSLiam Girdwood
devm_regulator_unregister_notifier(struct regulator * regulator,struct notifier_block * nb)620046db763SCharles Keepax static inline int devm_regulator_unregister_notifier(struct regulator *regulator,
621046db763SCharles Keepax struct notifier_block *nb)
622046db763SCharles Keepax {
623046db763SCharles Keepax return 0;
624046db763SCharles Keepax }
625046db763SCharles Keepax
regulator_suspend_enable(struct regulator_dev * rdev,suspend_state_t state)62651dfb6caSDmitry Osipenko static inline int regulator_suspend_enable(struct regulator_dev *rdev,
62751dfb6caSDmitry Osipenko suspend_state_t state)
62851dfb6caSDmitry Osipenko {
62951dfb6caSDmitry Osipenko return -EINVAL;
63051dfb6caSDmitry Osipenko }
63151dfb6caSDmitry Osipenko
regulator_suspend_disable(struct regulator_dev * rdev,suspend_state_t state)63251dfb6caSDmitry Osipenko static inline int regulator_suspend_disable(struct regulator_dev *rdev,
63351dfb6caSDmitry Osipenko suspend_state_t state)
63451dfb6caSDmitry Osipenko {
63551dfb6caSDmitry Osipenko return -EINVAL;
63651dfb6caSDmitry Osipenko }
63751dfb6caSDmitry Osipenko
regulator_set_suspend_voltage(struct regulator * regulator,int min_uV,int max_uV,suspend_state_t state)63851dfb6caSDmitry Osipenko static inline int regulator_set_suspend_voltage(struct regulator *regulator,
63951dfb6caSDmitry Osipenko int min_uV, int max_uV,
64051dfb6caSDmitry Osipenko suspend_state_t state)
64151dfb6caSDmitry Osipenko {
64251dfb6caSDmitry Osipenko return -EINVAL;
64351dfb6caSDmitry Osipenko }
64451dfb6caSDmitry Osipenko
regulator_get_drvdata(struct regulator * regulator)645e2ce4eaaSLiam Girdwood static inline void *regulator_get_drvdata(struct regulator *regulator)
646e2ce4eaaSLiam Girdwood {
647e2ce4eaaSLiam Girdwood return NULL;
648e2ce4eaaSLiam Girdwood }
649e2ce4eaaSLiam Girdwood
regulator_set_drvdata(struct regulator * regulator,void * data)650e2ce4eaaSLiam Girdwood static inline void regulator_set_drvdata(struct regulator *regulator,
651e2ce4eaaSLiam Girdwood void *data)
652e2ce4eaaSLiam Girdwood {
653e2ce4eaaSLiam Girdwood }
654e2ce4eaaSLiam Girdwood
regulator_count_voltages(struct regulator * regulator)6551a8f85d4SPhilip Rakity static inline int regulator_count_voltages(struct regulator *regulator)
6561a8f85d4SPhilip Rakity {
6571a8f85d4SPhilip Rakity return 0;
6581a8f85d4SPhilip Rakity }
6595127e31aSSuzuki K. Poulose
regulator_list_voltage(struct regulator * regulator,unsigned selector)6605127e31aSSuzuki K. Poulose static inline int regulator_list_voltage(struct regulator *regulator, unsigned selector)
6615127e31aSSuzuki K. Poulose {
6625127e31aSSuzuki K. Poulose return -EINVAL;
6635127e31aSSuzuki K. Poulose }
6645127e31aSSuzuki K. Poulose
665d072cb26SBartosz Golaszewski static inline void
regulator_bulk_set_supply_names(struct regulator_bulk_data * consumers,const char * const * supply_names,unsigned int num_supplies)666d072cb26SBartosz Golaszewski regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
667d0087e72SBartosz Golaszewski const char *const *supply_names,
668d0087e72SBartosz Golaszewski unsigned int num_supplies)
669d0087e72SBartosz Golaszewski {
670d0087e72SBartosz Golaszewski }
671d0087e72SBartosz Golaszewski
672b059b7e0SMarek Vasut static inline bool
regulator_is_equal(struct regulator * reg1,struct regulator * reg2)6730468e667SStephen Rothwell regulator_is_equal(struct regulator *reg1, struct regulator *reg2)
674b059b7e0SMarek Vasut {
675b059b7e0SMarek Vasut return false;
676b059b7e0SMarek Vasut }
677e2ce4eaaSLiam Girdwood #endif
678e2ce4eaaSLiam Girdwood
679907af7d6SManivannan Sadhasivam #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_REGULATOR)
680*0dffacbbSSebastian Reichel struct regulator *__must_check of_regulator_get(struct device *dev,
681*0dffacbbSSebastian Reichel struct device_node *node,
682*0dffacbbSSebastian Reichel const char *id);
683*0dffacbbSSebastian Reichel struct regulator *__must_check devm_of_regulator_get(struct device *dev,
684*0dffacbbSSebastian Reichel struct device_node *node,
685*0dffacbbSSebastian Reichel const char *id);
686907af7d6SManivannan Sadhasivam struct regulator *__must_check of_regulator_get_optional(struct device *dev,
687907af7d6SManivannan Sadhasivam struct device_node *node,
688907af7d6SManivannan Sadhasivam const char *id);
689907af7d6SManivannan Sadhasivam struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
690907af7d6SManivannan Sadhasivam struct device_node *node,
691907af7d6SManivannan Sadhasivam const char *id);
692907af7d6SManivannan Sadhasivam int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
693907af7d6SManivannan Sadhasivam struct regulator_bulk_data **consumers);
694907af7d6SManivannan Sadhasivam #else
of_regulator_get_optional(struct device * dev,struct device_node * node,const char * id)695907af7d6SManivannan Sadhasivam static inline struct regulator *__must_check of_regulator_get_optional(struct device *dev,
696907af7d6SManivannan Sadhasivam struct device_node *node,
697907af7d6SManivannan Sadhasivam const char *id)
698907af7d6SManivannan Sadhasivam {
699907af7d6SManivannan Sadhasivam return ERR_PTR(-ENODEV);
700907af7d6SManivannan Sadhasivam }
701907af7d6SManivannan Sadhasivam
devm_of_regulator_get_optional(struct device * dev,struct device_node * node,const char * id)702907af7d6SManivannan Sadhasivam static inline struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
703907af7d6SManivannan Sadhasivam struct device_node *node,
704907af7d6SManivannan Sadhasivam const char *id)
705907af7d6SManivannan Sadhasivam {
706907af7d6SManivannan Sadhasivam return ERR_PTR(-ENODEV);
707907af7d6SManivannan Sadhasivam }
708907af7d6SManivannan Sadhasivam
of_regulator_bulk_get_all(struct device * dev,struct device_node * np,struct regulator_bulk_data ** consumers)709907af7d6SManivannan Sadhasivam static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
710907af7d6SManivannan Sadhasivam struct regulator_bulk_data **consumers)
711907af7d6SManivannan Sadhasivam {
712907af7d6SManivannan Sadhasivam return 0;
713907af7d6SManivannan Sadhasivam }
714907af7d6SManivannan Sadhasivam
715907af7d6SManivannan Sadhasivam #endif
716907af7d6SManivannan Sadhasivam
regulator_set_voltage_triplet(struct regulator * regulator,int min_uV,int target_uV,int max_uV)71730f93ca8SViresh Kumar static inline int regulator_set_voltage_triplet(struct regulator *regulator,
71830f93ca8SViresh Kumar int min_uV, int target_uV,
71930f93ca8SViresh Kumar int max_uV)
72030f93ca8SViresh Kumar {
72130f93ca8SViresh Kumar if (regulator_set_voltage(regulator, target_uV, max_uV) == 0)
72230f93ca8SViresh Kumar return 0;
72330f93ca8SViresh Kumar
72430f93ca8SViresh Kumar return regulator_set_voltage(regulator, min_uV, max_uV);
72530f93ca8SViresh Kumar }
72630f93ca8SViresh Kumar
regulator_set_voltage_tol(struct regulator * regulator,int new_uV,int tol_uV)7273f196577SShawn Guo static inline int regulator_set_voltage_tol(struct regulator *regulator,
7283f196577SShawn Guo int new_uV, int tol_uV)
7293f196577SShawn Guo {
730dc9ceed6SMark Brown if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
731dc9ceed6SMark Brown return 0;
732dc9ceed6SMark Brown else
7333f196577SShawn Guo return regulator_set_voltage(regulator,
7343f196577SShawn Guo new_uV - tol_uV, new_uV + tol_uV);
7353f196577SShawn Guo }
7363f196577SShawn Guo
regulator_is_supported_voltage_tol(struct regulator * regulator,int target_uV,int tol_uV)737fe1e43f7SMark Brown static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
738fe1e43f7SMark Brown int target_uV, int tol_uV)
739fe1e43f7SMark Brown {
740fe1e43f7SMark Brown return regulator_is_supported_voltage(regulator,
741fe1e43f7SMark Brown target_uV - tol_uV,
742fe1e43f7SMark Brown target_uV + tol_uV);
743fe1e43f7SMark Brown }
744fe1e43f7SMark Brown
745e2ce4eaaSLiam Girdwood #endif
746