void acc_con_intr_handle(struct work_struct *_work) { //ACC_CONDEV_DBG(""); //check the flag MHL or keyboard int cur_state = gpio_get_value(GPIO_ACCESSORY_INT); if(cur_state !=DOCK_STATE) { if(1==cur_state) { ACC_CONDEV_DBG("docking station detatched!!!"); DOCK_STATE = cur_state; #if defined(CONFIG_KEYBOARD_P1) check_keyboard_dock(); #endif #ifdef CONFIG_MHL_SII9234 //call MHL deinit MHD_HW_Off(); //msleep(120); //max8998_ldo3_8_control(0,LDO_TV_OUT); //ldo 3,8 off //printk("%s: LDO3_8 is disabled by TV \n", __func__); TVout_LDO_ctrl(false); #endif acc_dock_check(CONNECTED_DOCK , DOCK_STATE); CONNECTED_DOCK = 0; } else if(0==cur_state) { ACC_CONDEV_DBG("docking station attatched!!!"); DOCK_STATE = cur_state; #if defined(CONFIG_KEYBOARD_P1) if(check_keyboard_dock()) { CONNECTED_DOCK = DOCK_KEYBD; } else #endif { #ifdef CONFIG_MHL_SII9234 CONNECTED_DOCK = DOCK_DESK; //max8998_ldo3_8_control(1,LDO_TV_OUT); //ldo 3,8 on //printk("%s: LDO3_8 is enabled by TV \n", __func__); //msleep(120); TVout_LDO_ctrl(true); //call MHL init sii9234_tpi_init(); #endif } acc_dock_check(CONNECTED_DOCK , DOCK_STATE); } } else { ACC_CONDEV_DBG("Ignored"); } enable_irq(IRQ_ACCESSORY_INT); }
static int acc_con_suspend(struct platform_device *pdev, pm_message_t state) { struct acc_con_info *acc = platform_get_drvdata(pdev); ACC_CONDEV_DBG(""); #ifdef CONFIG_MHL_SII9234 if ((acc->current_dock == DOCK_DESK) || (acc->current_dock == DOCK_KEYBOARD)) MHD_HW_Off(); /*call MHL deinit */ #endif return 0; }
static void acc_check_dock_detection(struct acc_con_info *acc) { if (NULL == acc->pdata->get_dock_state) { ACC_CONDEV_DBG("[30PIN] failed to get acc state!!!"); return; } if (!acc->pdata->get_dock_state()) { #ifdef CONFIG_SEC_KEYBOARD_DOCK if (acc->pdata->check_keyboard && acc->pdata->check_keyboard(true)) { acc->current_dock = DOCK_KEYBOARD; ACC_CONDEV_DBG ("[30PIN] keyboard dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_KEYBOARD); } else #endif { ACC_CONDEV_DBG ("[30PIN] desktop dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_DESK); acc->current_dock = DOCK_DESK; #ifdef CONFIG_MHL_SII9234 mutex_lock(&acc->lock); if (!acc->mhl_pwr_state) { sii9234_tpi_init(); acc->mhl_pwr_state = true; } mutex_unlock(&acc->lock); #endif } acc_dock_uevent(acc, true); } else { ACC_CONDEV_DBG("[30PIN] dock station detached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_NONE); #ifdef CONFIG_SEC_KEYBOARD_DOCK if (acc->pdata->check_keyboard) acc->pdata->check_keyboard(false); #endif #ifdef CONFIG_MHL_SII9234 /*call MHL deinit */ if (acc->mhl_pwr_state) { MHD_HW_Off(); acc->mhl_pwr_state = false; } #endif /*TVout_LDO_ctrl(false); */ acc_dock_uevent(acc, false); } }
static void acc_check_dock_detection(struct acc_con_info *acc) { if (!acc->pdata->get_dock_state()) { // ACC_CONDEV_DBG("[30PIN] failed to get acc state!!!"); wake_lock(&acc->wake_lock); #ifdef CONFIG_SEC_KEYBOARD_DOCK if (acc->pdata->check_keyboard && acc->pdata->check_keyboard(true)) { acc->current_dock = DOCK_KEYBOARD; ACC_CONDEV_DBG ("[30PIN] keyboard dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_KEYBOARD); } else #endif { ACC_CONDEV_DBG ("[30PIN] desktop dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_DESK); acc->current_dock = DOCK_DESK; } #ifdef CONFIG_MHL_SII9234 mutex_lock(&acc->lock); sii9234_tpi_init(); hdmi_msm_hpd_switch(true); mutex_unlock(&acc->lock); #endif acc_dock_uevent(acc, true); wake_unlock(&acc->wake_lock); } else { if (acc->current_dock == DOCK_NONE) return; ACC_CONDEV_DBG("docking station detached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_NONE); acc_dock_uevent(acc, false); #ifdef CONFIG_SEC_KEYBOARD_DOCK if (acc->pdata->check_keyboard) acc->pdata->check_keyboard(false); #endif #ifdef CONFIG_MHL_SII9234 /*call MHL deinit */ MHD_HW_Off(); hdmi_msm_hpd_switch(false); /*TVout_LDO_ctrl(false); */ #endif } }
void acc_TA_check(int On) { if(!gpio_get_value(GPIO_ACCESSORY_INT)) { if(On == FALSE) MHD_HW_Off(); else if((On == TRUE) && (CONNECTED_DOCK == DOCK_DESK) ) sii9234_tpi_init(); } }
static int acc_con_suspend(struct platform_device *pdev, pm_message_t state) { struct acc_con_info *acc = platform_get_drvdata(pdev); ACC_CONDEV_DBG(""); #ifdef CONFIG_MHL_SII9234 if (acc->mhl_pwr_state) { MHD_HW_Off(); /*call MHL deinit */ acc->mhl_pwr_state = false; } #endif return 0; }
static int acc_con_suspend(struct platform_device *pdev, pm_message_t state) { ACC_CONDEV_DBG(""); #ifdef CONFIG_MHL_SII9234 //call MHL deinit MHD_HW_Off(); //msleep(120); //max8998_ldo3_8_control(0,LDO_TV_OUT); //ldo 3,8 off //printk("%s: LDO3_8 is disabled by TV \n", __func__); #endif return 0; }
static int acc_con_suspend(struct platform_device *pdev, pm_message_t state) { struct acc_con_info *acc = platform_get_drvdata(pdev); ACC_CONDEV_DBG(""); #ifdef CONFIG_MHL_SII9234 if (acc->mhl_pwr_state) { pr_err("%s::MHL off\n", __func__); MHD_HW_Off(); acc->mhl_pwr_state = false; } #endif return 0; }
static ssize_t MHD_check_read(struct device *dev, struct device_attribute *attr, char *buf) { int count; int res; /*TVout_LDO_ctrl(true);*/ if (!MHD_HW_IsOn()) { sii9234_tpi_init(); res = MHD_Read_deviceID(); MHD_HW_Off(); } else { sii9234_tpi_init(); res = MHD_Read_deviceID(); } count = sprintf(buf, "%d\n", res); /*TVout_LDO_ctrl(false);*/ return count; }
static ssize_t MHD_check_read(struct device *dev, struct device_attribute *attr, char *buf) { int count; int res; #if 0 s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_UP); //MHL_SEL gpio_set_value(GPIO_MHL_SEL, 1); //TVout_LDO_ctrl(true); if(!MHD_HW_IsOn()) { sii9234_tpi_init(); res = MHD_Read_deviceID(); MHD_HW_Off(); } else { sii9234_tpi_init(); res = MHD_Read_deviceID(); } I2C_WriteByte(0x72, 0xA5, 0xE1); res = 0; res = I2C_ReadByte(0x72, 0xA5); printk("A5 res %x",res); res = 0; res = I2C_ReadByte(0x72, 0x1B); printk("Device ID res %x",res); res = 0; res = I2C_ReadByte(0x72, 0x1C); printk("Device Rev ID res %x",res); res = 0; res = I2C_ReadByte(0x72, 0x1D); printk("Device Reserved ID res %x",res); printk("\n####HDMI_EN1 %x MHL_RST %x GPIO_MHL_SEL %x\n",gpio_get_value(GPIO_HDMI_EN1),gpio_get_value(GPIO_MHL_RST),gpio_get_value(GPIO_MHL_SEL)); res = I2C_ReadByte(0x7A, 0x3D); res = I2C_ReadByte(0x7A, 0xFF); s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_NONE); //MHL_SEL gpio_set_value(GPIO_MHL_SEL, 0); #endif count = sprintf(buf,"%d\n", res ); //TVout_LDO_ctrl(false); return count; }
irqreturn_t acc_con_interrupt(int irq, void *ptr) { struct acc_con_info *acc = ptr; int cur_state; ACC_CONDEV_DBG(""); /* check the flag MHL or keyboard */ cur_state = gpio_get_value(acc->pdata->accessory_irq_gpio); if (cur_state == 1) { if (acc->current_dock == DOCK_NONE) { return; } ACC_CONDEV_DBG("[30PIN] dock station detached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_NONE); #ifdef CONFIG_SEC_KEYBOARD_DOCK check_keyboard_dock(false); #endif #ifdef CONFIG_MHL_SII9234 /*call MHL deinit */ if (acc->mhl_pwr_state) { MHD_HW_Off(); #if defined(CONFIG_MACH_SAMSUNG_P5) || (CONFIG_MACH_SAMSUNG_P5WIFI) hpd_force_low(); #endif acc->mhl_pwr_state = false; } /*TVout_LDO_ctrl(false); */ #endif acc_dock_check(acc, false); set_irq_type(irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT); } else if (0 == cur_state) { #ifdef CONFIG_SEC_KEYBOARD_DOCK if (check_keyboard_dock(true)) { acc->current_dock = DOCK_KEYBOARD; ACC_CONDEV_DBG("[30PIN] keyboard dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_KEYBOARD); } else #endif { #ifdef CONFIG_MHL_SII9234 ACC_CONDEV_DBG("[30PIN] desktop dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_DESK); acc->current_dock = DOCK_DESK; #endif if(acc->pdata->acc_power) { ACC_CONDEV_DBG("[30PIN] otg 5v up!!!"); acc->pdata->acc_power(2, true); } else printk(KERN_ERR"[30PIN][ERROR] acc_power is null !!!"); } if (!acc->mhl_pwr_state) { sii9234_tpi_init(); acc->mhl_pwr_state = true; } acc_dock_check(acc, true); set_irq_type(irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT); } return IRQ_HANDLED; }
irqreturn_t acc_con_interrupt(int irq, void *ptr) { struct acc_con_info *acc = ptr; int cur_state; ACC_CONDEV_DBG(""); /* check the flag MHL or keyboard */ cur_state = gpio_get_value(acc->pdata->accessory_irq_gpio); if (cur_state == 1) { if (acc->current_dock == DOCK_NONE) { return IRQ_HANDLED; } irq_set_irq_type(irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT); ACC_CONDEV_DBG("[30PIN] dock station detached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_NONE); #ifdef CONFIG_SEC_KEYBOARD_DOCK if (acc->pdata->check_keyboard) acc->pdata->check_keyboard(false); #endif #ifndef CONFIG_MACH_SAMSUNG_P3 #ifdef CONFIG_MHL_SII9234 /*call MHL deinit */ if (acc->mhl_pwr_state) { MHD_HW_Off(); #if defined(CONFIG_MACH_SAMSUNG_P5) || defined(CONFIG_MACH_SAMSUNG_P5WIFI) hpd_force_low(); #endif acc->mhl_pwr_state = false; wake_unlock(&acc->mhl_wake_lock); } #endif #endif /*TVout_LDO_ctrl(false); */ acc_dock_check(acc, false); } else if (0 == cur_state) { irq_set_irq_type(irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT); #ifdef CONFIG_SEC_KEYBOARD_DOCK if (acc->pdata->check_keyboard && acc->pdata->check_keyboard(true)) { acc->current_dock = DOCK_KEYBOARD; ACC_CONDEV_DBG("[30PIN] keyboard dock is attached"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_KEYBOARD); } else #endif { ACC_CONDEV_DBG("[30PIN] desktop dock station attached!!!"); switch_set_state(&acc->dock_switch, UEVENT_DOCK_DESK); acc->current_dock = DOCK_DESK; #ifndef CONFIG_MACH_SAMSUNG_P3 #ifdef CONFIG_MHL_SII9234 mutex_lock(&acc->lock); if (!acc->mhl_pwr_state) { #ifdef __SAMSUNG_HDMI_FLAG_WORKAROUND__ tegra_dc_set_hdmi_flag(1); #endif sii9234_tpi_init(); acc->mhl_pwr_state = true; wake_lock(&acc->mhl_wake_lock); } mutex_unlock(&acc->lock); #endif #endif } acc_dock_check(acc, true); } return IRQ_HANDLED; }
static int acc_con_probe(struct platform_device *pdev) { int retval; ACC_CONDEV_DBG(""); acc_dev = &pdev->dev; #ifdef CONFIG_MHL_SII9234 retval = i2c_add_driver(&SII9234A_i2c_driver); if (retval != 0) printk("[MHL SII9234A] can't add i2c driver\n"); else printk("[MHL SII9234A] add i2c driver\n"); retval = i2c_add_driver(&SII9234B_i2c_driver); if (retval != 0) printk("[MHL SII9234B] can't add i2c driver\n"); else printk("[MHL SII9234B] add i2c driver\n"); retval = i2c_add_driver(&SII9234C_i2c_driver); if (retval != 0) printk("[MHL SII9234C] can't add i2c driver\n"); else printk("[MHL SII9234C] add i2c driver\n"); retval = i2c_add_driver(&SII9234_i2c_driver); if (retval != 0) printk("[MHL SII9234] can't add i2c driver\n"); else printk("[MHL SII9234] add i2c driver\n"); //MHD_HW_Reset(); //9234 goes to D2 MHD_HW_Off(); #endif INIT_WORK(&acc_con_work, acc_con_intr_handle); acc_con_workqueue = create_singlethread_workqueue("acc_con_workqueue"); acc_con_interrupt_init(); #if defined (CONFIG_TARGET_LOCALE_EUR) || defined (CONFIG_TARGET_LOCALE_HKTW) || defined (CONFIG_TARGET_LOCALE_HKTW_FET) || defined (CONFIG_TARGET_LOCALE_VZW) || defined (CONFIG_TARGET_LOCALE_USAGSM) if(HWREV >=0xB) { INIT_WORK(&acc_ID_work, acc_ID_intr_handle); acc_ID_workqueue = create_singlethread_workqueue("acc_ID_workqueue"); acc_ID_interrupt_init(); } #else #ifdef CONFIG_TARGET_LOCALE_KOR if(HWREV >=0xA) { INIT_WORK(&acc_ID_work, acc_ID_intr_handle); acc_ID_workqueue = create_singlethread_workqueue("acc_ID_workqueue"); acc_ID_interrupt_init(); } #else INIT_WORK(&acc_ID_work, acc_ID_intr_handle); acc_ID_workqueue = create_singlethread_workqueue("acc_ID_workqueue"); acc_ID_interrupt_init(); #endif #endif //INIT_WORK(&acc_MHD_work, acc_MHD_intr_handle); //acc_MHD_workqueue = create_singlethread_workqueue("acc_MHD_workqueue"); //acc_MHD_interrupt_init(); if (device_create_file(acc_dev, &dev_attr_MHD_file) < 0) printk("Failed to create device file(%s)!\n", dev_attr_MHD_file.attr.name); if (device_create_file(acc_dev, &dev_attr_acc_file) < 0) printk("Failed to create device file(%s)!\n", dev_attr_acc_file.attr.name); /* init_timer(&connector_detect_timer); connector_detect_timer.function = acc_con_detect_timer_handler; connector_detect_timer.expires = DETECTION_INTR_DELAY; add_timer(&connector_detect_timer); */ return 0; }