Beispiel #1
0
static void get_system_status_in_sleep( int *battery_level_ptg, 
                    int *battery_level_vol, 
                    int *battery_temp, 
                    int *charge_current_adc )
{
    int temp_adc;
    int ptg_val;

    twl4030_i2c_init();
    normal_i2c_init();

    ptg_val = get_fuelgauge_ptg_value( CHARGE_DUR_SLEEP );
	ptg_val = get_adjusted_battery_ptg(ptg_val);

    if ( ptg_val >= 0 )
    {
        *battery_level_ptg = ptg_val;
    }

    *battery_level_vol = get_fuelgauge_adc_value( 5, CHARGE_DUR_SLEEP );

    temp_adc = t2_adc_data( device_config->TEMP_ADC_PORT );
    //temp_adc = _get_t2adc_data_( device_config->TEMP_ADC_PORT );

    if ( device_config->MONITORING_CHG_CURRENT )
        //*charge_current_adc = _get_t2adc_data_ ( device_config->CHG_CURRENT_ADC_PORT );
        *charge_current_adc = t2_adc_data ( device_config->CHG_CURRENT_ADC_PORT );

    normal_i2c_disinit();
    twl4030_i2c_disinit();

    *battery_temp = t2adc_to_temperature( temp_adc, device_config->TEMP_ADC_PORT ); 
}
Beispiel #2
0
static void get_system_status_in_sleep( int *battery_level_ptg, 
					int *battery_level_vol, 
					int *battery_temp, 
					int *charge_current_adc )
// ----------------------------------------------------------------------------
// Description    : 
// Input Argument :  
// Return Value   :
{
	int temp_adc;
	int ptg_val;

	twl4030_i2c_init();
	normal_i2c_init();

	ptg_val = get_fuelgauge_ptg_value( CHARGE_DUR_SLEEP );

	if ( ptg_val >= 0 )
	{
		*battery_level_ptg = ptg_val;
	}

	*battery_level_vol = get_fuelgauge_adc_value( 5, CHARGE_DUR_SLEEP );

	temp_adc = t2_adc_data( device_config->TEMP_ADC_PORT );

	if ( device_config->MONITORING_CHG_CURRENT )
		//*charge_current_adc = t2_adc_data ( device_config->CHG_CURRENT_ADC_PORT );//me close
                *charge_current_adc = get_fuelgauge_ptg_value( CHARGE_DUR_SLEEP );//me add
	normal_i2c_disinit();
	twl4030_i2c_disinit();

	//printk("\n<BR> TEMP ADC: %d\n", adc);
	//printk("                     <BR> CHG CURRENT ADC: %d, VOL: %d\n\n ", *charge_current_adc, (*charge_current_adc * 2500 / 1023) );

	*battery_temp = t2adc_to_temperature( temp_adc, device_config->TEMP_ADC_PORT );	

//	mdelay(1000);
}