diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-06-08 03:41:48 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-17 16:01:21 -0400 |
commit | 34e74f39fa9a2c1489444266cc9e973dc1b3a419 (patch) | |
tree | bfa49ea87b6779fb19be3673b28f8bb191e11865 /drivers/regulator/mc13xxx-regulator-core.c | |
parent | ee5e6253ac22210da892435711890fa2272daa41 (diff) |
regulator: mc13xxx: Convert to regulator_list_voltage_table
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/mc13xxx-regulator-core.c')
-rw-r--r-- | drivers/regulator/mc13xxx-regulator-core.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 3e191715fb25..8a6b050ff5aa 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
@@ -80,20 +80,6 @@ static int mc13xxx_regulator_is_enabled(struct regulator_dev *rdev) | |||
80 | return (val & mc13xxx_regulators[id].enable_bit) != 0; | 80 | return (val & mc13xxx_regulators[id].enable_bit) != 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | int mc13xxx_regulator_list_voltage(struct regulator_dev *rdev, | ||
84 | unsigned selector) | ||
85 | { | ||
86 | int id = rdev_get_id(rdev); | ||
87 | struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev); | ||
88 | struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators; | ||
89 | |||
90 | if (selector >= mc13xxx_regulators[id].desc.n_voltages) | ||
91 | return -EINVAL; | ||
92 | |||
93 | return mc13xxx_regulators[id].voltages[selector]; | ||
94 | } | ||
95 | EXPORT_SYMBOL_GPL(mc13xxx_regulator_list_voltage); | ||
96 | |||
97 | static int mc13xxx_regulator_set_voltage_sel(struct regulator_dev *rdev, | 83 | static int mc13xxx_regulator_set_voltage_sel(struct regulator_dev *rdev, |
98 | unsigned selector) | 84 | unsigned selector) |
99 | { | 85 | { |
@@ -135,14 +121,14 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev) | |||
135 | 121 | ||
136 | BUG_ON(val >= mc13xxx_regulators[id].desc.n_voltages); | 122 | BUG_ON(val >= mc13xxx_regulators[id].desc.n_voltages); |
137 | 123 | ||
138 | return mc13xxx_regulators[id].voltages[val]; | 124 | return rdev->desc->volt_table[val]; |
139 | } | 125 | } |
140 | 126 | ||
141 | struct regulator_ops mc13xxx_regulator_ops = { | 127 | struct regulator_ops mc13xxx_regulator_ops = { |
142 | .enable = mc13xxx_regulator_enable, | 128 | .enable = mc13xxx_regulator_enable, |
143 | .disable = mc13xxx_regulator_disable, | 129 | .disable = mc13xxx_regulator_disable, |
144 | .is_enabled = mc13xxx_regulator_is_enabled, | 130 | .is_enabled = mc13xxx_regulator_is_enabled, |
145 | .list_voltage = mc13xxx_regulator_list_voltage, | 131 | .list_voltage = regulator_list_voltage_table, |
146 | .set_voltage_sel = mc13xxx_regulator_set_voltage_sel, | 132 | .set_voltage_sel = mc13xxx_regulator_set_voltage_sel, |
147 | .get_voltage = mc13xxx_regulator_get_voltage, | 133 | .get_voltage = mc13xxx_regulator_get_voltage, |
148 | }; | 134 | }; |
@@ -151,15 +137,13 @@ EXPORT_SYMBOL_GPL(mc13xxx_regulator_ops); | |||
151 | int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev, int min_uV, | 137 | int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev, int min_uV, |
152 | int max_uV, unsigned *selector) | 138 | int max_uV, unsigned *selector) |
153 | { | 139 | { |
154 | struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev); | ||
155 | struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators; | ||
156 | int id = rdev_get_id(rdev); | 140 | int id = rdev_get_id(rdev); |
157 | 141 | ||
158 | dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n", | 142 | dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n", |
159 | __func__, id, min_uV, max_uV); | 143 | __func__, id, min_uV, max_uV); |
160 | 144 | ||
161 | if (min_uV <= mc13xxx_regulators[id].voltages[0] && | 145 | if (min_uV <= rdev->desc->volt_table[0] && |
162 | mc13xxx_regulators[id].voltages[0] <= max_uV) | 146 | rdev->desc->volt_table[0] <= max_uV) |
163 | return 0; | 147 | return 0; |
164 | else | 148 | else |
165 | return -EINVAL; | 149 | return -EINVAL; |
@@ -168,13 +152,11 @@ EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_set_voltage); | |||
168 | 152 | ||
169 | int mc13xxx_fixed_regulator_get_voltage(struct regulator_dev *rdev) | 153 | int mc13xxx_fixed_regulator_get_voltage(struct regulator_dev *rdev) |
170 | { | 154 | { |
171 | struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev); | ||
172 | struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators; | ||
173 | int id = rdev_get_id(rdev); | 155 | int id = rdev_get_id(rdev); |
174 | 156 | ||
175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id); | 157 | dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id); |
176 | 158 | ||
177 | return mc13xxx_regulators[id].voltages[0]; | 159 | return rdev->desc->volt_table[0]; |
178 | } | 160 | } |
179 | EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_get_voltage); | 161 | EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_get_voltage); |
180 | 162 | ||
@@ -182,7 +164,7 @@ struct regulator_ops mc13xxx_fixed_regulator_ops = { | |||
182 | .enable = mc13xxx_regulator_enable, | 164 | .enable = mc13xxx_regulator_enable, |
183 | .disable = mc13xxx_regulator_disable, | 165 | .disable = mc13xxx_regulator_disable, |
184 | .is_enabled = mc13xxx_regulator_is_enabled, | 166 | .is_enabled = mc13xxx_regulator_is_enabled, |
185 | .list_voltage = mc13xxx_regulator_list_voltage, | 167 | .list_voltage = regulator_list_voltage_table, |
186 | .set_voltage = mc13xxx_fixed_regulator_set_voltage, | 168 | .set_voltage = mc13xxx_fixed_regulator_set_voltage, |
187 | .get_voltage = mc13xxx_fixed_regulator_get_voltage, | 169 | .get_voltage = mc13xxx_fixed_regulator_get_voltage, |
188 | }; | 170 | }; |