[PATCH 2/2] mfd: da9063: ensure all gpio devices are probed before

Andrej Picej andrej.picej at norik.com
Tue Mar 15 06:39:42 PDT 2022


GPIO lines in da9063 are assigned dynamically, while majority of SOC
GPIO drivers assign their GPIOs in static manner (GPIO line numbers can
be calculated).

This introduces regression if deep probe support is used. If da9063
GPIOs are registered before the SOCs GPIOs, there is a good chance that
the SOCs statically computed GPIO line numbers will already be used by
PMIC.

Ensure all SOCs GPIO drivers and GPIO lines get registered before the
da9063 registers its own gpiochip.

Signed-off-by: Andrej Picej <andrej.picej at norik.com>
---
 drivers/mfd/da9063.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/da9063.c b/drivers/mfd/da9063.c
index a4e5226f3c..8b943eb4ef 100644
--- a/drivers/mfd/da9063.c
+++ b/drivers/mfd/da9063.c
@@ -390,6 +390,10 @@ static int da9063_probe(struct device_d *dev)
 	restart_handler_register(&priv->restart);
 
 	if (IS_ENABLED(CONFIG_GPIOLIB)) {
+		ret = of_device_ensured_probed_by_alias_stem("gpio");
+		if (ret)
+			goto on_error;
+
 		priv->gpio.base = -1;
 		priv->gpio.ngpio = 5;
 		priv->gpio.ops  = &da9063_gpio_ops;
-- 
2.25.1




More information about the barebox mailing list