diff options
author | Sherman Yin <syin@broadcom.com> | 2013-08-27 14:32:12 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-08-28 07:34:41 -0400 |
commit | 03b054e9696c3cbd3d5905ec96da15acd0a2fe8d (patch) | |
tree | 7123b780c194d350b3e5134c267e17262effb385 /drivers/pinctrl/pinctrl-u300.c | |
parent | f5ba9c52bf1e236c4698c240955e5f119db62a28 (diff) |
pinctrl: Pass all configs to driver on pin_config_set()
When setting pin configuration in the pinctrl framework, pin_config_set() or
pin_config_group_set() is called in a loop to set one configuration at a time
for the specified pin or group.
This patch 1) removes the loop and 2) changes the API to pass the whole pin
config array to the driver. It is now up to the driver to loop through the
configs. This allows the driver to potentially combine configs and reduce the
number of writes to pin config registers.
All c files changed have been build-tested to verify the change compiles and
that the corresponding .o is successfully generated.
Signed-off-by: Sherman Yin <syin@broadcom.com>
Reviewed-by: Christian Daudt <csd@broadcom.com>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-u300.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-u300.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c index 6fbdc06d2998..209a01b8bd3b 100644 --- a/drivers/pinctrl/pinctrl-u300.c +++ b/drivers/pinctrl/pinctrl-u300.c | |||
@@ -1027,21 +1027,23 @@ static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin, | |||
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, | 1029 | static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, |
1030 | unsigned long config) | 1030 | unsigned long *configs, unsigned num_configs) |
1031 | { | 1031 | { |
1032 | struct pinctrl_gpio_range *range = | 1032 | struct pinctrl_gpio_range *range = |
1033 | pinctrl_find_gpio_range_from_pin(pctldev, pin); | 1033 | pinctrl_find_gpio_range_from_pin(pctldev, pin); |
1034 | int ret; | 1034 | int ret, i; |
1035 | 1035 | ||
1036 | if (!range) | 1036 | if (!range) |
1037 | return -EINVAL; | 1037 | return -EINVAL; |
1038 | 1038 | ||
1039 | /* Note: none of these configurations take any argument */ | 1039 | for (i = 0; i < num_configs; i++) { |
1040 | ret = u300_gpio_config_set(range->gc, | 1040 | /* Note: none of these configurations take any argument */ |
1041 | (pin - range->pin_base + range->base), | 1041 | ret = u300_gpio_config_set(range->gc, |
1042 | pinconf_to_config_param(config)); | 1042 | (pin - range->pin_base + range->base), |
1043 | if (ret) | 1043 | pinconf_to_config_param(configs[i])); |
1044 | return ret; | 1044 | if (ret) |
1045 | return ret; | ||
1046 | } /* for each config */ | ||
1045 | 1047 | ||
1046 | return 0; | 1048 | return 0; |
1047 | } | 1049 | } |