diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2011-10-19 11:07:16 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-01-03 03:09:58 -0500 |
commit | 7afde8baa83b9ac409a6db86f27a41878aa6b33f (patch) | |
tree | f7d1af3bc5e5c03d2d9be10d3ede7de7fc49de53 /drivers/pinctrl/core.c | |
parent | b84e673f51799a2d0bad7a7c1e7a74021c4eba4b (diff) |
pinctrl: move group lookup to core
Now also the core needs to look up pin groups so move the lookup
function there and expose it in the internal header.
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index eadef9e191ea..9970590006d1 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -284,6 +284,37 @@ void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev, | |||
284 | mutex_unlock(&pctldev->gpio_ranges_lock); | 284 | mutex_unlock(&pctldev->gpio_ranges_lock); |
285 | } | 285 | } |
286 | 286 | ||
287 | /** | ||
288 | * pinctrl_get_group_selector() - returns the group selector for a group | ||
289 | * @pctldev: the pin controller handling the group | ||
290 | * @pin_group: the pin group to look up | ||
291 | */ | ||
292 | int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, | ||
293 | const char *pin_group) | ||
294 | { | ||
295 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; | ||
296 | unsigned group_selector = 0; | ||
297 | |||
298 | while (pctlops->list_groups(pctldev, group_selector) >= 0) { | ||
299 | const char *gname = pctlops->get_group_name(pctldev, | ||
300 | group_selector); | ||
301 | if (!strcmp(gname, pin_group)) { | ||
302 | dev_dbg(&pctldev->dev, | ||
303 | "found group selector %u for %s\n", | ||
304 | group_selector, | ||
305 | pin_group); | ||
306 | return group_selector; | ||
307 | } | ||
308 | |||
309 | group_selector++; | ||
310 | } | ||
311 | |||
312 | dev_err(&pctldev->dev, "does not have pin group %s\n", | ||
313 | pin_group); | ||
314 | |||
315 | return -EINVAL; | ||
316 | } | ||
317 | |||
287 | #ifdef CONFIG_DEBUG_FS | 318 | #ifdef CONFIG_DEBUG_FS |
288 | 319 | ||
289 | static int pinctrl_pins_show(struct seq_file *s, void *what) | 320 | static int pinctrl_pins_show(struct seq_file *s, void *what) |