regulator: Fixes for 3.8
A few fixes for the regulator subsystems, a few driver specific things plus a fix for the interaction between regultor_can_change_voltage() and continuous voltage ranges both of which were added for this release. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJQ9KWwAAoJELSic+t+oim9ctIP/24/GAoSg5XlfwrViMbYggMZ q95qQUy0OKRyWtWOmMbmCwgz4clvvD3flrlp068bOLxL9YNkVorJBT0k7cWVy0tP Jw/0LxLKZbImJDu2el4OV6F+Apzg+x/0Vq+uDh81nuqvf5KUZCAT97ZCVrgvNNMw 6N1fRW/flcR59oyJWogo1ch7mIwF6RI+Gl6JxPoIS+oXardGDLRMo9w+f7QwJjih Qf+J6FtwQ7mTmx7KeE3T5VhTlECfO4G0/Q14vX1rOpB9/YQ2FRxpq1sz1xATCl8t UFfUXasaClcJxcyI8UJhDGnfmqKdOmZILHsdG1Bb11LjVsQBY1Rgv02vjomReZZD bUhU8Tn9784BV+bVeGHBPebVsAcVJsXXv8hr7xIAUfB2VvQtv7NxNSw7ZsVfrwJD UWiQedqpfQaMMzWLfvaW7dlsh6HRwhwrnnQFV4+B9I6LtGB9EWqYa3TsFS3IXsQX hyP+EWg3O0XhsmJYnI/ZZtO9YjifvEubhnfPRr/pUcv+I0PB5X4w9NZsLhFRVz6z r8kbWCp0VEVr4YtoP/BZ9XXavz8/2fScWr2xmUTCtx5ZqiWRpOLX2Bch2caKHNy/ E+5gzhWPps46RPJi1FpFXKL2OMPwFBNBlTKgi5YiKHmgi5D9Dbu30huhB3kPyJOR nceJVN5pNjGYJf49j2m3 =a/VB -----END PGP SIGNATURE----- Merge tag 'regulator-3.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fixes from Mark Brown: "A few fixes for the regulator subsystems, a few driver specific things plus a fix for the interaction between regultor_can_change_voltage() and continuous voltage ranges both of which were added for this release." * tag 'regulator-3.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel regulator: max8998: Use uV in voltage_map_desc regulator: max8997: Use uV in voltage_map_desc regulator: core: Fix comment for regulator_register() regulator: core: Fix continuous_voltage_range case in regulator_can_change_voltage regulator: s5m8767: Fix probe failure due to stack corruption
This commit is contained in:
commit
2ac1e664a9
4 changed files with 52 additions and 47 deletions
|
@ -1885,9 +1885,15 @@ int regulator_can_change_voltage(struct regulator *regulator)
|
|||
struct regulator_dev *rdev = regulator->rdev;
|
||||
|
||||
if (rdev->constraints &&
|
||||
rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
|
||||
(rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
|
||||
return 1;
|
||||
(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
|
||||
if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
|
||||
return 1;
|
||||
|
||||
if (rdev->desc->continuous_voltage_range &&
|
||||
rdev->constraints->min_uV && rdev->constraints->max_uV &&
|
||||
rdev->constraints->min_uV != rdev->constraints->max_uV)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3315,7 +3321,8 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
|
|||
* @config: runtime configuration for regulator
|
||||
*
|
||||
* Called by regulator drivers to register a regulator.
|
||||
* Returns 0 on success.
|
||||
* Returns a valid pointer to struct regulator_dev on success
|
||||
* or an ERR_PTR() on error.
|
||||
*/
|
||||
struct regulator_dev *
|
||||
regulator_register(const struct regulator_desc *regulator_desc,
|
||||
|
|
|
@ -71,26 +71,26 @@ struct voltage_map_desc {
|
|||
int step;
|
||||
};
|
||||
|
||||
/* Voltage maps in mV */
|
||||
/* Voltage maps in uV */
|
||||
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 */
|
||||
|
||||
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 */
|
||||
|
||||
static const struct voltage_map_desc buck37_voltage_map_desc = {
|
||||
.min = 750, .max = 3900, .step = 50,
|
||||
.min = 750000, .max = 3900000, .step = 50000,
|
||||
}; /* Buck3, 7 */
|
||||
|
||||
/* current map in mA */
|
||||
/* current map in uA */
|
||||
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 = {
|
||||
.min = 50, .max = 200, .step = 10,
|
||||
.min = 50000, .max = 200000, .step = 10000,
|
||||
};
|
||||
|
||||
static const struct voltage_map_desc *reg_voltage_map[] = {
|
||||
|
@ -194,7 +194,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev,
|
|||
if (val > desc->max)
|
||||
return -EINVAL;
|
||||
|
||||
return val * 1000;
|
||||
return val;
|
||||
}
|
||||
|
||||
static int max8997_get_enable_register(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 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 = rdev_get_id(rdev);
|
||||
int i, reg, shift, mask, ret;
|
||||
|
@ -509,7 +508,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
|
|||
|
||||
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)
|
||||
return i;
|
||||
|
||||
|
@ -557,7 +556,7 @@ static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev,
|
|||
case MAX8997_BUCK4:
|
||||
case MAX8997_BUCK5:
|
||||
return DIV_ROUND_UP(desc->step * (new_selector - old_selector),
|
||||
max8997->ramp_delay);
|
||||
max8997->ramp_delay * 1000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -656,7 +655,6 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
|
|||
const struct voltage_map_desc *desc;
|
||||
int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;
|
||||
bool gpio_dvs_mode = false;
|
||||
int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
|
||||
|
||||
if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7)
|
||||
return -EINVAL;
|
||||
|
@ -681,7 +679,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
|
|||
selector);
|
||||
|
||||
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)
|
||||
return new_val;
|
||||
|
||||
|
@ -1123,8 +1121,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
|
|||
max8997->buck1_vol[i] = ret =
|
||||
max8997_get_voltage_proper_val(
|
||||
&buck1245_voltage_map_desc,
|
||||
pdata->buck1_voltage[i] / 1000,
|
||||
pdata->buck1_voltage[i] / 1000 +
|
||||
pdata->buck1_voltage[i],
|
||||
pdata->buck1_voltage[i] +
|
||||
buck1245_voltage_map_desc.step);
|
||||
if (ret < 0)
|
||||
goto err_out;
|
||||
|
@ -1132,8 +1130,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
|
|||
max8997->buck2_vol[i] = ret =
|
||||
max8997_get_voltage_proper_val(
|
||||
&buck1245_voltage_map_desc,
|
||||
pdata->buck2_voltage[i] / 1000,
|
||||
pdata->buck2_voltage[i] / 1000 +
|
||||
pdata->buck2_voltage[i],
|
||||
pdata->buck2_voltage[i] +
|
||||
buck1245_voltage_map_desc.step);
|
||||
if (ret < 0)
|
||||
goto err_out;
|
||||
|
@ -1141,8 +1139,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
|
|||
max8997->buck5_vol[i] = ret =
|
||||
max8997_get_voltage_proper_val(
|
||||
&buck1245_voltage_map_desc,
|
||||
pdata->buck5_voltage[i] / 1000,
|
||||
pdata->buck5_voltage[i] / 1000 +
|
||||
pdata->buck5_voltage[i],
|
||||
pdata->buck5_voltage[i] +
|
||||
buck1245_voltage_map_desc.step);
|
||||
if (ret < 0)
|
||||
goto err_out;
|
||||
|
|
|
@ -51,39 +51,39 @@ struct voltage_map_desc {
|
|||
int step;
|
||||
};
|
||||
|
||||
/* Voltage maps */
|
||||
/* Voltage maps in uV*/
|
||||
static const struct voltage_map_desc ldo23_voltage_map_desc = {
|
||||
.min = 800, .step = 50, .max = 1300,
|
||||
.min = 800000, .step = 50000, .max = 1300000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo456711_voltage_map_desc = {
|
||||
.min = 1600, .step = 100, .max = 3600,
|
||||
.min = 1600000, .step = 100000, .max = 3600000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo8_voltage_map_desc = {
|
||||
.min = 3000, .step = 100, .max = 3600,
|
||||
.min = 3000000, .step = 100000, .max = 3600000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo9_voltage_map_desc = {
|
||||
.min = 2800, .step = 100, .max = 3100,
|
||||
.min = 2800000, .step = 100000, .max = 3100000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo10_voltage_map_desc = {
|
||||
.min = 950, .step = 50, .max = 1300,
|
||||
.min = 95000, .step = 50000, .max = 1300000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo1213_voltage_map_desc = {
|
||||
.min = 800, .step = 100, .max = 3300,
|
||||
.min = 800000, .step = 100000, .max = 3300000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo1415_voltage_map_desc = {
|
||||
.min = 1200, .step = 100, .max = 3300,
|
||||
.min = 1200000, .step = 100000, .max = 3300000,
|
||||
};
|
||||
static const struct voltage_map_desc ldo1617_voltage_map_desc = {
|
||||
.min = 1600, .step = 100, .max = 3600,
|
||||
.min = 1600000, .step = 100000, .max = 3600000,
|
||||
};
|
||||
static const struct voltage_map_desc buck12_voltage_map_desc = {
|
||||
.min = 750, .step = 25, .max = 1525,
|
||||
.min = 750000, .step = 25000, .max = 1525000,
|
||||
};
|
||||
static const struct voltage_map_desc buck3_voltage_map_desc = {
|
||||
.min = 1600, .step = 100, .max = 3600,
|
||||
.min = 1600000, .step = 100000, .max = 3600000,
|
||||
};
|
||||
static const struct voltage_map_desc buck4_voltage_map_desc = {
|
||||
.min = 800, .step = 100, .max = 2300,
|
||||
.min = 800000, .step = 100000, .max = 2300000,
|
||||
};
|
||||
|
||||
static const struct voltage_map_desc *ldo_voltage_map[] = {
|
||||
|
@ -445,9 +445,9 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
|
|||
if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP))
|
||||
return 0;
|
||||
|
||||
difference = (new_selector - old_selector) * desc->step;
|
||||
difference = (new_selector - old_selector) * desc->step / 1000;
|
||||
if (difference > 0)
|
||||
return difference / ((val & 0x0f) + 1);
|
||||
return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
i = 0;
|
||||
while (buck12_voltage_map_desc.min +
|
||||
buck12_voltage_map_desc.step*i
|
||||
< (pdata->buck1_voltage1 / 1000))
|
||||
< pdata->buck1_voltage1)
|
||||
i++;
|
||||
max8998->buck1_vol[0] = i;
|
||||
ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i);
|
||||
|
@ -713,7 +713,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
i = 0;
|
||||
while (buck12_voltage_map_desc.min +
|
||||
buck12_voltage_map_desc.step*i
|
||||
< (pdata->buck1_voltage2 / 1000))
|
||||
< pdata->buck1_voltage2)
|
||||
i++;
|
||||
|
||||
max8998->buck1_vol[1] = i;
|
||||
|
@ -725,7 +725,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
i = 0;
|
||||
while (buck12_voltage_map_desc.min +
|
||||
buck12_voltage_map_desc.step*i
|
||||
< (pdata->buck1_voltage3 / 1000))
|
||||
< pdata->buck1_voltage3)
|
||||
i++;
|
||||
|
||||
max8998->buck1_vol[2] = i;
|
||||
|
@ -737,7 +737,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
i = 0;
|
||||
while (buck12_voltage_map_desc.min +
|
||||
buck12_voltage_map_desc.step*i
|
||||
< (pdata->buck1_voltage4 / 1000))
|
||||
< pdata->buck1_voltage4)
|
||||
i++;
|
||||
|
||||
max8998->buck1_vol[3] = i;
|
||||
|
@ -763,7 +763,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
i = 0;
|
||||
while (buck12_voltage_map_desc.min +
|
||||
buck12_voltage_map_desc.step*i
|
||||
< (pdata->buck2_voltage1 / 1000))
|
||||
< pdata->buck2_voltage1)
|
||||
i++;
|
||||
max8998->buck2_vol[0] = i;
|
||||
ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i);
|
||||
|
@ -774,7 +774,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
i = 0;
|
||||
while (buck12_voltage_map_desc.min +
|
||||
buck12_voltage_map_desc.step*i
|
||||
< (pdata->buck2_voltage2 / 1000))
|
||||
< pdata->buck2_voltage2)
|
||||
i++;
|
||||
max8998->buck2_vol[1] = i;
|
||||
ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i);
|
||||
|
@ -792,8 +792,8 @@ static int max8998_pmic_probe(struct platform_device *pdev)
|
|||
int count = (desc->max - desc->min) / desc->step + 1;
|
||||
|
||||
regulators[index].n_voltages = count;
|
||||
regulators[index].min_uV = desc->min * 1000;
|
||||
regulators[index].uV_step = desc->step * 1000;
|
||||
regulators[index].min_uV = desc->min;
|
||||
regulators[index].uV_step = desc->step;
|
||||
}
|
||||
|
||||
config.dev = max8998->dev;
|
||||
|
|
|
@ -214,7 +214,7 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
|
|||
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
||||
int ret, reg;
|
||||
int mask = 0xc0, enable_ctrl;
|
||||
u8 val;
|
||||
unsigned int val;
|
||||
|
||||
ret = s5m8767_get_register(rdev, ®, &enable_ctrl);
|
||||
if (ret == -EINVAL)
|
||||
|
@ -306,7 +306,7 @@ static int s5m8767_get_voltage_sel(struct regulator_dev *rdev)
|
|||
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
||||
int reg, mask, ret;
|
||||
int reg_id = rdev_get_id(rdev);
|
||||
u8 val;
|
||||
unsigned int val;
|
||||
|
||||
ret = s5m8767_get_voltage_register(rdev, ®);
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in a new issue