bool mhl_cable_connect(void) { int r; MHL_DEV_INFO("%s: in\n ", __func__); // pantech_hdmi_cable_detect(0);/*definitely off hdmi */ MHL_Set_Cable_State(MHL_CABLE_CONNCET); mhl_power_ctrl(1); msleep(10); MHL_On(1); // MHL_Cable_On(1); MHL_En_Control(1) ;// switch-MHL MHL_DEV_INFO( "!!!!!!!![SKY_MHL]%s MHL cable Connect\n",__func__); r = wait_event_timeout(mhl_disconnect_wait_queue, get_mhl_status()==MHL_CABLE_CONNECT ,msecs_to_jiffies(200)); MHL_DEV_INFO("get_mhl_status = %d", get_mhl_status()); MHL_DEV_INFO("get_mhl_rgnd_status=%d\n", get_mhl_rgnd_status()); MHL_DEV_INFO("get_mhl_power_mode=%d\n", get_mhl_power_mode()); if (!r && get_mhl_status() != MHL_CABLE_CONNECT) { wait_event_timeout(mhl_disconnect_wait_queue, 0 ,msecs_to_jiffies(100)); pr_err("get_mhl_status = %d", get_mhl_status()); if (!get_mhl_power_mode()){ pr_err("mhl is not ready to be operated\n"); MHL_DEV_INFO(" get_mhl_rgnd_status=%d", get_mhl_rgnd_status()); mhl_cable_disconnect(); return false; } } r = wait_event_timeout(mhl_disconnect_wait_queue, get_mhl_status()==MHL_DISCOVERY_SUCCESS ,msecs_to_jiffies(1500)); if (!r && get_mhl_status()!= MHL_DISCOVERY_SUCCESS ) { pr_err("get_mhl_status = %d", get_mhl_status()); /* for debug */ queue_delayed_work(mhl_ctrl_connect_work_queue, &mhl_ctrl_connect_work,10); return false; } return true; }
void mhl_cable_disconnect(void) { MHL_DEV_INFO("%s: in\n ", __func__); if(MHL_Get_Cable_State()){ MHL_DEV_INFO("%s: really in!!!!!! in\n ", __func__); MHL_Set_Cable_State(MHL_CABLE_DISCONNCET); set_mhl_ctrled_hpd_state(false); MHL_Cable_On(0); MHL_On(0); mhl_power_ctrl(0); MHL_En_Control(0) ;// switch-MHL // pantech_hdmi_cable_detect(0); MHL_DEV_INFO( "[SKY_MHL]%s MHL cable disConnect \n",__func__); } }
void mhl_cable_connect(struct work_struct *work) { if (HDMI_INP_ND(0x0000) & 0x00000001) { mhl_power_ctrl(1); msleep(10); MHL_On(1); MHL_En_Control(1) ;// switch-MHL MHL_Set_Cable_State(MHL_CABLE_CONNCET); #ifdef MHL_DEBUG printk(KERN_ERR "[SKY_MHL]%s MHL cable Connect \n",__func__); #endif return; } else { schedule_delayed_work(&sii9244_cable_connect_work.work, msecs_to_jiffies(100)); } 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 ; }