void muic_set_factory_mode_detect(unsigned char mode) { /* IDNO == 0100 (130KOhm). CP_UART. */ if(mode == IDNO_0100) { /* Connects CP UART signals to DP3T */ usif_switch_ctrl(USIF_DP3T); /* Connects CP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_UART); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enables UART Path (0x03=0x00) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); muic_mode = MUIC_CP_UART; } /* IDNO == 1010 (910KOhm). Factory Download switch to CP USB for AT command. */ else if(mode == IDNO_1010) { /* Connects CP USB signals to DP3T */ usif_switch_ctrl(USIF_AP); dp3t_switch_ctrl(DP3T_CP_USB); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enable USB Path (0x03=0x00) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); muic_mode = MUIC_CP_USB; } }
void muic_set_develop_mode_detect(void) { #if 1 /* Connects CP USB signals to DP3T */ usif_switch_ctrl(USIF_AP); dp3t_switch_ctrl(DP3T_CP_USB); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enable USB Path (0x03=0x00) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); muic_mode = MUIC_CP_USB; #else /* Connects CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connects AP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_AP_UART); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enable USB Path (0x03=0x00) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); muic_mode = MUIC_AP_UART; #endif// }
void set_ts5usba33402_ap_usb_mode(void) { /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* * AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ #if 0 // dp3t_switch_ctrl(DP3T_AP_UART); // muic_i2c_write_byte(SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); #else // dp3t_switch_ctrl(DP3T_NC); muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); // INT_EN, CP_AUD, CHG_TYP, USB_DET_DIS on. muic_i2c_write_byte(CONTROL_2, INT_EN | CP_AUD | CHG_TYPE); // Connect DP, DM to USB_DP, USB_DM muic_i2c_write_byte(SW_CONTROL, DP_USB | DM_USB); //muic_mode = MUIC_AP_USB; #endif }
int muic_set_ap_usb_mode(struct muic_client_device *mcdev)// (struct i2c_client *client) { struct i2c_client *client = max14526; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); if(!client) { printk("muic %s, client : %d", __func__, client); return -1; } dev_info(&client->dev, "muic: %s entry.\n", __func__); muic_i2c_write_byte(client,SW_CONTROL, OPEN); dp3t_switch_ctrl(DP3T_NC); muic_mdelay(100); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ dp3t_switch_ctrl(DP3T_AP_UART); /* Connect DP, DM to USB_DP, USB_DM */ muic_i2c_write_byte(client,SW_CONTROL, DP_USB | DM_USB); //muic_path = MUIC_AP_USB; //charging_mode = CHARGING_USB; printk("[MUIC] muic_set_ap_usb_mode(): AP_USB\n"); return 0; }
static s32 muic_proc_set_ap_usb(void) { s32 ret; #if defined (CONFIG_MACH_BSSQ) #else ret = muic_i2c_write_byte(SW_CONTROL, OPEN); dp3t_switch_ctrl(DP3T_NC); muic_mdelay(100); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ dp3t_switch_ctrl(DP3T_AP_UART); //dp3t_switch_ctrl(DP3T_NC); //[[email protected]] - Changed to X3 Code. CP USB OFF is only thing. #endif /* Connect DP, DM to USB_DP, USB_DM */ ret = muic_i2c_write_byte(SW_CONTROL, DP_USB | DM_USB); muic_mode = MUIC_AP_USB; charging_mode = CHARGING_USB; DBG("[MUIC] muic_proc_set_ap_usb(): AP_USB\n"); return ret; }
void muic_set_mhl_mode_detect(void) { printk("[MUIC] muic_set_mhl_mode_detect entry. \n"); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* * AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ dp3t_switch_ctrl(DP3T_NC); //muic_i2c_write_byte(SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ //muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); MHL_On(1); muic_path = MUIC_MHL; }
void ifx_fota_reset(void) { usif_switch_ctrl(0); fota_cp_reset(); }
int muic_set_mhl_mode(struct muic_client_device *mcdev)// (struct i2c_client *client) { struct i2c_client *client = tsu5611; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); dev_info(&client->dev, "muic: %s entry.\n", __func__); #if 0 /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* * AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ dp3t_switch_ctrl(DP3T_NC); #endif //muic_i2c_write_byte(SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); muic_i2c_write_byte(client, SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ //muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); #if 0 MHL_On(1); #endif // muic_set_mode(MUIC_MHL); }
static s32 muic_proc_set_ap_uart(void) { s32 ret; #if defined (CONFIG_MACH_BSSQ) #if defined(CONFIG_LU6500) if(get_lge_pcb_revision() > REV_D) muic_i2c_write_byte(SW_CONTROL, COMP2_TO_AUD2|COMN1_TO_AUD1); else #endif #else /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connect AP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_AP_UART); #endif /* Connect DP, DM to UART_TX, UART_RX */ ret = muic_i2c_write_byte(SW_CONTROL, DP_UART | DM_UART); muic_mode = MUIC_AP_UART; charging_mode = CHARGING_UNKNOWN; DBG("[MUIC] muic_proc_set_ap_uart(): AP_UART\n"); return ret; }
static s32 muic_proc_set_cp_usb(void) { s32 ret; #if defined (CONFIG_MACH_BSSQ) gpio_set_value(GPIO_CP_USB_VBUS_EN, 1); #else ret = muic_i2c_write_byte(SW_CONTROL, OPEN); dp3t_switch_ctrl(DP3T_NC); muic_mdelay(100); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP);//usif_switch_ctrl(USIF_DP3T); //[[email protected]] - Changed to X3 code. /* Connect CP USB to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_USB); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ // muic_i2c_write_byte(CONTROL_1, ID_200 |ADC_EN | CP_EN ); //13 //[[email protected]] - disabled because NOT in Cosmo Code // muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); //15 // muic_i2c_write_byte(CONTROL_1, ID_2P2 | SEMREN );//44 #endif /* Enable USB Path (0x03=0x00) --- Connect DP, DM to UART_TX, UART_RX */ ret = muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); muic_mode = MUIC_CP_USB; charging_mode = CHARGING_USB; DBG("[MUIC] muic_proc_set_cp_usb(): CP_USB\n"); return ret; }
int muic_set_cp_uart_mode(struct muic_client_device *mcdev) //UART_MODE { struct i2c_client *client = tsu5611; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); if(!client) { printk("muic %s, client : %ld", __func__, (long)client); return -1; } dev_info(&client->dev, "muic: %s\n", __func__); #if 0 /* Connects CP UART signals to DP3T */ usif_switch_ctrl(USIF_DP3T); /* Connects CP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_UART); #endif /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enables USB Path (0x03=0x00) */ muic_i2c_write_byte(client, SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); return 0; // muic_set_mode(MUIC_CP_UART); // CHECK }
int muic_set_ap_usb_mode(struct muic_client_device *mcdev)// (struct i2c_client *client) { struct i2c_client *client = tsu5611; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); if(!client) { printk("muic %s, client : %d", __func__, client); return -1; } dev_info(&client->dev, "muic: %s entry.\n", __func__); mdelay(200); muic_i2c_write_byte(client, SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); mdelay(200); #if 0 /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* * AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ dp3t_switch_ctrl(DP3T_AP_UART); #endif muic_i2c_write_byte(client, SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN | CP_EN); // muic_set_mode(MUIC_AP_USB); return 0; }
int muic_set_cp_uart_mode(struct muic_client_device *mcdev) //UART_MODE { struct i2c_client *client = max14526; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); if(!client) { printk("muic %s, client : %ld", __func__, (long)client); return -1; } dev_info(&client->dev, "muic: %s\n", __func__); /* Connect CP UART signals to DP3T */ usif_switch_ctrl(USIF_DP3T); /* Connect CP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_UART); /* Connect DP, DM to UART_TX, UART_RX */ muic_i2c_write_byte(client,SW_CONTROL, DP_UART | DM_UART); //muic_path = MUIC_CP_UART; //charging_mode = CHARGING_UNKNOWN; printk("[MUIC] muic_set_cp_uart_mode(): CP_UART\n"); return 0; // muic_set_mode(MUIC_CP_UART); // CHECK }
int muic_set_cp_usb_mode(struct muic_client_device *mcdev)// (struct i2c_client *client) { struct i2c_client *client = max14526; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); if(!client) { printk("muic %s, client : %ld", __func__, (long)client); return -1; } dev_info(&client->dev, "muic: %s entry.\n", __func__); muic_i2c_write_byte(client,SW_CONTROL, OPEN); dp3t_switch_ctrl(DP3T_NC); muic_mdelay(100); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connect CP USB to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_USB); /* Connect DP, DM to UART_TX, UART_RX */ muic_i2c_write_byte(client,SW_CONTROL, DP_UART | DM_UART); //muic_path = MUIC_CP_USB; //charging_mode = CHARGING_USB; printk("[MUIC] muic_set_cp_usb_mode(): CP_USB\n"); return 0; }
static ssize_t modem_uart_path_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { if (count == 0) return 0; modem_ctrl.uart_path = simple_strtol(buf, NULL, 10); modem_ctrl.uart_path = !!modem_ctrl.uart_path; #ifdef CONFIG_HUB_MUIC if (modem_ctrl.uart_path == 0) { usif_switch_ctrl(USIF_AP); printk("switch to the OMAP UART\n"); } else { usif_switch_ctrl(USIF_DP3T); printk("switch to the external connector\n"); } #endif return count; }
void set_max14526_ap_usb_mode(void) //USB_MODE { printk(KERN_WARNING "[MUIC] set_max14526_ap_usb_mode\n" ); usif_switch_ctrl(USIF_AP); dp3t_switch_ctrl(DP3T_CP_UART); /* Enables USB Path (0x03=0x00) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | ADC_EN | CP_EN); }
void set_ts5usba33402_cp_usb_mode(void) { /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connect CP USB to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_USB); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enable UART Path (0x03=0x09) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); }
void set_max14526_cp_usb_mode(void) //USB_MODE { printk(KERN_WARNING "[MUIC] set_max14526_cp_usb_mode\n" ); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connect CP USB to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_USB); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | ADC_EN | CP_EN); /* Enable UART Path (0x03=0x09) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); }
void set_ts5usba33402_ap_usb_mode(void) { /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* * AP USB does not pass through DP3T. * Just connect AP UART to MUIC UART. */ dp3t_switch_ctrl(DP3T_AP_UART); muic_i2c_write_byte(SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); }
s32 muic_CP_UART_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] */ /* Connect CP UART signals to DP3T */ usif_switch_ctrl(USIF_DP3T); /* Connect CP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_UART); if (muic_device == MAX14526) { /* ID_200, VLDO 2.6V, ADC is auto, Charge Pump.*/ ret = muic_i2c_write_byte(CONTROL_1, MID_200 | MADC_EN | MCP_EN); } else { /* ID_200, VLDO 2.6V, SEMREN on. ADC is auto.*/ ret = muic_i2c_write_byte(CONTROL_1, MID_200 | MSEMREN); } /* Connect DP, DM to UART_TX, UART_RX*/ ret = muic_i2c_write_byte(SW_CONTROL, DP_UART | DM_UART); /* Turn on charger IC with FACTORY mode */ charging_ic_set_factory_mode(); muic_mode = MUIC_CP_UART; printk(KERN_WARNING "[MUIC] muic_distinguish_vbus_accessory(): CP_UART\n"); /* wake lock for the factory mode */ /* LGE_CHANG_START 2011-03-30 [email protected] wakelock on when AT command sequence by CP UART */ set_wakelock(1); /* LGE_CHANGE_END 2011-03-30 [email protected] */ return ret; }
void set_ts5usba33402_ap_uart_mode(void) { /* Connects CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connects AP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_AP_UART); /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); #if defined(CONFIG_LU6500) if(get_lge_pcb_revision() > REV_D) muic_i2c_write_byte(SW_CONTROL, COMP2_TO_AUD2|COMN1_TO_AUD1); else #endif /* Enable USB Path (0x03=0x00) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); }
void ifx_fota_reset(void) { usif_switch_ctrl(0); fota_cp_reset(); /* int status; printk("%s: CP Reset IN\n", __func__); gpio_request(MODEM_GPIO_PWRON, "ifx pwron"); gpio_direction_output(MODEM_GPIO_PWRON, 0); udelay(100); gpio_set_value(MODEM_GPIO_PWRON, 0); status = gpio_get_value(MODEM_GPIO_PWRON); printk("%s: MODEM_GPIO_PWRON low- [CP POWER]: pin %d\n", __func__, status); mdelay(500); // 500mS delay gpio_direction_output(MODEM_GPIO_PWRON_SW, 0); //GPIO_3 OE udelay(100); gpio_set_value(MODEM_GPIO_PWRON_SW, 0); status = gpio_get_value(MODEM_GPIO_PWRON_SW); printk("%s: MODEM_GPIO_PWRON_SW low- [CP POWER]: pin %d\n", __func__, status); mdelay(500); // 500mS delay gpio_set_value(MODEM_GPIO_PWRON, 1); status = gpio_get_value(MODEM_GPIO_PWRON); printk("%s: MODEM_GPIO_PWRON high+ [CP POWER]: pin %d\n", __func__, status); mdelay(100); // 1000mS delay gpio_set_value(MODEM_GPIO_PWRON_SW, 1); status = gpio_get_value(MODEM_GPIO_PWRON_SW); printk("%s: MODEM_GPIO_PWRON_SW high+ [CP POWER]: pin %d\n", __func__, status); usif_switch_ctrl(0); printk("%s: CP Reset OUT\n", __func__); */ }
void set_ts5usba33402_cp_usb_mode(void) { #if defined(CONFIG_MACH_BSSQ) gpio_set_value(GPIO_CP_USB_VBUS_EN, 1); #endif #if !defined(CONFIG_MACH_BSSQ) /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connect CP USB to MUIC UART */ dp3t_switch_ctrl(DP3T_CP_USB); /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); #endif /* Enable UART Path (0x03=0x09) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); }
int muic_set_ap_uart_mode(struct muic_client_device *mcdev)// (struct i2c_client *client) { struct i2c_client *client = tsu5611; //to_i2c_client(%mcdev->dev);// i2c_verify_client(&mcdev->dev); dev_info(&client->dev, "muic: %s\n", __func__); #if 0 /* Connects CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* Connects AP UART to MUIC UART */ dp3t_switch_ctrl(DP3T_AP_UART); #endif /* Enables 200K, Charger Pump, and ADC (0x01=0x13) */ muic_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN | CP_EN); /* Enable USB Path (0x03=0x00) */ muic_i2c_write_byte(client, SW_CONTROL, COMP2_TO_U2 | COMN1_TO_U1); // muic_set_mode(MUIC_AP_UART); return 0; }
void muic_init_max14526(TYPE_RESET reset) { printk(KERN_WARNING "[MUIC] max14526_init()\n"); //[[email protected]] muic detecting... //atomic_set(&muic_charger_detected,0); if (reset == RESET) { /* Clears default switch position (0x03=0x24) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); } /* * Iniialize MAX14526 for Detection of Accessories * Enable 200K pull-up and ADC (0x01=0x12) * Enable Interrupt [XX REMOVED AUD related XX and set AUD Click/Pop resistor(CP_EN) XX XX] (0x02=0x50) */ muic_i2c_write_byte(CONTROL_1, ID_200 | ADC_EN); muic_i2c_write_byte(CONTROL_2, INT_EN); #ifdef CONFIG_MACH_STAR_SU660 dp3t_switch_ctrl(DP3T_NC); usif_switch_ctrl(USIF_AP); #endif }
//[[email protected]] - moved muic_ti.c to here void muic_set_mhl_mode_detect(void) { DBG("[MUIC] muic_set_mhl_mode_detect entry. \n"); /* Connect CP UART signals to AP */ usif_switch_ctrl(USIF_AP); /* 109 * AP USB does not pass through DP3T. 110 * Just connect AP UART to MUIC UART. 111 */ dp3t_switch_ctrl(DP3T_NC); //muic_i2c_write_byte(SW_CONTROL, COMP2_TO_DP2 | COMN1_TO_DN1); //Path USB muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); //Path OPEN /* Enable 200K, Charger Pump, and ADC (0x01=0x13) */ //muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); MHL_On(1); //muic_mode = MUIC_MHL; //[[email protected]] - Set by caller. NOT here. }
/* Initialize MUIC, i.e., the CONTROL_1,2 and SW_CONTROL registers. * 1) Prepare to sense INT_STAT and STATUS bits. * 2) Open MUIC paths. -> To keep the path from uboot setting, remove this stage. */ void muic_initialize(TYPE_RESET reset){ s32 ret; printk(KERN_WARNING "[MUIC] muic_initialize()\n"); if (reset) { ret = muic_i2c_write_byte(SW_CONTROL, DP_OPEN | DM_OPEN); // 20110915, [email protected], Debug USB recognition at reboot. if (muic_i2c_read_byte(DEVICE_ID, &muic_device) < 0) { printk(KERN_ERR "[MUIC] Device detection falied! Set default device.\n"); muic_device = TS5USBA33402; } muic_device &= 0xf0; printk(KERN_INFO "[MUIC] Device : %s\n", (muic_device == MAX14526) ? "MAX14526" : "TSUSBA33402"); } else { // Clear Default Switch Position (0x03=0x24) ret = muic_i2c_write_byte(SW_CONTROL, DP_OPEN | DM_OPEN); } if (muic_device == MAX14526) { ret = muic_i2c_write_byte(CONTROL_1, MID_200 | MADC_EN); ret = muic_i2c_write_byte(CONTROL_2, MINT_EN); } else { /* Reset MUIC - Disable all */ if(reset){ ret = muic_i2c_write_byte(CONTROL_1, 0x00); ret = muic_i2c_write_byte(CONTROL_2, MUSB_DET_DIS);// USB_DET_DIS is neg enabled } /* comments from the case of HUB * Initialize MUIC - Default setting. * * CONTROL_1: * * ID_2P2 = 0. Enable to distinguish MUIC_EARMIC from MUIC_TV_OUT_LOAD and MUIC_OTG. * Enable for MUIC_EARMIC operation. * ID_620 = 0. Enable only to distinguish MUIC_TV_OUT_LOAD from MUIC_OTG. * ID_200 = 1. * VLDO = 0. Enable to apply 2.3V for MUIC_EARMIC operation. * SEMREN = 1. * ADC_EN = 0. Because it is automatically enabled upon any change in ID resistor. * CP_EN = 0. Enalbe for USB 2.0 (MUIC_AP_USB, MUIC_CP_USB, and MUIC_OTG). * Enable for Audio charge pump (MUIC_EARMIC, MUIC_TV_OUT_LOAD). * * CONTROL_2: * * INTPOL = 0. * INT_EN = 1. * MIC_LP = 0. * CP_AUD = 1. Disable for Audio operation (MUIC_EARMIC, MUIC_TV_OUT_LOAD). * CHG_TYP = 1. * USB_DET_DIS = 0. Negative enabled. * * SW_CONTROL: * * MIC_ON = 0. Enable for MUIC_EARMIC and MUIC_TV_OUT_LOAD. * DP = 111 (open). * DM = 111 (open). */ ret = muic_i2c_write_byte(CONTROL_1, MID_200 | MSEMREN); ret = muic_i2c_write_byte(CONTROL_2, MCHG_TYP); /* comments from the case of HUB * The initialization time for the facility to set STATUS register's * DCPORT and CHPORT = 250msec since CHG_TYP on. * The initialization times for the facilities to set INT_STAT register bits * since CONTROL_1, 2 settings are much shorter (< 70msec). * The settle down time for INT_STAT and STATUS register bits * since an interrupt occurs = 70msec. * * Thus, * we need to wait 250msec if we enable CHG_TYP from its inactive state. * And, we need to wait just 70msec for all other cases including * interrupt and CONTROL register settings. */ if(reset) msleep(250); else msleep(70); /* Enable interrupt (INT_EN = 1). Keep other bits the same */ ret = muic_i2c_write_byte(CONTROL_2, MINT_EN | MCHG_TYP); } /* Default setting : CP_UART to DP3T Switch. */ usif_switch_ctrl(USIF_DP3T); set_wakelock(0); return; }
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; }
void ifx_uart_sw_ctrl(void) { pr_info("fota: %s\n", __func__); usif_switch_ctrl(0); // dp3t_switch_ctrl(0); }
void ifx_uart_sw_ctrl( void ) { printk("%s\n", __func__); usif_switch_ctrl(0); // dp3t_switch_ctrl(0); }