diff options
Diffstat (limited to 'drivers/regulator/max8998.c')
-rw-r--r-- | drivers/regulator/max8998.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index a1baf1fbe004..7f5fe6f198cf 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -173,6 +173,7 @@ static int max8998_get_enable_register(struct regulator_dev *rdev, static int max8998_ldo_is_enabled(struct regulator_dev *rdev) { struct max8998_data *max8998 = rdev_get_drvdata(rdev); + struct i2c_client *i2c = max8998->iodev->i2c; int ret, reg, shift = 8; u8 val; @@ -180,7 +181,7 @@ static int max8998_ldo_is_enabled(struct regulator_dev *rdev) if (ret) return ret; - ret = max8998_read_reg(max8998->iodev, reg, &val); + ret = max8998_read_reg(i2c, reg, &val); if (ret) return ret; @@ -190,25 +191,27 @@ static int max8998_ldo_is_enabled(struct regulator_dev *rdev) static int max8998_ldo_enable(struct regulator_dev *rdev) { struct max8998_data *max8998 = rdev_get_drvdata(rdev); + struct i2c_client *i2c = max8998->iodev->i2c; int reg, shift = 8, ret; ret = max8998_get_enable_register(rdev, ®, &shift); if (ret) return ret; - return max8998_update_reg(max8998->iodev, reg, 1<<shift, 1<<shift); + return max8998_update_reg(i2c, reg, 1<<shift, 1<<shift); } static int max8998_ldo_disable(struct regulator_dev *rdev) { struct max8998_data *max8998 = rdev_get_drvdata(rdev); + struct i2c_client *i2c = max8998->iodev->i2c; int reg, shift = 8, ret; ret = max8998_get_enable_register(rdev, ®, &shift); if (ret) return ret; - return max8998_update_reg(max8998->iodev, reg, 0, 1<<shift); + return max8998_update_reg(i2c, reg, 0, 1<<shift); } static int max8998_get_voltage_register(struct regulator_dev *rdev, @@ -276,6 +279,7 @@ static int max8998_get_voltage_register(struct regulator_dev *rdev, static int max8998_get_voltage(struct regulator_dev *rdev) { struct max8998_data *max8998 = rdev_get_drvdata(rdev); + struct i2c_client *i2c = max8998->iodev->i2c; int reg, shift = 0, mask, ret; u8 val; @@ -283,7 +287,7 @@ static int max8998_get_voltage(struct regulator_dev *rdev) if (ret) return ret; - ret = max8998_read_reg(max8998->iodev, reg, &val); + ret = max8998_read_reg(i2c, reg, &val); if (ret) return ret; @@ -297,6 +301,7 @@ static int max8998_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) { struct max8998_data *max8998 = rdev_get_drvdata(rdev); + struct i2c_client *i2c = max8998->iodev->i2c; int min_vol = min_uV / 1000, max_vol = max_uV / 1000; int previous_vol = 0; const struct voltage_map_desc *desc; @@ -330,14 +335,14 @@ static int max8998_set_voltage(struct regulator_dev *rdev, /* wait for RAMP_UP_DELAY if rdev is BUCK1/2 and * ENRAMP is ON */ if (ldo == MAX8998_BUCK1 || ldo == MAX8998_BUCK2) { - max8998_read_reg(max8998->iodev, MAX8998_REG_ONOFF4, &val); + max8998_read_reg(i2c, MAX8998_REG_ONOFF4, &val); if (val & (1 << 4)) { en_ramp = true; previous_vol = max8998_get_voltage(rdev); } } - ret = max8998_update_reg(max8998->iodev, reg, i<<shift, mask<<shift); + ret = max8998_update_reg(i2c, reg, i<<shift, mask<<shift); if (en_ramp == true) { int difference = desc->min + desc->step*i - previous_vol/1000; |