diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max77686.c | 15 | ||||
-rw-r--r-- | drivers/regulator/max8907-regulator.c | 3 | ||||
-rw-r--r-- | drivers/regulator/max8997.c | 39 | ||||
-rw-r--r-- | drivers/regulator/max8998.c | 2 | ||||
-rw-r--r-- | drivers/regulator/of_regulator.c | 6 | ||||
-rw-r--r-- | drivers/regulator/s2mps11.c | 4 | ||||
-rw-r--r-- | drivers/regulator/tps65217-regulator.c | 4 | ||||
-rw-r--r-- | drivers/regulator/tps65910-regulator.c | 2 |
8 files changed, 40 insertions, 35 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index b85040caaea3..cca18a3c0294 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -379,9 +379,10 @@ static struct regulator_desc regulators[] = { | |||
379 | }; | 379 | }; |
380 | 380 | ||
381 | #ifdef CONFIG_OF | 381 | #ifdef CONFIG_OF |
382 | static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | 382 | static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, |
383 | struct max77686_platform_data *pdata) | 383 | struct max77686_platform_data *pdata) |
384 | { | 384 | { |
385 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); | ||
385 | struct device_node *pmic_np, *regulators_np; | 386 | struct device_node *pmic_np, *regulators_np; |
386 | struct max77686_regulator_data *rdata; | 387 | struct max77686_regulator_data *rdata; |
387 | struct of_regulator_match rmatch; | 388 | struct of_regulator_match rmatch; |
@@ -390,15 +391,15 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
390 | pmic_np = iodev->dev->of_node; | 391 | pmic_np = iodev->dev->of_node; |
391 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); | 392 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); |
392 | if (!regulators_np) { | 393 | if (!regulators_np) { |
393 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | 394 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
394 | return -EINVAL; | 395 | return -EINVAL; |
395 | } | 396 | } |
396 | 397 | ||
397 | pdata->num_regulators = ARRAY_SIZE(regulators); | 398 | pdata->num_regulators = ARRAY_SIZE(regulators); |
398 | rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * | 399 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
399 | pdata->num_regulators, GFP_KERNEL); | 400 | pdata->num_regulators, GFP_KERNEL); |
400 | if (!rdata) { | 401 | if (!rdata) { |
401 | dev_err(iodev->dev, | 402 | dev_err(&pdev->dev, |
402 | "could not allocate memory for regulator data\n"); | 403 | "could not allocate memory for regulator data\n"); |
403 | return -ENOMEM; | 404 | return -ENOMEM; |
404 | } | 405 | } |
@@ -407,7 +408,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
407 | rmatch.name = regulators[i].name; | 408 | rmatch.name = regulators[i].name; |
408 | rmatch.init_data = NULL; | 409 | rmatch.init_data = NULL; |
409 | rmatch.of_node = NULL; | 410 | rmatch.of_node = NULL; |
410 | of_regulator_match(iodev->dev, regulators_np, &rmatch, 1); | 411 | of_regulator_match(&pdev->dev, regulators_np, &rmatch, 1); |
411 | rdata[i].initdata = rmatch.init_data; | 412 | rdata[i].initdata = rmatch.init_data; |
412 | rdata[i].of_node = rmatch.of_node; | 413 | rdata[i].of_node = rmatch.of_node; |
413 | } | 414 | } |
@@ -417,7 +418,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
417 | return 0; | 418 | return 0; |
418 | } | 419 | } |
419 | #else | 420 | #else |
420 | static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | 421 | static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, |
421 | struct max77686_platform_data *pdata) | 422 | struct max77686_platform_data *pdata) |
422 | { | 423 | { |
423 | return 0; | 424 | return 0; |
@@ -440,7 +441,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) | |||
440 | } | 441 | } |
441 | 442 | ||
442 | if (iodev->dev->of_node) { | 443 | if (iodev->dev->of_node) { |
443 | ret = max77686_pmic_dt_parse_pdata(iodev, pdata); | 444 | ret = max77686_pmic_dt_parse_pdata(pdev, pdata); |
444 | if (ret) | 445 | if (ret) |
445 | return ret; | 446 | return ret; |
446 | } | 447 | } |
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index d1a77512d83e..d40cf7fdb546 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -237,8 +237,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
237 | return -EINVAL; | 237 | return -EINVAL; |
238 | } | 238 | } |
239 | 239 | ||
240 | ret = of_regulator_match(pdev->dev.parent, regulators, | 240 | ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, |
241 | max8907_matches, | ||
242 | ARRAY_SIZE(max8907_matches)); | 241 | ARRAY_SIZE(max8907_matches)); |
243 | if (ret < 0) { | 242 | if (ret < 0) { |
244 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 243 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 02be7fcae32f..836908ce505e 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -934,7 +934,7 @@ static struct regulator_desc regulators[] = { | |||
934 | }; | 934 | }; |
935 | 935 | ||
936 | #ifdef CONFIG_OF | 936 | #ifdef CONFIG_OF |
937 | static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, | 937 | static int max8997_pmic_dt_parse_dvs_gpio(struct platform_device *pdev, |
938 | struct max8997_platform_data *pdata, | 938 | struct max8997_platform_data *pdata, |
939 | struct device_node *pmic_np) | 939 | struct device_node *pmic_np) |
940 | { | 940 | { |
@@ -944,7 +944,7 @@ static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, | |||
944 | gpio = of_get_named_gpio(pmic_np, | 944 | gpio = of_get_named_gpio(pmic_np, |
945 | "max8997,pmic-buck125-dvs-gpios", i); | 945 | "max8997,pmic-buck125-dvs-gpios", i); |
946 | if (!gpio_is_valid(gpio)) { | 946 | if (!gpio_is_valid(gpio)) { |
947 | dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio); | 947 | dev_err(&pdev->dev, "invalid gpio[%d]: %d\n", i, gpio); |
948 | return -EINVAL; | 948 | return -EINVAL; |
949 | } | 949 | } |
950 | pdata->buck125_gpios[i] = gpio; | 950 | pdata->buck125_gpios[i] = gpio; |
@@ -952,22 +952,23 @@ static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, | |||
952 | return 0; | 952 | return 0; |
953 | } | 953 | } |
954 | 954 | ||
955 | static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | 955 | static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, |
956 | struct max8997_platform_data *pdata) | 956 | struct max8997_platform_data *pdata) |
957 | { | 957 | { |
958 | struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); | ||
958 | struct device_node *pmic_np, *regulators_np, *reg_np; | 959 | struct device_node *pmic_np, *regulators_np, *reg_np; |
959 | struct max8997_regulator_data *rdata; | 960 | struct max8997_regulator_data *rdata; |
960 | unsigned int i, dvs_voltage_nr = 1, ret; | 961 | unsigned int i, dvs_voltage_nr = 1, ret; |
961 | 962 | ||
962 | pmic_np = iodev->dev->of_node; | 963 | pmic_np = iodev->dev->of_node; |
963 | if (!pmic_np) { | 964 | if (!pmic_np) { |
964 | dev_err(iodev->dev, "could not find pmic sub-node\n"); | 965 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
965 | return -ENODEV; | 966 | return -ENODEV; |
966 | } | 967 | } |
967 | 968 | ||
968 | regulators_np = of_find_node_by_name(pmic_np, "regulators"); | 969 | regulators_np = of_find_node_by_name(pmic_np, "regulators"); |
969 | if (!regulators_np) { | 970 | if (!regulators_np) { |
970 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | 971 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
971 | return -EINVAL; | 972 | return -EINVAL; |
972 | } | 973 | } |
973 | 974 | ||
@@ -976,11 +977,10 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
976 | for_each_child_of_node(regulators_np, reg_np) | 977 | for_each_child_of_node(regulators_np, reg_np) |
977 | pdata->num_regulators++; | 978 | pdata->num_regulators++; |
978 | 979 | ||
979 | rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * | 980 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
980 | pdata->num_regulators, GFP_KERNEL); | 981 | pdata->num_regulators, GFP_KERNEL); |
981 | if (!rdata) { | 982 | if (!rdata) { |
982 | dev_err(iodev->dev, "could not allocate memory for " | 983 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); |
983 | "regulator data\n"); | ||
984 | return -ENOMEM; | 984 | return -ENOMEM; |
985 | } | 985 | } |
986 | 986 | ||
@@ -991,14 +991,14 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
991 | break; | 991 | break; |
992 | 992 | ||
993 | if (i == ARRAY_SIZE(regulators)) { | 993 | if (i == ARRAY_SIZE(regulators)) { |
994 | dev_warn(iodev->dev, "don't know how to configure " | 994 | dev_warn(&pdev->dev, "don't know how to configure regulator %s\n", |
995 | "regulator %s\n", reg_np->name); | 995 | reg_np->name); |
996 | continue; | 996 | continue; |
997 | } | 997 | } |
998 | 998 | ||
999 | rdata->id = i; | 999 | rdata->id = i; |
1000 | rdata->initdata = of_get_regulator_init_data( | 1000 | rdata->initdata = of_get_regulator_init_data(&pdev->dev, |
1001 | iodev->dev, reg_np); | 1001 | reg_np); |
1002 | rdata->reg_node = reg_np; | 1002 | rdata->reg_node = reg_np; |
1003 | rdata++; | 1003 | rdata++; |
1004 | } | 1004 | } |
@@ -1014,7 +1014,7 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
1014 | 1014 | ||
1015 | if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || | 1015 | if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || |
1016 | pdata->buck5_gpiodvs) { | 1016 | pdata->buck5_gpiodvs) { |
1017 | ret = max8997_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np); | 1017 | ret = max8997_pmic_dt_parse_dvs_gpio(pdev, pdata, pmic_np); |
1018 | if (ret) | 1018 | if (ret) |
1019 | return -EINVAL; | 1019 | return -EINVAL; |
1020 | 1020 | ||
@@ -1025,8 +1025,7 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
1025 | } else { | 1025 | } else { |
1026 | if (pdata->buck125_default_idx >= 8) { | 1026 | if (pdata->buck125_default_idx >= 8) { |
1027 | pdata->buck125_default_idx = 0; | 1027 | pdata->buck125_default_idx = 0; |
1028 | dev_info(iodev->dev, "invalid value for " | 1028 | dev_info(&pdev->dev, "invalid value for default dvs index, using 0 instead\n"); |
1029 | "default dvs index, using 0 instead\n"); | ||
1030 | } | 1029 | } |
1031 | } | 1030 | } |
1032 | 1031 | ||
@@ -1040,28 +1039,28 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
1040 | if (of_property_read_u32_array(pmic_np, | 1039 | if (of_property_read_u32_array(pmic_np, |
1041 | "max8997,pmic-buck1-dvs-voltage", | 1040 | "max8997,pmic-buck1-dvs-voltage", |
1042 | pdata->buck1_voltage, dvs_voltage_nr)) { | 1041 | pdata->buck1_voltage, dvs_voltage_nr)) { |
1043 | dev_err(iodev->dev, "buck1 voltages not specified\n"); | 1042 | dev_err(&pdev->dev, "buck1 voltages not specified\n"); |
1044 | return -EINVAL; | 1043 | return -EINVAL; |
1045 | } | 1044 | } |
1046 | 1045 | ||
1047 | if (of_property_read_u32_array(pmic_np, | 1046 | if (of_property_read_u32_array(pmic_np, |
1048 | "max8997,pmic-buck2-dvs-voltage", | 1047 | "max8997,pmic-buck2-dvs-voltage", |
1049 | pdata->buck2_voltage, dvs_voltage_nr)) { | 1048 | pdata->buck2_voltage, dvs_voltage_nr)) { |
1050 | dev_err(iodev->dev, "buck2 voltages not specified\n"); | 1049 | dev_err(&pdev->dev, "buck2 voltages not specified\n"); |
1051 | return -EINVAL; | 1050 | return -EINVAL; |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | if (of_property_read_u32_array(pmic_np, | 1053 | if (of_property_read_u32_array(pmic_np, |
1055 | "max8997,pmic-buck5-dvs-voltage", | 1054 | "max8997,pmic-buck5-dvs-voltage", |
1056 | pdata->buck5_voltage, dvs_voltage_nr)) { | 1055 | pdata->buck5_voltage, dvs_voltage_nr)) { |
1057 | dev_err(iodev->dev, "buck5 voltages not specified\n"); | 1056 | dev_err(&pdev->dev, "buck5 voltages not specified\n"); |
1058 | return -EINVAL; | 1057 | return -EINVAL; |
1059 | } | 1058 | } |
1060 | 1059 | ||
1061 | return 0; | 1060 | return 0; |
1062 | } | 1061 | } |
1063 | #else | 1062 | #else |
1064 | static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | 1063 | static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, |
1065 | struct max8997_platform_data *pdata) | 1064 | struct max8997_platform_data *pdata) |
1066 | { | 1065 | { |
1067 | return 0; | 1066 | return 0; |
@@ -1085,7 +1084,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) | |||
1085 | } | 1084 | } |
1086 | 1085 | ||
1087 | if (iodev->dev->of_node) { | 1086 | if (iodev->dev->of_node) { |
1088 | ret = max8997_pmic_dt_parse_pdata(iodev, pdata); | 1087 | ret = max8997_pmic_dt_parse_pdata(pdev, pdata); |
1089 | if (ret) | 1088 | if (ret) |
1090 | return ret; | 1089 | return ret; |
1091 | } | 1090 | } |
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 1f0df4046b86..0a8dd1cbee6f 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -65,7 +65,7 @@ static const struct voltage_map_desc ldo9_voltage_map_desc = { | |||
65 | .min = 2800000, .step = 100000, .max = 3100000, | 65 | .min = 2800000, .step = 100000, .max = 3100000, |
66 | }; | 66 | }; |
67 | static const struct voltage_map_desc ldo10_voltage_map_desc = { | 67 | static const struct voltage_map_desc ldo10_voltage_map_desc = { |
68 | .min = 95000, .step = 50000, .max = 1300000, | 68 | .min = 950000, .step = 50000, .max = 1300000, |
69 | }; | 69 | }; |
70 | static const struct voltage_map_desc ldo1213_voltage_map_desc = { | 70 | static const struct voltage_map_desc ldo1213_voltage_map_desc = { |
71 | .min = 800000, .step = 100000, .max = 3300000, | 71 | .min = 800000, .step = 100000, .max = 3300000, |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 6f684916fd79..66ca769287ab 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
@@ -120,6 +120,12 @@ int of_regulator_match(struct device *dev, struct device_node *node, | |||
120 | if (!dev || !node) | 120 | if (!dev || !node) |
121 | return -EINVAL; | 121 | return -EINVAL; |
122 | 122 | ||
123 | for (i = 0; i < num_matches; i++) { | ||
124 | struct of_regulator_match *match = &matches[i]; | ||
125 | match->init_data = NULL; | ||
126 | match->of_node = NULL; | ||
127 | } | ||
128 | |||
123 | for_each_child_of_node(node, child) { | 129 | for_each_child_of_node(node, child) { |
124 | name = of_get_property(child, | 130 | name = of_get_property(child, |
125 | "regulator-compatible", NULL); | 131 | "regulator-compatible", NULL); |
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index bd062a2ffbe2..cd9ea2ea1826 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
@@ -174,9 +174,9 @@ static struct regulator_ops s2mps11_buck_ops = { | |||
174 | .min_uV = S2MPS11_BUCK_MIN2, \ | 174 | .min_uV = S2MPS11_BUCK_MIN2, \ |
175 | .uV_step = S2MPS11_BUCK_STEP2, \ | 175 | .uV_step = S2MPS11_BUCK_STEP2, \ |
176 | .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ | 176 | .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ |
177 | .vsel_reg = S2MPS11_REG_B9CTRL2, \ | 177 | .vsel_reg = S2MPS11_REG_B10CTRL2, \ |
178 | .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \ | 178 | .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \ |
179 | .enable_reg = S2MPS11_REG_B9CTRL1, \ | 179 | .enable_reg = S2MPS11_REG_B10CTRL1, \ |
180 | .enable_mask = S2MPS11_ENABLE_MASK \ | 180 | .enable_mask = S2MPS11_ENABLE_MASK \ |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index 73dce7664126..df395187c063 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c | |||
@@ -305,8 +305,8 @@ static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) | |||
305 | if (!regs) | 305 | if (!regs) |
306 | return NULL; | 306 | return NULL; |
307 | 307 | ||
308 | count = of_regulator_match(pdev->dev.parent, regs, | 308 | count = of_regulator_match(&pdev->dev, regs, reg_matches, |
309 | reg_matches, TPS65217_NUM_REGULATOR); | 309 | TPS65217_NUM_REGULATOR); |
310 | of_node_put(regs); | 310 | of_node_put(regs); |
311 | if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) | 311 | if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) |
312 | return NULL; | 312 | return NULL; |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 59c3770fa77d..b0e4c0bc85c3 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -998,7 +998,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
998 | return NULL; | 998 | return NULL; |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | ret = of_regulator_match(pdev->dev.parent, regulators, matches, count); | 1001 | ret = of_regulator_match(&pdev->dev, regulators, matches, count); |
1002 | if (ret < 0) { | 1002 | if (ret < 0) { |
1003 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 1003 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
1004 | ret); | 1004 | ret); |