提交 c6318467 编写于 作者: M Mark Brown

Merge remote-tracking branch 'regulator/fix/max8997' into tmp

...@@ -71,26 +71,26 @@ struct voltage_map_desc { ...@@ -71,26 +71,26 @@ struct voltage_map_desc {
int step; int step;
}; };
/* Voltage maps in mV */ /* Voltage maps in uV */
static const struct voltage_map_desc ldo_voltage_map_desc = { static const struct voltage_map_desc ldo_voltage_map_desc = {
.min = 800, .max = 3950, .step = 50, .min = 800000, .max = 3950000, .step = 50000,
}; /* LDO1 ~ 18, 21 all */ }; /* LDO1 ~ 18, 21 all */
static const struct voltage_map_desc buck1245_voltage_map_desc = { static const struct voltage_map_desc buck1245_voltage_map_desc = {
.min = 650, .max = 2225, .step = 25, .min = 650000, .max = 2225000, .step = 25000,
}; /* Buck1, 2, 4, 5 */ }; /* Buck1, 2, 4, 5 */
static const struct voltage_map_desc buck37_voltage_map_desc = { static const struct voltage_map_desc buck37_voltage_map_desc = {
.min = 750, .max = 3900, .step = 50, .min = 750000, .max = 3900000, .step = 50000,
}; /* Buck3, 7 */ }; /* Buck3, 7 */
/* current map in mA */ /* current map in uA */
static const struct voltage_map_desc charger_current_map_desc = { static const struct voltage_map_desc charger_current_map_desc = {
.min = 200, .max = 950, .step = 50, .min = 200000, .max = 950000, .step = 50000,
}; };
static const struct voltage_map_desc topoff_current_map_desc = { static const struct voltage_map_desc topoff_current_map_desc = {
.min = 50, .max = 200, .step = 10, .min = 50000, .max = 200000, .step = 10000,
}; };
static const struct voltage_map_desc *reg_voltage_map[] = { static const struct voltage_map_desc *reg_voltage_map[] = {
...@@ -194,7 +194,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev, ...@@ -194,7 +194,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev,
if (val > desc->max) if (val > desc->max)
return -EINVAL; return -EINVAL;
return val * 1000; return val;
} }
static int max8997_get_enable_register(struct regulator_dev *rdev, static int max8997_get_enable_register(struct regulator_dev *rdev,
...@@ -485,7 +485,6 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev, ...@@ -485,7 +485,6 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
{ {
struct max8997_data *max8997 = rdev_get_drvdata(rdev); struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c; struct i2c_client *i2c = max8997->iodev->i2c;
int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
const struct voltage_map_desc *desc; const struct voltage_map_desc *desc;
int rid = rdev_get_id(rdev); int rid = rdev_get_id(rdev);
int i, reg, shift, mask, ret; int i, reg, shift, mask, ret;
...@@ -509,7 +508,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev, ...@@ -509,7 +508,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
desc = reg_voltage_map[rid]; desc = reg_voltage_map[rid];
i = max8997_get_voltage_proper_val(desc, min_vol, max_vol); i = max8997_get_voltage_proper_val(desc, min_uV, max_uV);
if (i < 0) if (i < 0)
return i; return i;
...@@ -557,7 +556,7 @@ static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev, ...@@ -557,7 +556,7 @@ static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev,
case MAX8997_BUCK4: case MAX8997_BUCK4:
case MAX8997_BUCK5: case MAX8997_BUCK5:
return DIV_ROUND_UP(desc->step * (new_selector - old_selector), return DIV_ROUND_UP(desc->step * (new_selector - old_selector),
max8997->ramp_delay); max8997->ramp_delay * 1000);
} }
return 0; return 0;
...@@ -656,7 +655,6 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, ...@@ -656,7 +655,6 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
const struct voltage_map_desc *desc; const struct voltage_map_desc *desc;
int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg; int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;
bool gpio_dvs_mode = false; bool gpio_dvs_mode = false;
int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7) if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7)
return -EINVAL; return -EINVAL;
...@@ -681,7 +679,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, ...@@ -681,7 +679,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
selector); selector);
desc = reg_voltage_map[rid]; desc = reg_voltage_map[rid];
new_val = max8997_get_voltage_proper_val(desc, min_vol, max_vol); new_val = max8997_get_voltage_proper_val(desc, min_uV, max_uV);
if (new_val < 0) if (new_val < 0)
return new_val; return new_val;
...@@ -1123,8 +1121,8 @@ static int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1123,8 +1121,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
max8997->buck1_vol[i] = ret = max8997->buck1_vol[i] = ret =
max8997_get_voltage_proper_val( max8997_get_voltage_proper_val(
&buck1245_voltage_map_desc, &buck1245_voltage_map_desc,
pdata->buck1_voltage[i] / 1000, pdata->buck1_voltage[i],
pdata->buck1_voltage[i] / 1000 + pdata->buck1_voltage[i] +
buck1245_voltage_map_desc.step); buck1245_voltage_map_desc.step);
if (ret < 0) if (ret < 0)
goto err_out; goto err_out;
...@@ -1132,8 +1130,8 @@ static int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1132,8 +1130,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
max8997->buck2_vol[i] = ret = max8997->buck2_vol[i] = ret =
max8997_get_voltage_proper_val( max8997_get_voltage_proper_val(
&buck1245_voltage_map_desc, &buck1245_voltage_map_desc,
pdata->buck2_voltage[i] / 1000, pdata->buck2_voltage[i],
pdata->buck2_voltage[i] / 1000 + pdata->buck2_voltage[i] +
buck1245_voltage_map_desc.step); buck1245_voltage_map_desc.step);
if (ret < 0) if (ret < 0)
goto err_out; goto err_out;
...@@ -1141,8 +1139,8 @@ static int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1141,8 +1139,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
max8997->buck5_vol[i] = ret = max8997->buck5_vol[i] = ret =
max8997_get_voltage_proper_val( max8997_get_voltage_proper_val(
&buck1245_voltage_map_desc, &buck1245_voltage_map_desc,
pdata->buck5_voltage[i] / 1000, pdata->buck5_voltage[i],
pdata->buck5_voltage[i] / 1000 + pdata->buck5_voltage[i] +
buck1245_voltage_map_desc.step); buck1245_voltage_map_desc.step);
if (ret < 0) if (ret < 0)
goto err_out; goto err_out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册