aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/mvebu/pinctrl-mvebu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/mvebu/pinctrl-mvebu.c')
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-mvebu.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index c0e27e4f8953..2be432444124 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -638,23 +638,21 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
638 struct mvebu_mpp_ctrl *ctrl = &soc->controls[n]; 638 struct mvebu_mpp_ctrl *ctrl = &soc->controls[n];
639 639
640 pctl->desc.npins += ctrl->npins; 640 pctl->desc.npins += ctrl->npins;
641 /* initial control pins */ 641 /* initialize control's pins[] array */
642 for (k = 0; k < ctrl->npins; k++) 642 for (k = 0; k < ctrl->npins; k++)
643 ctrl->pins[k] = ctrl->pid + k; 643 ctrl->pins[k] = ctrl->pid + k;
644 644
645 /* special soc specific control */ 645 /*
646 if (ctrl->mpp_get || ctrl->mpp_set) { 646 * We allow to pass controls with NULL name that we treat
647 if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) { 647 * as a range of one-pin groups with generic mvebu register
648 dev_err(&pdev->dev, "wrong soc control info\n"); 648 * controls.
649 return -EINVAL; 649 */
650 } 650 if (!ctrl->name) {
651 pctl->num_groups += ctrl->npins;
652 noname += ctrl->npins;
653 } else {
651 pctl->num_groups += 1; 654 pctl->num_groups += 1;
652 continue;
653 } 655 }
654
655 /* generic mvebu register control */
656 pctl->num_groups += ctrl->npins;
657 noname += ctrl->npins;
658 } 656 }
659 657
660 pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins * 658 pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins *
@@ -690,8 +688,12 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
690 pctl->groups[gid].pins = ctrl->pins; 688 pctl->groups[gid].pins = ctrl->pins;
691 pctl->groups[gid].npins = ctrl->npins; 689 pctl->groups[gid].npins = ctrl->npins;
692 690
693 /* generic mvebu register control maps to a number of groups */ 691 /*
694 if (!ctrl->mpp_get && !ctrl->mpp_set) { 692 * We treat unnamed controls as a range of one-pin groups
693 * with generic mvebu register controls. Use one group for
694 * each in this range and assign a default group name.
695 */
696 if (!ctrl->name) {
695 pctl->groups[gid].name = noname_buf; 697 pctl->groups[gid].name = noname_buf;
696 pctl->groups[gid].npins = 1; 698 pctl->groups[gid].npins = 1;
697 sprintf(noname_buf, "mpp%d", ctrl->pid+0); 699 sprintf(noname_buf, "mpp%d", ctrl->pid+0);