static kal_uint32 charging_get_charger_type(void *data) { kal_uint32 status = STATUS_OK; #if defined(CONFIG_POWER_EXT) *(CHARGER_TYPE*)(data) = STANDARD_HOST; #else charging_type_det_done = KAL_FALSE; /********* Step initial ***************/ hw_bc11_init(); /********* Step DCD ***************/ if(1 == hw_bc11_DCD()) { /********* Step A1 ***************/ if(1 == hw_bc11_stepA1()) { *(CHARGER_TYPE*)(data) = APPLE_2_1A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step A1 : Apple 2.1A CHARGER!\r\n"); } else { *(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step A1 : Non STANDARD CHARGER!\r\n"); } } else { /********* Step A2 ***************/ if(1 == hw_bc11_stepA2()) { /********* Step B2 ***************/ if(1 == hw_bc11_stepB2()) { *(CHARGER_TYPE*)(data) = STANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : STANDARD CHARGER!\r\n"); } else { *(CHARGER_TYPE*)(data) = CHARGING_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : Charging Host!\r\n"); } } else { *(CHARGER_TYPE*)(data) = STANDARD_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step A2 : Standard USB Host!\r\n"); } } /********* Finally setting *******************************/ hw_bc11_done(); charging_type_det_done = KAL_TRUE; #endif return status; }
int hw_charging_get_charger_type(void) { #if 0 return STANDARD_HOST; //return STANDARD_CHARGER; //adaptor #else CHARGER_TYPE CHR_Type_num = CHARGER_UNKNOWN; /********* Step initial ***************/ hw_bc11_init(); /********* Step DCD ***************/ if(1 == hw_bc11_DCD()) { /********* Step A1 ***************/ if(1 == hw_bc11_stepA1()) { CHR_Type_num = APPLE_2_1A_CHARGER; battery_log(BAT_LOG_CRTI, "step A1 : Apple 2.1A CHARGER!\r\n"); } else { CHR_Type_num = NONSTANDARD_CHARGER; battery_log(BAT_LOG_CRTI, "step A1 : Non STANDARD CHARGER!\r\n"); } } else { /********* Step A2 ***************/ if(1 == hw_bc11_stepA2()) { /********* Step B2 ***************/ if(1 == hw_bc11_stepB2()) { // is_dcp_type = true; CHR_Type_num = STANDARD_CHARGER; battery_log(BAT_LOG_CRTI, "step B2 : STANDARD CHARGER!\r\n"); } else { CHR_Type_num = CHARGING_HOST; battery_log(BAT_LOG_CRTI, "step B2 : Charging Host!\r\n"); } } else { CHR_Type_num = STANDARD_HOST; battery_log(BAT_LOG_CRTI, "step A2 : Standard USB Host!\r\n"); } } /********* Finally setting *******************************/ hw_bc11_done(); return CHR_Type_num; #endif }
static CHARGER_TYPE hw_get_charger_type(void) { kal_uint32 status = STATUS_OK; CHARGER_TYPE charger_type = CHARGER_UNKNOWN; charging_type_det_done = KAL_FALSE; /********* Step initial ***************/ hw_bc11_init(); /********* Step DCD ***************/ if(1 == hw_bc11_DCD()) { /********* Step A1 ***************/ if(1 == hw_bc11_stepA1()) { charger_type = APPLE_2_1A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step A1 : Apple 2.1A CHARGER!\r\n"); } else { charger_type = NONSTANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step A1 : Non STANDARD CHARGER!\r\n"); } } else { /********* Step A2 ***************/ if(1 == hw_bc11_stepA2()) { /********* Step B2 ***************/ if(1 == hw_bc11_stepB2()) { charger_type = STANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : STANDARD CHARGER!\r\n"); } else { charger_type = CHARGING_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : Charging Host!\r\n"); } } else { charger_type = STANDARD_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step A2 : Standard USB Host!\r\n"); } } /********* Finally setting *******************************/ hw_bc11_done(); #endif return charger_type; }
static kal_uint32 charging_get_charger_type(void *data) { kal_uint32 status = STATUS_OK; #if defined(CONFIG_POWER_EXT) *(CHARGER_TYPE*)(data) = STANDARD_HOST; #else if (g_charger_type != CHARGER_UNKNOWN && g_charger_type != WIRELESS_CHARGER) { *(CHARGER_TYPE*)(data) = g_charger_type; battery_xlog_printk(BAT_LOG_CRTI, "[PowerSupply] return %d!\n", g_charger_type); return status; } charging_type_det_done = KAL_FALSE; /********* Step initial ***************/ hw_bc11_init(); /********* Step DCD ***************/ if(1 == hw_bc11_DCD()) { /********* Step A1 ***************/ if(1 == hw_bc11_stepA1()) { /********* Step B1 ***************/ if(1 == hw_bc11_stepB1()) { *(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B1 : Non STANDARD CHARGER!\n"); } else { *(CHARGER_TYPE*)(data) = APPLE_2_1A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B1 : Apple 2.1A CHARGER!\n"); } } else { /********* Step C1 ***************/ if(1 == hw_bc11_stepC1()) { *(CHARGER_TYPE*)(data) = APPLE_1_0A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step C1 : Apple 1A CHARGER!\n"); } else { *(CHARGER_TYPE*)(data) = APPLE_0_5A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step C1 : Apple 0.5A CHARGER!\n"); } } } else { /********* Step A2 ***************/ if(1 == hw_bc11_stepA2()) { /********* Step B2 ***************/ if(1 == hw_bc11_stepB2()) { *(CHARGER_TYPE*)(data) = STANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : STANDARD CHARGER!\n"); } else { *(CHARGER_TYPE*)(data) = CHARGING_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : Charging Host!\n"); } } else { *(CHARGER_TYPE*)(data) = STANDARD_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step A2 : Standard USB Host!\n"); } } /********* Finally setting *******************************/ hw_bc11_done(); #ifdef CONFIG_LGE_PM /* we do not support APPLE TA, so assume this as non-standard charger */ if (*(CHARGER_TYPE*)(data) == APPLE_2_1A_CHARGER || *(CHARGER_TYPE*)(data) == APPLE_1_0A_CHARGER || *(CHARGER_TYPE*)(data) == APPLE_0_5A_CHARGER) { *(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; } if (*(CHARGER_TYPE*)(data) == NONSTANDARD_CHARGER) { if (charging_type_det_retry == KAL_FALSE) { *(CHARGER_TYPE*)(data) = CHARGER_UNKNOWN; charging_type_det_retry = KAL_TRUE; } } #endif charging_type_det_done = KAL_TRUE; g_charger_type = *(CHARGER_TYPE*)(data); #endif return STATUS_OK; }
static kal_uint32 charging_get_charger_type(void *data) { kal_uint32 status = STATUS_OK; #if defined(CONFIG_POWER_EXT) *(CHARGER_TYPE*)(data) = STANDARD_HOST; #else #if defined(MTK_WIRELESS_CHARGER_SUPPORT) int wireless_state = 0; wireless_state = mt_get_gpio_in(wireless_charger_gpio_number); if(wireless_state == WIRELESS_CHARGER_EXIST_STATE) { *(CHARGER_TYPE*)(data) = WIRELESS_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "WIRELESS_CHARGER!\r\n"); return status; } #endif if(g_charger_type!=CHARGER_UNKNOWN && g_charger_type!=WIRELESS_CHARGER) { *(CHARGER_TYPE*)(data) = g_charger_type; battery_xlog_printk(BAT_LOG_CRTI, "return %d!\r\n", g_charger_type); return status; } charging_type_det_done = KAL_FALSE; /********* Step initial ***************/ hw_bc11_init(); /********* Step DCD ***************/ if(1 == hw_bc11_DCD()) { /********* Step A1 ***************/ if(1 == hw_bc11_stepA1()) { /********* Step B1 ***************/ if(1 == hw_bc11_stepB1()) { //*(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; //battery_xlog_printk(BAT_LOG_CRTI, "step B1 : Non STANDARD CHARGER!\r\n"); *(CHARGER_TYPE*)(data) = APPLE_2_1A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B1 : Apple 2.1A CHARGER!\r\n"); } else { //*(CHARGER_TYPE*)(data) = APPLE_2_1A_CHARGER; //battery_xlog_printk(BAT_LOG_CRTI, "step B1 : Apple 2.1A CHARGER!\r\n"); *(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B1 : Non STANDARD CHARGER!\r\n"); } } else { /********* Step C1 ***************/ if(1 == hw_bc11_stepC1()) { *(CHARGER_TYPE*)(data) = APPLE_1_0A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step C1 : Apple 1A CHARGER!\r\n"); } else { *(CHARGER_TYPE*)(data) = APPLE_0_5A_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step C1 : Apple 0.5A CHARGER!\r\n"); } } } else { /********* Step A2 ***************/ if(1 == hw_bc11_stepA2()) { /********* Step B2 ***************/ if(1 == hw_bc11_stepB2()) { *(CHARGER_TYPE*)(data) = STANDARD_CHARGER; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : STANDARD CHARGER!\r\n"); } else { *(CHARGER_TYPE*)(data) = CHARGING_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step B2 : Charging Host!\r\n"); } } else { *(CHARGER_TYPE*)(data) = STANDARD_HOST; battery_xlog_printk(BAT_LOG_CRTI, "step A2 : Standard USB Host!\r\n"); } } /********* Finally setting *******************************/ hw_bc11_done(); charging_type_det_done = KAL_TRUE; g_charger_type = *(CHARGER_TYPE*)(data); #endif return status; }
static kal_uint32 charging_get_charger_type(void *data) { kal_uint32 status = STATUS_OK; CHARGER_TYPE charger_type = CHARGER_UNKNOWN; #if defined(CONFIG_POWER_EXT) *(CHARGER_TYPE*)(data) = STANDARD_HOST; #else charging_type_det_done = KAL_FALSE; #if 0 charger_type = hw_charger_type_detection(); battery_log(BAT_LOG_CRTI, "charging_get_charger_type = %d\r\n", charger_type); *(CHARGER_TYPE*)(data) = charger_type; #endif #if 1 /********* Step initial ***************/ hw_bc11_init(); /********* Step DCD ***************/ if(1 == hw_bc11_DCD()) { /********* Step A1 ***************/ if(1 == hw_bc11_stepA1()) { /********* Step B1 ***************/ if(1 == hw_bc11_stepB1()) { //*(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; //battery_log(BAT_LOG_CRTI, "step B1 : Non STANDARD CHARGER!\r\n"); *(CHARGER_TYPE*)(data) = APPLE_2_1A_CHARGER; battery_log(BAT_LOG_CRTI, "step B1 : Apple 2.1A CHARGER!\r\n"); } else { //*(CHARGER_TYPE*)(data) = APPLE_2_1A_CHARGER; //battery_log(BAT_LOG_CRTI, "step B1 : Apple 2.1A CHARGER!\r\n"); *(CHARGER_TYPE*)(data) = NONSTANDARD_CHARGER; battery_log(BAT_LOG_CRTI, "step B1 : Non STANDARD CHARGER!\r\n"); } } else { /********* Step C1 ***************/ if(1 == hw_bc11_stepC1()) { *(CHARGER_TYPE*)(data) = APPLE_1_0A_CHARGER; battery_log(BAT_LOG_CRTI, "step C1 : Apple 1A CHARGER!\r\n"); } else { *(CHARGER_TYPE*)(data) = APPLE_0_5A_CHARGER; battery_log(BAT_LOG_CRTI, "step C1 : Apple 0.5A CHARGER!\r\n"); } } } else { /********* Step A2 ***************/ if(1 == hw_bc11_stepA2()) { /********* Step B2 ***************/ if(1 == hw_bc11_stepB2()) { *(CHARGER_TYPE*)(data) = STANDARD_CHARGER; battery_log(BAT_LOG_CRTI, "step B2 : STANDARD CHARGER!\r\n"); } else { *(CHARGER_TYPE*)(data) = CHARGING_HOST; battery_log(BAT_LOG_CRTI, "step B2 : Charging Host!\r\n"); } } else { *(CHARGER_TYPE*)(data) = STANDARD_HOST; battery_log(BAT_LOG_CRTI, "step A2 : Standard USB Host!\r\n"); } } /********* Finally setting *******************************/ hw_bc11_done(); #endif charging_type_det_done = KAL_TRUE; #endif return status; }