static void slimport_cable_plug_proc(struct anx7808_data *anx7808) { int status = 0; if (gpio_get_value_cansleep(anx7808->gpio_cbl_det)) { /* debounce time for avoiding glitch */ msleep(50); if (gpio_get_value_cansleep(anx7808->gpio_cbl_det)) { if (sp_tx_pd_mode) { /* first turn on hpd */ if (anx7808->hdmi_sp_ops->set_upstream_hpd) { status = anx7808->hdmi_sp_ops->set_upstream_hpd( anx7808->hdmi_pdev, 1); if (status) pr_err("failed to turn on hpd\n"); } sp_tx_hardware_poweron(); sp_tx_power_on(SP_TX_PWR_REG); sp_tx_power_on(SP_TX_PWR_TOTAL); hdmi_rx_initialization(); sp_tx_initialization(); sp_tx_vbus_poweron(); if (!sp_tx_get_cable_type(1)) { pr_err("AUX ERR\n"); sp_tx_power_down_and_init(); return; } sp_tx_rx_type_backup = sp_tx_rx_type; } switch (sp_tx_rx_type) { case RX_HDMI: if (sp_tx_get_hdmi_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_DP: if (sp_tx_get_dp_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_VGA_GEN: if (sp_tx_get_vga_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_VGA_9832: if (sp_tx_get_vga_connection()) { sp_tx_send_message(MSG_CLEAR_IRQ); sp_tx_set_sys_state(STATE_PARSE_EDID); } break; case RX_NULL: default: break; } } } else if (sp_tx_pd_mode == 0) { sp_tx_power_down_and_init(); } }
static void slimport_config_output(void) { sp_tx_clean_hdcp(); sp_tx_set_colorspace(); sp_tx_avi_setup(); sp_tx_config_packets(AVI_PACKETS); sp_tx_enable_video_input(1); sp_tx_set_sys_state(STATE_HDCP_AUTH); }
static void slimport_edid_proc(void) { sp_tx_edid_read(); if (bedid_break) pr_err("%s %s: EDID corruption!\n", LOG_TAG, __func__); hdmi_rx_set_hpd(1); hdmi_rx_set_termination(1); sp_tx_set_sys_state(STATE_CONFIG_HDMI); }
static void anx7808_chip_initial(void) { #ifdef EYE_TEST sp_tx_eye_diagram_test(); #else sp_tx_variable_init(); sp_tx_vbus_powerdown(); sp_tx_hardware_powerdown(); sp_tx_set_sys_state(STATE_CABLE_PLUG); #endif }
static void slimport_playback_proc(void) { if ((sp_tx_rx_type == RX_VGA_9832) || (sp_tx_rx_type == RX_VGA_GEN)) { if ((sp_tx_hw_hdcp_en == 0) && (hdcp_en == 1)) { sp_tx_video_mute(1); sp_tx_set_sys_state(STATE_HDCP_AUTH); } else if ((sp_tx_hw_hdcp_en == 1) && (hdcp_en == 0)) sp_tx_disable_slimport_hdcp(); } }
static void slimport_edid_proc(void) { sp_tx_aux_polling_enable(0); sp_tx_edid_read(); if (bedid_break) pr_err("EDID corruption!\n"); sp_tx_aux_polling_enable(1); hdmi_rx_set_hpd(1); hdmi_rx_set_termination(1); sp_tx_set_sys_state(STATE_LINK_TRAINING); }
static void slimport_main_proc(struct anx7808_data *anx7808) { mutex_lock(&anx7808->lock); if (!sp_tx_pd_mode) { sp_tx_int_irq_handler(); hdmi_rx_int_irq_handler(); } if (sp_tx_system_state == STATE_CABLE_PLUG) slimport_cable_plug_proc(anx7808); if (sp_tx_system_state == STATE_PARSE_EDID) slimport_edid_proc(); if (anx7808->update_chg_type && !sp_tx_pd_mode) { sp_tx_chg_current_ma = sp_tx_get_chg_current(); anx7808->update_chg_type = false; complete_all(&init_aux_ch_completion); } if (sp_tx_system_state == STATE_CONFIG_HDMI) sp_tx_config_hdmi_input(); if (sp_tx_system_state == STATE_LINK_TRAINING) { if (!sp_tx_lt_pre_config()) sp_tx_hw_link_training(); } if (sp_tx_system_state == STATE_CONFIG_OUTPUT) slimport_config_output(); if (sp_tx_system_state == STATE_HDCP_AUTH) { if (hdcp_enable) { sp_tx_hdcp_process(); } else { sp_tx_power_down(SP_TX_PWR_HDCP); sp_tx_video_mute(0); hdmi_rx_show_video_info(); sp_tx_show_infomation(); sp_tx_set_sys_state(STATE_PLAY_BACK); } } if (sp_tx_system_state == STATE_PLAY_BACK) slimport_playback_proc(); mutex_unlock(&anx7808->lock); }
static void slimport_main_proc(struct anx7808_data *anx7808) { mutex_lock(&anx7808->lock); if (!sp_tx_pd_mode) { sp_tx_int_irq_handler(); hdmi_rx_int_irq_handler(); } if (sp_tx_system_state == STATE_CABLE_PLUG) slimport_cable_plug_proc(anx7808); if (sp_tx_system_state == STATE_PARSE_EDID) slimport_edid_proc(); if (sp_tx_system_state == STATE_CONFIG_HDMI) sp_tx_config_hdmi_input(); if (sp_tx_system_state == STATE_LINK_TRAINING) { if (!sp_tx_lt_pre_config()) sp_tx_hw_link_training(); } if (sp_tx_system_state == STATE_CONFIG_OUTPUT) slimport_config_output(); if (sp_tx_system_state == STATE_HDCP_AUTH) { if (hdcp_enable) { sp_tx_hdcp_process(); } else { sp_tx_power_down(SP_TX_PWR_HDCP); sp_tx_video_mute(0); sp_tx_show_infomation(); sp_tx_set_sys_state(STATE_PLAY_BACK); } } if (sp_tx_system_state == STATE_PLAY_BACK) slimport_playback_proc(); #ifdef CONFIG_CHARGER_SMB345 slimport_cable_monitor(anx7808); #endif mutex_unlock(&anx7808->lock); }
static void anx7808_chip_initial(void) { #ifdef EYE_TEST sp_tx_eye_diagram_test(); #else sp_tx_variable_init(); sp_tx_vbus_powerdown(); sp_tx_hardware_powerdown(anx7808_client); //ASUS_BSP +++: workaround for turn off 1.0V after read chip id msleep(5); sp_tx_hardware_power_set(0); //ASUS_BSP ---: workaround for turn off 1.0V after read chip id sp_tx_set_sys_state(STATE_CABLE_PLUG); #endif }
static void slimport_cable_monitor(struct anx7808_data *anx7808) { if ((gpio_get_value_cansleep(anx7808->pdata->gpio_cbl_det)) && (!sp_tx_pd_mode)) { sp_tx_get_downstream_type(); if (sp_tx_rx_type_backup != sp_tx_rx_type) { pr_info("cable changed!\n"); sp_tx_vbus_powerdown(); sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); sp_tx_hardware_powerdown(); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; sp_tx_set_sys_state(STATE_CABLE_PLUG); } } }
static void slimport_cable_plug_proc(struct anx7808_data *anx7808) { struct anx7808_platform_data *pdata = anx7808->pdata; if (gpio_get_value_cansleep(pdata->gpio_cbl_det)) { mdelay(100); if (gpio_get_value_cansleep(pdata->gpio_cbl_det)) { if (sp_tx_pd_mode) { sp_tx_pd_mode = 0; #ifdef CONFIG_SLIMPORT_DYNAMIC_HPD slimport_set_hdmi_hpd(1); #endif sp_tx_hardware_poweron(); sp_tx_power_on(SP_TX_PWR_REG); sp_tx_power_on(SP_TX_PWR_TOTAL); hdmi_rx_initialization(); sp_tx_initialization(); sp_tx_vbus_poweron(); msleep(200); if (!sp_tx_get_cable_type()) { pr_err("%s %s:AUX ERR\n", LOG_TAG, __func__); sp_tx_vbus_powerdown(); sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); sp_tx_hardware_powerdown(); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; sp_tx_set_sys_state(STATE_CABLE_PLUG); return; } sp_tx_rx_type_backup = sp_tx_rx_type; } switch (sp_tx_rx_type) { case RX_HDMI: if (sp_tx_get_hdmi_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_DP: if (sp_tx_get_dp_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_VGA_GEN: if (sp_tx_get_vga_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_VGA_9832: if (sp_tx_get_vga_connection()) { sp_tx_send_message(MSG_CLEAR_IRQ); sp_tx_set_sys_state(STATE_PARSE_EDID); } break; case RX_NULL: default: break; } } } else if (sp_tx_pd_mode == 0) { sp_tx_vbus_powerdown(); sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); sp_tx_hardware_powerdown(); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; sp_tx_set_sys_state(STATE_CABLE_PLUG); } }
static void slimport_cable_plug_proc(struct anx7808_data *anx7808) { if (gpio_get_value_cansleep(anx7808->pdata->gpio_cbl_det)) { msleep(50); if (gpio_get_value_cansleep(anx7808->pdata->gpio_cbl_det)) { if (sp_tx_pd_mode) { sp_tx_pd_mode = 0; sp_tx_hardware_poweron(); sp_tx_power_on(SP_TX_PWR_REG); sp_tx_power_on(SP_TX_PWR_TOTAL); #ifdef CONFIG_CHARGER_SMB345 sp_tx_pull_down_id(TRUE); #endif hdmi_rx_initialization(); sp_tx_initialization(); sp_tx_vbus_poweron(); msleep(200); if (!sp_tx_get_cable_type()) { SP_DEV_ERR("%s:AUX ERR\n", __func__); sp_tx_vbus_powerdown(); #ifdef CONFIG_CHARGER_SMB345 sp_tx_pull_down_id(FALSE); #endif sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); sp_tx_hardware_powerdown(); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; sp_tx_set_sys_state(STATE_CABLE_PLUG); return; } sp_tx_rx_type_backup = sp_tx_rx_type; } switch (sp_tx_rx_type) { case RX_HDMI: if (sp_tx_get_hdmi_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_DP: if (sp_tx_get_dp_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_VGA_GEN: if (sp_tx_get_vga_connection()) sp_tx_set_sys_state(STATE_PARSE_EDID); break; case RX_VGA_9832: if (sp_tx_get_vga_connection()) { sp_tx_send_message(MSG_CLEAR_IRQ); sp_tx_set_sys_state(STATE_PARSE_EDID); } break; case RX_NULL: default: break; } } } else if (sp_tx_pd_mode == 0) { sp_tx_vbus_powerdown(); #ifdef CONFIG_CHARGER_SMB345 sp_tx_pull_down_id(FALSE); #endif sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); sp_tx_hardware_powerdown(); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; sp_tx_set_sys_state(STATE_CABLE_PLUG); } }
static void slimport_cable_plug_proc(struct anx7808_data *anx7808) { int Pad_HW_ID = 0; /// printk("+++++++++++++slimport_cable_plug_proc+++++++++++++++++++\n"); if (gpio_get_value_cansleep(anx7808->pdata->gpio_cbl_det) ) { msleep(50); if (gpio_get_value_cansleep(anx7808->pdata->gpio_cbl_det) ) { // printk("slimport_cable_plug_proc start\n"); if (sp_tx_pd_mode) { /// printk("=================slimport_cable_plug_proc (1) ===============\n"); //ASUS_BSP +++ : larry lai for pad solution if(sp_tx_get_asus_id()) { #ifdef CONFIG_EEPROM_NUVOTON Pad_HW_ID = AX_MicroP_IsMydpNewSKU(); #else Pad_HW_ID = -1; // default TV mode #endif if (Pad_HW_ID == 1) { printk("### [myDP] DP Pad detect ###\n"); sp_tx_asus_pad = 1; myDP_DP_Dongle = 1; } else if (Pad_HW_ID == 0) { printk("### [myDP] HDMI Pad detect ###\n"); sp_tx_asus_pad = 1; myDP_DP_Dongle = 0; } else { if (myDP_force_pad_mode) { if (myDP_DP_Dongle) { printk("[myDP] DP Pad detect ###\n"); sp_tx_asus_pad = 1; myDP_DP_Dongle = 1; } else { printk("[myDP] HDMI Pad detect ###\n"); sp_tx_asus_pad = 1; myDP_DP_Dongle = 0; } } else { printk("### [myDP] Fail detect Pad , force TV mode ###\n"); sp_tx_asus_pad = 0; myDP_DP_Dongle = 0; } } } else nv_touch_mode(4); //ASUS_BSP Deeo : notify touch while plug out HDMI 4: AC //ASUS_BSP --- : larry lai for pad solution //sp_tx_hardware_chip_enable(anx7808_client); sp_tx_hardware_poweron(anx7808_client); sp_tx_pd_mode = 0; //ANX : (ver:20130105) diff with ANX slimport driver, comment it ??? //// msleep(200); sp_tx_power_on(SP_TX_PWR_REG); sp_tx_power_on(SP_TX_PWR_TOTAL); /// printk("=================slimport_cable_plug_proc (2) ===============\n"); //ANX : (ver:0.2) sp_tx_pull_down_id(TRUE); hdmi_rx_initialization(); /// printk("=================slimport_cable_plug_proc (3) ===============\n"); sp_tx_initialization(); /// printk("=================slimport_cable_plug_proc (4) ===============\n"); //ASUS_BSP +++ : larry lai for pad solution if (!sp_tx_asus_pad) { sp_tx_vbus_poweron(); msleep(200); } else { msleep(20); } //ASUS_BSP --- : larry lai for pad solution if (!sp_tx_get_cable_type()) { DEV_ERR("%s:AUX ERR\n", __func__); sp_tx_vbus_powerdown(); //ANX : (ver:0.2) sp_tx_pull_down_id(FALSE); sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); // sp_tx_hardware_chip_disable(anx7808_client); sp_tx_hardware_powerdown(anx7808_client); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; //ANX +++: (ver:20130105) pad solution sp_tx_asus_pad = 0; //ANX ---: (ver:20130105) pad solution sp_tx_set_sys_state(STATE_CABLE_PLUG); return; } /// printk("=================slimport_cable_plug_proc (5) ===============\n"); sp_tx_rx_type_backup = sp_tx_rx_type; } switch(sp_tx_rx_type) { case RX_HDMI: /// printk("=================slimport_cable_plug_proc (RX_HDMI) ===============\n"); if(sp_tx_get_hdmi_connection()){ printk("==== (RX_HDMI) ===\n"); //ANX +++: (ver:20130105) pad solution if(sp_tx_asus_pad) { //skip EDID read hdmi_rx_set_hpd(1); hdmi_rx_set_termination(1); sp_tx_set_sys_state(STATE_CONFIG_HDMI); } else { sp_tx_set_sys_state(STATE_PARSE_EDID); } //ANX ---: (ver:20130105) pad solution } break; case RX_DP: if(sp_tx_get_dp_connection()) { printk("==== (RX_DP) ===\n"); if(sp_tx_asus_pad) { //skip EDID read hdmi_rx_set_hpd(1); hdmi_rx_set_termination(1); sp_tx_set_sys_state(STATE_CONFIG_HDMI); } else { sp_tx_set_sys_state(STATE_PARSE_EDID); } } break; case RX_VGA: if(sp_tx_get_vga_connection()){ sp_tx_send_message(MSG_CLEAR_IRQ); sp_tx_set_sys_state(STATE_PARSE_EDID); } break; case RX_NULL: default: break; } } } else if (sp_tx_pd_mode == 0) { sp_tx_vbus_powerdown(); //ANX : (ver:0.2) sp_tx_pull_down_id(FALSE); sp_tx_power_down(SP_TX_PWR_REG); sp_tx_power_down(SP_TX_PWR_TOTAL); sp_tx_hardware_powerdown(anx7808_client); // sp_tx_hardware_chip_disable(anx7808_client); sp_tx_pd_mode = 1; sp_tx_link_config_done = 0; sp_tx_hw_lt_enable = 0; sp_tx_hw_lt_done = 0; sp_tx_rx_type = RX_NULL; sp_tx_rx_type_backup = RX_NULL; //ANX +++: (ver:20130105) pad solution sp_tx_asus_pad = 0; //ANX ---: (ver:20130105) pad solution sp_tx_set_sys_state(STATE_CABLE_PLUG); } }
static void slimport_main_proc(struct anx7808_data *anx7808) { //unchar c1, c2; ///printk("=================slimport_main_proc================\n"); mutex_lock(&anx7808->lock); //ASUS BSP Wei Lai +++ //sp_tx_chip_located(); ///printk("(1) slimport_main_proc \n"); //sp_tx_hardware_poweron(anx7808_client); //msleep(200); //ASUS BSP Wei Lai --- if (!sp_tx_pd_mode) { /// printk("(1-1)slimport_main_proc \n"); sp_tx_int_irq_handler(); hdmi_rx_int_irq_handler(); /// printk("(1-2)slimport_main_proc \n"); } //sp_tx_hardware_chip_enable(anx7808_client); //printk("=================slimport_main_proc END================\n"); ///printk("(2)slimport_main_proc \n"); if (sp_tx_system_state == STATE_CABLE_PLUG) slimport_cable_plug_proc(anx7808); ///printk("(3)slimport_main_proc \n"); if (sp_tx_system_state == STATE_PARSE_EDID) slimport_edid_proc(); //ANX +++: (ver0.4) if (sp_tx_system_state == STATE_CONFIG_HDMI) { // if((sp_tx_asus_pad) && (!myDP_DP_Dongle)) if(sp_tx_asus_pad) { int try_count= 50; while (try_count) { if (!sp_tx_config_hdmi_input()) break; else msleep(20); try_count --; }; printk("[myDP] try_count = %d\n", try_count); if ( (!check_mdp4_dtv() || !try_count) && (g_slimport_bypass_check_mdp4) ) { printk("[myDP] after check RX input, still TMDS not ready, go link , then power down\n"); sp_tx_set_sys_state(STATE_LINK_TRAINING); } else { printk("[myDP] TMDS ready, go to next process\n"); g_slimport_bypass_check_mdp4 = 1; } if (sp_tx_system_state == STATE_LINK_TRAINING) sp_tx_sw_error_power_down(); else sp_tx_config_hdmi_pad(); } else { if (sp_tx_rx_type == RX_VGA) { // check need under 480p if (myDP_check_7808_rx_under_480p()) { sp_tx_config_hdmi_input(); } } else { sp_tx_config_hdmi_input(); } } } if (sp_tx_system_state == STATE_LINK_TRAINING) { if (!sp_tx_asus_pad) { if (!sp_tx_lt_pre_config()) sp_tx_hw_link_training(); } else {// pad mode not do link training, so power down chip sp_tx_sw_error_power_down(); } } //ANX ---: (ver0.4) //printk("=================slimport_main_proc================\n"); //printk("=================slimport_main_proc END================\n"); if (sp_tx_system_state == STATE_CONFIG_OUTPUT) slimport_config_output(); if (sp_tx_system_state == STATE_HDCP_AUTH) { if (hdcp_enable && ((sp_tx_rx_type == RX_HDMI) || ( sp_tx_rx_type ==RX_DP) || ( sp_tx_rx_type ==RX_VGA)) ) { //ANX +++: (ver:20130105) pad solution // if((sp_tx_asus_pad) && (!myDP_DP_Dongle)) if(sp_tx_asus_pad) sp_tx_sw_hdcp_process(); else sp_tx_hdcp_process(); //ANX ---: (ver:20130105) pad solution } else { sp_tx_power_down(SP_TX_PWR_HDCP); sp_tx_video_mute(0); sp_tx_show_infomation(); sp_tx_set_sys_state(STATE_PLAY_BACK); } } if (sp_tx_system_state == STATE_PLAY_BACK) slimport_playback_proc(); //ASUS BSP Wei Lai +++ //sp_tx_hardware_powerdown(anx7808_client); //ASUS BSP Wei Lai --- mutex_unlock(&anx7808->lock); /// printk("=================slimport_main_proc END================\n"); }