Skip to content

Commit

Permalink
board/freescale/vid: Add correction for ltc3882 read error.
Browse files Browse the repository at this point in the history
Voltage regulator LTC3882 device has 0.5% voltage read error.
So for NXP SoC devices this generally equates to 2mV

Update set_voltage_to_LTC for below:
1.Add coorection of upto 2mV in voltage comparison
  to take care of voltage read error of voltage regulator
2.Add loop max count kept as 100 to avoid infinte loop.

Signed-off-by: Priyanka Jain <[email protected]>
Reviewed-by: York Sun <[email protected]>
  • Loading branch information
p-priyanka-jain authored and York Sun committed Dec 6, 2018
1 parent 4c9d4a7 commit df182a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion board/freescale/common/vid.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ static int set_voltage_to_IR(int i2caddress, int vdd)
static int set_voltage_to_LTC(int i2caddress, int vdd)
{
int ret, vdd_last, vdd_target = vdd;
int count = 100, temp = 0;

/* Scale up to the LTC resolution is 1/4096V */
vdd = (vdd * 4096) / 1000;
Expand All @@ -343,7 +344,9 @@ static int set_voltage_to_LTC(int i2caddress, int vdd)
printf("VID: Couldn't read sensor abort VID adjust\n");
return -1;
}
} while (vdd_last != vdd_target);
count--;
temp = vdd_last - vdd_target;
} while ((abs(temp) > 2) && (count > 0));

return vdd_last;
}
Expand Down

0 comments on commit df182a4

Please sign in to comment.