Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
core.h
Go to the documentation of this file.
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 <[email protected]>
8  *
9  * License terms: GNU General Public License (GPL) version 2
10  */
11 
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 
35 struct pinctrl_dev {
36  struct list_head node;
37  struct pinctrl_desc *desc;
40  struct device *dev;
41  struct module *owner;
42  void *driver_data;
43  struct pinctrl *p;
44 #ifdef CONFIG_DEBUG_FS
45  struct dentry *device_root;
46 #endif
47 };
48 
58 struct pinctrl {
59  struct list_head node;
60  struct device *dev;
61  struct list_head states;
64 };
65 
72 struct pinctrl_state {
73  struct list_head node;
74  const char *name;
76 };
77 
84  unsigned group;
85  unsigned func;
86 };
87 
97  unsigned group_or_pin;
98  unsigned long *configs;
99  unsigned num_configs;
100 };
101 
111  struct list_head node;
114  union {
117  } data;
118 };
119 
136 struct pin_desc {
138  const char *name;
140  /* These fields only added when supporting pinmux drivers */
141 #ifdef CONFIG_PINMUX
142  unsigned mux_usecount;
143  const char *mux_owner;
144  const struct pinctrl_setting_mux *mux_setting;
145  const char *gpio_owner;
146 #endif
147 };
148 
149 struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
150 int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
151 const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
152 int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
153  const char *pin_group);
154 
155 static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,
156  unsigned int pin)
157 {
158  return radix_tree_lookup(&pctldev->pin_desc_tree, pin);
159 }
160 
161 int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps,
162  bool dup, bool locked);
163 void pinctrl_unregister_map(struct pinctrl_map const *map);
164 
165 extern struct mutex pinctrl_mutex;
166 extern struct list_head pinctrldev_list;