@@ -51,39 +51,39 @@ struct voltage_map_desc {
51
51
int step ;
52
52
};
53
53
54
- /* Voltage maps */
54
+ /* Voltage maps in uV */
55
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
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
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
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
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
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
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
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
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
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
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
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
445
if (max8998 -> iodev -> type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP ))
446
446
return 0 ;
447
447
448
- difference = (new_selector - old_selector ) * desc -> step ;
448
+ difference = (new_selector - old_selector ) * desc -> step / 1000 ;
449
449
if (difference > 0 )
450
- return difference / ( (val & 0x0f ) + 1 );
450
+ return DIV_ROUND_UP ( difference , (val & 0x0f ) + 1 );
451
451
452
452
return 0 ;
453
453
}
@@ -702,7 +702,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
702
702
i = 0 ;
703
703
while (buck12_voltage_map_desc .min +
704
704
buck12_voltage_map_desc .step * i
705
- < ( pdata -> buck1_voltage1 / 1000 ) )
705
+ < pdata -> buck1_voltage1 )
706
706
i ++ ;
707
707
max8998 -> buck1_vol [0 ] = i ;
708
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
713
i = 0 ;
714
714
while (buck12_voltage_map_desc .min +
715
715
buck12_voltage_map_desc .step * i
716
- < ( pdata -> buck1_voltage2 / 1000 ) )
716
+ < pdata -> buck1_voltage2 )
717
717
i ++ ;
718
718
719
719
max8998 -> buck1_vol [1 ] = i ;
@@ -725,7 +725,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
725
725
i = 0 ;
726
726
while (buck12_voltage_map_desc .min +
727
727
buck12_voltage_map_desc .step * i
728
- < ( pdata -> buck1_voltage3 / 1000 ) )
728
+ < pdata -> buck1_voltage3 )
729
729
i ++ ;
730
730
731
731
max8998 -> buck1_vol [2 ] = i ;
@@ -737,7 +737,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
737
737
i = 0 ;
738
738
while (buck12_voltage_map_desc .min +
739
739
buck12_voltage_map_desc .step * i
740
- < ( pdata -> buck1_voltage4 / 1000 ) )
740
+ < pdata -> buck1_voltage4 )
741
741
i ++ ;
742
742
743
743
max8998 -> buck1_vol [3 ] = i ;
@@ -763,7 +763,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
763
763
i = 0 ;
764
764
while (buck12_voltage_map_desc .min +
765
765
buck12_voltage_map_desc .step * i
766
- < ( pdata -> buck2_voltage1 / 1000 ) )
766
+ < pdata -> buck2_voltage1 )
767
767
i ++ ;
768
768
max8998 -> buck2_vol [0 ] = i ;
769
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
774
i = 0 ;
775
775
while (buck12_voltage_map_desc .min +
776
776
buck12_voltage_map_desc .step * i
777
- < ( pdata -> buck2_voltage2 / 1000 ) )
777
+ < pdata -> buck2_voltage2 )
778
778
i ++ ;
779
779
max8998 -> buck2_vol [1 ] = i ;
780
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
792
int count = (desc -> max - desc -> min ) / desc -> step + 1 ;
793
793
794
794
regulators [index ].n_voltages = count ;
795
- regulators [index ].min_uV = desc -> min * 1000 ;
796
- regulators [index ].uV_step = desc -> step * 1000 ;
795
+ regulators [index ].min_uV = desc -> min ;
796
+ regulators [index ].uV_step = desc -> step ;
797
797
}
798
798
799
799
config .dev = max8998 -> dev ;
0 commit comments