static enum drm_connector_status meson_connector_detect(struct drm_connector *connector, bool force) { struct meson_connector *meson_connector = to_meson_connector(connector); int vrefresh = drm_mode_vrefresh(meson_connector->mode); enum meson_cvbs_switch_state s = meson_cvbs_get_switch_state(); struct device *d = connector->dev->dev; if (!meson_connector->enabled) return connector_status_disconnected; /* PAL connector */ if (vrefresh == 100 && s != MESON_CVBS_SWITCH_PAL) { dev_info(d, "CVBS/NTSC selected from switch\n"); return connector_status_disconnected; } /* NTSC connector */ if (vrefresh == 120 && s != MESON_CVBS_SWITCH_NTSC) { dev_info(d, "CVBS/PAL selected from switch\n"); return connector_status_disconnected; } /* use the opposite from HPD -- HDMI connected means composite disconnected, * HDMI disconnected means composite connected. */ return read_hpd_gpio() ? connector_status_disconnected : connector_status_connected; }
static int osd1_init(logo_object_t *plogo) { int hpd_state = 0; if(plogo->para.output_dev_type==output_osd1.idx) { DisableVideoLayer(); if((plogo->platform_res[output_osd1.idx].mem_end - plogo->platform_res[output_osd1.idx].mem_start) ==0) { return OUTPUT_DEV_UNFOUND; } if(plogo->para.loaded) { osd_init_hw(plogo->para.loaded); if(plogo->para.vout_mode > VMODE_4K2K_SMPTE){ plogo->para.vout_mode|=VMODE_LOGO_BIT_MASK; } } #ifdef CONFIG_AM_HDMI_ONLY if(plogo->para.vout_mode > VMODE_4K2K_SMPTE) { set_current_vmode(plogo->para.vout_mode); }else{ extern int read_hpd_gpio(void); hpd_state = read_hpd_gpio(); if (hpd_state == 0){ set_current_vmode(cvbsmode_hdmionly); } else{ set_current_vmode(hdmimode_hdmionly); } } #else set_current_vmode(plogo->para.vout_mode); #endif output_osd1.vinfo=get_current_vinfo(); plogo->dev=&output_osd1; plogo->dev->window.x=0; plogo->dev->window.y=0; plogo->dev->window.w=plogo->dev->vinfo->width; plogo->dev->window.h=plogo->dev->vinfo->height; plogo->dev->output_dev.osd.mem_start=plogo->platform_res[LOGO_DEV_OSD1].mem_start; plogo->dev->output_dev.osd.mem_end=plogo->platform_res[LOGO_DEV_OSD1].mem_end; plogo->dev->output_dev.osd.color_depth=get_curr_color_depth(P_VIU_OSD2_BLK0_CFG_W0);//setup by uboot return OUTPUT_DEV_FOUND; } return OUTPUT_DEV_UNFOUND; }
static int osd1_init(logo_object_t *plogo) { #if defined(CONFIG_AM_HDMI_ONLY) int hpd_state = 0; #endif #if defined(CONFIG_AM_HDMI_ONLY) || (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8) vmode_t cur_mode = plogo->para.vout_mode; #endif if(plogo->para.output_dev_type==output_osd1.idx) { DisableVideoLayer(); if((plogo->platform_res[output_osd1.idx].mem_end - plogo->platform_res[output_osd1.idx].mem_start) ==0) { return OUTPUT_DEV_UNFOUND; } if(plogo->para.loaded) { osd_init_hw(plogo->para.loaded); if(plogo->para.vout_mode > VMODE_4K2K_SMPTE){ plogo->para.vout_mode|=VMODE_LOGO_BIT_MASK; } } #ifdef CONFIG_AM_HDMI_ONLY if(plogo->para.vout_mode > VMODE_4K2K_SMPTE) { set_current_vmode(plogo->para.vout_mode); }else{ extern int read_hpd_gpio(void); hpd_state = read_hpd_gpio(); if (hpd_state == 0){ cur_mode = cvbsmode_hdmionly; } else{ cur_mode = hdmimode_hdmionly; } set_current_vmode(cur_mode); } #else set_current_vmode(plogo->para.vout_mode); #endif #if MESON_CPU_TYPE < MESON_CPU_TYPE_MESON8 osd_init_scan_mode(); #endif output_osd1.vinfo=get_current_vinfo(); plogo->dev=&output_osd1; plogo->dev->window.x=0; plogo->dev->window.y=0; plogo->dev->window.w=plogo->dev->vinfo->width; plogo->dev->window.h=plogo->dev->vinfo->height; plogo->dev->output_dev.osd.mem_start=plogo->platform_res[LOGO_DEV_OSD1].mem_start; plogo->dev->output_dev.osd.mem_end=plogo->platform_res[LOGO_DEV_OSD1].mem_end; plogo->dev->output_dev.osd.color_depth=get_curr_color_depth(P_VIU_OSD2_BLK0_CFG_W0);//setup by uboot #if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 if((cur_mode != (plogo->para.vout_mode & VMODE_MODE_BIT_MASK)) && (cur_mode <= VMODE_4K2K_SMPTE)) { set_osd_freescaler(LOGO_DEV_OSD1, plogo, cur_mode); } #endif return OUTPUT_DEV_FOUND; } return OUTPUT_DEV_UNFOUND; }