pinctrl: sx150x: Enable device links to consumers

Message ID 20190523075102.16094-1-linus.walleij@linaro.org
State New
Headers show
Series
  • pinctrl: sx150x: Enable device links to consumers
Related show

Commit Message

Linus Walleij May 23, 2019, 7:51 a.m.
A recent core change makes it possible to create device links
between a pin controller and its consumers. This is necessary
to ascertain the right suspend/resume order for the devices:
if a device is using a certain pin control state and want
to switch that before/after going to suspend, then the pin
controller may not be suspended already, and conversely
on the resume path.

Make sure any SX150X consumers are suspended before the
SX150X is suspended.

The SX150X does not implement suspend/resume callbacks,
but the device links are hierarchical, and this also makes
sure that the I2C master where the SX150X is in turn
connected will not suspend before any clients of the pin
control settings are suspended (and conversely for resume).

Cc: Peter Rosin <peda@axentia.se>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/pinctrl/pinctrl-sx150x.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.20.1

Patch

diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c
index 4d87d75b9c6e..8b954f74a63a 100644
--- a/drivers/pinctrl/pinctrl-sx150x.c
+++ b/drivers/pinctrl/pinctrl-sx150x.c
@@ -1151,6 +1151,7 @@  static int sx150x_probe(struct i2c_client *client,
 	pctl->pinctrl_desc.pins = pctl->data->pins;
 	pctl->pinctrl_desc.npins = pctl->data->npins;
 	pctl->pinctrl_desc.owner = THIS_MODULE;
+	pctl->pinctrl_desc.link_consumers = true;
 
 	ret = devm_pinctrl_register_and_init(dev, &pctl->pinctrl_desc,
 					     pctl, &pctl->pctldev);