From nobody Mon Feb 9 07:23:52 2026 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 B490C350D5F for ; Fri, 9 Jan 2026 08:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767947930; cv=none; b=HJDFNSMSAaYltRWXqlCAbsvZ2KiDTsPAVgwjN/ybDKCF/aoMbG+sPzImcdRjv9ds9uhczdxWbePwFMVrKfyQsxled84PJE/Hl3kFt85xYu5DWnhDNvvg0r7HAU0WRo/4ILfJq7Y3VuWyHRobjco0kauEro3jqFEpo9QEcUmXKg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767947930; c=relaxed/simple; bh=DdBBgFhglOKY0ph9pTP5LrAKEsDqCeX9xP03lLUHCto=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hLLLqI2Hvy62Lesc508El9/VOx3u7L0EA0hqOWhvg36EZYw/PPQzrW2hpa/Y9n6yjqtTdxaWj55qzEZaVsuFSNKHNCfdYClUFh9JbZ1M4/H6jCgPNgVnKsEV9YmbM6Aw9LV3ewb74Cy/vNImbIlKMFgFGcBLxtmW0OpV014GajQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=D4O6UdH0; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="D4O6UdH0" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-b79ea617f55so796919166b.3 for ; Fri, 09 Jan 2026 00:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767947921; x=1768552721; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jIG9jHDbaVAm5OgY4WVVwK7anANLOwHME3rcrsh86ys=; b=D4O6UdH0FHy0AV8fB2mIXRVLSwFQSYPGbe+1ISUXcvnBgnmojWv2y9CZbLhIftfHb7 9JxcrpE1VCtWpcIG7VrvgMuo8LskptlPXLD8YbDWVc4amqTkiLARcB4VzVifhMueoAil tQgztCodvgidRYtW+xKyn1Aoj31IRGJi7RONZ9skEdQUjJuq86f6NB4biEnb8Lf5deEA hvMW12m9wgCl6NwQbugOIbUb22sLr3oDzKONm7cgzYiZNQvxT9lti4UkwvOq1NaOk3ZK RI6+9mNRhO3C/gYP5+TFjf3Zg5aKsGB7j2JE9o13ziIMhrD2VvboxQIDJxR1SZolXcmB eNWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767947921; x=1768552721; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=jIG9jHDbaVAm5OgY4WVVwK7anANLOwHME3rcrsh86ys=; b=AuSVf13baZSWi43/0mfA/QihzDmPWwm/jNEgIGREMoTACvW9jYciEkJWyOQU46HUSU 89QrRKyc9GtauTIpCF5WBljuNEny8HkBYyjusbz2orwn1UIE+ft+rj0h+vjB2PzLdUU1 oDdes9kGYc5PWbT+6zHY6ZPH9MuLD4RWVM38rXqsm1AwHLOZCfpRyrOzGGk5eyGQ5Mwi Xl5o7G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a640c23a62f3a-b8445179ea9mr877965366b.35.1767947921344; Fri, 09 Jan 2026 00:38:41 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6507be658b3sm9472950a12.18.2026.01.09.00.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 00:38:40 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 09 Jan 2026 08:38:40 +0000 Subject: [PATCH v2 4/8] regulator: core: streamline supply resolution for always-on/boot-on regulators Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260109-regulators-defer-v2-4-1a25dc968e60@linaro.org> References: <20260109-regulators-defer-v2-0-1a25dc968e60@linaro.org> In-Reply-To: <20260109-regulators-defer-v2-0-1a25dc968e60@linaro.org> To: Liam Girdwood , Mark Brown , Javier Martinez Canillas , Jon Hunter , Dmitry Baryshkov , Oleksij Rempel Cc: Peter Griffin , Tudor Ambarus , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 For always-on and boot-on regulators, regulator_register() is currently trying to anticipate the requirement to resolve a supply early. Unfortunately, this code executes too early, before we have potentially updated the regulator's always_on constraint as part of set_machine_constraints(), causing it to miss cases. Rather than trying to hack it more, just defer to the outcome of set_machine_constraints(). The latter returns early (without doing any regulator initialisation) with -EPROBE_DEFER as of commit 'regulator: core: move supply check earlier in set_machine_constraints()' and is therefore safe to call multiple times to determine if supplies need to be resolved early. Commit 8a866d527ac0 ("regulator: core: Resolve supply name earlier to prevent double-init") (later updated by commit 520fb178212d ("regulator: core: Fix regulator supply registration with sysfs")) added these tests originally to avoid calling set_machine_constraints() multiple times to try to avoid voltage glitches due to all the regulator initialisation happening each time. This isn't an issue anymore as per above. Signed-off-by: Andr=C3=A9 Draszik --- drivers/regulator/core.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9ce0eef1dcfcb39a072675e44a5577ae85d51982..08bdb1e4175e6d47d154e7a2d85= 9a9d39dcfd021 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5937,7 +5937,6 @@ regulator_register(struct device *dev, bool dangling_cfg_gpiod =3D false; bool dangling_of_gpiod =3D false; int ret, i; - bool resolved_early =3D false; =20 if (cfg =3D=3D NULL) return ERR_PTR(-EINVAL); @@ -6075,17 +6074,6 @@ regulator_register(struct device *dev, goto wash; } =20 - if ((rdev->supply_name && !rdev->supply) && - (rdev->constraints->always_on || - rdev->constraints->boot_on)) { - ret =3D regulator_resolve_supply(rdev); - if (ret) - rdev_dbg(rdev, "unable to resolve supply early: %pe\n", - ERR_PTR(ret)); - - resolved_early =3D true; - } - if (config->ena_gpiod) { ret =3D regulator_ena_gpio_request(rdev, config); if (ret !=3D 0) { @@ -6099,9 +6087,10 @@ regulator_register(struct device *dev, } =20 ret =3D set_machine_constraints(rdev); - if (ret =3D=3D -EPROBE_DEFER && !resolved_early) { - /* Regulator might be in bypass mode and so needs its supply - * to set the constraints + if (ret =3D=3D -EPROBE_DEFER) { + /* Regulator might be in bypass mode or an always-on or boot-on + * regulator and so needs its supply to set the constraints or + * for enable. */ /* FIXME: this currently triggers a chicken-and-egg problem * when creating -SUPPLY symlink in sysfs to a regulator --=20 2.52.0.457.g6b5491de43-goog