diff options
-rw-r--r-- | Documentation/pinctrl.txt | 6 | ||||
-rw-r--r-- | arch/arm/mach-u300/core.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-coh901.c | 2 | ||||
-rw-r--r-- | include/linux/pinctrl/consumer.h | 118 | ||||
-rw-r--r-- | include/linux/pinctrl/pinconf.h | 39 | ||||
-rw-r--r-- | include/linux/pinctrl/pinmux.h | 52 |
6 files changed, 125 insertions, 94 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt index 14aecd2b2dbc..b268832c49d2 100644 --- a/Documentation/pinctrl.txt +++ b/Documentation/pinctrl.txt | |||
@@ -208,6 +208,8 @@ unconnected. | |||
208 | 208 | ||
209 | For example, a platform may do this: | 209 | For example, a platform may do this: |
210 | 210 | ||
211 | #include <linux/pinctrl/consumer.h> | ||
212 | |||
211 | ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); | 213 | ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); |
212 | 214 | ||
213 | To pull up a pin to VDD. The pin configuration driver implements callbacks for | 215 | To pull up a pin to VDD. The pin configuration driver implements callbacks for |
@@ -920,7 +922,7 @@ this is not possible. | |||
920 | A driver may request a certain mux to be activated, usually just the default | 922 | A driver may request a certain mux to be activated, usually just the default |
921 | mux like this: | 923 | mux like this: |
922 | 924 | ||
923 | #include <linux/pinctrl/pinmux.h> | 925 | #include <linux/pinctrl/consumer.h> |
924 | 926 | ||
925 | struct foo_state { | 927 | struct foo_state { |
926 | struct pinmux *pmx; | 928 | struct pinmux *pmx; |
@@ -1019,6 +1021,8 @@ function, but with different named in the mapping as described under | |||
1019 | This snippet first muxes the function in the pins defined by group A, enables | 1021 | This snippet first muxes the function in the pins defined by group A, enables |
1020 | it, disables and releases it, and muxes it in on the pins defined by group B: | 1022 | it, disables and releases it, and muxes it in on the pins defined by group B: |
1021 | 1023 | ||
1024 | #include <linux/pinctrl/consumer.h> | ||
1025 | |||
1022 | foo_switch() | 1026 | foo_switch() |
1023 | { | 1027 | { |
1024 | struct pinmux *pmx; | 1028 | struct pinmux *pmx; |
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index b4c6926a700c..1429e5282198 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/mtd/nand.h> | 26 | #include <linux/mtd/nand.h> |
27 | #include <linux/mtd/fsmc.h> | 27 | #include <linux/mtd/fsmc.h> |
28 | #include <linux/pinctrl/machine.h> | 28 | #include <linux/pinctrl/machine.h> |
29 | #include <linux/pinctrl/pinmux.h> | 29 | #include <linux/pinctrl/consumer.h> |
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | 31 | ||
32 | #include <asm/types.h> | 32 | #include <asm/types.h> |
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index 69fb7072a23e..8bac3f093d58 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/pinctrl/pinmux.h> | 25 | #include <linux/pinctrl/consumer.h> |
26 | #include <mach/gpio-u300.h> | 26 | #include <mach/gpio-u300.h> |
27 | 27 | ||
28 | /* | 28 | /* |
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h new file mode 100644 index 000000000000..9c8513d5d0fb --- /dev/null +++ b/include/linux/pinctrl/consumer.h | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * Consumer interface the pin control subsystem | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Written on behalf of Linaro for ST-Ericsson | ||
6 | * Based on bits of regulator core, gpio core and clk core | ||
7 | * | ||
8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
9 | * | ||
10 | * License terms: GNU General Public License (GPL) version 2 | ||
11 | */ | ||
12 | #ifndef __LINUX_PINCTRL_CONSUMER_H | ||
13 | #define __LINUX_PINCTRL_CONSUMER_H | ||
14 | |||
15 | #include <linux/list.h> | ||
16 | #include <linux/seq_file.h> | ||
17 | #include "pinctrl.h" | ||
18 | |||
19 | /* This struct is private to the core and should be regarded as a cookie */ | ||
20 | struct pinmux; | ||
21 | |||
22 | #ifdef CONFIG_PINMUX | ||
23 | |||
24 | /* External interface to pinmux */ | ||
25 | extern int pinmux_request_gpio(unsigned gpio); | ||
26 | extern void pinmux_free_gpio(unsigned gpio); | ||
27 | extern int pinmux_gpio_direction_input(unsigned gpio); | ||
28 | extern int pinmux_gpio_direction_output(unsigned gpio); | ||
29 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); | ||
30 | extern void pinmux_put(struct pinmux *pmx); | ||
31 | extern int pinmux_enable(struct pinmux *pmx); | ||
32 | extern void pinmux_disable(struct pinmux *pmx); | ||
33 | |||
34 | #else /* !CONFIG_PINMUX */ | ||
35 | |||
36 | static inline int pinmux_request_gpio(unsigned gpio) | ||
37 | { | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static inline void pinmux_free_gpio(unsigned gpio) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | static inline int pinmux_gpio_direction_input(unsigned gpio) | ||
46 | { | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static inline int pinmux_gpio_direction_output(unsigned gpio) | ||
51 | { | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) | ||
56 | { | ||
57 | return NULL; | ||
58 | } | ||
59 | |||
60 | static inline void pinmux_put(struct pinmux *pmx) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | static inline int pinmux_enable(struct pinmux *pmx) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static inline void pinmux_disable(struct pinmux *pmx) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | #endif /* CONFIG_PINMUX */ | ||
74 | |||
75 | #ifdef CONFIG_PINCONF | ||
76 | |||
77 | extern int pin_config_get(const char *dev_name, const char *name, | ||
78 | unsigned long *config); | ||
79 | extern int pin_config_set(const char *dev_name, const char *name, | ||
80 | unsigned long config); | ||
81 | extern int pin_config_group_get(const char *dev_name, | ||
82 | const char *pin_group, | ||
83 | unsigned long *config); | ||
84 | extern int pin_config_group_set(const char *dev_name, | ||
85 | const char *pin_group, | ||
86 | unsigned long config); | ||
87 | |||
88 | #else | ||
89 | |||
90 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
91 | unsigned long *config) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
97 | unsigned long config) | ||
98 | { | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static inline int pin_config_group_get(const char *dev_name, | ||
103 | const char *pin_group, | ||
104 | unsigned long *config) | ||
105 | { | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static inline int pin_config_group_set(const char *dev_name, | ||
110 | const char *pin_group, | ||
111 | unsigned long config) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | #endif | ||
117 | |||
118 | #endif /* __LINUX_PINCTRL_CONSUMER_H */ | ||
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index 477922cf043a..f8cf156873d7 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h | |||
@@ -53,45 +53,6 @@ struct pinconf_ops { | |||
53 | unsigned selector); | 53 | unsigned selector); |
54 | }; | 54 | }; |
55 | 55 | ||
56 | extern int pin_config_get(const char *dev_name, const char *name, | ||
57 | unsigned long *config); | ||
58 | extern int pin_config_set(const char *dev_name, const char *name, | ||
59 | unsigned long config); | ||
60 | extern int pin_config_group_get(const char *dev_name, | ||
61 | const char *pin_group, | ||
62 | unsigned long *config); | ||
63 | extern int pin_config_group_set(const char *dev_name, | ||
64 | const char *pin_group, | ||
65 | unsigned long config); | ||
66 | |||
67 | #else | ||
68 | |||
69 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
70 | unsigned long *config) | ||
71 | { | ||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
76 | unsigned long config) | ||
77 | { | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static inline int pin_config_group_get(const char *dev_name, | ||
82 | const char *pin_group, | ||
83 | unsigned long *config) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static inline int pin_config_group_set(const char *dev_name, | ||
89 | const char *pin_group, | ||
90 | unsigned long config) | ||
91 | { | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | #endif | 56 | #endif |
96 | 57 | ||
97 | #endif /* __LINUX_PINCTRL_PINCONF_H */ | 58 | #endif /* __LINUX_PINCTRL_PINCONF_H */ |
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index 937b3e2fa36f..47e9237edd47 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
@@ -16,9 +16,6 @@ | |||
16 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
17 | #include "pinctrl.h" | 17 | #include "pinctrl.h" |
18 | 18 | ||
19 | /* This struct is private to the core and should be regarded as a cookie */ | ||
20 | struct pinmux; | ||
21 | |||
22 | #ifdef CONFIG_PINMUX | 19 | #ifdef CONFIG_PINMUX |
23 | 20 | ||
24 | struct pinctrl_dev; | 21 | struct pinctrl_dev; |
@@ -88,55 +85,6 @@ struct pinmux_ops { | |||
88 | bool input); | 85 | bool input); |
89 | }; | 86 | }; |
90 | 87 | ||
91 | /* External interface to pinmux */ | ||
92 | extern int pinmux_request_gpio(unsigned gpio); | ||
93 | extern void pinmux_free_gpio(unsigned gpio); | ||
94 | extern int pinmux_gpio_direction_input(unsigned gpio); | ||
95 | extern int pinmux_gpio_direction_output(unsigned gpio); | ||
96 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); | ||
97 | extern void pinmux_put(struct pinmux *pmx); | ||
98 | extern int pinmux_enable(struct pinmux *pmx); | ||
99 | extern void pinmux_disable(struct pinmux *pmx); | ||
100 | |||
101 | #else /* !CONFIG_PINMUX */ | ||
102 | |||
103 | static inline int pinmux_request_gpio(unsigned gpio) | ||
104 | { | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static inline void pinmux_free_gpio(unsigned gpio) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | static inline int pinmux_gpio_direction_input(unsigned gpio) | ||
113 | { | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static inline int pinmux_gpio_direction_output(unsigned gpio) | ||
118 | { | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) | ||
123 | { | ||
124 | return NULL; | ||
125 | } | ||
126 | |||
127 | static inline void pinmux_put(struct pinmux *pmx) | ||
128 | { | ||
129 | } | ||
130 | |||
131 | static inline int pinmux_enable(struct pinmux *pmx) | ||
132 | { | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static inline void pinmux_disable(struct pinmux *pmx) | ||
137 | { | ||
138 | } | ||
139 | |||
140 | #endif /* CONFIG_PINMUX */ | 88 | #endif /* CONFIG_PINMUX */ |
141 | 89 | ||
142 | #endif /* __LINUX_PINCTRL_PINMUX_H */ | 90 | #endif /* __LINUX_PINCTRL_PINMUX_H */ |