Skip to content

Commit 7f0ff06

Browse files
nikita-youshLinus Walleij
authored andcommitted
pinctrl: When claiming hog, skip maps not served by same device
When pinctrl device registers, it automatically claims hogs, that is, maps that pinctrl device serves for itself. It is possible that in addition to SoC's pinctrl device, other pinctrl devices get registered. E.g. some gpio expander devies are registered as pinctrl devices. For such devices, pinctrl maps could be defined that set up SoC's pins (e.g. interrupt pin for gpio expander). Such a map will have target device set to gpio expander. Here is device tree snippet that causes this scenario: &i2c0 { sx1503@20 { compatible = "semtech,sx1503q"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sx1503_20>; ... }; }; ... &iomuxc { pinctrl_sx1503_20: pinctrl-sx1503-20 { fsl,pins = < VF610_PAD_PTB1__GPIO_23 0x219d >; }; }; Such a map will have target device set to gpio expander. However is not a hog, it is a regular map that is claimed by core before gpio expander device is probed. Thus when looking for hogs, it is not enough to check that map's target device is set to pinctrl device being registered. Need also check that map's control device is also set to the same. Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 5586ee4 commit 7f0ff06

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎drivers/pinctrl/core.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,16 @@ static struct pinctrl *create_pinctrl(struct device *dev,
10381038
/* Map must be for this device */
10391039
if (strcmp(map->dev_name, devname))
10401040
continue;
1041+
/*
1042+
* If pctldev is not null, we are claiming hog for it,
1043+
* that means, setting that is served by pctldev by itself.
1044+
*
1045+
* Thus we must skip map that is for this device but is served
1046+
* by other device.
1047+
*/
1048+
if (pctldev &&
1049+
strcmp(dev_name(pctldev->dev), map->ctrl_dev_name))
1050+
continue;
10411051

10421052
ret = add_setting(p, pctldev, map);
10431053
/*

0 commit comments

Comments
 (0)