summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8997.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 10:34:56 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 10:34:56 -0700
commitd15d76448bb58c7832e954b6a8f1e301720b7866 (patch)
tree7891c9e0779f5df33840be9cdba1f0331459e97c /drivers/regulator/max8997.c
parent0c2fe82a9b106f1c03719783134360586d718a69 (diff)
parent4992fa1fd425f1934f503ffa96b68e235b89db9a (diff)
downloadlinux-d15d76448bb58c7832e954b6a8f1e301720b7866.tar.bz2
Merge tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates for 3.4 from Mark Brown: "This has been a fairly quiet release from a regulator point of view, the only real framework features added were devm support and a convenience helper for setting up fixed voltage regulators. We also added a couple of drivers (but will drop the BQ240022 driver via the arm-soc tree as it's been replaced by the more generic gpio-regulator driver) and Axel Lin continued his relentless and generally awesome stream of fixes and cleanups." * tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (93 commits) regulator: Fix up a confusing dev_warn when DT lookup fails regulator: Convert tps6507x to set_voltage_sel regulator: Refactor tps6507x to use one tps6507x_pmic_ops for all LDOs and DCDCs regulator: Make s5m8767_get_voltage_register always return correct register regulator: s5m8767: Check pdata->buck[2|3|4]_gpiodvs earlier regulator: tps65910: Provide settling time for DCDC voltage change regulator: Add Anatop regulator driver regulator: Simplify implementation of tps65912_get_voltage_dcdc regulator: Use tps65912_set_voltage_sel for both DCDCx and LDOx regulator: tps65910: Provide settling time for enabling rails regulator: max8925: Use DIV_ROUND_UP macro regulator: tps65912: Use simple equations to get register address regulator: Fix the logic of tps65910_get_mode regulator: Merge tps65217_pmic_ldo234_ops and tps65217_pmic_dcdc_ops to tps65217_pmic_ops regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current regulator: Use array to store dcdc_range settings for tps65912 regulator: Rename s5m8767_convert_voltage to s5m8767_convert_voltage_to_sel regulator: tps6524x: Remove unneeded comment for N_REGULATORS regulator: Rename set_voltage_sel callback function name to *_sel regulator: Fix s5m8767_set_voltage_time_sel calculation value ...
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r--drivers/regulator/max8997.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index d26e8646277b..96579296f04d 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -130,15 +130,10 @@ static const struct voltage_map_desc *reg_voltage_map[] = {
[MAX8997_CHARGER_TOPOFF] = &topoff_current_map_desc,
};
-static inline int max8997_get_rid(struct regulator_dev *rdev)
-{
- return rdev_get_id(rdev);
-}
-
static int max8997_list_voltage_safeout(struct regulator_dev *rdev,
unsigned int selector)
{
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
if (rid == MAX8997_ESAFEOUT1 || rid == MAX8997_ESAFEOUT2) {
switch (selector) {
@@ -161,7 +156,7 @@ static int max8997_list_voltage_safeout(struct regulator_dev *rdev,
static int max8997_list_voltage_charger_cv(struct regulator_dev *rdev,
unsigned int selector)
{
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
if (rid != MAX8997_CHARGER_CV)
goto err;
@@ -184,7 +179,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{
const struct voltage_map_desc *desc;
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
int val;
if (rid >= ARRAY_SIZE(reg_voltage_map) ||
@@ -205,7 +200,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev,
static int max8997_get_enable_register(struct regulator_dev *rdev,
int *reg, int *mask, int *pattern)
{
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
switch (rid) {
case MAX8997_LDO1 ... MAX8997_LDO21:
@@ -325,7 +320,7 @@ static int max8997_reg_disable(struct regulator_dev *rdev)
static int max8997_get_voltage_register(struct regulator_dev *rdev,
int *_reg, int *_shift, int *_mask)
{
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
int reg, shift = 0, mask = 0x3f;
switch (rid) {
@@ -386,7 +381,7 @@ static int max8997_get_voltage(struct regulator_dev *rdev)
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c;
int reg, shift, mask, ret;
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
u8 val;
ret = max8997_get_voltage_register(rdev, &reg, &shift, &mask);
@@ -446,7 +441,7 @@ static int max8997_set_voltage_charger_cv(struct regulator_dev *rdev,
{
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c;
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
int lb, ub;
int reg, shift = 0, mask, ret = 0;
u8 val = 0x0;
@@ -503,7 +498,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
struct i2c_client *i2c = max8997->iodev->i2c;
int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
const struct voltage_map_desc *desc;
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
int reg, shift = 0, mask, ret;
int i;
u8 org;
@@ -564,7 +559,7 @@ static int max8997_assess_side_effect(struct regulator_dev *rdev,
u8 new_val, int *best)
{
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
u8 *buckx_val[3];
bool buckx_gpiodvs[3];
int side_effect[8];
@@ -641,7 +636,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *selector)
{
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
const struct voltage_map_desc *desc;
int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;
bool gpio_dvs_mode = false;
@@ -724,7 +719,7 @@ static int max8997_set_voltage_safeout(struct regulator_dev *rdev,
{
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c;
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
int reg, shift = 0, mask, ret;
int i = 0;
u8 val;
@@ -766,7 +761,7 @@ static int max8997_reg_disable_suspend(struct regulator_dev *rdev)
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c;
int ret, reg, mask, pattern;
- int rid = max8997_get_rid(rdev);
+ int rid = rdev_get_id(rdev);
ret = max8997_get_enable_register(rdev, &reg, &mask, &pattern);
if (ret)
@@ -908,13 +903,13 @@ static struct regulator_desc regulators[] = {
},
regulator_desc_buck(7),
{
- .name = "EN32KHz AP",
+ .name = "EN32KHz_AP",
.id = MAX8997_EN32KHZ_AP,
.ops = &max8997_fixedvolt_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
}, {
- .name = "EN32KHz CP",
+ .name = "EN32KHz_CP",
.id = MAX8997_EN32KHZ_CP,
.ops = &max8997_fixedvolt_ops,
.type = REGULATOR_VOLTAGE,
@@ -938,7 +933,7 @@ static struct regulator_desc regulators[] = {
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
}, {
- .name = "CHARGER CV",
+ .name = "CHARGER_CV",
.id = MAX8997_CHARGER_CV,
.ops = &max8997_fixedstate_ops,
.type = REGULATOR_VOLTAGE,
@@ -950,7 +945,7 @@ static struct regulator_desc regulators[] = {
.type = REGULATOR_CURRENT,
.owner = THIS_MODULE,
}, {
- .name = "CHARGER TOPOFF",
+ .name = "CHARGER_TOPOFF",
.id = MAX8997_CHARGER_TOPOFF,
.ops = &max8997_charger_fixedstate_ops,
.type = REGULATOR_CURRENT,