diff options
| -rw-r--r-- | drivers/regulator/max8998.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index b821d08eb64a..1f0df4046b86 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
| @@ -51,39 +51,39 @@ struct voltage_map_desc { | |||
| 51 | int step; | 51 | int step; |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | /* Voltage maps */ | 54 | /* Voltage maps in uV*/ |
| 55 | static const struct voltage_map_desc ldo23_voltage_map_desc = { | 55 | static const struct voltage_map_desc ldo23_voltage_map_desc = { |
| 56 | .min = 800, .step = 50, .max = 1300, | 56 | .min = 800000, .step = 50000, .max = 1300000, |
| 57 | }; | 57 | }; |
| 58 | static const struct voltage_map_desc ldo456711_voltage_map_desc = { | 58 | static const struct voltage_map_desc ldo456711_voltage_map_desc = { |
| 59 | .min = 1600, .step = 100, .max = 3600, | 59 | .min = 1600000, .step = 100000, .max = 3600000, |
| 60 | }; | 60 | }; |
| 61 | static const struct voltage_map_desc ldo8_voltage_map_desc = { | 61 | static const struct voltage_map_desc ldo8_voltage_map_desc = { |
| 62 | .min = 3000, .step = 100, .max = 3600, | 62 | .min = 3000000, .step = 100000, .max = 3600000, |
| 63 | }; | 63 | }; |
| 64 | static const struct voltage_map_desc ldo9_voltage_map_desc = { | 64 | static const struct voltage_map_desc ldo9_voltage_map_desc = { |
| 65 | .min = 2800, .step = 100, .max = 3100, | 65 | .min = 2800000, .step = 100000, .max = 3100000, |
| 66 | }; | 66 | }; |
| 67 | static const struct voltage_map_desc ldo10_voltage_map_desc = { | 67 | static const struct voltage_map_desc ldo10_voltage_map_desc = { |
| 68 | .min = 950, .step = 50, .max = 1300, | 68 | .min = 95000, .step = 50000, .max = 1300000, |
| 69 | }; | 69 | }; |
| 70 | static const struct voltage_map_desc ldo1213_voltage_map_desc = { | 70 | static const struct voltage_map_desc ldo1213_voltage_map_desc = { |
| 71 | .min = 800, .step = 100, .max = 3300, | 71 | .min = 800000, .step = 100000, .max = 3300000, |
| 72 | }; | 72 | }; |
| 73 | static const struct voltage_map_desc ldo1415_voltage_map_desc = { | 73 | static const struct voltage_map_desc ldo1415_voltage_map_desc = { |
| 74 | .min = 1200, .step = 100, .max = 3300, | 74 | .min = 1200000, .step = 100000, .max = 3300000, |
| 75 | }; | 75 | }; |
| 76 | static const struct voltage_map_desc ldo1617_voltage_map_desc = { | 76 | static const struct voltage_map_desc ldo1617_voltage_map_desc = { |
| 77 | .min = 1600, .step = 100, .max = 3600, | 77 | .min = 1600000, .step = 100000, .max = 3600000, |
| 78 | }; | 78 | }; |
| 79 | static const struct voltage_map_desc buck12_voltage_map_desc = { | 79 | static const struct voltage_map_desc buck12_voltage_map_desc = { |
| 80 | .min = 750, .step = 25, .max = 1525, | 80 | .min = 750000, .step = 25000, .max = 1525000, |
| 81 | }; | 81 | }; |
| 82 | static const struct voltage_map_desc buck3_voltage_map_desc = { | 82 | static const struct voltage_map_desc buck3_voltage_map_desc = { |
| 83 | .min = 1600, .step = 100, .max = 3600, | 83 | .min = 1600000, .step = 100000, .max = 3600000, |
| 84 | }; | 84 | }; |
| 85 | static const struct voltage_map_desc buck4_voltage_map_desc = { | 85 | static const struct voltage_map_desc buck4_voltage_map_desc = { |
| 86 | .min = 800, .step = 100, .max = 2300, | 86 | .min = 800000, .step = 100000, .max = 2300000, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | static const struct voltage_map_desc *ldo_voltage_map[] = { | 89 | 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, | |||
| 445 | if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP)) | 445 | if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP)) |
| 446 | return 0; | 446 | return 0; |
| 447 | 447 | ||
| 448 | difference = (new_selector - old_selector) * desc->step; | 448 | difference = (new_selector - old_selector) * desc->step / 1000; |
| 449 | if (difference > 0) | 449 | if (difference > 0) |
| 450 | return difference / ((val & 0x0f) + 1); | 450 | return DIV_ROUND_UP(difference, (val & 0x0f) + 1); |
| 451 | 451 | ||
| 452 | return 0; | 452 | return 0; |
| 453 | } | 453 | } |
| @@ -702,7 +702,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 702 | i = 0; | 702 | i = 0; |
| 703 | while (buck12_voltage_map_desc.min + | 703 | while (buck12_voltage_map_desc.min + |
| 704 | buck12_voltage_map_desc.step*i | 704 | buck12_voltage_map_desc.step*i |
| 705 | < (pdata->buck1_voltage1 / 1000)) | 705 | < pdata->buck1_voltage1) |
| 706 | i++; | 706 | i++; |
| 707 | max8998->buck1_vol[0] = i; | 707 | max8998->buck1_vol[0] = i; |
| 708 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); | 708 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); |
| @@ -713,7 +713,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 713 | i = 0; | 713 | i = 0; |
| 714 | while (buck12_voltage_map_desc.min + | 714 | while (buck12_voltage_map_desc.min + |
| 715 | buck12_voltage_map_desc.step*i | 715 | buck12_voltage_map_desc.step*i |
| 716 | < (pdata->buck1_voltage2 / 1000)) | 716 | < pdata->buck1_voltage2) |
| 717 | i++; | 717 | i++; |
| 718 | 718 | ||
| 719 | max8998->buck1_vol[1] = i; | 719 | max8998->buck1_vol[1] = i; |
| @@ -725,7 +725,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 725 | i = 0; | 725 | i = 0; |
| 726 | while (buck12_voltage_map_desc.min + | 726 | while (buck12_voltage_map_desc.min + |
| 727 | buck12_voltage_map_desc.step*i | 727 | buck12_voltage_map_desc.step*i |
| 728 | < (pdata->buck1_voltage3 / 1000)) | 728 | < pdata->buck1_voltage3) |
| 729 | i++; | 729 | i++; |
| 730 | 730 | ||
| 731 | max8998->buck1_vol[2] = i; | 731 | max8998->buck1_vol[2] = i; |
| @@ -737,7 +737,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 737 | i = 0; | 737 | i = 0; |
| 738 | while (buck12_voltage_map_desc.min + | 738 | while (buck12_voltage_map_desc.min + |
| 739 | buck12_voltage_map_desc.step*i | 739 | buck12_voltage_map_desc.step*i |
| 740 | < (pdata->buck1_voltage4 / 1000)) | 740 | < pdata->buck1_voltage4) |
| 741 | i++; | 741 | i++; |
| 742 | 742 | ||
| 743 | max8998->buck1_vol[3] = i; | 743 | max8998->buck1_vol[3] = i; |
| @@ -763,7 +763,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 763 | i = 0; | 763 | i = 0; |
| 764 | while (buck12_voltage_map_desc.min + | 764 | while (buck12_voltage_map_desc.min + |
| 765 | buck12_voltage_map_desc.step*i | 765 | buck12_voltage_map_desc.step*i |
| 766 | < (pdata->buck2_voltage1 / 1000)) | 766 | < pdata->buck2_voltage1) |
| 767 | i++; | 767 | i++; |
| 768 | max8998->buck2_vol[0] = i; | 768 | max8998->buck2_vol[0] = i; |
| 769 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); | 769 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); |
| @@ -774,7 +774,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 774 | i = 0; | 774 | i = 0; |
| 775 | while (buck12_voltage_map_desc.min + | 775 | while (buck12_voltage_map_desc.min + |
| 776 | buck12_voltage_map_desc.step*i | 776 | buck12_voltage_map_desc.step*i |
| 777 | < (pdata->buck2_voltage2 / 1000)) | 777 | < pdata->buck2_voltage2) |
| 778 | i++; | 778 | i++; |
| 779 | max8998->buck2_vol[1] = i; | 779 | max8998->buck2_vol[1] = i; |
| 780 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i); | 780 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i); |
| @@ -792,8 +792,8 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
| 792 | int count = (desc->max - desc->min) / desc->step + 1; | 792 | int count = (desc->max - desc->min) / desc->step + 1; |
| 793 | 793 | ||
| 794 | regulators[index].n_voltages = count; | 794 | regulators[index].n_voltages = count; |
| 795 | regulators[index].min_uV = desc->min * 1000; | 795 | regulators[index].min_uV = desc->min; |
| 796 | regulators[index].uV_step = desc->step * 1000; | 796 | regulators[index].uV_step = desc->step; |
| 797 | } | 797 | } |
| 798 | 798 | ||
| 799 | config.dev = max8998->dev; | 799 | config.dev = max8998->dev; |
