mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] regulator: mt6363: Fix the regmap value width and the VSRAM LDO registers
@ 2026-11-01 16:44 GIBEOM LEE (이기범)
  2026-11-01 16:44 ` [PATCH 1/2] regulator: mt6363: Use 8-bit regmap values GIBEOM LEE (이기범)
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: GIBEOM LEE (이기범) @ 2026-11-01 16:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: AngeloGioacchino Del Regno, Matthias Brugger, linux-kernel,
	linux-arm-kernel, linux-mediatek,
	GIBEOM LEE (이기범)

These patches fix two problems in the MT6363 regulator driver that can be
seen from the code. They are on top of regulator for-next, where the driver
is the same as in master and v7.2.12.

Patch 1: the registers have 8 bits but the regmap has 16-bit values, so
every write also writes the next register. For example, disabling one of
VS2 and VBUCK1-7 also disables VS1, VS3 and VSRAM_{DIGRF,MDFE,MODEM}. The
MT6373 driver on the list has 16-bit values too, so its next version will
want the same change.

Patch 2: VSRAM_{CPUB,CPUM,CPUL,APU} use the enable and low power registers
of the BUCK1 group instead of their own, so disabling one of them disables
VS1.

Testing: none of this has run on hardware, because the bootloader of my
board (Lenovo TB375FC, MT6897) is still locked. Each patch builds with W=1.
The driver file also ran unchanged in user space, against a model of the
registers made from MediaTek's header and driver, before and after the
patches:

 - 16 of the 33 checks of the model fail before and pass after. The 9 that
   still fail are about the VEMC voltage callbacks and the overcurrent
   handling, for which I have fixes that I would like to test first.
 - ASan reports a stack buffer overflow in the BUCK_TOP key write before
   patch 1, and nothing after it.
 - The resolved table of the 35 rails differs from MediaTek's driver in 8
   entries before patch 2, and in none after it.

The model comes from MediaTek's sources, so it does not show how the chip
really behaves. A Tested-by from anyone with an MT8196 or MT6991 board would
be very welcome.

How this was made: Claude (claude-opus-5-5, an AI coding assistant) found
both problems while comparing the driver with MediaTek's driver in the
OnePlus MT6897 kernel, during a longer session of porting mainline Linux to
this tablet. It wrote the patches, their changelogs and this letter, and it
ran the checks above. I reviewed the result before signing off.

GIBEOM LEE (이기범) (2):
  regulator: mt6363: Use 8-bit regmap values
  regulator: mt6363: Fix the registers of the VSRAM CPU and APU LDOs

 drivers/regulator/mt6363-regulator.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-02 17:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01 16:44 [PATCH 0/2] regulator: mt6363: Fix the regmap value width and the VSRAM LDO registers GIBEOM LEE (이기범)
2026-11-01 16:44 ` [PATCH 1/2] regulator: mt6363: Use 8-bit regmap values GIBEOM LEE (이기범)
2026-11-02 16:07   ` amergnat
2026-11-01 16:44 ` [PATCH 2/2] regulator: mt6363: Fix the registers of the VSRAM CPU and APU LDOs GIBEOM LEE (이기범)
2026-11-02 16:54   ` Alexandre Mergnat
2026-11-02 16:43 ` [PATCH 0/2] regulator: mt6363: Fix the regmap value width and the VSRAM LDO registers Alexandre Mergnat
2026-11-02 17:33   ` GIBEOM LEE (이기범)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®