From: Laxman Dewangan <ldewangan@nvidia.com>
To: <lrg@ti.com>, <broonie@opensource.wolfsonmicro.com>
Cc: <linux-kernel@vger.kernel.org>, Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V2 3/3] regulator: tps65910: use of_node of matched regulator being register
Date: Sun, 20 May 2012 21:48:50 +0530 [thread overview]
Message-ID: <1337530730-16605-4-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1337530730-16605-1-git-send-email-ldewangan@nvidia.com>
After getting matched regulators by using of_regulator_match(),
initialize the config.of_node of regulator being register with
of_regulator_match.of_node of that regulator.
This is require for supporting regulator consumers in dt.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Changes from V1:
This is discussed in details on patch
regulator: core: use correct device for device supply lookup
with other issue of input_supply and decided to have the implementation
similar to the mc13892-regulator.c.
In this patch making the implementation very similar to
mc13892-regulator.c. config.of_node for regulator being
register is initialize with of_regulator_match.of_node
which get initialized by calling of_regulator_match.
drivers/regulator/tps65910-regulator.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index 0190f29..4e01a42 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1071,7 +1071,8 @@ static struct of_regulator_match tps65911_matches[] = {
};
static struct tps65910_board *tps65910_parse_dt_reg_data(
- struct platform_device *pdev)
+ struct platform_device *pdev,
+ struct of_regulator_match **tps65910_reg_matches)
{
struct tps65910_board *pmic_plat_data;
struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
@@ -1116,6 +1117,8 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
return NULL;
}
+ *tps65910_reg_matches = matches;
+
for (idx = 0; idx < count; idx++) {
if (!matches[idx].init_data || !matches[idx].of_node)
continue;
@@ -1133,8 +1136,10 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
}
#else
static inline struct tps65910_board *tps65910_parse_dt_reg_data(
- struct platform_device *pdev)
+ struct platform_device *pdev,
+ struct of_regulator_match **tps65910_reg_matches)
{
+ *tps65910_reg_matches = NULL;
return 0;
}
#endif
@@ -1148,11 +1153,13 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
struct regulator_dev *rdev;
struct tps65910_reg *pmic;
struct tps65910_board *pmic_plat_data;
+ struct of_regulator_match *tps65910_reg_matches = NULL;
int i, err;
pmic_plat_data = dev_get_platdata(tps65910->dev);
if (!pmic_plat_data && tps65910->dev->of_node)
- pmic_plat_data = tps65910_parse_dt_reg_data(pdev);
+ pmic_plat_data = tps65910_parse_dt_reg_data(pdev,
+ &tps65910_reg_matches);
if (!pmic_plat_data) {
dev_err(&pdev->dev, "Platform data not found\n");
@@ -1265,10 +1272,8 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
config.driver_data = pmic;
config.regmap = tps65910->regmap;
-#ifdef CONFIG_OF
- config.of_node = of_find_node_by_name(tps65910->dev->of_node,
- info->name);
-#endif
+ if (tps65910_reg_matches)
+ config.of_node = tps65910_reg_matches[i].of_node;
rdev = regulator_register(&pmic->desc[i], &config);
if (IS_ERR(rdev)) {
--
1.7.1.1
next prev parent reply other threads:[~2012-05-20 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-20 16:18 [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Laxman Dewangan
2012-05-20 16:18 ` [PATCH 1/3] regulator: tps65910: add error message in case of failure Laxman Dewangan
2012-05-20 17:23 ` Mark Brown
2012-05-20 16:18 ` [PATCH 2/3] regulator: tps65910: dt: support when "regulators" node found Laxman Dewangan
2012-05-20 16:18 ` Laxman Dewangan [this message]
2012-05-20 17:23 ` [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Mark Brown
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=1337530730-16605-4-git-send-email-ldewangan@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
/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®