aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-04-20 12:18:20 +0530
committerSrinidhi KASAGAR <srinidhi.kasagar@stericsson.com>2011-04-21 11:05:30 +0200
commit1c83b370b1e01e847692e835e738b4eddf17054d (patch)
tree2e70bd3136e2d8943bbbf5cfeb231a53c17a60ce /drivers/regulator
parent2db6c03433da1528c46cc8963aeb71084fea2ed8 (diff)
regulators: ab5500: use n_voltages
ST-Ericsson Linux next: - ST-Ericsson ID: WP257121 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ic33a0ba6f7ff9fd1bf82b0858a5439ff69cf2297 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/21178 Tested-by: Rabin VINCENT <rabin.vincent@stericsson.com> Reviewed-by: Vijaya Kumar K-1 <vijay.kilari@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/ab5500.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/regulator/ab5500.c b/drivers/regulator/ab5500.c
index 907b9e0fefd..5189049c0e4 100644
--- a/drivers/regulator/ab5500.c
+++ b/drivers/regulator/ab5500.c
@@ -12,7 +12,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/err.h>
-#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
@@ -58,7 +57,6 @@
struct ab5500_regulator {
struct regulator_desc desc;
const int *voltages;
- int voltages_len;
bool pwrctrl;
int enable_time;
u8 bank;
@@ -124,10 +122,11 @@ ab5500_regulator_list_voltage(struct regulator_dev *rdev, unsigned selector)
{
struct ab5500_regulators *ab5500 = rdev_get_drvdata(rdev);
struct ab5500_regulator *r = ab5500->regulator[rdev_get_id(rdev)];
+ unsigned n_voltages = r->desc.n_voltages;
int selindex;
int i;
- for (i = 0, selindex = 0; selindex < r->voltages_len; i++) {
+ for (i = 0, selindex = 0; selindex < n_voltages; i++) {
int voltage = r->voltages[i];
if (!voltage)
@@ -167,7 +166,7 @@ static int ab5500_regulator_get_voltage(struct regulator_dev *rdev)
}
regval &= AB5500_LDO_VOLT_MASK;
- if (regval >= r->voltages_len || !r->voltages[regval])
+ if (regval >= r->desc.n_voltages || !r->voltages[regval])
return -EINVAL;
return r->voltages[regval];
@@ -176,6 +175,7 @@ static int ab5500_regulator_get_voltage(struct regulator_dev *rdev)
static int ab5500_get_best_voltage_index(struct ab5500_regulator *r,
int min_uV, int max_uV)
{
+ unsigned n_voltages = r->desc.n_voltages;
int bestmatch = INT_MAX;
int bestindex = -EINVAL;
int selindex;
@@ -187,7 +187,7 @@ static int ab5500_get_best_voltage_index(struct ab5500_regulator *r,
* in strict falling order so we need to check them
* all for the best match.
*/
- for (i = 0, selindex = 0; selindex < r->voltages_len; i++) {
+ for (i = 0, selindex = 0; selindex < n_voltages; i++) {
int voltage = r->voltages[i];
if (!voltage)
@@ -300,11 +300,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_variable_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_s_voltages),
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_S_ST,
.voltages = ab5500_ldo_s_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_s_voltages),
.enable_time = 400,
.pwrctrl = true,
},
@@ -315,11 +315,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_d_voltages),
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_D_ST,
.voltages = ab5500_ldo_d_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_d_voltages),
.enable_time = 400,
.pwrctrl = true,
},
@@ -330,11 +330,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_variable_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_lg_voltages) - 2,
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_L_ST,
.voltages = ab5500_ldo_lg_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_lg_voltages) - 2,
.enable_time = 400,
},
[AB5500_LDO_G] = {
@@ -344,11 +344,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_variable_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_lg_voltages) - 2,
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_G_ST,
.voltages = ab5500_ldo_lg_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_lg_voltages) - 2,
.enable_time = 400,
},
[AB5500_LDO_K] = {
@@ -358,11 +358,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_variable_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_kh_voltages),
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_K_ST,
.voltages = ab5500_ldo_kh_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_kh_voltages),
.enable_time = 400,
},
[AB5500_LDO_H] = {
@@ -372,11 +372,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_variable_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_kh_voltages),
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_H_ST,
.voltages = ab5500_ldo_kh_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_kh_voltages),
.enable_time = 400,
},
[AB5500_LDO_VDIGMIC] = {
@@ -386,11 +386,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_vdigmic_voltages),
},
.bank = AB5500_BANK_STARTUP,
.reg = AB5500_LDO_VDIGMIC_ST,
.voltages = ab5500_ldo_vdigmic_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_vdigmic_voltages),
.enable_time = 450,
},
[AB5500_LDO_SIM] = {
@@ -400,11 +400,11 @@ static struct ab5500_regulator ab5500_regulators[] = {
.ops = &ab5500_regulator_variable_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
+ .n_voltages = ARRAY_SIZE(ab5500_ldo_sim_voltages),
},
.bank = AB5500_BANK_SIM_USBSIM,
.reg = AB5500_SIM_SUP,
.voltages = ab5500_ldo_sim_voltages,
- .voltages_len = ARRAY_SIZE(ab5500_ldo_sim_voltages),
.enable_time = 1000,
},
};