From: neil.armstrong@linaro.org
To: kr494167@gmail.com, broonie@kernel.org, lgirdwood@gmail.com
Cc: kancy2333@outlook.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: sgm3804: register rails with their DT nodes
Date: Mon, 20 Jul 2026 18:05:07 +0200 [thread overview]
Message-ID: <0da42fc9-c9d7-4f3a-b81f-e460e8d1c58d@linaro.org> (raw)
In-Reply-To: <20260720105955.105148-1-kr494167@gmail.com>
On 7/20/26 12:59, kr494167@gmail.com wrote:
> From: surendra <kr494167@gmail.com>
>
> The driver locates the pos and neg child nodes to obtain their enable
> GPIOs, but registers both regulators with the parent node. As a result,
> the regulator core does not parse per-rail DT constraints or supplies.
Hmmm, no it does get the constraints properly because the regulator core will
fetch the associated subnodes with the of_match desc property in regulator_of_get_init_node().
This patch solves nothing and duplicates the regulator core behaviour.
Neil
>
> Pass each matching child node in regulator_config.of_node.
>
> Fixes: 0c47e1a8cf5d ("regulator: add SGM3804 Dual Output driver")
> Signed-off-by: surendra <kr494167@gmail.com>
> ---
> drivers/regulator/sgm3804-regulator.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/regulator/sgm3804-regulator.c b/drivers/regulator/sgm3804-regulator.c
> index c3406cfb73d0..531b98460ee3 100644
> --- a/drivers/regulator/sgm3804-regulator.c
> +++ b/drivers/regulator/sgm3804-regulator.c
> @@ -9,6 +9,7 @@
> #include <linux/err.h>
> #include <linux/i2c.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/regmap.h>
> #include <linux/regulator/driver.h>
> #include <linux/regulator/of_regulator.h>
> @@ -268,14 +269,21 @@ static int sgm3804_probe(struct i2c_client *i2c)
>
> for (i = 0; i < ARRAY_SIZE(sgm3804_regulator_desc); i++) {
> struct regulator_config config = { };
> + const struct regulator_desc *reg = &sgm3804_regulator_desc[i];
> struct regulator_dev *rdev;
> + struct device_node *child;
> +
> + child = of_get_child_by_name(dev_of_node(dev), reg->of_match);
> + if (!child)
> + return dev_err_probe(dev, -EINVAL, "missing child '%s'\n",
> + reg->of_match);
>
> config.dev = dev;
> config.regmap = ctx->regmap;
> - config.of_node = dev_of_node(dev);
> + config.of_node = child;
> config.driver_data = ctx;
> - rdev = devm_regulator_register(dev, &sgm3804_regulator_desc[i],
> - &config);
> + rdev = devm_regulator_register(dev, reg, &config);
> + of_node_put(child);
> if (IS_ERR(rdev))
> return dev_err_probe(dev, PTR_ERR(rdev),
> "failed to register regulator %d\n", i);
prev parent reply other threads:[~2026-07-20 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 10:59 kr494167
2026-07-20 16:05 ` neil.armstrong [this message]
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=0da42fc9-c9d7-4f3a-b81f-e460e8d1c58d@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=broonie@kernel.org \
--cc=kancy2333@outlook.com \
--cc=kr494167@gmail.com \
--cc=lgirdwood@gmail.com \
--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
all inboxes | Powered by JetHome®