From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Saikiran B <bjsaikiran@gmail.com>
Cc: broonie@kernel.org, lgirdwood@gmail.com, andersson@kernel.org,
konrad.dybcio@kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] regulator: qcom-rpmh: Add support for regulator-off-on-delay-us
Date: Wed, 28 Jan 2026 12:42:12 +0100 [thread overview]
Message-ID: <99aa1a81-e64d-4ea8-b69d-3ce08b9994a3@oss.qualcomm.com> (raw)
In-Reply-To: <CAAFDt1tuod0GUepTuKYN3xM1pGHTLt0tkpQpE1=ySGBsNsoiFA@mail.gmail.com>
On 1/28/26 12:34 PM, Saikiran B wrote:
> On Wed, Jan 28, 2026 at 4:00 PM Konrad Dybcio
> <konrad.dybcio@oss.qualcomm.com> wrote:
>>
>> On 1/27/26 6:37 PM, Saikiran wrote:
>>> The core regulator framework supports enforcing a physical off-time via
>>> standard properties, but the `qcom-rpmh-regulator` driver currently ignores
>>> them. This prevents boards with slow-discharging rails from enforcing safe
>>> power-cycling constraints.
>>>
>>> On the Lenovo Yoga Slim 7x (Snapdragon X Elite), certain camera regulators
>>> rely on passive discharge and require a significant off-time to drop below
>>> brownout thresholds. Without this driver support, we cannot enforce this
>>> constraint via Device Tree, leading to sensor initialization failures during
>>> rapid power cycling.
>>>
>>> Add support for parsing the `regulator-off-on-delay-us` property from
>>> the device tree.
>>>
>>> I have tested this on the Yoga Slim 7x. When the delay property is present
>>> in the device tree, the regulator core correctly blocks re-enable calls
>>> until the delay passes, fixing the camera brownout issues.
>>>
>>> Signed-off-by: Saikiran <bjsaikiran@gmail.com>
>>> ---
>>> drivers/regulator/qcom-rpmh-regulator.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c
>>> index 6e4cb2871fca..aafba61551b3 100644
>>> --- a/drivers/regulator/qcom-rpmh-regulator.c
>>> +++ b/drivers/regulator/qcom-rpmh-regulator.c
>>> @@ -503,6 +503,9 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg, struct device *dev,
>>> vreg->always_wait_for_ack = of_property_read_bool(node,
>>> "qcom,always-wait-for-ack");
>>>
>>> + of_property_read_u32(node, "regulator-off-on-delay-us",
>>> + &vreg->rdesc.off_on_delay);
>>
>> Would it not be a better fit for of_regulator.c?
>>
>> Konrad
>
> Hi Konrad,
>
> On Tue, Jan 27, 2026 at 4:00 PM Konrad Dybcio wrote:
>> Would it not be a better fit for of_regulator.c?
>
> That was my initial thought as well, but there is a limitation:
>
> The `off_on_delay` field resides in `struct regulator_desc`. For most
> regulator drivers, this structure is `static const` (immutable) as it describes
> fixed silicon characteristics. Generic parsing code in `of_regulator.c`
> cannot blindly write to `desc->off_on_delay` without risking a write to
> read-only memory.
>
> The `qcom-rpmh-regulator` driver is unique in that it allocates
> `vreg->rdesc` dynamically at runtime, which allows us to safely populate
> this field from DT.
>
> To support this generically in `of_regulator.c`, we would likely need to
> introduce `off_on_delay` into `struct regulator_constraints` instead,
> and then update the core regulator handling to check both sources.
>
> I opted for this driver-specific approach to minimize impact on the core
> subsystem, given that `qcom-rpmh` is already set up to handle dynamic
> descriptors.
>
> Let me know if you would prefer I attempt the core framework change instead.
I'm a fly-by reviewer for this sort of thing (as you can see by me not
knowing this reasoning..)
Mark (the maintainer) should be able to give you a more insightful answer
Konrad
next prev parent reply other threads:[~2026-01-28 11:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 17:37 [PATCH v2] regulator: qcom-rpmh: Add support for regulator-off-on-delay-us Saikiran
2026-01-28 10:29 ` Konrad Dybcio
2026-01-28 11:34 ` Saikiran B
2026-01-28 11:42 ` Konrad Dybcio [this message]
2026-01-28 11:55 ` Mark Brown
2026-01-28 13:59 ` Saikiran B
2026-01-28 14:04 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=99aa1a81-e64d-4ea8-b69d-3ce08b9994a3@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=bjsaikiran@gmail.com \
--cc=broonie@kernel.org \
--cc=konrad.dybcio@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox