spring: Update PMU ADC constant

The current sense resistor has changed. Update constant here to reflect
the new values for DVT1.

BUG=None
TEST=Build Spring
BRANCH=Spring

Change-Id: Ib27c45cef569fa758db2fbb428150c8c2b6732ef
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49892
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vic Yang
2013-05-02 21:42:36 +08:00
committed by ChromeBot
parent a26c722b0a
commit 3addfe80f9

View File

@@ -82,6 +82,10 @@ enum ilim_config {
#define PWM_MAPPING_A 3012
#define PWM_MAPPING_B (-29)
/* Current sense resistor values */
#define R_INPUT_MOHM 20 /* mOhm */
#define R_BATTERY_MOHM 33 /* mOhm */
static int current_dev_type = TSU6721_TYPE_NONE;
static int nominal_pwm_duty;
static int current_pwm_duty;
@@ -779,11 +783,11 @@ static int command_batdebug(int argc, char **argv)
ccprintf("VAC = %d mV\n", pmu_adc_read(ADC_VAC, ADC_FLAG_KEEP_ON)
* 17000 / 1024);
ccprintf("IAC = %d mA\n", pmu_adc_read(ADC_IAC, ADC_FLAG_KEEP_ON)
* 20 * 33 / 1024);
* (1000 / R_INPUT_MOHM) * 33 / 1024);
ccprintf("VBAT = %d mV\n", pmu_adc_read(ADC_VBAT, ADC_FLAG_KEEP_ON)
* 17000 / 1024);
ccprintf("IBAT = %d mA\n", pmu_adc_read(ADC_IBAT, 0)
* 50 * 40 / 1024);
* (1000 / R_BATTERY_MOHM) * 40 / 1024);
ccprintf("PWM = %d%%\n", STM32_TIM_CCR1(3));
battery_current(&val);
ccprintf("Battery Current = %d mA\n", val);
@@ -844,7 +848,7 @@ static int power_command_info(struct host_cmd_handler_args *args)
r->voltage_system = pmu_adc_read(ADC_VAC, ADC_FLAG_KEEP_ON)
* 17000 / 1024;
r->current_system = pmu_adc_read(ADC_IAC, 0)
* 20 * 33 / 1024;
* (1000 / R_INPUT_MOHM) * 33 / 1024;
r->usb_dev_type = current_dev_type;
/* Approximate value by PWM duty cycle */