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-samsung.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-samsung.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-samsung.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index 439f2ef680df..222648d69f25 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c | |||
@@ -442,9 +442,17 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin, | |||
442 | 442 | ||
443 | /* set the pin config settings for a specified pin */ | 443 | /* set the pin config settings for a specified pin */ |
444 | static int samsung_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, | 444 | static int samsung_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, |
445 | unsigned long config) | 445 | unsigned long *configs, unsigned num_configs) |
446 | { | 446 | { |
447 | return samsung_pinconf_rw(pctldev, pin, &config, true); | 447 | int i, ret; |
448 | |||
449 | for (i = 0; i < num_configs; i++) { | ||
450 | ret = samsung_pinconf_rw(pctldev, pin, &configs[i], true); | ||
451 | if (ret < 0) | ||
452 | return ret; | ||
453 | } /* for each config */ | ||
454 | |||
455 | return 0; | ||
448 | } | 456 | } |
449 | 457 | ||
450 | /* get the pin config settings for a specified pin */ | 458 | /* get the pin config settings for a specified pin */ |
@@ -456,7 +464,8 @@ static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, | |||
456 | 464 | ||
457 | /* set the pin config settings for a specified pin group */ | 465 | /* set the pin config settings for a specified pin group */ |
458 | static int samsung_pinconf_group_set(struct pinctrl_dev *pctldev, | 466 | static int samsung_pinconf_group_set(struct pinctrl_dev *pctldev, |
459 | unsigned group, unsigned long config) | 467 | unsigned group, unsigned long *configs, |
468 | unsigned num_configs) | ||
460 | { | 469 | { |
461 | struct samsung_pinctrl_drv_data *drvdata; | 470 | struct samsung_pinctrl_drv_data *drvdata; |
462 | const unsigned int *pins; | 471 | const unsigned int *pins; |
@@ -466,7 +475,7 @@ static int samsung_pinconf_group_set(struct pinctrl_dev *pctldev, | |||
466 | pins = drvdata->pin_groups[group].pins; | 475 | pins = drvdata->pin_groups[group].pins; |
467 | 476 | ||
468 | for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) | 477 | for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) |
469 | samsung_pinconf_set(pctldev, pins[cnt], config); | 478 | samsung_pinconf_set(pctldev, pins[cnt], configs, num_configs); |
470 | 479 | ||
471 | return 0; | 480 | return 0; |
472 | } | 481 | } |