From 66c22af1921ad0cac19e29971de528fb3a4c6e96 Mon Sep 17 00:00:00 2001 From: "Ying-Chun Liu (PaulLiu)" Date: Fri, 13 Apr 2012 21:37:41 +0800 Subject: [PATCH] --- yaml --- r: 302207 b: refs/heads/master c: 88c84c14cca44d9409f1733dfdecc1f473463f20 h: refs/heads/master i: 302205: 3fa0da24250c05fa17bbe61c2fd30aa46696b250 302203: 051c50b6ca462bd9c7480f7ec7c6eca99cd27b71 302199: 8357fd21ca26f20108537c137c97143df9105ee8 302191: fb7af3c0f006afc27037ceb0550ac0e780de9c86 302175: 9e7a0b449f2b0979eea412c2433b6eca16a9db8c 302143: 04905db0639720a908dbd3b9dc148c038880763f 302079: efcea516635255e6beecec5423d8abc36a23fe79 v: v3 --- [refs] | 2 +- trunk/drivers/regulator/da9052-regulator.c | 29 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 135133f943c4..ab8d9ab52019 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4d26f7d581b7cff8e5efd0bf9c1867caa09a1e90 +refs/heads/master: 88c84c14cca44d9409f1733dfdecc1f473463f20 diff --git a/trunk/drivers/regulator/da9052-regulator.c b/trunk/drivers/regulator/da9052-regulator.c index b6c8c4be83c9..2678cbe91d9d 100644 --- a/trunk/drivers/regulator/da9052-regulator.c +++ b/trunk/drivers/regulator/da9052-regulator.c @@ -19,6 +19,9 @@ #include #include #include +#ifdef CONFIG_OF +#include +#endif #include #include @@ -425,8 +428,32 @@ static int __devinit da9052_regulator_probe(struct platform_device *pdev) } config.dev = &pdev->dev; - config.init_data = pdata->regulators[pdev->id]; config.driver_data = regulator; + if (pdata && pdata->regulators) { + config.init_data = pdata->regulators[pdev->id]; + } else { +#ifdef CONFIG_OF + struct device_node *nproot = da9052->dev->of_node; + struct device_node *np; + + if (!nproot) + return -ENODEV; + + nproot = of_find_node_by_name(nproot, "regulators"); + if (!nproot) + return -ENODEV; + + for (np = of_get_next_child(nproot, NULL); !np; + np = of_get_next_child(nproot, np)) { + if (!of_node_cmp(np->name, + regulator->info->reg_desc.name)) { + config.init_data = of_get_regulator_init_data( + &pdev->dev, np); + break; + } + } +#endif + } regulator->rdev = regulator_register(®ulator->info->reg_desc, &config);