static kal_uint32 charging_enable(void *data)
{
	kal_uint32 status = STATUS_OK;
	kal_uint32 enable = *(kal_uint32*)(data);

	if(KAL_TRUE == enable)
	{
		bq24196_set_en_hiz(0x0);	            	
		bq24196_set_chg_config(0x1); // charger enable
	}
	else
	{
		#if defined(CONFIG_USB_MTK_HDRC_HCD)
		if(mt_usb_is_device())
		#endif 			
		{
			bq24196_set_chg_config(0x0);
			if (charging_get_error_state()) {
				battery_log(BAT_LOG_CRTI, "[charging_enable] bq24196_set_hz_mode(0x1)\n");
				bq24196_set_en_hiz(0x1);	// disable power path
			}
		}
		#if defined(CONFIG_MTK_DUAL_INPUT_CHARGER_SUPPORT)
		bq24196_set_chg_config(0x0);
		bq24196_set_en_hiz(0x1);	// disable power path
		#endif
	}

	return status;
}
static kal_uint32 charging_enable(void *data)
{
    kal_uint32 status = STATUS_OK;
    kal_uint32 enable = *(kal_uint32*)(data);
    kal_uint32 ret = 0;

    if(KAL_TRUE == enable)
    {
        //mt6333_set_rg_chr_en(1);
        ret=mt6333_config_interface(0x04, 0x95, 0xFF, 0x0);
    }
    else
    {

#if defined(CONFIG_USB_MTK_HDRC_HCD)
        if(mt_usb_is_device())
#endif 			
        {
            //mt6333_set_rg_chr_en(0);
            ret=mt6333_config_interface(0x04, 0x94, 0xFF, 0x0);
        }
    }
	
    return status;
}
 static kal_uint32 charging_enable(void *data)
 {
 	kal_uint32 status = STATUS_OK;
	kal_uint32 enable = *(kal_uint32*)(data);

	if(KAL_TRUE == enable)
	{
		fan5402_set_ce(0);
		fan5402_set_hz_mode(0);
		fan5402_set_opa_mode(0);
	}
	else
	{

#if defined(CONFIG_USB_MTK_HDRC_HCD)
   		if(mt_usb_is_device())
#endif 			
    	{
	        mt_set_gpio_mode(gpio_number,gpio_off_mode);  
	        mt_set_gpio_dir(gpio_number,gpio_off_dir);
	        mt_set_gpio_out(gpio_number,gpio_off_out);

	        fan5402_set_ce(1);
    	}
	}
		
	return status;
 }
示例#4
0
 static kal_uint32 charging_enable(void *data)
 {
 	kal_uint32 status = STATUS_OK;
	kal_uint32 enable = *(kal_uint32*)(data);

	if(KAL_TRUE == enable)
	{
		ncp1854_set_chg_en(0x1); // charger enable
		//Set SPM = 1		
#ifdef GPIO_SWCHARGER_EN_PIN

		mt_set_gpio_mode(GPIO_SWCHARGER_EN_PIN, GPIO_MODE_00);
		mt_set_gpio_dir(GPIO_SWCHARGER_EN_PIN, GPIO_DIR_OUT);
		mt_set_gpio_out(GPIO_SWCHARGER_EN_PIN, GPIO_OUT_ONE);

#endif
	}
	else
	{
#if defined(CONFIG_USB_MTK_HDRC_HCD)
   		if(mt_usb_is_device())
#endif 			
    	{
			ncp1854_set_chg_en(0x0); // charger disable
    	}
	}
		
	return status;
 }
 static kal_uint32 charging_enable(void *data)
 {
 	kal_uint32 status = STATUS_OK;
	kal_uint32 enable = *(kal_uint32*)(data);

	if(KAL_TRUE == enable)
	{
		ncp1854_set_chg_en(0x1); // charger enable
		//Set SPM = 1
		mt_set_gpio_mode(GPIO_CHR_SPM_PIN, GPIO_MODE_00);
		mt_set_gpio_dir(GPIO_CHR_SPM_PIN, GPIO_DIR_OUT);
		mt_set_gpio_out(GPIO_CHR_SPM_PIN, GPIO_OUT_ONE);
	}
	else
	{
#if defined(CONFIG_USB_MTK_HDRC_HCD)
   		if(mt_usb_is_device())
#endif
    	{
			if(charging_get_error_state())
			{
				ncp1854_set_chg_en(0x0); // charger disable
				battery_log(BAT_LOG_CRTI,"[charging_enable] ncp1854_set_pwr_path(0)\n");
				ncp1854_set_pwr_path(0);	// disable power path
			}
    	}
	}

	return status;
 }
int upmu_is_chr_det_hal(void)
{
    if(is_chr_det() == 0)
    {
        return 0;
    }
    else
    {
        if( mt_usb_is_device() )
        {
        	battery_xlog_printk(BAT_LOG_CRTI, "[upmu_is_chr_det_hal] Charger exist and USB is not host\n");
            return 1;
        }
        else
        {
            battery_xlog_printk(BAT_LOG_CRTI, "[upmu_is_chr_det_hal] Charger exist but USB is host\n");
            return 0;
        }
    }
}
static kal_uint32 charging_enable_bq24196(void *data)
{
	kal_uint32 status = STATUS_OK;
	kal_uint32 enable = *(kal_uint32*)(data);

	if(KAL_TRUE == enable)
	{
		bq24196_set_en_hiz(0x0);
		bq24196_set_chg_config(0x1); // charger enable
	}
	else
	{
#if defined(CONFIG_USB_MTK_HDRC_HCD)
		if(mt_usb_is_device())
#endif
		{
			bq24196_set_chg_config(0x0);
		}
	}

	return status;
}
示例#8
0
static kal_uint32 charging_enable(void *data)
{
    kal_uint32 status = STATUS_OK;
    kal_uint32 enable = *(kal_uint32*)(data);

    if(KAL_TRUE == enable)
    {
        bq24160_set_hz_mode(0);
        bq24160_set_ce(0);
    }
    else
    {

#if defined(CONFIG_USB_MTK_HDRC_HCD)
        if(mt_usb_is_device())
#endif             
        {
            bq24160_set_ce(1);
            bq24160_set_hz_mode(1);
        }
    }
        
    return status;
}