* [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register.
@ 2012-05-20 16:18 Laxman Dewangan
2012-05-20 16:18 ` [PATCH 1/3] regulator: tps65910: add error message in case of failure Laxman Dewangan
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-20 16:18 UTC (permalink / raw)
To: lrg, broonie; +Cc: linux-kernel, Laxman Dewangan
Initialize config.of_node for regulator before registering.
This is needed for DT based regulator support.
Regulator stores this of_node value in rdev->dev.of_node
and used for lookup when client ask for regulator_get().
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/regulator/tps62360-regulator.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index b5be0d0..e534269 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -490,6 +490,7 @@ static int __devinit tps62360_probe(struct i2c_client *client,
config.dev = &client->dev;
config.init_data = pdata->reg_init_data;
config.driver_data = tps;
+ config.of_node = client->dev.of_node;
/* Register the regulators */
rdev = regulator_register(&tps->desc, &config);
--
1.7.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/3] regulator: tps65910: add error message in case of failure
2012-05-20 16:18 [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Laxman Dewangan
@ 2012-05-20 16:18 ` 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
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-20 16:18 UTC (permalink / raw)
To: lrg, broonie; +Cc: linux-kernel, Laxman Dewangan
Prints error message whenever there is failure on resource
allocation.
Also used dev_* to print messages instead of pr_*
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Resend: This was sent earlier on other series as 5/5 and it
was ok but due to discussion on other patches it did not apply.
Making the changes as first of this series.
drivers/regulator/tps65910-regulator.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index 57d3993..94c1801 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1101,7 +1101,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
matches = tps65911_matches;
break;
default:
- pr_err("Invalid tps chip version\n");
+ dev_err(&pdev->dev, "Invalid tps chip version\n");
return NULL;
}
@@ -1150,12 +1150,16 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
if (!pmic_plat_data && tps65910->dev->of_node)
pmic_plat_data = tps65910_parse_dt_reg_data(pdev);
- if (!pmic_plat_data)
+ if (!pmic_plat_data) {
+ dev_err(&pdev->dev, "Platform data not found\n");
return -EINVAL;
+ }
pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
- if (!pmic)
+ if (!pmic) {
+ dev_err(&pdev->dev, "Memory allocation failed for pmic\n");
return -ENOMEM;
+ }
mutex_init(&pmic->mutex);
pmic->mfd = tps65910;
@@ -1179,7 +1183,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
info = tps65911_regs;
break;
default:
- pr_err("Invalid tps chip version\n");
+ dev_err(&pdev->dev, "Invalid tps chip version\n");
return -ENODEV;
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] regulator: tps65910: dt: support when "regulators" node found
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 16:18 ` Laxman Dewangan
2012-05-20 16:18 ` [PATCH V2 3/3] regulator: tps65910: use of_node of matched regulator being register Laxman Dewangan
2012-05-20 17:23 ` [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-20 16:18 UTC (permalink / raw)
To: lrg, broonie; +Cc: linux-kernel, Laxman Dewangan
The device tree binding for the tps65910 is described as:
tps65911 {
reg = <0x2d>
:::::::::
regulators {
compatible = "ti,tps65911";
ldo1_reg: ldo1 {
/** regulator entry */
};
ldo2_reg: ldo2 {
/** regulator entry */
};
::::::::::
};
};
Support the regulators functionality only when there is "regulators"
child node available for tps65910.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/regulator/tps65910-regulator.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index 94c1801..0190f29 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1090,6 +1090,10 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
}
regulators = of_find_node_by_name(np, "regulators");
+ if (!regulators) {
+ dev_err(&pdev->dev, "regulator node not found\n");
+ return NULL;
+ }
switch (tps65910_chip_id(tps65910)) {
case TPS65910:
--
1.7.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 3/3] regulator: tps65910: use of_node of matched regulator being register
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 16:18 ` [PATCH 2/3] regulator: tps65910: dt: support when "regulators" node found Laxman Dewangan
@ 2012-05-20 16:18 ` Laxman Dewangan
2012-05-20 17:23 ` [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-20 16:18 UTC (permalink / raw)
To: lrg, broonie; +Cc: linux-kernel, Laxman Dewangan
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register.
2012-05-20 16:18 [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Laxman Dewangan
` (2 preceding siblings ...)
2012-05-20 16:18 ` [PATCH V2 3/3] regulator: tps65910: use of_node of matched regulator being register Laxman Dewangan
@ 2012-05-20 17:23 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-05-20 17:23 UTC (permalink / raw)
To: Laxman Dewangan; +Cc: lrg, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
On Sun, May 20, 2012 at 09:48:47PM +0530, Laxman Dewangan wrote:
> Initialize config.of_node for regulator before registering.
> This is needed for DT based regulator support.
> Regulator stores this of_node value in rdev->dev.of_node
> and used for lookup when client ask for regulator_get().
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] regulator: tps65910: add error message in case of failure
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
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-05-20 17:23 UTC (permalink / raw)
To: Laxman Dewangan; +Cc: lrg, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 214 bytes --]
On Sun, May 20, 2012 at 09:48:48PM +0530, Laxman Dewangan wrote:
> Prints error message whenever there is failure on resource
> allocation.
> Also used dev_* to print messages instead of pr_*
Applied all, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-20 17:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH V2 3/3] regulator: tps65910: use of_node of matched regulator being register Laxman Dewangan
2012-05-20 17:23 ` [PATCH] regulator: tps62360: dt: initialize of_node param for regulator register Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.