From befe5bdfbb698b3bc57c58d0bd7ca3391c9275ed Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 9 Feb 2012 19:47:48 +0100 Subject: pinctrl: factor pin control handles over to the core This moves the per-devices struct pinctrl handles and device map over from the pinmux part of the subsystem to the core pinctrl part. This makes the device handles core infrastructure with the goal of using these handles also for pin configuration, so that device drivers (or boards etc) will need one and only one handle to the pin control core. Acked-by: Stephen Warren Signed-off-by: Linus Walleij --- drivers/pinctrl/core.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'drivers/pinctrl/core.h') diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 7a89888fce94..a50cdb053c84 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h @@ -30,6 +30,7 @@ struct pinctrl_gpio_range; * subsystem * @pinctrl_hogs_lock: lock for the pin control hog list * @pinctrl_hogs: list of pin control maps hogged by this device + * @device_root: debugfs root for this device */ struct pinctrl_dev { struct list_head node; @@ -41,12 +42,37 @@ struct pinctrl_dev { struct device *dev; struct module *owner; void *driver_data; + struct mutex pinctrl_hogs_lock; + struct list_head pinctrl_hogs; #ifdef CONFIG_DEBUG_FS struct dentry *device_root; #endif +}; + +/** + * struct pinctrl - per-device pin control state holder + * @node: global list node + * @dev: the device using this pin control handle + * @usecount: the number of active users of this pin controller setting, used + * to keep track of nested use cases + * @pctldev: pin control device handling this pin control handle + * @mutex: a lock for the pin control state holder + * @func_selector: the function selector for the pinmux device handling + * this pinmux + * @groups: the group selectors for the pinmux device and + * selector combination handling this pinmux, this is a list that + * will be traversed on all pinmux operations such as + * get/put/enable/disable + */ +struct pinctrl { + struct list_head node; + struct device *dev; + unsigned usecount; + struct pinctrl_dev *pctldev; + struct mutex mutex; #ifdef CONFIG_PINMUX - struct mutex pinctrl_hogs_lock; - struct list_head pinctrl_hogs; + unsigned func_selector; + struct list_head groups; #endif }; -- cgit v1.2.3-58-ga151