diff options
author | Antoine Ténart <antoine.tenart@free-electrons.com> | 2014-04-10 09:07:50 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-04-22 08:47:02 -0400 |
commit | e5b3b2d9ed202697a937c282f9c4d93b1e3e0848 (patch) | |
tree | 787cdc0ff48a468a7a1f466c4bf60019eb99a30e /drivers/pinctrl/pinmux.c | |
parent | eb171a997de8b746f4d52b23108d64e9f88f0a09 (diff) |
pinctrl: allows not to define the get_group_pins operation
When using a group only pinctrl driver, which does not have any
information on the pins it is useless to define a get_group_pins
always returning an empty list of pins.
When not using get_group_pin[1], a driver must implement it so
pins = NULL and num_pins = 0. This patch makes it the default
behaviour if not defined in the pinctrl driver when used in
pinmux enable and disable funtions and in pinctrl_groups_show.
It also adds a check in pinctrl_get_group_pins and return -EINVAL if
not defined. This function is called in the gpiolib when adding when
pingroup range. It cannot be used if no group is defined, so this seams
reasonable.
[1] get_group_pin(struct pinctrl_dev *pctldev,
unsigned selector,
const unsigned **pins,
unsigned *num_pins);
Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.c')
-rw-r--r-- | drivers/pinctrl/pinmux.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 9248ce4efed4..051e8592990e 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c | |||
@@ -391,14 +391,16 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting) | |||
391 | struct pinctrl_dev *pctldev = setting->pctldev; | 391 | struct pinctrl_dev *pctldev = setting->pctldev; |
392 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; | 392 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; |
393 | const struct pinmux_ops *ops = pctldev->desc->pmxops; | 393 | const struct pinmux_ops *ops = pctldev->desc->pmxops; |
394 | int ret; | 394 | int ret = 0; |
395 | const unsigned *pins; | 395 | const unsigned *pins = NULL; |
396 | unsigned num_pins; | 396 | unsigned num_pins = 0; |
397 | int i; | 397 | int i; |
398 | struct pin_desc *desc; | 398 | struct pin_desc *desc; |
399 | 399 | ||
400 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, | 400 | if (pctlops->get_group_pins) |
401 | &pins, &num_pins); | 401 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, |
402 | &pins, &num_pins); | ||
403 | |||
402 | if (ret) { | 404 | if (ret) { |
403 | const char *gname; | 405 | const char *gname; |
404 | 406 | ||
@@ -470,14 +472,15 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) | |||
470 | struct pinctrl_dev *pctldev = setting->pctldev; | 472 | struct pinctrl_dev *pctldev = setting->pctldev; |
471 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; | 473 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; |
472 | const struct pinmux_ops *ops = pctldev->desc->pmxops; | 474 | const struct pinmux_ops *ops = pctldev->desc->pmxops; |
473 | int ret; | 475 | int ret = 0; |
474 | const unsigned *pins; | 476 | const unsigned *pins = NULL; |
475 | unsigned num_pins; | 477 | unsigned num_pins = 0; |
476 | int i; | 478 | int i; |
477 | struct pin_desc *desc; | 479 | struct pin_desc *desc; |
478 | 480 | ||
479 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, | 481 | if (pctlops->get_group_pins) |
480 | &pins, &num_pins); | 482 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, |
483 | &pins, &num_pins); | ||
481 | if (ret) { | 484 | if (ret) { |
482 | const char *gname; | 485 | const char *gname; |
483 | 486 | ||