staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / drivers / regulator / internal.h
blob83ae442f515b66ad2385057c00cb566c5be3784c
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * internal.h -- Voltage/Current Regulator framework internal code
5 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
6 * Copyright 2008 SlimLogic Ltd.
8 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
9 */
11 #ifndef __REGULATOR_INTERNAL_H
12 #define __REGULATOR_INTERNAL_H
14 #include <linux/suspend.h>
16 #define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1)
18 struct regulator_voltage {
19 int min_uV;
20 int max_uV;
24 * struct regulator
26 * One for each consumer device.
27 * @voltage - a voltage array for each state of runtime, i.e.:
28 * PM_SUSPEND_ON
29 * PM_SUSPEND_TO_IDLE
30 * PM_SUSPEND_STANDBY
31 * PM_SUSPEND_MEM
32 * PM_SUSPEND_MAX
34 struct regulator {
35 struct device *dev;
36 struct list_head list;
37 unsigned int always_on:1;
38 unsigned int bypass:1;
39 int uA_load;
40 unsigned int enable_count;
41 unsigned int deferred_disables;
42 struct regulator_voltage voltage[REGULATOR_STATES_NUM];
43 const char *supply_name;
44 struct device_attribute dev_attr;
45 struct regulator_dev *rdev;
46 struct dentry *debugfs;
49 extern struct class regulator_class;
51 static inline struct regulator_dev *dev_to_rdev(struct device *dev)
53 return container_of(dev, struct regulator_dev, dev);
56 #ifdef CONFIG_OF
57 struct regulator_dev *of_find_regulator_by_node(struct device_node *np);
58 struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
59 const struct regulator_desc *desc,
60 struct regulator_config *config,
61 struct device_node **node);
63 struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev,
64 int index);
66 int of_get_n_coupled(struct regulator_dev *rdev);
68 bool of_check_coupling_data(struct regulator_dev *rdev);
70 #else
71 static inline struct regulator_dev *
72 of_find_regulator_by_node(struct device_node *np)
74 return NULL;
77 static inline struct regulator_init_data *
78 regulator_of_get_init_data(struct device *dev,
79 const struct regulator_desc *desc,
80 struct regulator_config *config,
81 struct device_node **node)
83 return NULL;
86 static inline struct regulator_dev *
87 of_parse_coupled_regulator(struct regulator_dev *rdev,
88 int index)
90 return NULL;
93 static inline int of_get_n_coupled(struct regulator_dev *rdev)
95 return 0;
98 static inline bool of_check_coupling_data(struct regulator_dev *rdev)
100 return false;
103 #endif
104 enum regulator_get_type {
105 NORMAL_GET,
106 EXCLUSIVE_GET,
107 OPTIONAL_GET,
108 MAX_GET_TYPE
111 struct regulator *_regulator_get(struct device *dev, const char *id,
112 enum regulator_get_type get_type);
113 #endif