Re: [PATCH 3/3] regulator: Modify mt6315 regulator mode mask
From: Chen-Yu Tsai <wenst@chromium.org>
Date: 2025-08-01 07:31:06
Also in:
linux-devicetree, linux-mediatek, lkml
On Fri, Aug 1, 2025 at 3:20 PM niklaus.liu [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Modify mt6315 regulator mode mask, compatible with all 6315 models Signed-off-by: niklaus.liu <redacted> --- drivers/regulator/mt6315-regulator.c | 6 ++++++ 1 file changed, 6 insertions(+)diff --git a/drivers/regulator/mt6315-regulator.c b/drivers/regulator/mt6315-regulator.c index 2608a6652d77..092ff748fe21 100644 --- a/drivers/regulator/mt6315-regulator.c +++ b/drivers/regulator/mt6315-regulator.c@@ -218,8 +218,10 @@ static int mt6315_regulator_probe(struct spmi_device *pdev) struct regmap *regmap; struct mt6315_chip *chip; struct mt_regulator_init_data *init_data; + struct device_node *node = pdev->dev.of_node; struct regulator_config config = {}; struct regulator_dev *rdev; + unsigned int val = 0; int i; regmap = devm_regmap_init_spmi_ext(pdev, &mt6315_regmap_config);@@ -247,6 +249,10 @@ static int mt6315_regulator_probe(struct spmi_device *pdev) init_data->modeset_mask[MT6315_VBUCK1] = BIT(MT6315_VBUCK1); break; } + + if (!of_property_read_u32(node, "buck1-modeset-mask", &val)) + init_data->modeset_mask[MT6315_VBUCK1] = val; +
This needs a matching change to the DT bindings. However, please take a look at Angelo's recent series [1] for MT8196 PMICs that also adds variants of the MT6316 series regulators and how it adds compatible strings for various parts to cover 2-phase, 3-phase, and 4-phase settings. Now personally I think a better way would be if we could somehow read back a) the part number, or b) the multi-phase settings from the chip itself, and derive `modeset_mask` automatically. Is that possible? Can MediaTek share this information? ChenYu [1] https://lore.kernel.org/all/20250715140224.206329-1-angelogioacchino.delregno@collabora.com/ (local)
for (i = MT6315_VBUCK2; i < MT6315_VBUCK_MAX; i++)
init_data->modeset_mask[i] = BIT(i);
--
2.46.0