Skip to content

Commit e310b74

Browse files
committed
pinctrl: mvebu: identify generic controls by name
We treat unnamed controls as generic mvebu mpp register controls but we identify them by not being special controls. Flip the logic and use the name pointer as identification instead. While at it, add some comments explaining the not so obvious treatment. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Tested-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
1 parent dc2a900 commit e310b74

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

‎drivers/pinctrl/mvebu/pinctrl-mvebu.c‎

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -638,23 +638,21 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
638638
struct mvebu_mpp_ctrl *ctrl = &soc->controls[n];
639639

640640
pctl->desc.npins += ctrl->npins;
641-
/* initial control pins */
641+
/* initialize control's pins[] array */
642642
for (k = 0; k < ctrl->npins; k++)
643643
ctrl->pins[k] = ctrl->pid + k;
644644

645-
/* special soc specific control */
646-
if (ctrl->mpp_get || ctrl->mpp_set) {
647-
if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) {
648-
dev_err(&pdev->dev, "wrong soc control info\n");
649-
return -EINVAL;
650-
}
645+
/*
646+
* We allow to pass controls with NULL name that we treat
647+
* as a range of one-pin groups with generic mvebu register
648+
* controls.
649+
*/
650+
if (!ctrl->name) {
651+
pctl->num_groups += ctrl->npins;
652+
noname += ctrl->npins;
653+
} else {
651654
pctl->num_groups += 1;
652-
continue;
653655
}
654-
655-
/* generic mvebu register control */
656-
pctl->num_groups += ctrl->npins;
657-
noname += ctrl->npins;
658656
}
659657

660658
pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins *
@@ -690,8 +688,12 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
690688
pctl->groups[gid].pins = ctrl->pins;
691689
pctl->groups[gid].npins = ctrl->npins;
692690

693-
/* generic mvebu register control maps to a number of groups */
694-
if (!ctrl->mpp_get && !ctrl->mpp_set) {
691+
/*
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) {
695697
pctl->groups[gid].name = noname_buf;
696698
pctl->groups[gid].npins = 1;
697699
sprintf(noname_buf, "mpp%d", ctrl->pid+0);

0 commit comments

Comments
 (0)