diff options
author | Gyungoh Yoo <jack.yoo@skyworksinc.com> | 2014-12-02 03:05:28 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-12-02 07:22:39 -0500 |
commit | 586b1514e6f66a839612bff612ce6123a84974b3 (patch) | |
tree | 9c4ec5058b681258294bf2d6f396630ca57af99e /drivers/regulator/sky81452-regulator.c | |
parent | 70b5b27c4fbe1e8b6edc29082fcb2b79ef0838b8 (diff) |
regulator: sky81452: Modify Device Tree structure
Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/sky81452-regulator.c')
-rw-r--r-- | drivers/regulator/sky81452-regulator.c | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/drivers/regulator/sky81452-regulator.c b/drivers/regulator/sky81452-regulator.c index 476b80a0abca..647860611916 100644 --- a/drivers/regulator/sky81452-regulator.c +++ b/drivers/regulator/sky81452-regulator.c | |||
@@ -5,9 +5,8 @@ | |||
5 | * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com> | 5 | * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License version 2 |
9 | * Free Software Foundation; either version 2, or (at your option) any | 9 | * as published by the Free Software Foundation. |
10 | * later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, but | 11 | * This program is distributed in the hope that it will be useful, but |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -52,6 +51,8 @@ static const struct regulator_linear_range sky81452_reg_ranges[] = { | |||
52 | 51 | ||
53 | static const struct regulator_desc sky81452_reg = { | 52 | static const struct regulator_desc sky81452_reg = { |
54 | .name = "LOUT", | 53 | .name = "LOUT", |
54 | .of_match = of_match_ptr("lout"), | ||
55 | .regulators_node = of_match_ptr("regulator"), | ||
55 | .ops = &sky81452_reg_ops, | 56 | .ops = &sky81452_reg_ops, |
56 | .type = REGULATOR_VOLTAGE, | 57 | .type = REGULATOR_VOLTAGE, |
57 | .owner = THIS_MODULE, | 58 | .owner = THIS_MODULE, |
@@ -64,30 +65,6 @@ static const struct regulator_desc sky81452_reg = { | |||
64 | .enable_mask = SKY81452_LEN, | 65 | .enable_mask = SKY81452_LEN, |
65 | }; | 66 | }; |
66 | 67 | ||
67 | #ifdef CONFIG_OF | ||
68 | static struct regulator_init_data *sky81452_reg_parse_dt(struct device *dev) | ||
69 | { | ||
70 | struct regulator_init_data *init_data; | ||
71 | struct device_node *np; | ||
72 | |||
73 | np = of_get_child_by_name(dev->parent->of_node, "regulator"); | ||
74 | if (unlikely(!np)) { | ||
75 | dev_err(dev, "regulator node not found"); | ||
76 | return NULL; | ||
77 | } | ||
78 | |||
79 | init_data = of_get_regulator_init_data(dev, np); | ||
80 | |||
81 | of_node_put(np); | ||
82 | return init_data; | ||
83 | } | ||
84 | #else | ||
85 | static struct regulator_init_data *sky81452_reg_parse_dt(struct device *dev) | ||
86 | { | ||
87 | return ERR_PTR(-EINVAL); | ||
88 | } | ||
89 | #endif | ||
90 | |||
91 | static int sky81452_reg_probe(struct platform_device *pdev) | 68 | static int sky81452_reg_probe(struct platform_device *pdev) |
92 | { | 69 | { |
93 | struct device *dev = &pdev->dev; | 70 | struct device *dev = &pdev->dev; |
@@ -95,20 +72,16 @@ static int sky81452_reg_probe(struct platform_device *pdev) | |||
95 | struct regulator_config config = { }; | 72 | struct regulator_config config = { }; |
96 | struct regulator_dev *rdev; | 73 | struct regulator_dev *rdev; |
97 | 74 | ||
98 | if (!init_data) { | 75 | config.dev = dev->parent; |
99 | init_data = sky81452_reg_parse_dt(dev); | ||
100 | if (IS_ERR(init_data)) | ||
101 | return PTR_ERR(init_data); | ||
102 | } | ||
103 | |||
104 | config.dev = dev; | ||
105 | config.init_data = init_data; | 76 | config.init_data = init_data; |
106 | config.of_node = dev->of_node; | 77 | config.of_node = dev->of_node; |
107 | config.regmap = dev_get_drvdata(dev->parent); | 78 | config.regmap = dev_get_drvdata(dev->parent); |
108 | 79 | ||
109 | rdev = devm_regulator_register(dev, &sky81452_reg, &config); | 80 | rdev = devm_regulator_register(dev, &sky81452_reg, &config); |
110 | if (IS_ERR(rdev)) | 81 | if (IS_ERR(rdev)) { |
82 | dev_err(dev, "failed to register. err=%ld\n", PTR_ERR(rdev)); | ||
111 | return PTR_ERR(rdev); | 83 | return PTR_ERR(rdev); |
84 | } | ||
112 | 85 | ||
113 | platform_set_drvdata(pdev, rdev); | 86 | platform_set_drvdata(pdev, rdev); |
114 | 87 | ||
@@ -126,4 +99,4 @@ module_platform_driver(sky81452_reg_driver); | |||
126 | 99 | ||
127 | MODULE_DESCRIPTION("Skyworks SKY81452 Regulator driver"); | 100 | MODULE_DESCRIPTION("Skyworks SKY81452 Regulator driver"); |
128 | MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>"); | 101 | MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>"); |
129 | MODULE_LICENSE("GPL"); | 102 | MODULE_LICENSE("GPL v2"); |