[PATCH v3 5/9] i2c: of-prober: skip post-power-on delay if powered on sufficiently long
From: Chen-Yu Tsai
Date: Tue Jul 21 2026 - 04:00:32 EST
On some devices the I2C component is powered from an always-on power
rail, or the power rail has been left on by either POR defaults or
the bootloader. By the time the prober probes the device, the device
most certainly has finished initializing and can respond. There is no
need for the delay.
In such designs, the system integrators tend to work around the delay
to avoid the boot time penalty by simply omitting it from the device
tree and the component prober. This is undesired, as the device tree
is not fully describing the hardware.
Switch to the new regulator_enable_and_wait() function that makes sure
a certain amount of time has passed since the regulator supply was
actually enabled.
Signed-off-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
---
Changes since v2:
- Switched to new regulator_enable_and_wait() API
---
drivers/i2c/i2c-core-of-prober.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/i2c-core-of-prober.c b/drivers/i2c/i2c-core-of-prober.c
index 6a82b03809d4..f9f3c0ef93ff 100644
--- a/drivers/i2c/i2c-core-of-prober.c
+++ b/drivers/i2c/i2c-core-of-prober.c
@@ -18,6 +18,7 @@
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/stddef.h>
+#include <linux/time.h>
/*
* Some devices, such as Google Hana Chromebooks, are produced by multiple
@@ -226,13 +227,11 @@ static int i2c_of_probe_simple_enable_regulator(struct device *dev, struct i2c_o
dev_dbg(dev, "Enabling regulator supply \"%s\"\n", ctx->opts->supply_name);
- ret = regulator_enable(ctx->supply);
+ ret = regulator_enable_and_wait(ctx->supply,
+ ctx->opts->post_power_on_delay_ms * USEC_PER_MSEC);
if (ret)
return ret;
- if (ctx->opts->post_power_on_delay_ms)
- msleep(ctx->opts->post_power_on_delay_ms);
-
return 0;
}
--
2.55.0.229.g6434b31f56-goog