From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 6B5C742C4FD for ; Tue, 11 Aug 2026 12:20:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786450858; cv=none; b=fUucOMEZ+pSh6YGzu3H15Dq8mcdTFaZJx5vdKoIATrTyu65OBLd481+a9MLeneObnc6Dni5vbB5Vj3QxBCVBDNCXf7JNpbtuTngby/McocNfC57DLfGtzN/esNq+NTrIYO7ftlDSENBO7J/lyiYc9OjH5t42+x+ajFNzJdfudes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786450858; c=relaxed/simple; bh=eYYAZt1D/azsw9KiyzJSs5x1E12lPK58GJkuELjCTl0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aKbzjDJK506O7yeyrC8Iv5qiNrMeM/4ej0nC1JPqZYNSx+dilQawlLO7IuYaoCxpzUAz1UarerkaxZvLdIoKon9mfwUk1PxR6xbs0XfLNiUXzpGTy6jC/QVcvqd09Zg9yikBvBtdYsK/mN7afa11tUOLK5xHicb13HZfqHJ2VlI= 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=UmD2gsVl; arc=none smtp.client-ip=209.85.210.170 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="UmD2gsVl" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-84e27035206so441588b3a.3 for ; Tue, 11 Aug 2026 05:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1786450857; x=1787055657; 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=W0rjMz7r89FDG00LgKpSG7rJxKNH2nfPyMU32ONUt3s=; b=UmD2gsVlUCkjjjCgEhB1BENgxroVNIETQZHZCmnABrHU5UOkWXXEsRTLE2H6VlqswC Jwd9uk4puvmNyLdAv/+kOFXYWMaMEzwZVN8nDqoxsHFx15ilzAGsGF8XINHTtjhKO5av hQCaIKiV3T+hipr5e16zLCF9RhDKedg4OQyG4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786450857; x=1787055657; 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=W0rjMz7r89FDG00LgKpSG7rJxKNH2nfPyMU32ONUt3s=; b=YUH9p9f/5qaTHocN3giCeVjT7ardZoR5c0JhvD8Mt6mt4GcpvxiwdecVEL/sKDewMU zj8NhvcOo6cOVviwJVnrxJwG0NLJ8rt57FrTvopUKleaPCaUKOmwdjRL8/+SU1p67XBr Y9Goo3FfQ5H2H4MVOfv5p7rC5h9SV9zsgPyRXC62VApbY3L/poDZvWd3tKV8L4ezeFeg VQOGrCSwfl33Zn1lQ8QJdkW2eOL38Pdr4Bq9XeDSm7PmRWk+VdnsL0HNZIk5QiaA+5y1 KIqCy1gg6hIBtCL0yXWIda6PtT00lVpWeJ0VlDgZzqDLClRWPMqzYTznSPc0YbfV1oxU qxwg== X-Forwarded-Encrypted: i=1; AHgh+RoFF7bdWVducgnPJOnH63jprokBkZxHj/GC+9tKNxCX1Zo/j95DMy9VNGEKeBWnW89WMIRP8GBEal6OdoE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7xBGKiIF32N02+t/jmPh+oa9Gm9MEuE82yaEuJkk6BNjbIqz5 buPy+Vlija4vtJp+1RFDT0cVH0TMj2SNOydDm84jQSWfdht0raFDrgNhI6YSSjbElw== X-Gm-Gg: AR+sD116hOF/tMZOr2UHbM+nKNkKl1L+A8tCsVQyPQxvoMgwxv1wj1le6EZTX+Znx/T qE+tB9ETUmL47NuBTJv1yCpN2J4HXAkYKsykIDiW18PJifyIEmADfoOYpE8fJ9SbqCB/kiIcKPU hbWYXny1dH/A1qeGJgslWiRteNLDpevuLAGgCB2DejK5lhATJ1WHiXDBY/dTBmqPrOZwx2Sz6Yf WjXZVORnggpAfQ+dn7Ndrl3nbNub+IeydFoDBNpmFXiZx/rNiOFm48R1887Tgkv5tdPcdEQ3dqA by3x/htF5Ir4EbXEq5euko7adWQ2gt4A6x3E2i2jr4AUEcMGefjEVsttuifPTjd1heagh86zrVq IUTfXKncKAKL5xCbVcRgFNEz6btefvhIt+v9vovAYuoIN909vv7JKCW/e1Qxd37nma4xyPzoya3 nOPOjqJaMpt7G/Jnal6O4zUYW/QpejYDHGriVX9UUazMycHisCbtwUHQUby4tcrDAuEDY1UhDf+ S7/HE0//DEftTknRIFhb6OtGpq9E0wKYCUIKS64tZ4poA== X-Received: by 2002:a05:6a00:32c3:b0:845:40d1:87fa with SMTP id d2e1a72fcca58-84fa873632emr3028343b3a.25.1786450856753; Tue, 11 Aug 2026 05:20:56 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:12e1:df26:6add:1ea7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84fa9574e9dsm662454b3a.54.2026.08.11.05.20.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 05:20:54 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Benson Leung , Tzung-Bi Shih , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: 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 v4 5/9] i2c: of-prober: skip post-power-on delay if powered on sufficiently long Date: Tue, 11 Aug 2026 20:20:05 +0800 Message-ID: <20260811122011.3539250-6-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog In-Reply-To: <20260811122011.3539250-1-wenst@chromium.org> References: <20260811122011.3539250-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.679.g6767b8d81c-goog