aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinmux.h
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-03-02 15:05:45 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-03-05 05:20:50 -0500
commit7ecdb16fe63e5b356335ebdc236adfb48cef31e1 (patch)
tree036d9939c64f98e1f85343f15c12ad83c9a2a890 /drivers/pinctrl/pinmux.h
parent57b676f9c1b7cd84397fe5a86c9bd2788ac4bd32 (diff)
pinctrl: refactor struct pinctrl handling in core.c vs pinmux.c
This change separates two aspects of struct pinctrl: a) The data representation of the parsed mapping table, into: 1) The top-level struct pinctrl object, a single entity returned by pinctrl_get(). 2) The parsed version of each mapping table entry, struct pinctrl_setting, of which there is one per mapping table entry. b) The code that handles this; the code for (1) above is in core.c, and the code to parse/execute each entry in (2) above is in pinmux.c, while the iteration over multiple settings is lifted to core.c. This will allow the following future changes: 1) pinctrl_get() API rework, so that struct pinctrl represents all states for the device, and the device can select between them without calling put()/get() again. 2) To support that, a struct pinctrl_state object will be inserted into the data model between the struct pinctrl and struct pinctrl_setting. 3) The mapping table will be extended to allow specification of pin config settings too. To support this, struct pinctrl_setting will be enhanced to store either mux settings or config settings, and functions will be added to pinconf.c to parse/execute pin configuration settings. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.h')
-rw-r--r--drivers/pinctrl/pinmux.h41
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h
index 822febb2d968..1500ae88f87c 100644
--- a/drivers/pinctrl/pinmux.h
+++ b/drivers/pinctrl/pinmux.h
@@ -13,6 +13,7 @@
13#ifdef CONFIG_PINMUX 13#ifdef CONFIG_PINMUX
14 14
15int pinmux_check_ops(struct pinctrl_dev *pctldev); 15int pinmux_check_ops(struct pinctrl_dev *pctldev);
16
16int pinmux_request_gpio(struct pinctrl_dev *pctldev, 17int pinmux_request_gpio(struct pinctrl_dev *pctldev,
17 struct pinctrl_gpio_range *range, 18 struct pinctrl_gpio_range *range,
18 unsigned pin, unsigned gpio); 19 unsigned pin, unsigned gpio);
@@ -21,21 +22,16 @@ void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
21int pinmux_gpio_direction(struct pinctrl_dev *pctldev, 22int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
22 struct pinctrl_gpio_range *range, 23 struct pinctrl_gpio_range *range,
23 unsigned pin, bool input); 24 unsigned pin, bool input);
24static inline void pinmux_init_pinctrl_handle(struct pinctrl *p) 25
25{ 26int pinmux_map_to_setting(struct pinctrl_map const *map,
26 INIT_LIST_HEAD(&p->groups); 27 struct pinctrl_setting *setting);
27} 28void pinmux_free_setting(struct pinctrl_setting const *setting);
28int pinmux_apply_muxmap(struct pinctrl_dev *pctldev, 29int pinmux_enable_setting(struct pinctrl_setting const *setting);
29 struct pinctrl *p, 30void pinmux_disable_setting(struct pinctrl_setting const *setting);
30 struct device *dev, 31
31 const char *devname, 32void pinmux_dbg_show(struct seq_file *s, struct pinctrl_setting const *setting);
32 struct pinctrl_map const *map);
33void pinmux_put(struct pinctrl *p);
34int pinmux_enable(struct pinctrl *p);
35void pinmux_disable(struct pinctrl *p);
36void pinmux_init_device_debugfs(struct dentry *devroot, 33void pinmux_init_device_debugfs(struct dentry *devroot,
37 struct pinctrl_dev *pctldev); 34 struct pinctrl_dev *pctldev);
38void pinmux_dbg_show(struct seq_file *s, struct pinctrl *p);
39 35
40#else 36#else
41 37
@@ -64,28 +60,23 @@ static inline int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
64 return 0; 60 return 0;
65} 61}
66 62
67static inline void pinmux_init_pinctrl_handle(struct pinctrl *p) 63static inline int pinmux_map_to_setting(struct pinctrl_map const *map,
68{ 64 struct pinctrl_setting *setting)
69}
70
71static inline int pinmux_apply_muxmap(struct pinctrl_dev *pctldev,
72 struct pinctrl *p,
73 struct device *dev,
74 const char *devname,
75 struct pinctrl_map const *map)
76{ 65{
77 return 0; 66 return 0;
78} 67}
79 68
80static inline void pinmux_put(struct pinctrl *p) 69static inline void pinmux_free_setting(struct pinctrl_setting const *setting)
81{ 70{
82} 71}
83 72
84static inline int pinmux_enable(struct pinctrl *p) 73static inline int pinmux_enable_setting(struct pinctrl_setting const *setting)
85{ 74{
75 return 0;
86} 76}
87 77
88static inline void pinmux_disable(struct pinctrl *p) 78static inline void pinmux_disable_setting(
79 struct pinctrl_setting const *setting)
89{ 80{
90} 81}
91 82