diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-03-02 15:05:45 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-03-05 05:20:50 -0500 |
commit | 7ecdb16fe63e5b356335ebdc236adfb48cef31e1 (patch) | |
tree | 036d9939c64f98e1f85343f15c12ad83c9a2a890 /drivers/pinctrl/pinmux.h | |
parent | 57b676f9c1b7cd84397fe5a86c9bd2788ac4bd32 (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.h | 41 |
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 | ||
15 | int pinmux_check_ops(struct pinctrl_dev *pctldev); | 15 | int pinmux_check_ops(struct pinctrl_dev *pctldev); |
16 | |||
16 | int pinmux_request_gpio(struct pinctrl_dev *pctldev, | 17 | int 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, | |||
21 | int pinmux_gpio_direction(struct pinctrl_dev *pctldev, | 22 | int 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); |
24 | static inline void pinmux_init_pinctrl_handle(struct pinctrl *p) | 25 | |
25 | { | 26 | int pinmux_map_to_setting(struct pinctrl_map const *map, |
26 | INIT_LIST_HEAD(&p->groups); | 27 | struct pinctrl_setting *setting); |
27 | } | 28 | void pinmux_free_setting(struct pinctrl_setting const *setting); |
28 | int pinmux_apply_muxmap(struct pinctrl_dev *pctldev, | 29 | int pinmux_enable_setting(struct pinctrl_setting const *setting); |
29 | struct pinctrl *p, | 30 | void pinmux_disable_setting(struct pinctrl_setting const *setting); |
30 | struct device *dev, | 31 | |
31 | const char *devname, | 32 | void pinmux_dbg_show(struct seq_file *s, struct pinctrl_setting const *setting); |
32 | struct pinctrl_map const *map); | ||
33 | void pinmux_put(struct pinctrl *p); | ||
34 | int pinmux_enable(struct pinctrl *p); | ||
35 | void pinmux_disable(struct pinctrl *p); | ||
36 | void pinmux_init_device_debugfs(struct dentry *devroot, | 33 | void pinmux_init_device_debugfs(struct dentry *devroot, |
37 | struct pinctrl_dev *pctldev); | 34 | struct pinctrl_dev *pctldev); |
38 | void 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 | ||
67 | static inline void pinmux_init_pinctrl_handle(struct pinctrl *p) | 63 | static inline int pinmux_map_to_setting(struct pinctrl_map const *map, |
68 | { | 64 | struct pinctrl_setting *setting) |
69 | } | ||
70 | |||
71 | static 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 | ||
80 | static inline void pinmux_put(struct pinctrl *p) | 69 | static inline void pinmux_free_setting(struct pinctrl_setting const *setting) |
81 | { | 70 | { |
82 | } | 71 | } |
83 | 72 | ||
84 | static inline int pinmux_enable(struct pinctrl *p) | 73 | static inline int pinmux_enable_setting(struct pinctrl_setting const *setting) |
85 | { | 74 | { |
75 | return 0; | ||
86 | } | 76 | } |
87 | 77 | ||
88 | static inline void pinmux_disable(struct pinctrl *p) | 78 | static inline void pinmux_disable_setting( |
79 | struct pinctrl_setting const *setting) | ||
89 | { | 80 | { |
90 | } | 81 | } |
91 | 82 | ||