void is_mhl_cable(struct work_struct *work) { int rc=0; MHL_DEV_INFO("%s: MHL_Get_Cable_State %d\n ", __func__ , MHL_Get_Cable_State()); if (!MHL_Get_Cable_State()) { if (is_mhl_mode()) { atomic_set(&mhl_connect_status,0); do{ rc = queue_delayed_work(mhl_ctrl_connect_work_queue, &mhl_ctrl_connect_work,0); wait_event_timeout(mhl_connect_wait_queue, 0 ,msecs_to_jiffies(10)); if (!rc) { MHL_DEV_INFO("%s: mhl_ctrl_connect_work_queue is already on, queue again\n ", __func__); } }while(!rc); set_flag_mhl_mode(0); } } else if (MHL_Get_Cable_State()) { if (!is_mhl_mode()) { atomic_set(&mhl_connect_status,1); MHL_DEV_INFO("%s: cable_mv is_mhl_mode\n ", __func__); do{ rc = queue_delayed_work(mhl_ctrl_connect_work_queue, &mhl_ctrl_connect_work,0); wait_event_timeout(mhl_connect_wait_queue, 0 ,msecs_to_jiffies(10)); if (!rc) { MHL_DEV_INFO("%s: mhl_ctrl_connect_work_queue is already on, queue again\n ", __func__); } }while(!rc); set_flag_mhl_mode(0); } } return ; }
void is_mhl_cable(struct work_struct *work) { struct pm8xxx_adc_chan_result result; int rc=0; int try_max=0; do { rc = pm8xxx_adc_mpp_config_read(PM8XXX_AMUX_MPP_3, ADC_MPP_1_AMUX6, &result); try_max++; }while(rc && try_max<20); #ifdef MHL_DEBUG printk("%s: cable_mv %lld\n ", __func__, result.physical); #endif #if ((BOARD_VER>=TP10 && BOARD_VER<TP20) && (defined(CONFIG_MACH_MSM8960_EF45K) || defined(CONFIG_MACH_MSM8960_EF46L) || defined(CONFIG_MACH_MSM8960_EF47S))) if (!MHL_Get_Cable_State() && (mhlsii9244_adc_value > 15000 && mhlsii9244_adc_value< 50000)) #elif (BOARD_VER>=TP20 && (defined(CONFIG_MACH_MSM8960_EF45K) || defined(CONFIG_MACH_MSM8960_EF46L) || defined(CONFIG_MACH_MSM8960_EF47S))) if (!MHL_Get_Cable_State() && (mhlsii9244_adc_value> 22000 &&mhlsii9244_adc_value < 50000)) #else /*(defined(CONFIG_MACH_MSM8960_VEGAPVW) || defined(CONFIG_MACH_MSM8960_VEGAPKDDI))*/ if (!MHL_Get_Cable_State() && (mhlsii9244_adc_valuel< 300000)) #endif { sii9244_cfg_power(0); pantech_hdmi_cable_detect(1); schedule_delayed_work(&sii9244_cable_connect_work.work, msecs_to_jiffies(100)); mhlsii9244_adc_value = 0; } #if ((BOARD_VER>=TP10 && BOARD_VER<TP20) && (defined(CONFIG_MACH_MSM8960_EF45K) || defined(CONFIG_MACH_MSM8960_EF46L) || defined(CONFIG_MACH_MSM8960_EF47S))) else if (MHL_Get_Cable_State() && (result.physical < 15000 || result.physical > 50000)) #elif (BOARD_VER>=TP20 && (defined(CONFIG_MACH_MSM8960_EF45K) || defined(CONFIG_MACH_MSM8960_EF46L) || defined(CONFIG_MACH_MSM8960_EF47S))) else if (MHL_Get_Cable_State() && (result.physical < 22000 || result.physical > 50000)) #else /*(defined(CONFIG_MACH_MSM8960_VEGAPVW) || defined(CONFIG_MACH_MSM8960_VEGAPKDDI))*/ else if (MHL_Get_Cable_State() && (result.physical > 300000)) #endif { if ( get_mhl_status()== MHL_RSEN_LOW) { pantech_hdmi_cable_detect(0); MHL_On(0); // mhl_power_ctrl(0); MHL_En_Control(0) ;// switch-MHL MHL_Set_Cable_State(MHL_CABLE_DISCONNCET); #ifdef MHL_DEBUG printk(KERN_ERR "[SKY_MHL]%s MHL cable disConnect \n",__func__); #endif sii9244_cfg_power_init(); } } #if (BOARD_VER>=TP20 && (defined(CONFIG_MACH_MSM8960_EF45K) || defined(CONFIG_MACH_MSM8960_EF46L) || defined(CONFIG_MACH_MSM8960_EF47S))) if (!MHL_Get_Cable_State() && (mhlsii9244_adc_value<22000)) { if (is_mhl_mode()) { sii9244_cfg_power(0); pantech_hdmi_cable_detect(1); schedule_delayed_work(&sii9244_cable_connect_work.work, msecs_to_jiffies(100)); mhlsii9244_adc_value = 0; set_flag_mhl_mode(0); } } #endif return ; }