pinctrl: fix the pin descriptor kerneldoc
[firefly-linux-kernel-4.4.55.git] / drivers / pinctrl / core.h
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  *
9  * License terms: GNU General Public License (GPL) version 2
10  */
11
12 #include <linux/pinctrl/pinconf.h>
13
14 struct pinctrl_gpio_range;
15
16 /**
17  * struct pinctrl_dev - pin control class device
18  * @node: node to include this pin controller in the global pin controller list
19  * @desc: the pin controller descriptor supplied when initializing this pin
20  *      controller
21  * @pin_desc_tree: each pin descriptor for this pin controller is stored in
22  *      this radix tree
23  * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
24  *      ranges are added to this list at runtime
25  * @gpio_ranges_lock: lock for the GPIO ranges list
26  * @dev: the device entry for this pin controller
27  * @owner: module providing the pin controller, used for refcounting
28  * @driver_data: driver data for drivers registering to the pin controller
29  *      subsystem
30  * @p: result of pinctrl_get() for this device
31  * @device_root: debugfs root for this device
32  */
33 struct pinctrl_dev {
34         struct list_head node;
35         struct pinctrl_desc *desc;
36         struct radix_tree_root pin_desc_tree;
37         struct list_head gpio_ranges;
38         struct mutex gpio_ranges_lock;
39         struct device *dev;
40         struct module *owner;
41         void *driver_data;
42         struct pinctrl *p;
43 #ifdef CONFIG_DEBUG_FS
44         struct dentry *device_root;
45 #endif
46 };
47
48 /**
49  * struct pinctrl - per-device pin control state holder
50  * @node: global list node
51  * @dev: the device using this pin control handle
52  * @usecount: the number of active users of this pin controller setting, used
53  *      to keep track of nested use cases
54  * @pctldev: pin control device handling this pin control handle
55  * @mutex: a lock for the pin control state holder
56  * @groups: the group selectors for the pinmux device and
57  *      selector combination handling this pinmux, this is a list that
58  *      will be traversed on all pinmux operations such as
59  *      get/put/enable/disable
60  */
61 struct pinctrl {
62         struct list_head node;
63         struct device *dev;
64         unsigned usecount;
65         struct pinctrl_dev *pctldev;
66         struct mutex mutex;
67 #ifdef CONFIG_PINMUX
68         struct list_head groups;
69 #endif
70 };
71
72 /**
73  * struct pin_desc - pin descriptor for each physical pin in the arch
74  * @pctldev: corresponding pin control device
75  * @name: a name for the pin, e.g. the name of the pin/pad/finger on a
76  *      datasheet or such
77  * @dynamic_name: if the name of this pin was dynamically allocated
78  * @lock: a lock to protect the descriptor structure
79  * @owner: the device holding this pin or NULL of no device has claimed it
80  */
81 struct pin_desc {
82         struct pinctrl_dev *pctldev;
83         const char *name;
84         bool dynamic_name;
85         spinlock_t lock;
86         /* These fields only added when supporting pinmux drivers */
87 #ifdef CONFIG_PINMUX
88         const char *owner;
89 #endif
90 };
91
92 struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
93 int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
94 int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
95                                const char *pin_group);
96
97 static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,
98                                             unsigned int pin)
99 {
100         return radix_tree_lookup(&pctldev->pin_desc_tree, pin);
101 }