Пример #1
0
static void aat2862_set_main_current_level(struct i2c_client *client, int level)
{
	struct aat2862_device *dev;
	unsigned char val;
	unsigned char aat2862_muic_mode;
	
	dev = (struct aat2862_device *)i2c_get_clientdata(client);
	cur_main_lcd_level = level; 
	dev->bl_dev->props.brightness = cur_main_lcd_level;
/* 20101124 [email protected] for CP_USB and CP_UART[LGE_START]*/	
	aat2862_muic_mode = get_muic_mode();

	if ((aat2862_muic_mode == 9) && (check_battery_present() == 0)) //20101126 [email protected] to check battery present
		level = 0x00;
/* 20101124 [email protected] for CP_USB and CP_UART[LGE_END]*/
	val = 0xFF - level;
	//val = 0xC0 | (backlight_status<<5) | level;

	aat2862_write_reg(client, 0x03, val);

	if(level > 0x3F){
		val = 0;
	}else{
		val = 0x3F - level;
	}

	aat2862_write_reg(client, 0x04, val);
	aat2862_write_reg(client, 0x05, val);
	aat2862_write_reg(client, 0x06, val);

	mdelay(1);	// 20100526 [email protected]
}
Пример #2
0
/** @brief  To check PIF connected for factory test mode
    @author [email protected]
    @date   2010.05.14
*/
static ssize_t pif_detect_show(struct device *dev,
			       struct device_attribute *attr,
			       char *buf)
{
	int ret, val;
#if defined(CONFIG_HUB_MUIC)
	ret = get_muic_mode();

	if(ret == MUIC_UNKNOWN) {
		val = -1;
	} else if (lcd_off_boot && !check_battery_present()) {
		val = 2;
	} else if (ret == MUIC_AP_UART) {
		val = 1;
	} else if ((ret == MUIC_CP_UART) || (ret == MUIC_CP_USB)) {
		val = 2;
	} else {
		val = 0;
	}
// [email protected] 20120502 MUIC re-work start	
#elif defined(CONFIG_MUIC)
	int muic_mode;
	muic_mode = muic_get_mode();

	if(muic_mode == MUIC_UNKNOWN) {
		val = -1;
	} else if (lcd_off_boot && !check_battery_present()) {
		val = 2;
	} else if (muic_mode == MUIC_AP_UART) {
		val = 1;
	} else if ((muic_mode == MUIC_CP_UART) || (muic_mode == MUIC_CP_USB)) {
		val = 2;
	} else {
		val = 0;
	}
// [email protected] 20120502 MUIC re-work end	
#endif
	sprintf(buf, "%d\n", val);
	return (ssize_t)(strlen(buf) + 1);
}
Пример #3
0
void setting_for_factory_mode_hw_req(void)
{
#if 0 /* XXX_mbk */
	/* Battery FET OFF */
	lge_battery_fet_onoff(0);
#else
	/* HW요청사항...Battery가 있으면...2A가 아닌 960mA로 충전하도록
	   Charger IC가 2A로 충전을 계속하게 되면 버티지 못함. */
	if( check_battery_present() ) {
		printk(KERN_INFO "%s, Charger Current Setting TA mode from Factory Mode\n", __FUNCTION__);
		charging_ic_set_ta_mode();
	}
#endif
}
Пример #4
0
void charging_ic_deactive_before_setting(void)
{

	printk(KERN_INFO "[charging_msg]%s start, status %d\n", __FUNCTION__, charging_ic_status);
	/* If No Battery and Charger IC Deactive, the Device will be power down */
	if( check_battery_present() == 0 ) {
		printk("[charging_msg] %s, Fail... cause No Battery \n",__FUNCTION__);
		return ;
	}

	gpio_set_value(CHG_EN_SET_N_OMAP, 1);
	mdelay(1);
	udelay(800);
	return ;
}
Пример #5
0
void setting_for_factory_mode_hw_req(void)
{
#if 0 /* XXX_mbk */
	/* Battery FET OFF */
	lge_battery_fet_onoff(0);
#else
	extern void dp3t_switch_ctrl(TYPE_DP3T_MODE mode);
	
	/* HW요청사항...Battery가 있으면...2A가 아닌 960mA로 충전하도록
	   Charger IC가 2A로 충전을 계속하게 되면 버티지 못함. */
	if( check_battery_present() ) {
		printk(KERN_INFO "%s, Charger Current Setting TA mode from Factory Mode\n", __FUNCTION__);
		charging_ic_set_ta_mode();
	}
#endif

	/* USB Switch to CP */
	dp3t_switch_ctrl(DP3T_CP_USB);
}
Пример #6
0
static void twl4030_bci_battery_read_status(struct twl4030_bci_device_info *di)
{
	/* Read Battery Status */
	di->temp_C = twl4030battery_temperature();			// Read Temperature

	if(system_rev >= 2 && di->battery_present) {			// Adjust RCOMP for fuelgauge(Rev.D)
		max17043_set_rcomp_by_temperature(di->temp_C);
		// TODO : max17043_update
	}
//20120221, [email protected] , When is suddenly Over temperature,  retry read temperature. [START]
	if (di->temp_C >600 && di->temp_C != 0xBA00E00){
		msleep(10);
		printk("[BATTERY] When suddenly OverTemp. temp_C : %d \n", di->temp_C);
		di->temp_C = twl4030battery_temperature();
		printk("[BATTERY] When suddenly OverTemp. retry temp_C : %d \n", di->temp_C);
	}
//20120221, [email protected] , When is suddenly Over temperature,  retry read temperature. [END]
	di->voltage_uV = twl4030battery_voltage();			// Read Voltage
	di->battery_capacity = twl4030battery_capacity(di);	// Read Capacity
	di->battery_present = check_battery_present();		// Set Battery Present

	/* hub do not use BCI block. so we cannot measure battery current */
	di->current_uA = 0;
}
Пример #7
0
s32 muic_CP_USB_set(void){

	s32 ret;

/* LGE_CHANGE_START 2011-03-16 [email protected] patch for Adb offline set and Mass Storage Driver detecting fail */    	
	/* 20110113 [email protected] check muic driver init. state [START] */
	if(!muic_init_done){

		printk(KERN_WARNING "[MUIC] MUIC has not been initialized! Nothing will be done!!!.\n");
		return 0;
	}
	/* 20110113 [email protected] check muic driver init. state [END] */
/* LGE_CHANGE_END 2011-03-16 [email protected] */

// LGE_UPDATE_S 20110411 [[email protected]] force D+/D- open in CP side
	ret = muic_i2c_write_byte(SW_CONTROL, DP_OPEN | DM_OPEN);
	muic_udelay(100000);

	if(ret < 0)
		printk(KERN_WARNING "[MUIC] i2c write error for D+/D- open in muic_CP_USB_SET\n");
// LGE_UPDATE_E 20110411 [[email protected]] force D+/D- open in CP side

	/* Connect CP UART signals to AP */
   	/* CP <-> USIF_AP ?�결??CP ?�운로드 Fail 발생 */
    usif_switch_ctrl(USIF_DP3T);
	/* Connect CP USB to MUIC UART */
	dp3t_switch_ctrl(DP3T_CP_USB);

	if (muic_device == MAX14526) {
		/* ID_200, VLDO 2.6V, ADC is auto.
		 * USB 2.0 also needs the charge pump (CP_EN) on.*/
		ret = muic_i2c_write_byte(CONTROL_1, MID_200 | MADC_EN | MCP_EN);
	}
	else {
		if( MUIC_CP_USB != muic_mode ) {
			/* ID_200, VLDO 2.6V, SEMREN on. ADC is auto.
			 * USB 2.0 also needs the charge pump (CP_EN) on.*/
			ret = muic_i2c_write_byte(CONTROL_1, MID_200 | MSEMREN | MCP_EN);
		}
	}

	ret = muic_i2c_write_byte(SW_CONTROL, DP_USB | DM_USB);

	// S [email protected] ; add for charging mode when CP USB is slected
	int check_battery_present();
	if(check_battery_present()==1)
		charging_ic_set_usb_mode();
	else
		charging_ic_set_factory_mode();
	// E [email protected] ; add for charging mode when CP USB is slected

	muic_mode = MUIC_CP_USB;
	printk(KERN_ERR "[MUIC] muic_distinguish_vbus_accessory(): CP_USB\n");

// START [email protected] 2011/03/03 LAB1_FW : WAKELOCK_CASE_AT_CP_USB : Ref from LU3000 {
	if ( reset_status == 2 /* RESET_GLOBAL_SW_RESET */ ) {
        // If muic path is CP_USB, Reset cause is SW_RESET then WakeLock AP
		// wake lock for the factory mode
		if(0==the_wlock.wake_lock_on){
			wake_lock(&the_wlock.wake_lock);
			the_wlock.wake_lock_on=1;
			printk(KERN_WARNING "[MUIC] ====^^==== wake_lock_on=1 (locked)\n");
		}
	}
    else {
		/* wake lock off for the factory mode */
		set_wakelock(0);
    }
// END [email protected] 2011/03/03 LAB1_FW }

	return ret;
}