Exemple #1
0
void pchr_turn_on_charging (void)
{
	upmu_set_rg_usbdl_set(0);        //force leave USBDL mode
	upmu_set_rg_usbdl_rst(1);		//force leave USBDL mode
	
	kick_charger_wdt();
	
	upmu_set_rg_cs_vth(0xC);    	// CS_VTH, 450mA            
	upmu_set_rg_csdac_en(1);                // CSDAC_EN
	upmu_set_rg_chr_en(1);                  // CHR_EN  

#ifdef MTK_FAN5405_SUPPORT
	fan5405_hw_init();
	fan5405_turn_on_charging();
	fan5405_dump_register();
#endif

#ifdef MTK_BQ24196_SUPPORT
	bq24196_hw_init();
	bq24196_charging_enable(0);  //disable charging with power path
	bq24196_dump_register();
#endif
#ifdef MTK_BQ24158_SUPPORT
    bq24158_hw_init();
    bq24158_turn_on_charging();
    bq24158_dump_register();
#endif

}
Exemple #2
0
static int fan5405_driver_probe(struct i2c_client *client, const struct i2c_device_id *id) 
{             
	struct class_device *class_dev = NULL;
    int err=0; 
    struct fan5405_struct *fan_struct;

    printk("[fan5405_driver_probe] \n");

	if (!(new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL))) {
	printk("%s: kmalloc client fail!\n",__func__);
        err = -ENOMEM;
        goto exit;
    }	
    memset(new_client, 0, sizeof(struct i2c_client));

	new_client = client;

    fan_struct = kzalloc(sizeof(struct fan5405_struct), GFP_KERNEL);
    if (!fan_struct){
	printk("%s: kzalloc fan_struct fail!\n",__func__);
        err = -ENOMEM;
        goto exit_kfree;
    }

//    fan_struct->dev_readaddr = FAN5405_SLAVE_ADDR;
    fan_struct->ops = &fan_ops;
//    atomic_set(&fan_struct->config_count, 1);	/* re-setting chg param flag*/
    fan_struct->config_count = 1;	/* re-setting chg param flag*/
//    atomic_set(&fan_struct->disable_count, 1);	/*set fan5405 to HZ mode flag*/
    fan_struct->disable_count = 1;	/*set fan5405 to HZ mode flag*/
    fan_struct->work_mode = FAN5405_CHARGE_MODE;	/*set fan5405 to HZ mode flag*/
    fan_struct->boost_fault_status = BOOST_NORMAL_STATUS;
    fan_struct->chg_fault_status =  CHARGE_NORMAL_STATUS;

    the_fan5405_struct = fan_struct;
	
    if(fan5405_hw_init(fan_struct) == -1)
	{	
	printk("%s: failed!\n",__func__);
	goto exit_kfree_fan;
	}
    else
	printk("%s: success!\n",__func__);

//	fan5405_dump_register();

    return 0;  
                                                                                     
exit_kfree_fan:
    kfree(fan_struct);
    the_fan5405_struct = NULL;	
exit_kfree:
    kfree(new_client);
exit:
    return err;

}