static void hw_bc11_done(void)
{
   //RG_bc11_VSRC_EN[1:0]=00
   bc11_set_register_value(PMIC_RG_BC11_VSRC_EN,0x0);
   //RG_bc11_VREF_VTH = [1:0]=0
   bc11_set_register_value(PMIC_RG_BC11_VREF_VTH,0x0);
   //RG_bc11_CMP_EN[1.0] = 00
   bc11_set_register_value(PMIC_RG_BC11_CMP_EN,0x0);
   //RG_bc11_IPU_EN[1.0] = 00
   bc11_set_register_value(PMIC_RG_BC11_IPU_EN,0x0);
   //RG_bc11_IPD_EN[1.0] = 00
   bc11_set_register_value(PMIC_RG_BC11_IPD_EN,0x0);
   //RG_bc11_BIAS_EN=0
   bc11_set_register_value(PMIC_RG_BC11_BIAS_EN,0x0);


   Charger_Detect_Release();

   if(Enable_BATDRV_LOG == BAT_LOG_FULL)
   {
       battery_xlog_printk(BAT_LOG_FULL, "hw_bc11_done() \r\n");
       hw_bc11_dump_register();
   }
   
}
Ejemplo n.º 2
0
static void hw_bc11_done(void)
{
   //RG_bc11_VSRC_EN[1:0]=00
   mt6325_upmu_set_rg_bc11_vsrc_en(0x0);
   //RG_bc11_VREF_VTH = [1:0]=0
   mt6325_upmu_set_rg_bc11_vref_vth(0x0);
   //RG_bc11_CMP_EN[1.0] = 00
   mt6325_upmu_set_rg_bc11_cmp_en(0x0);
   //RG_bc11_IPU_EN[1.0] = 00
   mt6325_upmu_set_rg_bc11_ipu_en(0x0);
   //RG_bc11_IPD_EN[1.0] = 00
   mt6325_upmu_set_rg_bc11_ipd_en(0x0);
   //RG_bc11_BIAS_EN=0
   mt6325_upmu_set_rg_bc11_bias_en(0x0);

  // if (!is_dcp_type)
   Charger_Detect_Release();

   if(Enable_BATDRV_LOG == BAT_LOG_FULL)
   {
       battery_log(BAT_LOG_FULL, "hw_bc11_done() \r\n");
       hw_bc11_dump_register();
   }

}
static void hw_bc11_done(void)
{
	//RG_BC11_VSRC_EN[1:0]=00
	upmu_set_rg_bc11_vsrc_en(0x0);
	//RG_BC11_VREF_VTH = [1:0]=0
	upmu_set_rg_bc11_vref_vth(0x0);
	//RG_BC11_CMP_EN[1.0] = 00
	upmu_set_rg_bc11_cmp_en(0x0);
	//RG_BC11_IPU_EN[1.0] = 00
	upmu_set_rg_bc11_ipu_en(0x0);
	//RG_BC11_IPD_EN[1.0] = 00
	upmu_set_rg_bc11_ipd_en(0x0);
	//RG_BC11_BIAS_EN=0
	upmu_set_rg_bc11_bias_en(0x0);

	Charger_Detect_Release();

	battery_xlog_printk(BAT_LOG_FULL, "[PowerSupply] hw_bc11_done()\n");
	hw_bc11_dump_register();
}
static void hw_bc12_done(void)
{
   //RG_bc12_VSRC_EN[1:0]=00
   mt6332_upmu_set_rg_bc12_vsrc_en(0x0);
   //RG_bc12_VREF_VTH = [1:0]=0
   mt6332_upmu_set_rg_bc12_vref_vth(0x0);
   //RG_bc12_CMP_EN[1.0] = 00
   mt6332_upmu_set_rg_bc12_cmp_en(0x0);
   //RG_bc12_IPU_EN[1.0] = 00
   mt6332_upmu_set_rg_bc12_ipu_en(0x0);
   //RG_bc12_IPD_EN[1.0] = 00
   mt6332_upmu_set_rg_bc12_ipd_en(0x0);
   //RG_bc12_BIAS_EN=0
   mt6332_upmu_set_rg_bc12_bias_en(0x0); 

   Charger_Detect_Release();

   if(Enable_BATDRV_LOG == BAT_LOG_FULL)
   {
       battery_xlog_printk(BAT_LOG_FULL, "hw_bc12_done() \r\n");
       hw_bc12_dump_register();
   }
   
}
Ejemplo n.º 5
0
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
    kal_uint8 val=0;
    kal_uint8 dpdm_bit=1;
    kal_uint32 i =0;
    kal_uint32 i_timeout=10000000;
    
    #if defined(MTK_WIRELESS_CHARGER_SUPPORT)
    int wireless_state = 0;
    if(wireless_charger_gpio_number!=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!\n");
            return status;
        }
    }
    else
    {
        battery_xlog_printk(BAT_LOG_CRTI, "wireless_charger_gpio_number=%d\n", wireless_charger_gpio_number);
    }
    
    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!\n", g_charger_type);
        return status;
    }
    #endif
    
    if(is_chr_det()==0)
    {
        g_charger_type = CHARGER_UNKNOWN; 
        *(CHARGER_TYPE*)(data) = CHARGER_UNKNOWN;
        battery_xlog_printk(BAT_LOG_CRTI, "[charging_get_charger_type] return CHARGER_UNKNOWN\n");
        return status;
    }
    
    charging_type_det_done = KAL_FALSE;

    if(get_pmic_mt6332_cid()==PMIC6332_E1_CID_CODE)
    {        
        msleep(300);
        Charger_Detect_Init();

        //-----------------------------------------------------
        bq24160_config_interface(bq24160_CON3, 0x1, 0x1, 0);

        dpdm_bit=1;
        while(dpdm_bit!=0)
        {           
            bq24160_read_interface(bq24160_CON3, &dpdm_bit, 0x1, 0);
            battery_xlog_printk(BAT_LOG_CRTI,"[charging_get_charger_type] bq24160_CON3[0]=%d\n", dpdm_bit);

            msleep(10);

            i++;
            if(i > i_timeout)
                break;
        }

        if(i > i_timeout)
        {
            *(CHARGER_TYPE*)(data) = STANDARD_HOST;        
            battery_xlog_printk(BAT_LOG_CRTI,"[charging_get_charger_type] timeout(%d) : step=STANDARD_HOST\n", i);
        }
        else
        {
            bq24160_read_interface(bq24160_CON2, &val, 0x7, 4);
            if(val==0)
            {
                *(CHARGER_TYPE*)(data) = STANDARD_HOST;        
                battery_xlog_printk(BAT_LOG_CRTI,"[charging_get_charger_type] E1 workaround (%d), step=STANDARD_HOST\n", val);    
            }
            else
            {
                *(CHARGER_TYPE*)(data) = STANDARD_CHARGER;        
                battery_xlog_printk(BAT_LOG_CRTI,"[charging_get_charger_type] E1 workaround (%d), step=STANDARD_CHARGER\n", val);
            }
        }
        //-----------------------------------------------------

        Charger_Detect_Release();
    }
    else
    {
        *(CHARGER_TYPE*)(data) = hw_charging_get_charger_type();
    }

    charging_type_det_done = KAL_TRUE;

    g_charger_type = *(CHARGER_TYPE*)(data);
    
#endif
    return status;
}