.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Interface the pinctrl subsystem |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * This interface is used in the core to keep track of pins. |
---|
7 | 8 | * |
---|
8 | 9 | * Author: Linus Walleij <linus.walleij@linaro.org> |
---|
9 | | - * |
---|
10 | | - * License terms: GNU General Public License (GPL) version 2 |
---|
11 | 10 | */ |
---|
12 | 11 | #ifndef __LINUX_PINCTRL_PINCTRL_H |
---|
13 | 12 | #define __LINUX_PINCTRL_PINCTRL_H |
---|
14 | | - |
---|
15 | | -#ifdef CONFIG_PINCTRL |
---|
16 | 13 | |
---|
17 | 14 | #include <linux/radix-tree.h> |
---|
18 | 15 | #include <linux/list.h> |
---|
.. | .. |
---|
125 | 122 | * the hardware description |
---|
126 | 123 | * @custom_conf_items: Information how to print @params in debugfs, must be |
---|
127 | 124 | * the same size as the @custom_params, i.e. @num_custom_params |
---|
| 125 | + * @link_consumers: If true create a device link between pinctrl and its |
---|
| 126 | + * consumers (i.e. the devices requesting pin control states). This is |
---|
| 127 | + * sometimes necessary to ascertain the right suspend/resume order for |
---|
| 128 | + * example. |
---|
128 | 129 | */ |
---|
129 | 130 | struct pinctrl_desc { |
---|
130 | 131 | const char *name; |
---|
.. | .. |
---|
139 | 140 | const struct pinconf_generic_params *custom_params; |
---|
140 | 141 | const struct pin_config_item *custom_conf_items; |
---|
141 | 142 | #endif |
---|
| 143 | + bool link_consumers; |
---|
142 | 144 | }; |
---|
143 | 145 | |
---|
144 | 146 | /* External interface to pin controller */ |
---|
.. | .. |
---|
167 | 169 | extern void devm_pinctrl_unregister(struct device *dev, |
---|
168 | 170 | struct pinctrl_dev *pctldev); |
---|
169 | 171 | |
---|
170 | | -extern bool pin_is_valid(struct pinctrl_dev *pctldev, int pin); |
---|
171 | 172 | extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev, |
---|
172 | 173 | struct pinctrl_gpio_range *range); |
---|
173 | 174 | extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev, |
---|
.. | .. |
---|
185 | 186 | const char *pin_group, const unsigned **pins, |
---|
186 | 187 | unsigned *num_pins); |
---|
187 | 188 | |
---|
188 | | -#ifdef CONFIG_OF |
---|
| 189 | +#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL) |
---|
189 | 190 | extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np); |
---|
190 | 191 | #else |
---|
191 | 192 | static inline |
---|
.. | .. |
---|
198 | 199 | extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); |
---|
199 | 200 | extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev); |
---|
200 | 201 | extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); |
---|
201 | | -#else |
---|
202 | | - |
---|
203 | | -struct pinctrl_dev; |
---|
204 | | - |
---|
205 | | -/* Sufficiently stupid default functions when pinctrl is not in use */ |
---|
206 | | -static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) |
---|
207 | | -{ |
---|
208 | | - return pin >= 0; |
---|
209 | | -} |
---|
210 | | - |
---|
211 | | -#endif /* !CONFIG_PINCTRL */ |
---|
212 | 202 | |
---|
213 | 203 | #endif /* __LINUX_PINCTRL_PINCTRL_H */ |
---|