aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-07-19 01:06:22 -0400
committerMark Brown <broonie@linaro.org>2013-07-19 14:08:37 -0400
commit6625d9d297f28741d42a4ba712338a05f7464bd6 (patch)
treeb03364d11eb0250c0449ec65c572507e1cf7dd75
parent7c45f60b42e0f916aaf31fedf8e8afeaf585ee90 (diff)
regulator: 88pm800: Add missing n_voltages setting for bucks
Some regulator APIs are broken if n_voltages setting is not set. e.g. regulator_count_voltages(), regulator_list_voltage(), and regulator_can_change_voltage() do not work if n_voltages setting is missing. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/regulator/88pm800.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c
index fc0c352c98df..b4c29b1c52a5 100644
--- a/drivers/regulator/88pm800.c
+++ b/drivers/regulator/88pm800.c
@@ -91,8 +91,9 @@ struct pm800_regulators {
91 * amax - the current 91 * amax - the current
92 * Buck has 2 kinds of voltage steps. It is easy to find voltage by ranges, 92 * Buck has 2 kinds of voltage steps. It is easy to find voltage by ranges,
93 * not the constant voltage table. 93 * not the constant voltage table.
94 * n_volt - Number of available selectors
94 */ 95 */
95#define PM800_BUCK(vreg, ereg, ebit, amax, volt_ranges) \ 96#define PM800_BUCK(vreg, ereg, ebit, amax, volt_ranges, n_volt) \
96{ \ 97{ \
97 .desc = { \ 98 .desc = { \
98 .name = #vreg, \ 99 .name = #vreg, \
@@ -100,6 +101,7 @@ struct pm800_regulators {
100 .type = REGULATOR_VOLTAGE, \ 101 .type = REGULATOR_VOLTAGE, \
101 .id = PM800_ID_##vreg, \ 102 .id = PM800_ID_##vreg, \
102 .owner = THIS_MODULE, \ 103 .owner = THIS_MODULE, \
104 .n_voltages = n_volt, \
103 .linear_ranges = volt_ranges, \ 105 .linear_ranges = volt_ranges, \
104 .n_linear_ranges = ARRAY_SIZE(volt_ranges), \ 106 .n_linear_ranges = ARRAY_SIZE(volt_ranges), \
105 .vsel_reg = PM800_##vreg, \ 107 .vsel_reg = PM800_##vreg, \
@@ -204,11 +206,11 @@ static struct regulator_ops pm800_volt_table_ops = {
204 206
205/* The array is indexed by id(PM800_ID_XXX) */ 207/* The array is indexed by id(PM800_ID_XXX) */
206static struct pm800_regulator_info pm800_regulator_info[] = { 208static struct pm800_regulator_info pm800_regulator_info[] = {
207 PM800_BUCK(BUCK1, BUCK_ENA, 0, 3000000, buck1_volt_range), 209 PM800_BUCK(BUCK1, BUCK_ENA, 0, 3000000, buck1_volt_range, 0x55),
208 PM800_BUCK(BUCK2, BUCK_ENA, 1, 1200000, buck2_5_volt_range), 210 PM800_BUCK(BUCK2, BUCK_ENA, 1, 1200000, buck2_5_volt_range, 0x73),
209 PM800_BUCK(BUCK3, BUCK_ENA, 2, 1200000, buck2_5_volt_range), 211 PM800_BUCK(BUCK3, BUCK_ENA, 2, 1200000, buck2_5_volt_range, 0x73),
210 PM800_BUCK(BUCK4, BUCK_ENA, 3, 1200000, buck2_5_volt_range), 212 PM800_BUCK(BUCK4, BUCK_ENA, 3, 1200000, buck2_5_volt_range, 0x73),
211 PM800_BUCK(BUCK5, BUCK_ENA, 4, 1200000, buck2_5_volt_range), 213 PM800_BUCK(BUCK5, BUCK_ENA, 4, 1200000, buck2_5_volt_range, 0x73),
212 214
213 PM800_LDO(LDO1, LDO_ENA1_1, 0, 200000, ldo1_volt_table), 215 PM800_LDO(LDO1, LDO_ENA1_1, 0, 200000, ldo1_volt_table),
214 PM800_LDO(LDO2, LDO_ENA1_1, 1, 10000, ldo2_volt_table), 216 PM800_LDO(LDO2, LDO_ENA1_1, 1, 10000, ldo2_volt_table),