aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-06-24 09:06:19 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-06-25 06:54:56 -0400
commitad42fc6c84795d19972e7f7dee70fe74bec4c2d8 (patch)
treebfd0a8572743dd556015a8650de3d1706d45bf84 /drivers/pinctrl
parentb58f0273f0858214da2ee4e1675221e56f7712ec (diff)
pinctrl: rip out the direct pinconf API
From the inception ot the pin config API there has been the possibility to get a handle at a pin directly and configure its electrical characteristics. For this reason we had: int pin_config_get(const char *dev_name, const char *name, unsigned long *config); int pin_config_set(const char *dev_name, const char *name, unsigned long config); int pin_config_group_get(const char *dev_name, const char *pin_group, unsigned long *config); int pin_config_group_set(const char *dev_name, const char *pin_group, unsigned long config); After the introduction of the pin control states that will control pins associated with devices, and its subsequent introduction to the device core, as well as the introduction of pin control hogs that can set up states on boot and optionally also at sleep, this direct pin control API is a thing of the past. As could be expected, it has zero in-kernel users. Let's delete this API and make our world simpler. Reported-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinconf.c174
1 files changed, 0 insertions, 174 deletions
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index 694c3ace4520..e875f21a5908 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -75,98 +75,6 @@ int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
75 return ops->pin_config_get(pctldev, pin, config); 75 return ops->pin_config_get(pctldev, pin, config);
76} 76}
77 77
78/**
79 * pin_config_get() - get the configuration of a single pin parameter
80 * @dev_name: name of the pin controller device for this pin
81 * @name: name of the pin to get the config for
82 * @config: the config pointed to by this argument will be filled in with the
83 * current pin state, it can be used directly by drivers as a numeral, or
84 * it can be dereferenced to any struct.
85 */
86int pin_config_get(const char *dev_name, const char *name,
87 unsigned long *config)
88{
89 struct pinctrl_dev *pctldev;
90 int pin;
91
92 pctldev = get_pinctrl_dev_from_devname(dev_name);
93 if (!pctldev) {
94 pin = -EINVAL;
95 return pin;
96 }
97
98 mutex_lock(&pctldev->mutex);
99
100 pin = pin_get_from_name(pctldev, name);
101 if (pin < 0)
102 goto unlock;
103
104 pin = pin_config_get_for_pin(pctldev, pin, config);
105
106unlock:
107 mutex_unlock(&pctldev->mutex);
108 return pin;
109}
110EXPORT_SYMBOL(pin_config_get);
111
112static int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
113 unsigned long config)
114{
115 const struct pinconf_ops *ops = pctldev->desc->confops;
116 int ret;
117
118 if (!ops || !ops->pin_config_set) {
119 dev_err(pctldev->dev, "cannot configure pin, missing "
120 "config function in driver\n");
121 return -EINVAL;
122 }
123
124 ret = ops->pin_config_set(pctldev, pin, config);
125 if (ret) {
126 dev_err(pctldev->dev,
127 "unable to set pin configuration on pin %d\n", pin);
128 return ret;
129 }
130
131 return 0;
132}
133
134/**
135 * pin_config_set() - set the configuration of a single pin parameter
136 * @dev_name: name of pin controller device for this pin
137 * @name: name of the pin to set the config for
138 * @config: the config in this argument will contain the desired pin state, it
139 * can be used directly by drivers as a numeral, or it can be dereferenced
140 * to any struct.
141 */
142int pin_config_set(const char *dev_name, const char *name,
143 unsigned long config)
144{
145 struct pinctrl_dev *pctldev;
146 int pin, ret;
147
148 pctldev = get_pinctrl_dev_from_devname(dev_name);
149 if (!pctldev) {
150 ret = -EINVAL;
151 return ret;
152 }
153
154 mutex_lock(&pctldev->mutex);
155
156 pin = pin_get_from_name(pctldev, name);
157 if (pin < 0) {
158 ret = pin;
159 goto unlock;
160 }
161
162 ret = pin_config_set_for_pin(pctldev, pin, config);
163
164unlock:
165 mutex_unlock(&pctldev->mutex);
166 return ret;
167}
168EXPORT_SYMBOL(pin_config_set);
169
170int pin_config_group_get(const char *dev_name, const char *pin_group, 78int pin_config_group_get(const char *dev_name, const char *pin_group,
171 unsigned long *config) 79 unsigned long *config)
172{ 80{
@@ -204,88 +112,6 @@ unlock:
204 mutex_unlock(&pctldev->mutex); 112 mutex_unlock(&pctldev->mutex);
205 return ret; 113 return ret;
206} 114}
207EXPORT_SYMBOL(pin_config_group_get);
208
209int pin_config_group_set(const char *dev_name, const char *pin_group,
210 unsigned long config)
211{
212 struct pinctrl_dev *pctldev;
213 const struct pinconf_ops *ops;
214 const struct pinctrl_ops *pctlops;
215 int selector;
216 const unsigned *pins;
217 unsigned num_pins;
218 int ret;
219 int i;
220
221 pctldev = get_pinctrl_dev_from_devname(dev_name);
222 if (!pctldev) {
223 ret = -EINVAL;
224 return ret;
225 }
226
227 mutex_lock(&pctldev->mutex);
228
229 ops = pctldev->desc->confops;
230 pctlops = pctldev->desc->pctlops;
231
232 if (!ops || (!ops->pin_config_group_set && !ops->pin_config_set)) {
233 dev_err(pctldev->dev, "cannot configure pin group, missing "
234 "config function in driver\n");
235 ret = -EINVAL;
236 goto unlock;
237 }
238
239 selector = pinctrl_get_group_selector(pctldev, pin_group);
240 if (selector < 0) {
241 ret = selector;
242 goto unlock;
243 }
244
245 ret = pctlops->get_group_pins(pctldev, selector, &pins, &num_pins);
246 if (ret) {
247 dev_err(pctldev->dev, "cannot configure pin group, error "
248 "getting pins\n");
249 goto unlock;
250 }
251
252 /*
253 * If the pin controller supports handling entire groups we use that
254 * capability.
255 */
256 if (ops->pin_config_group_set) {
257 ret = ops->pin_config_group_set(pctldev, selector, config);
258 /*
259 * If the pin controller prefer that a certain group be handled
260 * pin-by-pin as well, it returns -EAGAIN.
261 */
262 if (ret != -EAGAIN)
263 goto unlock;
264 }
265
266 /*
267 * If the controller cannot handle entire groups, we configure each pin
268 * individually.
269 */
270 if (!ops->pin_config_set) {
271 ret = 0;
272 goto unlock;
273 }
274
275 for (i = 0; i < num_pins; i++) {
276 ret = ops->pin_config_set(pctldev, pins[i], config);
277 if (ret < 0)
278 goto unlock;
279 }
280
281 ret = 0;
282
283unlock:
284 mutex_unlock(&pctldev->mutex);
285
286 return ret;
287}
288EXPORT_SYMBOL(pin_config_group_set);
289 115
290int pinconf_map_to_setting(struct pinctrl_map const *map, 116int pinconf_map_to_setting(struct pinctrl_map const *map,
291 struct pinctrl_setting *setting) 117 struct pinctrl_setting *setting)