Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283438
b: refs/heads/master
c: 9c9cf9e
h: refs/heads/master
v: v3
  • Loading branch information
Philip Rakity authored and Anton Vorontsov committed Nov 25, 2011
1 parent 899f927 commit e207433
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 44abd774f52999125d499aed17a2f70211c34dcd
refs/heads/master: 9c9cf9e26363d0c06d0e01d5304477be97ace5cb
13 changes: 6 additions & 7 deletions trunk/drivers/power/max8925_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static int start_measure(struct max8925_power_info *info, int type)
}

max8925_bulk_read(info->adc, meas_reg, 2, buf);
ret = (buf[0] << 4) | (buf[1] >> 4);
ret = ((buf[0]<<8) | buf[1]) >> 4;

return ret;
}
Expand All @@ -208,7 +208,7 @@ static int max8925_ac_get_prop(struct power_supply *psy,
if (info->ac_online) {
ret = start_measure(info, MEASURE_VCHG);
if (ret >= 0) {
val->intval = ret << 1; /* unit is mV */
val->intval = ret * 2000; /* unit is uV */
goto out;
}
}
Expand Down Expand Up @@ -242,7 +242,7 @@ static int max8925_usb_get_prop(struct power_supply *psy,
if (info->usb_online) {
ret = start_measure(info, MEASURE_VCHG);
if (ret >= 0) {
val->intval = ret << 1; /* unit is mV */
val->intval = ret * 2000; /* unit is uV */
goto out;
}
}
Expand All @@ -266,7 +266,6 @@ static int max8925_bat_get_prop(struct power_supply *psy,
union power_supply_propval *val)
{
struct max8925_power_info *info = dev_get_drvdata(psy->dev->parent);
long long int tmp = 0;
int ret = 0;

switch (psp) {
Expand All @@ -277,7 +276,7 @@ static int max8925_bat_get_prop(struct power_supply *psy,
if (info->bat_online) {
ret = start_measure(info, MEASURE_VMBATT);
if (ret >= 0) {
val->intval = ret << 1; /* unit is mV */
val->intval = ret * 2000; /* unit is uV */
ret = 0;
break;
}
Expand All @@ -288,8 +287,8 @@ static int max8925_bat_get_prop(struct power_supply *psy,
if (info->bat_online) {
ret = start_measure(info, MEASURE_ISNS);
if (ret >= 0) {
tmp = (long long int)ret * 6250 / 4096 - 3125;
ret = (int)tmp;
/* assume r_sns is 0.02 */
ret = ((ret * 6250) - 3125) /* uA */;
val->intval = 0;
if (ret > 0)
val->intval = ret; /* unit is mA */
Expand Down

0 comments on commit e207433

Please sign in to comment.