@@ -34,7 +34,7 @@ struct mp2888_data {
34
34
int curr_sense_gain ;
35
35
};
36
36
37
- #define to_mp2888_data (x ) container_of(x, struct mp2888_data, info)
37
+ #define to_mp2888_data (x ) container_of(x, struct mp2888_data, info)
38
38
39
39
static int mp2888_read_byte_data (struct i2c_client * client , int page , int reg )
40
40
{
@@ -109,7 +109,7 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page,
109
109
* - Kcs is the DrMOS current sense gain of power stage, which is obtained from the
110
110
* register MP2888_MFR_VR_CONFIG1, bits 13-12 with the following selection of DrMOS
111
111
* (data->curr_sense_gain):
112
- * 00b - 5µA/A, 01b - 8.5µA /A, 10b - 9.7µA /A, 11b - 10µA /A.
112
+ * 00b - 8. 5µA/A, 01b - 9.7µA /A, 1b - 10µA /A, 11b - 5µA /A.
113
113
* - Rcs is the internal phase current sense resistor. This parameter depends on hardware
114
114
* assembly. By default it is set to 1kΩ. In case of different assembly, user should
115
115
* scale this parameter by dividing it by Rcs.
@@ -118,10 +118,9 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page,
118
118
* because sampling of current occurrence of bit weight has a big deviation, especially for
119
119
* light load.
120
120
*/
121
- ret = DIV_ROUND_CLOSEST (ret * 100 - 9800 , data -> curr_sense_gain );
122
- ret = (data -> phase_curr_resolution ) ? ret * 2 : ret ;
121
+ ret = DIV_ROUND_CLOSEST (ret * 200 - 19600 , data -> curr_sense_gain );
123
122
/* Scale according to total current resolution. */
124
- ret = (data -> total_curr_resolution ) ? ret * 8 : ret * 4 ;
123
+ ret = (data -> total_curr_resolution ) ? ret * 2 : ret ;
125
124
return ret ;
126
125
}
127
126
@@ -212,7 +211,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase,
212
211
ret = pmbus_read_word_data (client , page , phase , reg );
213
212
if (ret < 0 )
214
213
return ret ;
215
- ret = data -> total_curr_resolution ? ret * 2 : ret ;
214
+ ret = data -> total_curr_resolution ? ret : DIV_ROUND_CLOSEST ( ret , 2 ) ;
216
215
break ;
217
216
case PMBUS_POUT_OP_WARN_LIMIT :
218
217
ret = pmbus_read_word_data (client , page , phase , reg );
@@ -223,7 +222,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase,
223
222
* set 1. Actual power is reported with 0.5W or 1W respectively resolution. Scaling
224
223
* is needed to match both.
225
224
*/
226
- ret = data -> total_curr_resolution ? ret * 4 : ret * 2 ;
225
+ ret = data -> total_curr_resolution ? ret * 2 : ret ;
227
226
break ;
228
227
/*
229
228
* The below registers are not implemented by device or implemented not according to the
0 commit comments