diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-05-02 15:28:00 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-05-11 05:14:15 -0400 |
commit | 24cbdd75c4a868bf1ebc986337ffcacf3f8a4109 (patch) | |
tree | 01e4bf0c82ba9a69a1bb46256803e376701aca32 /drivers/pinctrl/pinctrl-nomadik.c | |
parent | 6f4350a6da99652423039765b9d1c57784150d39 (diff) |
pinctrl/nomadik: reuse GPIO debug function for pins
Since all pins we can control are GPIOs, match a GPIO range to
each pin in the debug function and call into the GPIO debug
print function to have the per-pin information.
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-nomadik.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 8ed7917d513d..7543eb243c12 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1326,10 +1326,36 @@ static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, | |||
1326 | return 0; | 1326 | return 0; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | static struct pinctrl_gpio_range * | ||
1330 | nmk_match_gpio_range(struct pinctrl_dev *pctldev, unsigned offset) | ||
1331 | { | ||
1332 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1333 | int i; | ||
1334 | |||
1335 | for (i = 0; i < npct->soc->gpio_num_ranges; i++) { | ||
1336 | struct pinctrl_gpio_range *range; | ||
1337 | |||
1338 | range = &npct->soc->gpio_ranges[i]; | ||
1339 | if (offset >= range->pin_base && | ||
1340 | offset <= (range->pin_base + range->npins - 1)) | ||
1341 | return range; | ||
1342 | } | ||
1343 | return NULL; | ||
1344 | } | ||
1345 | |||
1329 | static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, | 1346 | static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, |
1330 | unsigned offset) | 1347 | unsigned offset) |
1331 | { | 1348 | { |
1332 | seq_printf(s, " Nomadik GPIO"); | 1349 | struct pinctrl_gpio_range *range; |
1350 | struct gpio_chip *chip; | ||
1351 | |||
1352 | range = nmk_match_gpio_range(pctldev, offset); | ||
1353 | if (!range || !range->gc) { | ||
1354 | seq_printf(s, "invalid pin offset"); | ||
1355 | return; | ||
1356 | } | ||
1357 | chip = range->gc; | ||
1358 | nmk_gpio_dbg_show_one(s, chip, offset - chip->base, offset); | ||
1333 | } | 1359 | } |
1334 | 1360 | ||
1335 | static struct pinctrl_ops nmk_pinctrl_ops = { | 1361 | static struct pinctrl_ops nmk_pinctrl_ops = { |