]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/pinctrl/core.h
pinctrl: restore pin naming
[mirror_ubuntu-bionic-kernel.git] / drivers / pinctrl / core.h
CommitLineData
2744e8af
LW
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
ae6b4d85
LW
12#include <linux/pinctrl/pinconf.h>
13
14struct pinctrl_gpio_range;
15
2744e8af
LW
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 * @pin_desc_tree_lock: lock for the descriptor tree
24 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
25 * ranges are added to this list at runtime
26 * @gpio_ranges_lock: lock for the GPIO ranges list
27 * @dev: the device entry for this pin controller
28 * @owner: module providing the pin controller, used for refcounting
29 * @driver_data: driver data for drivers registering to the pin controller
30 * subsystem
31 * @pinmux_hogs_lock: lock for the pinmux hog list
32 * @pinmux_hogs: list of pinmux maps hogged by this device
33 */
34struct pinctrl_dev {
35 struct list_head node;
36 struct pinctrl_desc *desc;
37 struct radix_tree_root pin_desc_tree;
38 spinlock_t pin_desc_tree_lock;
39 struct list_head gpio_ranges;
40 struct mutex gpio_ranges_lock;
51cd24ee 41 struct device *dev;
2744e8af
LW
42 struct module *owner;
43 void *driver_data;
02157160
TL
44#ifdef CONFIG_DEBUG_FS
45 struct dentry *device_root;
46#endif
2744e8af
LW
47#ifdef CONFIG_PINMUX
48 struct mutex pinmux_hogs_lock;
49 struct list_head pinmux_hogs;
50#endif
51};
52
53/**
54 * struct pin_desc - pin descriptor for each physical pin in the arch
55 * @pctldev: corresponding pin control device
56 * @name: a name for the pin, e.g. the name of the pin/pad/finger on a
57 * datasheet or such
ca53c5f1 58 * @dynamic_name: if the name of this pin was dynamically allocated
2744e8af
LW
59 * @lock: a lock to protect the descriptor structure
60 * @mux_requested: whether the pin is already requested by pinmux or not
61 * @mux_function: a named muxing function for the pin that will be passed to
62 * subdrivers and shown in debugfs etc
63 */
64struct pin_desc {
65 struct pinctrl_dev *pctldev;
9af1e44f 66 const char *name;
ca53c5f1 67 bool dynamic_name;
2744e8af
LW
68 spinlock_t lock;
69 /* These fields only added when supporting pinmux drivers */
70#ifdef CONFIG_PINMUX
5d2eaf80 71 const char *mux_function;
2744e8af
LW
72#endif
73};
74
75struct pinctrl_dev *get_pinctrl_dev_from_dev(struct device *dev,
76 const char *dev_name);
33d58949 77struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, unsigned int pin);
ae6b4d85 78int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
2744e8af
LW
79int pinctrl_get_device_gpio_range(unsigned gpio,
80 struct pinctrl_dev **outdev,
81 struct pinctrl_gpio_range **outrange);
7afde8ba
LW
82int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
83 const char *pin_group);