diff options
| -rw-r--r-- | drivers/regulator/isl6271a-regulator.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index 78cdc90e0a7e..00cb28816725 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c | |||
| @@ -35,26 +35,19 @@ struct isl_pmic { | |||
| 35 | struct mutex mtx; | 35 | struct mutex mtx; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | static int isl6271a_get_voltage(struct regulator_dev *dev) | 38 | static int isl6271a_get_voltage_sel(struct regulator_dev *dev) |
| 39 | { | 39 | { |
| 40 | struct isl_pmic *pmic = rdev_get_drvdata(dev); | 40 | struct isl_pmic *pmic = rdev_get_drvdata(dev); |
| 41 | int idx, data; | 41 | int idx; |
| 42 | 42 | ||
| 43 | mutex_lock(&pmic->mtx); | 43 | mutex_lock(&pmic->mtx); |
| 44 | 44 | ||
| 45 | idx = i2c_smbus_read_byte(pmic->client); | 45 | idx = i2c_smbus_read_byte(pmic->client); |
| 46 | if (idx < 0) { | 46 | if (idx < 0) |
| 47 | dev_err(&pmic->client->dev, "Error getting voltage\n"); | 47 | dev_err(&pmic->client->dev, "Error getting voltage\n"); |
| 48 | data = idx; | ||
| 49 | goto out; | ||
| 50 | } | ||
| 51 | |||
| 52 | /* Convert the data from chip to microvolts */ | ||
| 53 | data = ISL6271A_VOLTAGE_MIN + (ISL6271A_VOLTAGE_STEP * (idx & 0xf)); | ||
| 54 | 48 | ||
| 55 | out: | ||
| 56 | mutex_unlock(&pmic->mtx); | 49 | mutex_unlock(&pmic->mtx); |
| 57 | return data; | 50 | return idx; |
| 58 | } | 51 | } |
| 59 | 52 | ||
| 60 | static int isl6271a_set_voltage(struct regulator_dev *dev, | 53 | static int isl6271a_set_voltage(struct regulator_dev *dev, |
| @@ -84,7 +77,7 @@ static int isl6271a_set_voltage(struct regulator_dev *dev, | |||
| 84 | } | 77 | } |
| 85 | 78 | ||
| 86 | static struct regulator_ops isl_core_ops = { | 79 | static struct regulator_ops isl_core_ops = { |
| 87 | .get_voltage = isl6271a_get_voltage, | 80 | .get_voltage_sel = isl6271a_get_voltage_sel, |
| 88 | .set_voltage = isl6271a_set_voltage, | 81 | .set_voltage = isl6271a_set_voltage, |
| 89 | .list_voltage = regulator_list_voltage_linear, | 82 | .list_voltage = regulator_list_voltage_linear, |
| 90 | }; | 83 | }; |
