diff options
author | Benjamin Gaignard <benjamin.gaignard@st.com> | 2019-05-22 17:29:24 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2019-05-23 09:34:54 +0200 |
commit | 036f394dd77f8117346874151793ec38967d843f (patch) | |
tree | 53fdb17254789615469b2df6c2f869c29e53c8fd /drivers/pinctrl/core.c | |
parent | ee11f864f18349f01b7be94b8e0328353462b7b0 (diff) | |
download | linux-stable-036f394dd77f8117346874151793ec38967d843f.tar.gz linux-stable-036f394dd77f8117346874151793ec38967d843f.tar.bz2 linux-stable-036f394dd77f8117346874151793ec38967d843f.zip |
pinctrl: Enable device link creation for pin control
A pin controller may want to create a link between itself
and its clients to be sure of suspend/resume call ordering.
Introduce link_consumers field in pinctrl_desc structure to let
pinctrl core knows that controller expect to create a link.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
[Renamed create_link to link_consumers]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index c6ff4d5fa482..d757c51d7114 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1216,6 +1216,15 @@ struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p, } EXPORT_SYMBOL_GPL(pinctrl_lookup_state); +static void pinctrl_link_add(struct pinctrl_dev *pctldev, + struct device *consumer) +{ + if (pctldev->desc->link_consumers) + device_link_add(consumer, pctldev->dev, + DL_FLAG_PM_RUNTIME | + DL_FLAG_AUTOREMOVE_CONSUMER); +} + /** * pinctrl_commit_state() - select/activate/program a pinctrl state to HW * @p: the pinctrl handle for the device that requests configuration @@ -1261,6 +1270,8 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) if (ret < 0) { goto unapply_new_state; } + + pinctrl_link_add(setting->pctldev, p->dev); } p->state = state; |