From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FD3E435ED0 for ; Tue, 21 Jul 2026 07:54:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784620460; cv=none; b=Zc+q9yM7YsrmkT8LvP0BoQ0nB325xbpTV9BT+V+0ymF2iOlmdqu20aiY28cllF0r2+dwBodbJQw1+DzWQyDZzcWEeiMlH4nwuOk3KhGp+brNDsKBQuUeHtKVk84eoE78+D/3Nrh+SKUzhEXUToFt8UyAD9Y2KeWQoWdwkvH0N4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784620460; c=relaxed/simple; bh=v6GPocRuAdYXxfW5GCiY7PkoQqyVIhzeyfAlaB/90Io=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ConAskHiaZL4fM2+qHaIhoSdE++jGkKpGaFxzuysmQUcpZz1T+mTPp7fGavPU/xeokex7Wk9Or1/5MTOdGObzB2C7kD1pNjCZBZBUpgk+0DGCMRe1njHwhG2QkYtXCeuBI+DnRxlHTISilFvZU6qpsPnvonC9YdCTO6usoR8oFM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=QD/LPHKO; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="QD/LPHKO" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2cce6a0c9c3so98888365ad.1 for ; Tue, 21 Jul 2026 00:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1784620459; x=1785225259; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fwE3F1d5K76sODY+n24O04o43zDEBUUtH4OGbkRqhTY=; b=QD/LPHKOGNi2+XaBdLMGVgrUjfGg41mV5vzf5LDIL0lxu/nj+B8IiK4L7jv2Q6jqLy idSCOH5tFaGoXd08tPcjpA3XsK4McqhItPoWhaeqM1mmHcB5NQlTWcipQ/c0X87htmTr 0wS2zOACOf6tn4IXzjpPw/leCVAUW5QjfVkws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784620459; x=1785225259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=fwE3F1d5K76sODY+n24O04o43zDEBUUtH4OGbkRqhTY=; b=hQDO9D4pTn3IBRav0sWMCM9dWgkXt9hH8Dd5cMOxinhrqr4tuDa3bMYQJviVR6JWSt ofbIbNNhNM3cPW7vZXN65mNp2Wq1n+kji+qDi5P+/n5fq3qjadqdrztYioh+UqomeYLq aJxnQ6Zs5WNPtFOTmAf2FW5d5lPmApjFZkXdCk2iWtKVD11ztJxovYxCPdmXozCpfE7+ EnhSnmQGUOMRTe7ZxqYGsRAaR6vs3nutB4ubspGXhJ0hHrCSsGW8FnlUSRH6b5axnC3o 3XCsHgPfCux07RK3bwt2eClKh5qhHTrF2jlTFXAHuGSsBeaqCbSBwIWHfWddk7oImwta 3CdA== X-Forwarded-Encrypted: i=1; AHgh+RpXbDuGcKWLU4JpcaGgvC4wOhuilydxpk6I7AbBE2q4sWp1EIMtO2sh9JImLiizU/sK4q//UH7bFsH4Mek=@vger.kernel.org X-Gm-Message-State: AOJu0YytOpMnd7aOd6SiKBdA9TxqjlZHhrYcSgj9Yy7r2SZAT3TB/sBh ju9967MDx6m47Ct12QKN3EIMn952AI851iDgFuCES/3+VtvT6kS14JKUi1VKcaStDA== X-Gm-Gg: AR+sD12zU1uXAL/NlJf8mVJs3uHe+hB6lOjqDHJ1ZzDlf82AS8xqeLhPGC0qasIAc8Y 3fboPwJmyCF3ldMSQ27gvZsmlAFfR3MYmNC/C+2pYt3hdF0w9KUqnUAxkOQIndEMj8iYEYVI6p3 q0X6Ie65plyNQssCx/qU/t+uJEDq08yXrxNyomRudDn/OmZN1zG7R3KlLZWDK8ygmaWNiaaylDs lJwopBGpe7kvgPrp+z78mm7vbknNiZCNB4AF6lS7C6p1+YxX+M82IUQvhrS/Tyg0SjGDJw7MXNb Q95qJrCg2u7jjqbYGqmME6RnY2rxv6/ZJq49d7u8er3x73HZF5oLUbz8Sk337a6dlK0tx49vGzF Z8fwqmKAIwMfU4NcndrioRsrqKTsqaELVyzJniYcgMc1S5tUKY+lUoWsJW3emWY6Z6lvokg9LwA IYMYFa5z8tCBRn7ZittsvK/95Z+xP610u59UzY9Zfqzu9NW3G7+mdV80l7C+U= X-Received: by 2002:a17:903:1ae7:b0:2c0:e5ee:f554 with SMTP id d9443c01a7336-2cf34895672mr185287855ad.8.1784620458954; Tue, 21 Jul 2026 00:54:18 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:3916:f048:32c3:931f]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf3448f705sm70724175ad.15.2026.07.21.00.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 00:54:18 -0700 (PDT) From: Chen-Yu Tsai To: Matthias Brugger , AngeloGioacchino Del Regno , Benson Leung , Tzung-Bi Shih , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Andy Shevchenko , Chen-Yu Tsai , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/9] i2c: of-prober: skip post-power-on delay if powered on sufficiently long Date: Tue, 21 Jul 2026 15:52:19 +0800 Message-ID: <20260721075226.2347933-6-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog In-Reply-To: <20260721075226.2347933-1-wenst@chromium.org> References: <20260721075226.2347933-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 #include #include +#include /* * 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