void set_ts5usba33402_muic_path(unsigned char int_stat_value)
{
	if (int_stat_value & VBUS) {
		if ((int_stat_value & IDNO) == IDNO_0010 || 
			(int_stat_value & IDNO) == IDNO_1001 ||
			(int_stat_value & IDNO) == IDNO_1010) {
			set_ts5usba33402_cp_usb_mode();
			muic_path = MUIC_CP_USB;
			charging_mode = CHARGING_FACTORY;
		} else if ((int_stat_value & IDNO) == IDNO_0100) {
			set_ts5usba33402_cp_uart_mode();
			muic_path = MUIC_CP_UART;
			charging_mode = CHARGING_FACTORY;
		} else if (int_stat_value & CHGDET) {
			muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ);
			muic_path = MUIC_LG_TA;
			charging_mode = CHARGING_LG_TA;
		} else {
			if ((int_stat_value & IDNO ) == IDNO_0000){
				muic_set_mhl_mode_detect(); 
			}else{
			set_ts5usba33402_ap_usb_mode();
			muic_path = MUIC_AP_USB;
			charging_mode = CHARGING_USB;
			}
		}
	} else {
		if ((int_stat_value & IDNO) == IDNO_0010) {
			set_ts5usba33402_ap_uart_mode();
			muic_path = MUIC_AP_UART;
			charging_mode = CHARGING_NONE;
		} else if ((int_stat_value & IDNO) == IDNO_0100) {
			set_ts5usba33402_cp_uart_mode();
			muic_path = MUIC_CP_UART;
			charging_mode = CHARGING_NONE;
		} else {
			muic_path = MUIC_UNKNOWN;
			charging_mode = CHARGING_NONE;
		}
	}
}
예제 #2
0
void set_ts5usba33402_muic_mode(unsigned char int_stat_value)
{
	gpio_set_value(GPIO_CP_UART_SW, 0);
	gpio_set_value(GPIO_CP_USB_VBUS_EN, 0);
#if defined(CONFIG_LU6500)
	muic_i2c_write_byte(SW_CONTROL, DP_OPEN | DM_OPEN);
#else
	muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ);
#endif	
	muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN);

	muic_mdelay(10);

	if (int_stat_value & V_VBUS) {
		if ((int_stat_value & IDNO) == IDNO_0010 || 
			(int_stat_value & IDNO) == IDNO_1001 ||
			(int_stat_value & IDNO) == IDNO_1010) {
			set_ts5usba33402_cp_usb_mode();
			muic_mode = MUIC_CP_USB;
			charging_mode = CHARGING_FACTORY;
		} else if ((int_stat_value & IDNO) == IDNO_0100) {
			set_ts5usba33402_cp_uart_mode();
			muic_mode = MUIC_CP_UART;
			charging_mode = CHARGING_FACTORY;
#if defined(CONFIG_MHL_TX_SII9244)
		} else if ((int_stat_value & IDNO) == IDNO_0000) {	//                                               
			muic_set_mhl_mode_detect();
			muic_mode = MUIC_MHL;
			charging_mode = CHARGING_USB;
#endif
		} else if (int_stat_value & CHGDET) {
			muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ);
			muic_mode = MUIC_LG_TA;
			charging_mode = CHARGING_LG_TA;
		} else {
			set_ts5usba33402_ap_usb_mode();
			muic_mode = MUIC_AP_USB;
			charging_mode = CHARGING_USB;
		}
	} else {
		if ((int_stat_value & IDNO) == IDNO_0010) {
			set_ts5usba33402_ap_uart_mode();
			muic_mode = MUIC_AP_UART;
			charging_mode = CHARGING_NONE;
		} else if ((int_stat_value & IDNO) == IDNO_0100) {
			set_ts5usba33402_cp_uart_mode();
			muic_mode = MUIC_CP_UART;
			charging_mode = CHARGING_NONE;
		} else {
			muic_mode = MUIC_UNKNOWN;
			charging_mode = CHARGING_NONE;
		}
	}

#if 0 //                                        
	unsigned char reg_value;	
	s32 ret = 0;

	printk(KERN_INFO "[MUIC] %s :  int_stat_value  = 0x%x \n" ,__func__ ,int_stat_value);
	/*if(retain_mode  == BOOT_CP_USB){
		muic_set_develop_mode_detect();
	}else */if (int_stat_value & CHGDET) {
		printk(KERN_INFO "[MUIC] %s :  muic_mode is CHGDET (%d) \n" ,__func__ ,muic_mode);
		muic_set_charger_detect(int_stat_value);
	} else if((int_stat_value & IDNO) == IDNO_0100 ) {
		printk(KERN_INFO "[MUIC] %s :  muic_mode is 130Kohm CP_UART (%d) \n" ,__func__ ,muic_mode);
		/* IDNO=0100? 130Kohm :: CP_UART */
		muic_set_factory_mode_detect(IDNO_0100);	
	} else if((int_stat_value & IDNO) == IDNO_1010) {	
		printk(KERN_INFO "[MUIC] %s :  muic_mode is 910KOhm AP_USB (%d) \n" ,__func__ ,muic_mode);		
		/* IDNO=0100? 910KOhm :: CP_USB */		
		muic_set_factory_mode_detect(IDNO_1010);	
	} else if ((int_stat_value & IDNO) == IDNO_0010) {
		/* IDNO=0010? 56Kohm  :: USB_MODE */
		muic_set_develop_mode_detect();
#if defined(CONFIG_MHL_TX_SII9244)
	} else if (int_stat_value == 0x10) {
		/* IDNO=0000? 0Kohm  :: MHL_MODE */
		muic_set_mhl_mode_detect();    
#else		
	} else if ((int_stat_value == 0x30) || (int_stat_value == 0x11) || (int_stat_value == 0x10)) {
		muic_set_special_test_mode_detect();
#endif//
	} else  if (int_stat_value & V_VBUS) {
		/* Standard USB Host Detected (0x03=0x23) */
		   
		/* Read a status reigster(0x05) */
		ret = muic_i2c_read_byte(STATUS, &reg_value);

		if (reg_value & DCPORT || reg_value & CHPORT) {
			/* Charger Detected*/
			/* COMP2/COMN1 to H-Z (0x03=0x24) */
			muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ);			
			muic_mode = MUIC_NA_TA;
		} else {
#if defined(CONFIG_MHL_TX_SII9244)
			if ((int_stat_value & IDNO ) == IDNO_0000) {
					muic_set_mhl_mode_detect(); 					
			} else {
					///* Standard USB Host Detected (0x03=0x23) */							
					muic_set_usb_mode_detect(); 	// Turn on USB switches 		
					muic_mode = MUIC_AP_USB;
			}
#else
			///* Standard USB Host Detected (0x03=0x23) */							
			muic_set_usb_mode_detect(); 	// Turn on USB switches 		
			muic_mode = MUIC_AP_USB;
#endif
		}			
	} else if ((int_stat_value & IDNO ) == IDNO_0001) {
	/* Vidoe Cable 24k registor Detected - No TV Attached */
	//current_device = DEVICE_VIDEO_CABLE_NO_LOAD;
	} else if ((int_stat_value & IDNO) == IDNO_0000 ) {
		//Set_MUIC_Other_Mode_Detect();
	} else {
		/* Accessory Not Supported */
		muic_mode = MUIC_NONE;
	}
#endif
}