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); }
void set_max14526_ap_usb_mode(void) //USB_MODE { s32 ret; printk(KERN_WARNING "[MUIC] set_max14526_ap_usb_mode\n" ); //KIMCS TEST 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_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); }
static int muic_init_chip(struct regmap_desc *pdesc) { regmap_t *preg = pdesc->regmap; int i; pr_info("%s\n", __func__); for (i = 0; i < pdesc->size; i++, preg++) { if (!preg->name) continue; if (preg->init != INIT_NONE) { pr_info(" [%02x] : 0x%02x\n", i, preg->init); if (muic_i2c_write_byte(pdesc->muic->i2c, i, preg->init) < 0) goto i2c_write_error; } else if(preg->init == INIT_INT_CLR){ pr_info("%s:%s clear MUIC interrupt %x registers\n",MUIC_DEV_NAME, __func__,i); muic_i2c_read_byte(pdesc->muic->i2c, i); } } return 0; i2c_write_error: pr_err("%s i2c write error.\n", __func__); return -1; }
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; }
static int muic_reboot_notify(struct notifier_block *nb, unsigned long event, void *data) { switch (event) { case SYS_RESTART: case SYS_HALT: case SYS_POWER_OFF: { printk("%s : %d\n",__func__, event); disable_irq(muic_gpio_irq); free_irq(muic_gpio_irq, &muic_client->dev); printk("%s : disable_irq\n",__func__); //flush_workqueue(muic_wq); //destroy_workqueue(muic_wq); //printk("%s : flush_workqueue\n",__func__); muic_i2c_write_byte(CONTROL_1, 0x00); } return NOTIFY_OK; } return NOTIFY_DONE; }
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 }
static s32 muic_resume(struct i2c_client *client) { #if 0//def CONFIG_MACH_STAR_SU660 unsigned long flags; printk("[MUIC] UIC : Resume , MUIC_GPIO level %d, muic_irq_already_run %d\n", gpio_get_value(MUIC_GPIO), muic_irq_already_run); #endif client->dev.power.power_state = PMSG_ON; if(muic_device == MAX14526) muic_i2c_write_byte(CONTROL_2, INT_EN); #if 0 spin_lock_irqsave(&muic_spin_lock, flags); if (gpio_get_value(MUIC_GPIO) == 0 && muic_irq_already_run == false) { queue_work(muic_wq, &muic_work); } spin_unlock_irqrestore(&muic_spin_lock, flags); #endif #if 0 //[[email protected]] - why suspend? // DBG("[MUIC] COSMO MUIC : Resume \n"); muic_init_device(RESET); #endif return 0; }
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_ts5usba33402_charger_mode(unsigned char int_stat_value) { s32 ret = 0; unsigned char reg_value; if (((int_stat_value & IDNO) == IDNO_0101) || ((int_stat_value & IDNO) == IDNO_1011)) { /*LG Proprietary TA Detected 180K ohm on ID */ muic_path = MUIC_LG_TA; } else if ((int_stat_value & IDNO) == IDNO_0110) { /* 1A charger detected */ muic_path = MUIC_TA_1A; } else { /* Enable interrpt and charger type detection (0x02=0x42) */ muic_i2c_write_byte(CONTROL_2, INT_EN | CHG_TYPE); muic_mdelay(2); /* Read INT_STAT */ ret = muic_i2c_read_byte(INT_STAT, ®_value); ret = muic_i2c_read_byte(STATUS, ®_value); if (reg_value & DCPORT) { muic_path = MUIC_NA_TA; } else set_ts5usba33402_ap_usb_mode(); } }
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); }
/* * Initialize MUIC, i.e., the CONTROL_1,2 and SW_CONTROL registers. * 1) Prepare to sense INT_STATUS1 and STATUS bits. * 2) Open MUIC paths. -> To keep the path from uboot setting, remove this stage. */ void muic_init_tsu5611(struct i2c_client *client, TYPE_RESET reset) { dev_info(&client->dev, "muic: %s\n", __func__); muic_i2c_write_byte(client, SW_CONTROL, DP_OPEN|DM_OPEN); muic_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN); if (BOOTUP == reset) { /* TSU5611 BUG fix */ dev_info(&client->dev, "muic: %s, init by BOOTUP\n", __func__); muic_i2c_write_byte(client, CONTROL_2, CHG_TYPE); mdelay(250); muic_i2c_write_byte(client, CONTROL_2, INT_EN | CP_AUD | CHG_TYPE); }else { muic_i2c_write_byte(client, CONTROL_2, INT_EN); } }
void muic_init_max14526(struct i2c_client *client, TYPE_RESET reset) { dev_info(&client->dev, "muic: %s\n", __func__); /* * Iniialize MAX14526 for Detection of Accessories * Enable 200K pull-up and ADC (0x01=0x12) * Enable Interrupt and set AUD Click/Pop resistor (0x02=0x50) */ if (reset == RESET) { /* Clears default switch position (0x03=0x24) */ muic_i2c_write_byte(client,SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); muic_i2c_write_byte(client,CONTROL_1, ID_200 | ADC_EN); // mdelay(250); msleep(250);//mo2hongkeon.kim 2012-0816 for BT issue with TA charger } muic_i2c_write_byte(client,CONTROL_2, INT_EN | CP_AUD | CHG_TYPE); }
void muic_init_max14526(TYPE_RESET reset) { printk(KERN_WARNING "[chahee.kim] max14526_init()\n"); // atomic_set(&muic_charger_detected,0); /* Clears Default Switch Position (0x03=0x24) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); /* Enables 200K pull-up and ADC (0x01=0x12)*/ muic_i2c_write_byte(CONTROL_1, ID_200 | ADC_EN); /* Enables Interrupt and set AUD Click/Pop resistor (0x02=0x50) */ muic_i2c_write_byte(CONTROL_2, INT_EN); //CHR_Charger_Update(); }
void muic_init_max14526(TYPE_RESET reset) { printk(KERN_WARNING "[MUIC] max14526_init()\n"); 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); }
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 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(muic_client,SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); } /* * Iniialize MAX14526 for Detection of Accessories * Enable 200K pull-up and ADC (0x01=0x12) * Enable Interrupt and set AUD Click/Pop resistor (0x02=0x50) */ muic_i2c_write_byte(muic_client,CONTROL_1, ID_200 | ADC_EN | CP_EN); muic_i2c_write_byte(muic_client,CONTROL_2, INT_EN); }
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); }
void muic_init_ts5usba33402(TYPE_RESET reset) { printk(KERN_INFO "[MUIC] muic_init_ts5usba33402()\n"); if (reset == RESET) { /* Clear default switch position (0x03=0x24) */ muic_i2c_write_byte(SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); } /* * Iniialize ts5usba33402 for detection of accessories * Enable 200K pull-up and ADC (0x01=0x12) * Enable interrupt and set AUD Click/Pop resistor (0x02=0x50) */ muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); muic_i2c_write_byte(CONTROL_2, INT_EN); return; }
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; }
int tsu5611_process_reset_muic(struct i2c_client *client) { if(Int_Status == First_Int) { dev_info(&client->dev, "muic: trying reset n redetect cause of TSU5611 chipset bug\n"); muic_i2c_write_byte(client, 0x09, 0x80);//open hidden register muic_i2c_write_byte(client, 0x0b, 0xa8);//MUIC reset mdelay(300); // delay is must 300ms ~ 600ms after reset dev_info(&client->dev, "muic: device reset is done\n"); Int_Status = Second_Int; // goto RetainLabel; } else { dev_info(&client->dev, "muic: << Second Interrupt\n"); Int_Status = First_Int; } return Int_Status; }
int max14526_process_reset_muic(struct i2c_client *client) { if(Int_Status == First_Int) { dev_info(&client->dev, "muic: trying reset n redetect cause of MAX14526 chipset bug\n"); /* Clears default switch position (0x03=0x24) */ muic_i2c_write_byte(client,SW_CONTROL, COMP2_TO_HZ | COMN1_TO_HZ); mdelay(300); // delay is must 300ms ~ 600ms after reset dev_info(&client->dev, "muic: device reset is done\n"); Int_Status = Second_Int; } else { dev_info(&client->dev, "muic: << Second Interrupt\n"); Int_Status = First_Int; } muic_i2c_write_byte(client,CONTROL_1, ID_200 | ADC_EN | CP_EN); muic_i2c_write_byte(client,CONTROL_2, INT_EN); return Int_Status; }
void muic_set_charger_mode(struct i2c_client *client, unsigned char int_stat_value) { s32 ret = 0; unsigned char reg_value; dev_info(&client->dev, "muic: Charger ID = 0x%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_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN); muic_i2c_write_byte(client, CONTROL_2, INT_EN); muic_set_mode(MUIC_LG_TA); } else if ((int_stat_value & IDNO) == IDNO_0110) { /* 1A charger detected */ muic_set_mode(MUIC_TA_1A); } else { dev_info(&client->dev, "muic: Charger ID11111\n"); /* Enable interrpt and charger type detection (0x02=0x42) */ muic_i2c_write_byte(client, CONTROL_2, INT_EN | CHG_TYPE); /* Read INT_STATUS1 */ ret = muic_i2c_read_byte(client, INT_STATUS1, ®_value); ret = muic_i2c_read_byte(client, STATUS, ®_value); if (reg_value & DCPORT) { printk("Charger ID22222\n"); muic_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN); muic_i2c_write_byte(client, CONTROL_2, INT_EN); muic_set_mode(MUIC_NA_TA); } else { printk("Charger ID33333\n"); muic_set_mode(MUIC_AP_USB); // muic_set_usb_mode_detect(client); } } }
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 }
/* * Initialize MUIC, i.e., the CONTROL_1,2 and SW_CONTROL registers. * 1) Prepare to sense INT_STATUS1 and STATUS bits. * 2) Open MUIC paths. -> To keep the path from uboot setting, remove this stage. */ void muic_init_tsu5611(struct i2c_client *client, TYPE_RESET reset) { dev_info(&client->dev, "muic: %s\n", __func__); muic_i2c_write_byte(client, SW_CONTROL, DP_OPEN|DM_OPEN); muic_i2c_write_byte(client, CONTROL_1, ID_200 | SEMREN); /* When boot up timing, CHG_TYPE must be set within TSU5611. * This is chip bug of TSU5611. * Eg: SU540, KU5400, LU5400 * TODO: boot up init and reset init may be seperated, * cause those function implementation is ambigous * [email protected] */ if (BOOTUP == reset) { /* TSU5611 BUG fix */ dev_info(&client->dev, "muic: %s, init by BOOTUP\n", __func__); muic_i2c_write_byte(client, CONTROL_2, CHG_TYPE); mdelay(250); muic_i2c_write_byte(client, CONTROL_2, INT_EN | CP_AUD | CHG_TYPE); }else { muic_i2c_write_byte(client, CONTROL_2, INT_EN); } }
void muic_for_download(int mode) { int ret; if(mode == 0) { select_bus(I2C3 , OMAP_I2C_STANDARD); usif1_switch_ctrl(USIF1_IPC); dp3t_switch_ctrl(2); ret = muic_i2c_write_byte(SW_CONTROL, DP_UART | DM_UART); } else dp3t_switch_ctrl(DP3T_S3_CP_USB); printf("CP_USB is set(910Kohm)\n"); }
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; } } }
//[[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. }
/* LGE_UPDATE_S [[email protected]] 2010-12-01, modify detection scheme */ static void muic_device_none_detect(void) { u8 reg_value; if ((key_col == 1) && (key_row == 1)) // Volume up key_was_pressed = 1; else if ((key_col == 1) && (key_row == 2)) // Volume down key_was_pressed = 2; printk(KERN_WARNING "[MUIC] Device_None_Detect int_stat_val = 0x%x\n",int_stat_val); /* LGE_CHANGE_S [[email protected]] 2010-12-14, CP retain mode */ #ifdef CP_RETAIN if (is_cp_retained) { muic_CP_USB_set(); } else /* LGE_CHANGE_E [[email protected]] 2011-01-06, CP retain mode */ #elif defined(USB_RETAIN) /* 2012.05.15, [email protected], USB retain mode. */ if (usb_retained == CP_RETAINED) { muic_CP_USB_set(); } else if (usb_retained == AP_RETAINED) { muic_AP_USB_set(); } else #endif // IDNO=0100? 130Kohm :: CP UART MODE if(((int_stat_val & MIDNO) == 0x04) // LGE_CHANGE_S [[email protected]] 2011-02-08 for 130K and 100K and 300K ?�??? CP UART�??�정 { || ((int_stat_val & MIDNO) == 0x03) || ((int_stat_val & MIDNO) == 0x07) // LGE_CHANGE_E [[email protected]] 2011-02-08 } || (hidden_menu_switching == 7)) { muic_CP_UART_set(); } // IDNO=0010? 56Kohm :: CP USB MODE else if (((int_stat_val & MIDNO ) == 0x02) || (hidden_menu_switching == 9)){ if (key_was_pressed == 2) muic_AP_UART_set(); else { // START [email protected] 2011/04/03 LAB1_FW : STOP_ENTERING_EARLYSUSPEND_STATE for factory test { if( usb_swiched_thru_factory_cmd ) { printk(KERN_INFO "[MUIC] AP_USB because usb_swiched_thru_factory_cmd==1\n"); muic_AP_USB_set(); } else // END [email protected] 2011/04/03 LAB1_FW } { muic_CP_USB_set(); } } } // LGE_UPDATE_S [[email protected]] 2010-12-12, for 910K factory download // IDNO=1010? 910Kohm :: CP USB MODE #ifdef CABLE_DETECT_910K else if ((int_stat_val & MIDNO ) == 0x0a) { muic_CP_USB_set(); } else if ((int_stat_val & MIDNO ) == 0x09) { muic_CP_USB_set(); } #endif // CHGDET=1? :: HIGH CURRENT USB or TA? else if (int_stat_val & MCHGDET) { muic_distinguish_charger(); } // VBUS=1? :: TA or AP USB? else if (int_stat_val & MVBUS) { if (muic_device == MAX14526) { // COMP2 to H-Z / COMN1 to C1COMP (0x03=0x23) muic_i2c_write_byte(SW_CONTROL, 0x23); msleep(3); // Read STATUS_REG (0x05) muic_i2c_read_byte(STATUS, ®_value); if (reg_value & 0x01 ) { // Dedicated Charger(TA) Detected // COMP2 to H-Z / COMN1 to H-Z (0x03=0x24) muic_i2c_write_byte(SW_CONTROL, DP_OPEN | DM_OPEN); charging_ic_set_ta_mode(); muic_mode = MUIC_NA_TA; printk(KERN_WARNING "[MUIC] Charger detected\n"); } else { // USB Detected if (key_was_pressed == 2) muic_CP_USB_set(); else muic_AP_USB_set(); } } else { // USB Detected if (key_was_pressed == 2) muic_CP_USB_set(); else { muic_AP_USB_set(); } } } else { // Accessory Not Supported muic_mode = MUIC_NONE; } key_was_pressed = 0; }