This source file includes following definitions.
- pin_desc_get
1
2
3
4
5
6
7
8
9
10
11 #include <linux/kref.h>
12 #include <linux/mutex.h>
13 #include <linux/radix-tree.h>
14 #include <linux/pinctrl/pinconf.h>
15 #include <linux/pinctrl/machine.h>
16
17 struct pinctrl_gpio_range;
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 struct pinctrl_dev {
43 struct list_head node;
44 struct pinctrl_desc *desc;
45 struct radix_tree_root pin_desc_tree;
46 #ifdef CONFIG_GENERIC_PINCTRL_GROUPS
47 struct radix_tree_root pin_group_tree;
48 unsigned int num_groups;
49 #endif
50 #ifdef CONFIG_GENERIC_PINMUX_FUNCTIONS
51 struct radix_tree_root pin_function_tree;
52 unsigned int num_functions;
53 #endif
54 struct list_head gpio_ranges;
55 struct device *dev;
56 struct module *owner;
57 void *driver_data;
58 struct pinctrl *p;
59 struct pinctrl_state *hog_default;
60 struct pinctrl_state *hog_sleep;
61 struct mutex mutex;
62 #ifdef CONFIG_DEBUG_FS
63 struct dentry *device_root;
64 #endif
65 };
66
67
68
69
70
71
72
73
74
75
76
77 struct pinctrl {
78 struct list_head node;
79 struct device *dev;
80 struct list_head states;
81 struct pinctrl_state *state;
82 struct list_head dt_maps;
83 struct kref users;
84 };
85
86
87
88
89
90
91
92 struct pinctrl_state {
93 struct list_head node;
94 const char *name;
95 struct list_head settings;
96 };
97
98
99
100
101
102
103 struct pinctrl_setting_mux {
104 unsigned group;
105 unsigned func;
106 };
107
108
109
110
111
112
113
114
115
116 struct pinctrl_setting_configs {
117 unsigned group_or_pin;
118 unsigned long *configs;
119 unsigned num_configs;
120 };
121
122
123
124
125
126
127
128
129
130
131 struct pinctrl_setting {
132 struct list_head node;
133 enum pinctrl_map_type type;
134 struct pinctrl_dev *pctldev;
135 const char *dev_name;
136 union {
137 struct pinctrl_setting_mux mux;
138 struct pinctrl_setting_configs configs;
139 } data;
140 };
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159 struct pin_desc {
160 struct pinctrl_dev *pctldev;
161 const char *name;
162 bool dynamic_name;
163 void *drv_data;
164
165 #ifdef CONFIG_PINMUX
166 unsigned mux_usecount;
167 const char *mux_owner;
168 const struct pinctrl_setting_mux *mux_setting;
169 const char *gpio_owner;
170 #endif
171 };
172
173
174
175
176
177
178
179 struct pinctrl_maps {
180 struct list_head node;
181 const struct pinctrl_map *maps;
182 unsigned num_maps;
183 };
184
185 #ifdef CONFIG_GENERIC_PINCTRL_GROUPS
186
187
188
189
190
191
192
193
194 struct group_desc {
195 const char *name;
196 int *pins;
197 int num_pins;
198 void *data;
199 };
200
201 int pinctrl_generic_get_group_count(struct pinctrl_dev *pctldev);
202
203 const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
204 unsigned int group_selector);
205
206 int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev,
207 unsigned int group_selector,
208 const unsigned int **pins,
209 unsigned int *npins);
210
211 struct group_desc *pinctrl_generic_get_group(struct pinctrl_dev *pctldev,
212 unsigned int group_selector);
213
214 int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
215 int *gpins, int ngpins, void *data);
216
217 int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
218 unsigned int group_selector);
219
220 #endif
221
222 struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
223 struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);
224 int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
225 const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
226 int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
227 const char *pin_group);
228
229 static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,
230 unsigned int pin)
231 {
232 return radix_tree_lookup(&pctldev->pin_desc_tree, pin);
233 }
234
235 extern struct pinctrl_gpio_range *
236 pinctrl_find_gpio_range_from_pin_nolock(struct pinctrl_dev *pctldev,
237 unsigned int pin);
238
239 int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps,
240 bool dup);
241 void pinctrl_unregister_map(const struct pinctrl_map *map);
242
243 extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev);
244 extern int pinctrl_force_default(struct pinctrl_dev *pctldev);
245
246 extern struct mutex pinctrl_maps_mutex;
247 extern struct list_head pinctrl_maps;
248
249 #define for_each_maps(_maps_node_, _i_, _map_) \
250 list_for_each_entry(_maps_node_, &pinctrl_maps, node) \
251 for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \
252 _i_ < _maps_node_->num_maps; \
253 _i_++, _map_ = &_maps_node_->maps[_i_])