diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-05-20 12:18:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-20 13:22:41 -0400 |
commit | 84df8c1241beb87fec73415ef4f6e627aca34835 (patch) | |
tree | fd863e664653e8a3aad7026f7564659bc584f4c8 /drivers/regulator | |
parent | 92ab953bd6477b816e8ddd2cf9eaed063332013a (diff) |
regulator: tps65910: use of_node of matched regulator being register
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | 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 8b31f073c6f3..8dc3d9392bfa 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -1071,7 +1071,8 @@ static struct of_regulator_match tps65911_matches[] = { | |||
1071 | }; | 1071 | }; |
1072 | 1072 | ||
1073 | static struct tps65910_board *tps65910_parse_dt_reg_data( | 1073 | static struct tps65910_board *tps65910_parse_dt_reg_data( |
1074 | struct platform_device *pdev) | 1074 | struct platform_device *pdev, |
1075 | struct of_regulator_match **tps65910_reg_matches) | ||
1075 | { | 1076 | { |
1076 | struct tps65910_board *pmic_plat_data; | 1077 | struct tps65910_board *pmic_plat_data; |
1077 | struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); | 1078 | struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); |
@@ -1116,6 +1117,8 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
1116 | return NULL; | 1117 | return NULL; |
1117 | } | 1118 | } |
1118 | 1119 | ||
1120 | *tps65910_reg_matches = matches; | ||
1121 | |||
1119 | for (idx = 0; idx < count; idx++) { | 1122 | for (idx = 0; idx < count; idx++) { |
1120 | if (!matches[idx].init_data || !matches[idx].of_node) | 1123 | if (!matches[idx].init_data || !matches[idx].of_node) |
1121 | continue; | 1124 | continue; |
@@ -1133,8 +1136,10 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
1133 | } | 1136 | } |
1134 | #else | 1137 | #else |
1135 | static inline struct tps65910_board *tps65910_parse_dt_reg_data( | 1138 | static inline struct tps65910_board *tps65910_parse_dt_reg_data( |
1136 | struct platform_device *pdev) | 1139 | struct platform_device *pdev, |
1140 | struct of_regulator_match **tps65910_reg_matches) | ||
1137 | { | 1141 | { |
1142 | *tps65910_reg_matches = NULL; | ||
1138 | return 0; | 1143 | return 0; |
1139 | } | 1144 | } |
1140 | #endif | 1145 | #endif |
@@ -1148,11 +1153,13 @@ static __devinit int tps65910_probe(struct platform_device *pdev) | |||
1148 | struct regulator_dev *rdev; | 1153 | struct regulator_dev *rdev; |
1149 | struct tps65910_reg *pmic; | 1154 | struct tps65910_reg *pmic; |
1150 | struct tps65910_board *pmic_plat_data; | 1155 | struct tps65910_board *pmic_plat_data; |
1156 | struct of_regulator_match *tps65910_reg_matches = NULL; | ||
1151 | int i, err; | 1157 | int i, err; |
1152 | 1158 | ||
1153 | pmic_plat_data = dev_get_platdata(tps65910->dev); | 1159 | pmic_plat_data = dev_get_platdata(tps65910->dev); |
1154 | if (!pmic_plat_data && tps65910->dev->of_node) | 1160 | if (!pmic_plat_data && tps65910->dev->of_node) |
1155 | pmic_plat_data = tps65910_parse_dt_reg_data(pdev); | 1161 | pmic_plat_data = tps65910_parse_dt_reg_data(pdev, |
1162 | &tps65910_reg_matches); | ||
1156 | 1163 | ||
1157 | if (!pmic_plat_data) { | 1164 | if (!pmic_plat_data) { |
1158 | dev_err(&pdev->dev, "Platform data not found\n"); | 1165 | dev_err(&pdev->dev, "Platform data not found\n"); |
@@ -1265,10 +1272,8 @@ static __devinit int tps65910_probe(struct platform_device *pdev) | |||
1265 | config.driver_data = pmic; | 1272 | config.driver_data = pmic; |
1266 | config.regmap = tps65910->regmap; | 1273 | config.regmap = tps65910->regmap; |
1267 | 1274 | ||
1268 | #ifdef CONFIG_OF | 1275 | if (tps65910_reg_matches) |
1269 | config.of_node = of_find_node_by_name(tps65910->dev->of_node, | 1276 | config.of_node = tps65910_reg_matches[i].of_node; |
1270 | info->name); | ||
1271 | #endif | ||
1272 | 1277 | ||
1273 | rdev = regulator_register(&pmic->desc[i], &config); | 1278 | rdev = regulator_register(&pmic->desc[i], &config); |
1274 | if (IS_ERR(rdev)) { | 1279 | if (IS_ERR(rdev)) { |