Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e310b745 authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth
Browse files

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: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Tested-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
parent dc2a9000
Loading
Loading
Loading
Loading
+16 −14
Original line number Original line Diff line number Diff line
@@ -638,23 +638,21 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
		struct mvebu_mpp_ctrl *ctrl = &soc->controls[n];
		struct mvebu_mpp_ctrl *ctrl = &soc->controls[n];


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


		/* special soc specific control */
		/*
		if (ctrl->mpp_get || ctrl->mpp_set) {
		 * We allow to pass controls with NULL name that we treat
			if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) {
		 * as a range of one-pin groups with generic mvebu register
				dev_err(&pdev->dev, "wrong soc control info\n");
		 * controls.
				return -EINVAL;
		 */
			}
		if (!ctrl->name) {
			pctl->num_groups += 1;
			continue;
		}

		/* generic mvebu register control */
			pctl->num_groups += ctrl->npins;
			pctl->num_groups += ctrl->npins;
			noname += ctrl->npins;
			noname += ctrl->npins;
		} else {
			pctl->num_groups += 1;
		}
	}
	}


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


		/* generic mvebu register control maps to a number of groups */
		/*
		if (!ctrl->mpp_get && !ctrl->mpp_set) {
		 * We treat unnamed controls as a range of one-pin groups
		 * with generic mvebu register controls. Use one group for
		 * each in this range and assign a default group name.
		 */
		if (!ctrl->name) {
			pctl->groups[gid].name = noname_buf;
			pctl->groups[gid].name = noname_buf;
			pctl->groups[gid].npins = 1;
			pctl->groups[gid].npins = 1;
			sprintf(noname_buf, "mpp%d", ctrl->pid+0);
			sprintf(noname_buf, "mpp%d", ctrl->pid+0);