void set_max14526_charger_mode(unsigned char int_stat_value) { unsigned char reg_value; printk(KERN_WARNING "[MUIC] set_max14526_charger_mode, int_stat_value = %x \n", int_stat_value ); if (((int_stat_value & IDNO) == IDNO_0101) || ((int_stat_value & IDNO) == IDNO_1011)) { /* LG Proprietary TA Detected 180K ohm on ID */ muic_mode = MUIC_LG_TA; } else if ((int_stat_value & IDNO) == IDNO_0110) { /* 1A charger detected */ muic_mode = MUIC_TA_1A; } else { /* Enable interrpt and charger type detection (0x02=0x42) */ muic_i2c_write_byte(CONTROL_2, INT_EN | CHG_TYPE); /////////////////////////////////////////////// // This line should be modified by a customer. // // Wait for Interrupt // //////////////////////////////////////////////// /* Read INT_STAT */ muic_i2c_read_byte(INT_STAT, ®_value); muic_i2c_read_byte(STATUS, ®_value); if (reg_value & DCPORT) { /* Dedicated charger(TA) detected */ muic_mode = MUIC_NA_TA; } else if (reg_value & CHPORT) { set_max14526_ap_usb_mode(); } } }
void set_max14526_muic_path(unsigned char int_stat_value) { unsigned char reg_value; printk(KERN_WARNING "[MUIC] set_max14526_muic_path, int_stat_value = 0x%02x \n", 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_max14526_cp_usb_mode(); muic_path = MUIC_CP_USB; charging_mode = CHARGING_FACTORY; } else if ((int_stat_value & IDNO) == IDNO_0100) { set_max14526_cp_uart_mode(); muic_path = MUIC_CP_UART; charging_mode = CHARGING_FACTORY; } else if (int_stat_value & CHGDET) { muic_i2c_write_byte(muic_client,SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); muic_path = MUIC_LG_TA; charging_mode = CHARGING_LG_TA; } else { muic_i2c_write_byte(muic_client,SW_CONTROL, COMP2_TO_HZ | COMN1_TO_C1COMP); muic_mdelay(2); muic_i2c_read_byte(muic_client,STATUS, ®_value); if (reg_value & C1COMP) { muic_i2c_write_byte(muic_client,SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); muic_path = MUIC_LG_TA; charging_mode = CHARGING_LG_TA; } else { set_max14526_ap_usb_mode(); muic_path = MUIC_AP_USB; charging_mode = CHARGING_USB; } } } else { if ((int_stat_value & IDNO) == IDNO_0010) { set_max14526_ap_uart_mode(); muic_path = MUIC_AP_UART; charging_mode = CHARGING_NONE; } else if ((int_stat_value & IDNO) == IDNO_0100) { set_max14526_cp_uart_mode(); muic_path = MUIC_CP_UART; charging_mode = CHARGING_NONE; } else { muic_path = MUIC_UNKNOWN; charging_mode = CHARGING_NONE; } } }
void set_max14526_muic_mode(unsigned char int_stat_value) { unsigned char reg_value; printk(KERN_WARNING "[MUIC] set_max14526_muic_mode, int_stat_value = 0x%02x \n", int_stat_value); 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_max14526_cp_usb_mode(); muic_mode = MUIC_CP_USB; charging_mode = CHARGING_FACTORY; } else if ((int_stat_value & IDNO) == IDNO_0100) { set_max14526_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_MHL; #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 { muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_C1COMP); muic_mdelay(2); muic_i2c_read_byte(STATUS, ®_value); if (reg_value & C1COMP) { muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); muic_mode = MUIC_LG_TA; charging_mode = CHARGING_LG_TA; } else { set_max14526_ap_usb_mode(); muic_mode = MUIC_AP_USB; charging_mode = CHARGING_USB; } } } else { if ((int_stat_value & IDNO) == IDNO_0010) { set_max14526_ap_uart_mode(); muic_mode = MUIC_AP_UART; charging_mode = CHARGING_NONE; } else if ((int_stat_value & IDNO) == IDNO_0100) { set_max14526_cp_uart_mode(); muic_mode = MUIC_CP_UART; charging_mode = CHARGING_NONE; } else { muic_mode = MUIC_UNKNOWN; charging_mode = CHARGING_NONE; } } #if 0 if(retain_mode == BOOT_CP_USB){ set_max14526_cp_usb_mode_detect(); }if ((int_stat_value & IDNO) == IDNO_0100 || (int_stat_value == 0x11)) { /* 0x11 for Special Test with MIC */ /* IDNO=0100? 130Kohm :: UART_MODE */ set_max14526_cp_uart_mode_detect(); } else if ((int_stat_value & IDNO ) == IDNO_0010) { /* IDNO=0010? 56Kohm :: USB_MODE */ set_max14526_ap_uart_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 == 0x11) || (int_stat_value == 0x10)) { //Set_MAX14526_SpecialTest_Mode_Detect(); #endif// } else if ((int_stat_value & IDNO) == IDNO_1010) { set_max14526_cp_usb_mode_detect(); } else if (int_stat_value & CHGDET) { /* CHGDET=1? */ set_max14526_charger_detect(int_stat_value); } else if (int_stat_value & V_VBUS) { /* V_VBUS=1? */ /* Standard USB Host Detected (0x03=0x23) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_C1COMP); muic_udelay(1000); /* Read Status Reigster(0x05) */ muic_i2c_read_byte(STATUS, ®_value); if (reg_value & C1COMP) { /* Charger Detected COMP2/COMN1 to H-Z (0x03=0x24) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); /* Dedicated Charger(TA) Detected */ muic_mode = MUIC_NA_TA; } else { /* Turn on USB switches */ #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) */ set_max14526_ap_usb_mode_detect(); muic_mode = MUIC_AP_USB; } #else set_max14526_ap_usb_mode_detect(); muic_mode = MUIC_AP_USB; #endif// } } else if ((int_stat_value & IDNO) == IDNO_0001) { /* Vidoe Cable 24k registor Detected - No TV Attached */ //muic_mode = DEVICE_VIDEO_CABLE_NO_LOAD; } else if ((int_stat_value & IDNO) == IDNO_0000 ) { muic_mode = MUIC_NONE; } else { /* Accessory Not Supported */ muic_mode = MUIC_NONE; } #endif }
void set_max14526_muic_mode(unsigned char int_stat_value) { unsigned char reg_value; printk(KERN_WARNING "[chahee.kim] set_max14526_muic_mode, " "int_stat_value = %x \n", int_stat_value); if (int_stat_value & CHGDET) { set_max14526_charger_mode(int_stat_value); #ifndef CHARGER_TEST lge_charger_ta_mode_enable(); #endif } else if (int_stat_value & VBUS) { if ((int_stat_value & IDNO) == IDNO_0101) { set_max14526_ap_usb_mode(); #ifndef CHARGER_TEST lge_charger_usb_mode_enable(); #endif } else { /* Standard USB Host Detected (0x03=0x23) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_C1COMP); muic_udelay(1000); /* Read Status Reigster(0x05) */ muic_i2c_read_byte(STATUS, ®_value); if (reg_value & C1COMP) { /* Charger Detected COMP2/COMN1 to H-Z (0x03=0x24) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); /* Dedicated Charger(TA) Detected */ muic_mode = MUIC_NA_TA; } else { /* Turn on USB switches */ set_max14526_ap_usb_mode(); #ifndef CHARGER_TEST lge_charger_usb_mode_enable(); #endif } } } else if ((int_stat_value & IDNO) == IDNO_0010) { //set_max14526_cp_usb_mode(); set_max14526_ap_uart_mode(); #ifndef CHARGER_TEST lge_charger_disable(); #endif } else if ((int_stat_value & IDNO) == IDNO_0101) { set_max14526_ap_uart_mode(); #ifndef CHARGER_TEST lge_charger_disable(); #endif } else { /* Accessory Not Supported */ muic_mode = MUIC_NONE; muic_init_max14526(DEFAULT); #ifndef CHARGER_TEST lge_charger_disable(); #endif } }