diff options
Diffstat (limited to 'drivers/pinctrl/core.h')
-rw-r--r-- | drivers/pinctrl/core.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 12f5694f3d5d..ee72f1f6d862 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h | |||
@@ -9,6 +9,7 @@ | |||
9 | * License terms: GNU General Public License (GPL) version 2 | 9 | * License terms: GNU General Public License (GPL) version 2 |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kref.h> | ||
12 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
13 | #include <linux/radix-tree.h> | 14 | #include <linux/radix-tree.h> |
14 | #include <linux/pinctrl/pinconf.h> | 15 | #include <linux/pinctrl/pinconf.h> |
@@ -30,6 +31,8 @@ struct pinctrl_gpio_range; | |||
30 | * @driver_data: driver data for drivers registering to the pin controller | 31 | * @driver_data: driver data for drivers registering to the pin controller |
31 | * subsystem | 32 | * subsystem |
32 | * @p: result of pinctrl_get() for this device | 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 | ||
33 | * @device_root: debugfs root for this device | 36 | * @device_root: debugfs root for this device |
34 | */ | 37 | */ |
35 | struct pinctrl_dev { | 38 | struct pinctrl_dev { |
@@ -41,6 +44,8 @@ struct pinctrl_dev { | |||
41 | struct module *owner; | 44 | struct module *owner; |
42 | void *driver_data; | 45 | void *driver_data; |
43 | struct pinctrl *p; | 46 | struct pinctrl *p; |
47 | struct pinctrl_state *hog_default; | ||
48 | struct pinctrl_state *hog_sleep; | ||
44 | #ifdef CONFIG_DEBUG_FS | 49 | #ifdef CONFIG_DEBUG_FS |
45 | struct dentry *device_root; | 50 | struct dentry *device_root; |
46 | #endif | 51 | #endif |
@@ -54,6 +59,7 @@ struct pinctrl_dev { | |||
54 | * @state: the current state | 59 | * @state: the current state |
55 | * @dt_maps: the mapping table chunks dynamically parsed from device tree for | 60 | * @dt_maps: the mapping table chunks dynamically parsed from device tree for |
56 | * this device, if any | 61 | * this device, if any |
62 | * @users: reference count | ||
57 | */ | 63 | */ |
58 | struct pinctrl { | 64 | struct pinctrl { |
59 | struct list_head node; | 65 | struct list_head node; |
@@ -61,6 +67,7 @@ struct pinctrl { | |||
61 | struct list_head states; | 67 | struct list_head states; |
62 | struct pinctrl_state *state; | 68 | struct pinctrl_state *state; |
63 | struct list_head dt_maps; | 69 | struct list_head dt_maps; |
70 | struct kref users; | ||
64 | }; | 71 | }; |
65 | 72 | ||
66 | /** | 73 | /** |
@@ -148,6 +155,18 @@ struct pin_desc { | |||
148 | #endif | 155 | #endif |
149 | }; | 156 | }; |
150 | 157 | ||
158 | /** | ||
159 | * struct pinctrl_maps - a list item containing part of the mapping table | ||
160 | * @node: mapping table list node | ||
161 | * @maps: array of mapping table entries | ||
162 | * @num_maps: the number of entries in @maps | ||
163 | */ | ||
164 | struct pinctrl_maps { | ||
165 | struct list_head node; | ||
166 | struct pinctrl_map const *maps; | ||
167 | unsigned num_maps; | ||
168 | }; | ||
169 | |||
151 | struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name); | 170 | struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name); |
152 | int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name); | 171 | int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name); |
153 | const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin); | 172 | const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin); |
@@ -164,5 +183,15 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, | |||
164 | bool dup, bool locked); | 183 | bool dup, bool locked); |
165 | void pinctrl_unregister_map(struct pinctrl_map const *map); | 184 | void pinctrl_unregister_map(struct pinctrl_map const *map); |
166 | 185 | ||
186 | extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev); | ||
187 | extern int pinctrl_force_default(struct pinctrl_dev *pctldev); | ||
188 | |||
167 | extern struct mutex pinctrl_mutex; | 189 | extern struct mutex pinctrl_mutex; |
168 | extern struct list_head pinctrldev_list; | 190 | extern struct list_head pinctrldev_list; |
191 | extern struct list_head pinctrl_maps; | ||
192 | |||
193 | #define for_each_maps(_maps_node_, _i_, _map_) \ | ||
194 | list_for_each_entry(_maps_node_, &pinctrl_maps, node) \ | ||
195 | for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \ | ||
196 | _i_ < _maps_node_->num_maps; \ | ||
197 | _i_++, _map_ = &_maps_node_->maps[_i_]) | ||