core.h (99e4f67508e1dd51e21ebae2150c6e4f4eae068b) core.h (c7059c5ac70aea194b07b2d811df433eb0ca81b5)
1/*
2 * Core private header for the pin control subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 *
7 * Author: Linus Walleij <linus.walleij@linaro.org>
8 *

--- 10 unchanged lines hidden (view full) ---

19
20/**
21 * struct pinctrl_dev - pin control class device
22 * @node: node to include this pin controller in the global pin controller list
23 * @desc: the pin controller descriptor supplied when initializing this pin
24 * controller
25 * @pin_desc_tree: each pin descriptor for this pin controller is stored in
26 * this radix tree
1/*
2 * Core private header for the pin control subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 *
7 * Author: Linus Walleij <linus.walleij@linaro.org>
8 *

--- 10 unchanged lines hidden (view full) ---

19
20/**
21 * struct pinctrl_dev - pin control class device
22 * @node: node to include this pin controller in the global pin controller list
23 * @desc: the pin controller descriptor supplied when initializing this pin
24 * controller
25 * @pin_desc_tree: each pin descriptor for this pin controller is stored in
26 * this radix tree
27 * @pin_group_tree: optionally each pin group can be stored in this radix tree
28 * @num_groups: optionally number of groups can be kept here
27 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
28 * ranges are added to this list at runtime
29 * @dev: the device entry for this pin controller
30 * @owner: module providing the pin controller, used for refcounting
31 * @driver_data: driver data for drivers registering to the pin controller
32 * subsystem
33 * @p: result of pinctrl_get() for this device
34 * @hog_default: default state for pins hogged by this device
35 * @hog_sleep: sleep state for pins hogged by this device
36 * @late_init: delayed work for pin controller to finish registration
37 * @mutex: mutex taken on each pin controller specific action
38 * @device_root: debugfs root for this device
39 */
40struct pinctrl_dev {
41 struct list_head node;
42 struct pinctrl_desc *desc;
43 struct radix_tree_root pin_desc_tree;
29 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
30 * ranges are added to this list at runtime
31 * @dev: the device entry for this pin controller
32 * @owner: module providing the pin controller, used for refcounting
33 * @driver_data: driver data for drivers registering to the pin controller
34 * subsystem
35 * @p: result of pinctrl_get() for this device
36 * @hog_default: default state for pins hogged by this device
37 * @hog_sleep: sleep state for pins hogged by this device
38 * @late_init: delayed work for pin controller to finish registration
39 * @mutex: mutex taken on each pin controller specific action
40 * @device_root: debugfs root for this device
41 */
42struct pinctrl_dev {
43 struct list_head node;
44 struct pinctrl_desc *desc;
45 struct radix_tree_root pin_desc_tree;
46 struct radix_tree_root pin_group_tree;
47 unsigned int num_groups;
44 struct list_head gpio_ranges;
45 struct device *dev;
46 struct module *owner;
47 void *driver_data;
48 struct pinctrl *p;
49 struct pinctrl_state *hog_default;
50 struct pinctrl_state *hog_sleep;
51 struct delayed_work late_init;

--- 105 unchanged lines hidden (view full) ---

157 unsigned mux_usecount;
158 const char *mux_owner;
159 const struct pinctrl_setting_mux *mux_setting;
160 const char *gpio_owner;
161#endif
162};
163
164/**
48 struct list_head gpio_ranges;
49 struct device *dev;
50 struct module *owner;
51 void *driver_data;
52 struct pinctrl *p;
53 struct pinctrl_state *hog_default;
54 struct pinctrl_state *hog_sleep;
55 struct delayed_work late_init;

--- 105 unchanged lines hidden (view full) ---

161 unsigned mux_usecount;
162 const char *mux_owner;
163 const struct pinctrl_setting_mux *mux_setting;
164 const char *gpio_owner;
165#endif
166};
167
168/**
169 * struct group_desc - generic pin group descriptor
170 * @name: name of the pin group
171 * @pins: array of pins that belong to the group
172 * @num_pins: number of pins in the group
173 * @data: pin controller driver specific data
174 */
175struct group_desc {
176 const char *name;
177 int *pins;
178 int num_pins;
179 void *data;
180};
181
182/**
165 * struct pinctrl_maps - a list item containing part of the mapping table
166 * @node: mapping table list node
167 * @maps: array of mapping table entries
168 * @num_maps: the number of entries in @maps
169 */
170struct pinctrl_maps {
171 struct list_head node;
172 struct pinctrl_map const *maps;
173 unsigned num_maps;
174};
175
183 * struct pinctrl_maps - a list item containing part of the mapping table
184 * @node: mapping table list node
185 * @maps: array of mapping table entries
186 * @num_maps: the number of entries in @maps
187 */
188struct pinctrl_maps {
189 struct list_head node;
190 struct pinctrl_map const *maps;
191 unsigned num_maps;
192};
193
194#ifdef CONFIG_GENERIC_PINCTRL
195
196int pinctrl_generic_get_group_count(struct pinctrl_dev *pctldev);
197
198const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
199 unsigned int group_selector);
200
201int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev,
202 unsigned int group_selector,
203 const unsigned int **pins,
204 unsigned int *npins);
205
206struct group_desc *pinctrl_generic_get_group(struct pinctrl_dev *pctldev,
207 unsigned int group_selector);
208
209int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name,
210 int *gpins, int ngpins, void *data);
211
212int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev,
213 unsigned int group_selector);
214
215static inline int
216pinctrl_generic_remove_last_group(struct pinctrl_dev *pctldev)
217{
218 return pinctrl_generic_remove_group(pctldev, pctldev->num_groups - 1);
219}
220
221#endif /* CONFIG_GENERIC_PINCTRL */
222
176struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
177struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);
178int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
179const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
180int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
181 const char *pin_group);
182
183static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,

--- 24 unchanged lines hidden ---
223struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
224struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);
225int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
226const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
227int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
228 const char *pin_group);
229
230static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,

--- 24 unchanged lines hidden ---