Ejemplo n.º 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 ); 
}
Ejemplo n.º 2
0
static int get_battery_level_ptg( void )
{
    int value;

    value = get_fuelgauge_ptg_value( CHARGE_DUR_ACTIVE );

	/* adjust percentage value for Latona */
	//if(!sec_bci.charger.is_charging)
	value = get_adjusted_battery_ptg(value);
/*
    if ( sec_bci.charger.is_charging && value >= 100)
        value = 99;
*/
    if ( sec_bci.charger.charge_status == POWER_SUPPLY_STATUS_FULL )
		value = 100;

    if(!boot_complete && value <= 0)
        value = 1;

#ifdef CONFIG_SAMSUNG_BATTERY_TESTMODE
    return 60;
#else
    return value;
#endif
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
0
static int get_battery_level_ptg( void )
// ----------------------------------------------------------------------------
// Description    : The result value is returned as a percentage of cell's full 
//                  capacity.
// Input Argument :  
// Return Value   : 
{
	int value;

	value = get_fuelgauge_ptg_value( CHARGE_DUR_ACTIVE );

	if ( value < 0 )
		value=sec_bci.battery.battery_level_ptg;

	return value;
}