From: kr494167@gmail.com
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: neil.armstrong@linaro.org, kancy2333@outlook.com,
linux-kernel@vger.kernel.org, surendra <kr494167@gmail.com>
Subject: [PATCH] regulator: sgm3804: register rails with their DT nodes
Date: Mon, 20 Jul 2026 16:29:55 +0530 [thread overview]
Message-ID: <20260720105955.105148-1-kr494167@gmail.com> (raw)
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.
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);
--
2.55.0
next reply other threads:[~2026-07-20 11:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 10:59 kr494167 [this message]
2026-07-20 16:05 ` neil.armstrong
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=20260720105955.105148-1-kr494167@gmail.com \
--to=kr494167@gmail.com \
--cc=broonie@kernel.org \
--cc=kancy2333@outlook.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.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
Powered by JetHome