Esempio n. 1
0
void charging_ic_deactive(void)
{

    if(charging_ic_status == POWER_SUPPLY_TYPE_BATTERY)
    {
		battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: it's already %s mode!! :\n", __func__);
        return;
    }

    mutex_lock(&charging_lock);

#if 1
    charging_ic_set_chargingmode(CHR_DENACTIVE_MODE);
#else
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ONE);

    udelay(2000);
#endif /* 0 */

    charging_ic_status = POWER_SUPPLY_TYPE_BATTERY;

    mutex_unlock(&charging_lock);

	battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: %s :\n", __func__);
}
Esempio n. 2
0
// USB500 mode charging
void charging_ic_active_default(void)
{
    u32 wait;

    if(charging_ic_status == POWER_SUPPLY_TYPE_USB)
    {
		battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: it's already %s mode!!\n", __func__);
        return;
    }

    if(charging_ic_status != POWER_SUPPLY_TYPE_BATTERY)
    {
        charging_ic_deactive();
    }

    mutex_lock(&charging_lock);

    // USB500 mode
#if (1)
    charging_ic_set_chargingmode(CHR_USB_500_MODE);
#else
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(1500);
#endif /* 1 */

    charging_ic_status = POWER_SUPPLY_TYPE_USB;

    mutex_unlock(&charging_lock);

	battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: %s :\n", __func__);

}
Esempio n. 3
0
// TA connection, ISET mode
void charging_ic_set_ta_mode()
{
    u32 wait;

    if(charging_ic_status == POWER_SUPPLY_TYPE_MAINS)
    {
        xlog_printk(ANDROID_LOG_INFO, "Power/Charger", "[charger_rt9536] :: it's already %s mode!! : \n", __func__);
        return;
    }

    if(charging_ic_status != POWER_SUPPLY_TYPE_BATTERY)
    {
        charging_ic_deactive();
    }
/*                                                                                                              */
#ifdef SINGLE_CHARGER_CONTOL_USING_GPT_TIMER
    mutex_lock(&charging_lock);
    wait = 0;
    while (wait < 10)
    {
        if (Set_Charging_Commmand(CHARGING_SET_TA_MODE_COMMAND) == KAL_TRUE)
        {
            break;
        }
        wait++;
        mdelay(10);
    }
    charging_ic_status = POWER_SUPPLY_TYPE_MAINS;
    mutex_unlock(&charging_lock);
#else

    mutex_lock(&charging_lock);

//                                                                                    
#if defined(SINGLE_CHARGER_CONTROL_USING_SPIN_LOCK)
    charging_ic_set_chargingmode(CHR_ISET_MODE);
#else
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ONE);
    udelay(400);  // about 400 us
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(1800);

    /*                                                                                       */
    high_volt_setting();
    /*                                                                                       */
#endif
//                                                                                    

    charging_ic_status = POWER_SUPPLY_TYPE_MAINS;

    mutex_unlock(&charging_lock);
#endif
/*                                                                                                              */

    xlog_printk(ANDROID_LOG_INFO, "Power/Charger", "[charger_rt9536] :: %s : \n", __func__);
}
Esempio n. 4
0
void charging_ic_set_factory_mode(void)
{
    u32 wait;

#if 0
    if(charging_ic_status == POWER_SUPPLY_TYPE_FACTORY)
    {
		battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: it's already %s mode!! :\n", __func__);
        return;
    }
#endif /* 0 */

	battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: charging_ic_set_factory_mode\n");

    if(charging_ic_status != POWER_SUPPLY_TYPE_BATTERY)
    {
        charging_ic_deactive();
    }

    mutex_lock(&charging_lock);

#if (1)
    charging_ic_set_chargingmode(CHR_PTM_MODE);
#else
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ONE);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ONE);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ONE);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(1500);
#endif /* 0 */

#if 0
    charging_ic_status = POWER_SUPPLY_TYPE_FACTORY;
#endif /* 0 */

    mutex_unlock(&charging_lock);

	battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: %s :\n", __func__);
}
Esempio n. 5
0
// TA connection, ISET mode
void charging_ic_set_ta_mode(void)
{
    u32 wait;

	battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: charging_ic_set_ta_mode\n");

    if(charging_ic_status == POWER_SUPPLY_TYPE_MAINS)
    {
		battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: it's already %s mode!! :\n", __func__);
        return;
    }

    if(charging_ic_status != POWER_SUPPLY_TYPE_BATTERY)
    {
        charging_ic_deactive();
    }

    mutex_lock(&charging_lock);

#if (1)
    charging_ic_set_chargingmode(CHR_ISET_MODE);
#else
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(400);
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ONE);
    udelay(400);  // about 400 us
    mt_set_gpio_out(CHG_EN_SET_N, GPIO_OUT_ZERO);
    udelay(1500);
#endif /* 1 */

    charging_ic_status = POWER_SUPPLY_TYPE_MAINS;

    mutex_unlock(&charging_lock);

	battery_log(BAT_LOG_CRTI,  "[charger_rt9536] :: %s :\n", __func__);
}