BOOL kernel_power_off_charging_detection(void)
{
    int off_mode_status = 1;
    /* */
    if(is_force_boot()) {
        upmu_set_rg_chrind_on(0);
		printf("[%s] Turn off HW Led\n", __func__);
        return FALSE;
    }

    off_mode_status = get_off_mode_charge_status();
    printf("[%s] off_mode_status %d\n", __func__, off_mode_status);
    if(upmu_is_chr_det() == KAL_TRUE) {
        if (off_mode_status) {
            g_boot_mode = KERNEL_POWER_OFF_CHARGING_BOOT;
        } else {
            g_boot_mode = NORMAL_BOOT;
            upmu_set_rg_chrind_on(0);
            return FALSE;
        }
		return TRUE;
    }
    else {
        /* power off */
        #ifndef NO_POWER_OFF
        printf("[kernel_power_off_charging_detection] power off\n");
        mt6575_power_off();        
        #endif
		return FALSE;	
    }
    /* */
}
BOOL kernel_power_off_charging_detection(void)
{
#if 0
	if((upmu_is_chr_det() == KAL_TRUE))
	{
		if(bypass_kernel_power_off_charging()){
			return FALSE;
		}
		else
		{
            
			g_boot_mode = KERNEL_POWER_OFF_CHARGING_BOOT;
			return TRUE;
		}		
	}
	else
	{	
		upmu_set_rg_chrind_on(0);
		printf("[%s] Turn off HW Led\n", __func__);
		return FALSE;
	}
#else
    /* */
    if(is_force_boot()) {
        upmu_set_rg_chrind_on(0);
		printf("[%s] Turn off HW Led\n", __func__);
        return FALSE;
    }

    if((upmu_is_chr_det() == KAL_TRUE)) {
        g_boot_mode = KERNEL_POWER_OFF_CHARGING_BOOT;
		return TRUE;
    }
#ifdef RTC_2SEC_REBOOT_ENABLE
    else if(rtc_2sec_boot_check()){ //customize reboot to KPOC, but not charger in, still boot to normal
        printf("[%s] customize auto boot to KPOC, but charger not in, still boot to normal\n", __func__);
        g_boot_mode = NORMAL_BOOT;
        return TRUE;
    }
#endif
    else {
        /* power off */
        #ifndef NO_POWER_OFF
        printf("[kernel_power_off_charging_detection] power off\n");
        mt6575_power_off();        
        #endif
		return FALSE;	
    }
    /* */
#endif
}