From nobody Mon Feb 9 17:34:55 2026 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 2AF6D314D19 for ; Sat, 27 Dec 2025 12:17:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766837877; cv=none; b=N50+hkRWLt+QceMj/sO2swqlfs3f38X76vwx3Bvx82sCQqp2qBQwLLa5TKOiwgQesrTytQ68nLh09QMB2Ciy8gJ0UD+bRVsib3IUQ1U5f2i9geAGuwVQeP06V3l8tLIMhrCmWj4xRjUX6eobbx3rASB3dg6fwLmwrh6cX/2gqtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766837877; c=relaxed/simple; bh=flDp/n5fNdRNaijbrxj7fWKZJmSjLItwp7qfWjhxONg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UsUD/h7dNOFyf0NfY4Thfm+EbDbktqeA6S1NW5kVo+t7lV38qP5bcByiFcUdZZ56TaVXIPXXmP5ubSI4tDwQrkXG+QaFxMNrLvo2BiE9WHHUlzf4neRQRE6U+OEsp6MMUfSu9FsXj4sLe0+eW+19oGD7UDfKIOBDxotM82Dcx5g= 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=fpVrkTwc; arc=none smtp.client-ip=209.85.218.46 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="fpVrkTwc" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-b73161849e1so1522613866b.2 for ; Sat, 27 Dec 2025 04:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766837870; x=1767442670; 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=q/jZnK8nS4pEmw7rnsILBau4+awmUqMLUa+J8ILnmjg=; b=fpVrkTwcsMgye7pw2+lghQvkUmqeaVbqooh5TQJgX92jg0a9fBYWeB+Mv8uBmhQqNk hA2V7foT38TX8m60rQ9sGI74U5i0sjhFJjoY/oJHjqni/gir+CdBy70tOMxY19sl5tZy J6H2EBZZVB1RMi+c7GqvMiqQioMAW3E3G8xmkq7HSbhTai8Slr5Mjs+9oFRc6qPpEcE4 DefY4e9nSpnSf9Utc/d43e4Cpo9WKPqXKFrvrGJaFfVplHAUqUzqbobdyhpi8vhE0t6S MSw4HPLzCLTkDbADa97XydxreF95tSegrBZEWzlmJL5lejmKKx7ASf3DG802m88zTw01 s+Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766837870; x=1767442670; 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=q/jZnK8nS4pEmw7rnsILBau4+awmUqMLUa+J8ILnmjg=; b=BUjFwW3am1JrxPjk1ENPTILl724mmqzqdnwlwKJQNki/xFV6MGu5Fyu+EVeAmplzVg gLWYyMmmtHiVBj3l1zY3CKeEzRwbcXUN6o6foyJqn4w72y5enQkXIpuuCMeYKmzrWS67 Puv4cDWhpiZRt3dunChcmVWioxFsLuzOrJNg2lKw/GbRzqk7fXVXFRNrNxm0QQAAorEv hYea2rCoZmy7VHi60dkExJ2PPRtW/ja/FECp/P2tZ2870SxQf14eSySSzDZ7cDbbDmkS qDO8mn0sGAtdv9iRmoC86ANvAyHiy9rtR7kP9x8Zeexx6N7Yw9vFKCSwPN8WzYeTPHXz l+DQ== X-Forwarded-Encrypted: i=1; AJvYcCX/Wp8pz4mCpVee/D4vS4GHogmdh5YsllWEcx3xYBeySfCwDESvFXrpRsE74NhXZoiXhuax/OAUr/c/VWI=@vger.kernel.org X-Gm-Message-State: AOJu0YyZq7s13sz8Lm05aBBWmQ60kK80w0dkQkJv6DBkFjLrVdMRs3oT o9tjJkTa0jeo8ukGY9VBu8Z9L49VN3agmalWwhZ0PzHRnQ0TeCWBjmMFCOtzUV1a3yI= X-Gm-Gg: AY/fxX7adhD/UsGMJ8qJexdy/mID86rVybl7bOBGNqBYrDBBAuUFTcq4wzycYsRj0oM 2dj3BYZYy2uS2PfXyfteCTxQWSME8s79ePtsZqzReQeOruwL/O8W7K6Y6Sd03VejVR4Qy/Qa06w +E7M2shUxFm237daOCkEt7efXCYNgepykwiLlRNmKb8Z0Y3i/c+z/6Kjs89K9dx0+Co3wzsUYZ1 ka6XsOWANj1LKfDfP6XXw+PcL2ssJHc5qpF+cyz+3VeZUrMplEAxsNaXrSjAA1D/dwkikBF4EW7 2k9tD+jxtRRp1cXiVdEPtmrCVtvQYBw/XUJDbK3C5xFc8muA7iYt18G1Qk5/cbkZs3WFbgnEOoa 380LWq/6tMybGn1FX+B4n9O7EdTZkzw2hBFbxjkGpAK4xA1X2xdmA2MoV1TxgqfejAcrUpVWFSQ /EZSpdJPstIAOgzcdyo+DKA8x8l8eJXLNKzv0bCkqPLdvPzpRkdEcBU28s1VRGl7cbRFCyRergi T2VQg== X-Google-Smtp-Source: AGHT+IHSYPouoO0YSE7EVZLxcVrQOmYqxHDL1OxgSIqt/5HlkhrtWWxMKhDWlgt2J8VEaoTc4sStUQ== X-Received: by 2002:a17:907:d1c:b0:b79:f753:6910 with SMTP id a640c23a62f3a-b803705dbe2mr2913770266b.40.1766837869823; Sat, 27 Dec 2025 04:17:49 -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 a640c23a62f3a-b8037f18575sm2616274666b.54.2025.12.27.04.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:17:49 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:17:48 +0000 Subject: [PATCH 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: <20251227-regulators-defer-v1-4-3104b22d84cb@linaro.org> References: <20251227-regulators-defer-v1-0-3104b22d84cb@linaro.org> In-Reply-To: <20251227-regulators-defer-v1-0-3104b22d84cb@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.351.gbe84eed79e-goog