Messages in this thread Patch in this message | | | From | Mark Brown <> | Subject | Applied "regulator: s2mpa01: Convert to use simplified DT parsing" to the regulator tree | Date | Mon, 8 Apr 2019 14:30:38 +0700 (+07) |
| |
The patch
regulator: s2mpa01: Convert to use simplified DT parsing
has been applied to the regulator tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 0677c3ea53dcb38314718e8ed7d851972eabf102 Mon Sep 17 00:00:00 2001 From: Axel Lin <axel.lin@ingics.com> Date: Thu, 4 Apr 2019 23:07:09 +0800 Subject: [PATCH] regulator: s2mpa01: Convert to use simplified DT parsing
Use regulator core's simplified DT parsing code to simply the driver implementation.
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/regulator/s2mpa01.c | 39 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 29 deletions(-)
diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c index 58a1fe583a6c..da11ac5c09f2 100644 --- a/drivers/regulator/s2mpa01.c +++ b/drivers/regulator/s2mpa01.c @@ -20,7 +20,6 @@ #define S2MPA01_REGULATOR_CNT ARRAY_SIZE(regulators) struct s2mpa01_info { - struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX]; int ramp_delay24; int ramp_delay3; int ramp_delay5; @@ -232,6 +231,8 @@ static const struct regulator_ops s2mpa01_buck_ops = { #define regulator_desc_ldo(num, step) { \ .name = "LDO"#num, \ + .of_match = of_match_ptr("LDO"#num), \ + .regulators_node = of_match_ptr("regulators"), \ .id = S2MPA01_LDO##num, \ .ops = &s2mpa01_ldo_ops, \ .type = REGULATOR_VOLTAGE, \ @@ -247,6 +248,8 @@ static const struct regulator_ops s2mpa01_buck_ops = { #define regulator_desc_buck1_4(num) { \ .name = "BUCK"#num, \ + .of_match = of_match_ptr("BUCK"#num), \ + .regulators_node = of_match_ptr("regulators"), \ .id = S2MPA01_BUCK##num, \ .ops = &s2mpa01_buck_ops, \ .type = REGULATOR_VOLTAGE, \ @@ -263,6 +266,8 @@ static const struct regulator_ops s2mpa01_buck_ops = { #define regulator_desc_buck5 { \ .name = "BUCK5", \ + .of_match = of_match_ptr("BUCK5"), \ + .regulators_node = of_match_ptr("regulators"), \ .id = S2MPA01_BUCK5, \ .ops = &s2mpa01_buck_ops, \ .type = REGULATOR_VOLTAGE, \ @@ -279,6 +284,8 @@ static const struct regulator_ops s2mpa01_buck_ops = { #define regulator_desc_buck6_10(num, min, step) { \ .name = "BUCK"#num, \ + .of_match = of_match_ptr("BUCK"#num), \ + .regulators_node = of_match_ptr("regulators"), \ .id = S2MPA01_BUCK##num, \ .ops = &s2mpa01_buck_ops, \ .type = REGULATOR_VOLTAGE, \ @@ -336,9 +343,7 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) { struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); - struct device_node *reg_np = NULL; struct regulator_config config = { }; - struct of_regulator_match *rdata; struct s2mpa01_info *s2mpa01; int i; @@ -346,39 +351,15 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) if (!s2mpa01) return -ENOMEM; - rdata = s2mpa01->rdata; - for (i = 0; i < S2MPA01_REGULATOR_CNT; i++) - rdata[i].name = regulators[i].name; - - if (iodev->dev->of_node) { - reg_np = of_get_child_by_name(iodev->dev->of_node, - "regulators"); - if (!reg_np) { - dev_err(&pdev->dev, - "could not find regulators sub-node\n"); - return -EINVAL; - } - - of_regulator_match(&pdev->dev, reg_np, rdata, - S2MPA01_REGULATOR_MAX); - of_node_put(reg_np); - } - - platform_set_drvdata(pdev, s2mpa01); - - config.dev = &pdev->dev; + config.dev = iodev->dev; config.regmap = iodev->regmap_pmic; config.driver_data = s2mpa01; for (i = 0; i < S2MPA01_REGULATOR_MAX; i++) { struct regulator_dev *rdev; + if (pdata) config.init_data = pdata->regulators[i].initdata; - else - config.init_data = rdata[i].init_data; - - if (reg_np) - config.of_node = rdata[i].of_node; rdev = devm_regulator_register(&pdev->dev, ®ulators[i], &config); -- 2.20.1
| |