Re: [PATCH v6 3/4] regulator: qcom-rpmh: readback voltage/bypass/mode set during bootup

From: Kamal Wadhwa

Date: Sun Sep 20 2026 - 15:54:48 EST


On Sun, Sep 20, 2026 at 06:45:13PM +0300, Dmitry Baryshkov wrote:
> On Tue, Sep 01, 2026 at 11:49:42AM +0200, Konrad Dybcio wrote:
> > On 8/1/26 10:00 AM, Kamal Wadhwa wrote:
> > > Currently, during regulator registration, regulator framework sends an
> > > unnecessary `min-microvolts` request for the rpmh-regulator device. This
> > > happens because in current design, we do not have a way to readback the
> > > voltage settings that was set during the bootloader stage.
> > >
> > > Fix this by using the rpmh_read() API to read the regulator voltage
> > > settings done during boot and make it available to regulator framework
> > > from the very first read after the bootup.
> > >
> > > Also use this API to read the mode/bypass settings as well. This will
> > > provide the regulator framework a sense of the initial settings done by
> > > bootloader and thus preventing any redundant writes for any setting post
> > > bootup incase the same setting was already applied during bootup.
> > >
> > > Signed-off-by: Kamal Wadhwa <kamal.wadhwa@xxxxxxxxxxxxxxxx>
> > > ---
> >
> > SC8180X Primus hangs with this patch applied and so does SM8150 HDK.
>
> [ 4.015947] cpu cpu0: EM: created perf domain
> [ 14.216480] qcom-rpmh-regulator 18200000.rsc:regulators-1: failed to read VOLTAGE ret = -110
> [ 14.216731] ------------[ cut here ]------------
> [ 14.225298] ldo1: Setting 1800000-1800000uV
> [ 14.230090] WARNING: drivers/soc/qcom/rpmh.c:441 at rpmh_write_batch+0x190/0x2b0, CPU#3: sugov:0/113
> [ 14.230135] Modules linked in:
> [ 14.247173] CPU: 3 UID: 0 PID: 113 Comm: sugov:0 Not tainted 7.3.0-rc3-next-20260918-g7afa080bdfc7 #5098 PREEMPT
> [ 14.257742] Hardware name: Qualcomm Technologies, Inc. SM8150 HDK (DT)
> [ 14.264472] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [ 14.271648] pc : rpmh_write_batch+0x190/0x2b0
> [ 14.276164] lr : rpmh_write_batch+0x188/0x2b0
> [ 14.280679] sp : ffff80008180b740
> [...]
> [ 14.357986] Call trace:
> [ 14.360529] rpmh_write_batch+0x190/0x2b0 (P)
> [ 14.365051] qcom_icc_bcm_voter_commit+0x33c/0x500
> [ 14.370016] qcom_icc_set+0x20/0x34
> [ 14.373642] apply_constraints+0x78/0xbc
> [ 14.377710] icc_set_bw+0x22c/0x480
> [ 14.381337] _set_opp_bw+0x50/0xe0
> [ 14.384879] _set_opp+0xd0/0x5fc
> [ 14.388244] dev_pm_opp_set_opp+0x70/0xfc
> [ 14.392401] qcom_cpufreq_hw_target_index+0x10c/0x120
> [ 14.397629] __cpufreq_driver_target+0x1f0/0x388
> [ 14.402411] sugov_work+0x58/0x80
> [ 14.405865] kthread_worker_fn+0xd8/0x4f0
> [ 14.410025] kthread+0x134/0x140
> [ 14.413388] ret_from_fork+0x10/0x20
> [ 14.417106] irq event stamp: 40
> [ 14.420365] hardirqs last enabled at (39): [<ffffbf371a8ff250>] _raw_spin_unlock_irq+0x30/0x64
> [ 14.429336] hardirqs last disabled at (40): [<ffffbf371a8e8a80>] el1_brk64+0x20/0x60
> [ 14.437324] softirqs last enabled at (0): [<ffffbf37196e8008>] copy_process+0x8a8/0x1e64
> [ 14.445758] softirqs last disabled at (0): [<0000000000000000>] 0x0
> [ 14.452243] ---[ end trace 0000000000000000 ]---
> [ 14.457163] Error sending AMC RPMH requests (-110)
>
>
> >
> > Interestingly, SDM845 DB845c doesn't
>
> Neither does SDM845 HDK.
>
> >
> > I think we may need to opt some platforms out of this..
>
> Would you send a patch or should I?

It seems that Maulik has already sent a patch to skip reads for some platforms.
https://lore.kernel.org/all/20260911-rsc_read-v2-2-98675c248278@xxxxxxxxxxxxxxxx/

>
> --
> With best wishes
> Dmitry

Regards,
Kamal