int vout_set_mode(int no,vout_inf_mode_t mode) { vout_t *vo; DBG_DETAIL("(%d,%d)\n",no,mode); if( vout_query_inf_support(no,mode)==0 ){ DBG_ERR("not support this interface(%d,%d)\n",no,mode); return -1; } vo = vout_get_entry(no); if( vo->inf ){ if( vo->inf->mode == mode ) return 0; vo->inf->uninit(vo,0); vout_change_status(vo,VPP_VOUT_STS_ACTIVE,0); if( vo->dev ) vo->dev->set_power_down(1); } vo->inf = vout_inf_get_entry(mode); vo->dev = ( vo->ext_dev && (vo->ext_dev->mode == mode) )? vo->ext_dev:0; vo->inf->init(vo,0); vout_change_status(vo,VPP_VOUT_STS_ACTIVE,1); return 0; }
char *vout_get_edid(int no) { vout_t *vo; int ret; DBG_DETAIL("(%d)\n",no); if( (vo = vout_get_entry(no)) == 0 ){ return 0; } if( vo->status & VPP_VOUT_STS_EDID ){ DBG_MSG("edid exist\n"); return vo->edid; } vout_change_status(vo,VPP_VOUT_STS_EDID,0); #ifdef CONFIG_VOUT_EDID_ALLOC if( vo->edid == 0 ){ // DBG_MSG("edid buf alloc\n"); vo->edid = (char *) kmalloc(128*EDID_BLOCK_MAX,GFP_KERNEL); if( !vo->edid ){ DBG_ERR("edid buf alloc\n"); return 0; } } #endif ret = 1; if( vo->dev && vo->dev->get_edid ){ ret = vo->dev->get_edid(vo->edid); } else { if( vo->inf->get_edid ){ ret = vo->inf->get_edid(vo,(int)vo->edid); } } if( ret == 0 ){ vout_info_t *info; DBG_DETAIL("edid read\n"); vout_change_status(vo,VPP_VOUT_STS_EDID,1); if( (info = vout_get_info_entry((g_vpp.virtual_display)?1:no)) ){ info->force_config = 1; } return vo->edid; } else { DBG_ERR("read edid fail\n"); } #ifdef CONFIG_VOUT_EDID_ALLOC if( vo->edid ){ kfree(vo->edid); vo->edid = 0; } #endif return 0; }
int vout_chkplug(int no) { vout_t *vo; vout_inf_t *inf; int ret = 0; DBG_DETAIL("(%d)\n",no); if( (vo = vout_get_entry(no)) == 0 ){ return 0; } if( vo->inf == 0 ){ return 0; } if( (inf = vout_inf_get_entry(vo->inf->mode)) == 0 ){ return 0; } if( vo->dev && vo->dev->check_plugin ){ ret = vo->dev->check_plugin(0); } else { ret = inf->chkplug(vo,0); } vout_change_status(vo,VPP_VOUT_STS_PLUGIN,ret); return ret; }
static void vo_do_plug ( void *ptr /*!<; // work input data */ ) #endif { vout_t *vo; int plugin; if( vo_plug_func == 0 ) return; vo = vout_get_entry(vo_plug_vout); govrh_set_dvo_enable(vo->govr,1); plugin = vo_plug_func(1); govrh_set_dvo_enable(vo->govr,plugin); vout_change_status(vo,VPP_VOUT_STS_PLUGIN,plugin); vo_plug_flag = 0; DBG_DETAIL("vo_do_plug %d\n",plugin); vppif_reg32_write(GPIO_BASE_ADDR+0x300+VPP_VOINT_NO,0x80,7,1); // GPIO irq enable vppif_reg32_write(GPIO_BASE_ADDR+0x80,0x1<<VPP_VOINT_NO,VPP_VOINT_NO,0x0); // GPIO input mode #ifdef __KERNEL__ vpp_netlink_notify(USER_PID,DEVICE_PLUG_IN,plugin); vpp_netlink_notify(WP_PID,DEVICE_PLUG_IN,plugin); #endif return; }
int vout_set_blank(unsigned int mask,vout_blank_t arg) { int i; vout_t *vo; DBG_DETAIL("(0x%x,%d)\n",mask,arg); if( mask == 0 ) return 0; for(i=0;i<VPP_VOUT_NUM;i++){ if( (mask & (0x1 << i)) == 0 ) continue; if( (vo = vout_get_entry(i)) ){ if( vo->inf ){ vout_change_status(vo,VPP_VOUT_STS_BLANK,arg); vo->inf->blank(vo,arg); if( vo->dev && vo->dev->set_power_down ){ vo->dev->set_power_down((arg==VOUT_BLANK_POWERDOWN)?1:0); } } } } if(1){ int govr_enable_mask,govr_mask; govrh_mod_t *govr; govr_enable_mask = 0; for(i=0;i<VPP_VOUT_NUM;i++){ if( (vo = vout_get_entry(i)) ){ if( vo->govr ){ govr_mask = (vo->govr->mod == VPP_MOD_GOVRH)? 0x1:0x2; govr_enable_mask |= (vo->status & VPP_VOUT_STS_BLANK)? 0:govr_mask; } } } for(i=0;i<VPP_VOUT_INFO_NUM;i++){ govr = (i==0)? p_govrh:p_govrh2; govr_mask = 0x1 << i; govrh_set_MIF_enable(govr,(govr_enable_mask & govr_mask)? 1:0); } } return 0; }
/*! * \brief * * \retval 0 if success */ int vout_op(vout_t *vo,int cmd,int arg) { #if 0 int *addr; int (*ioctl_proc)(int arg); int ret; printf("vout_op(%d,0x%x)\n",cmd,arg); addr = (void *) vo->ops; addr += cmd; ioctl_proc = (void *) *addr; if( !ioctl_proc ){ return 0; } ret = ioctl_proc(arg); vout_change_status(vo,cmd,arg,ret); return ret; #endif return 0; } /* End of vout_op */
void sil902x_poll(void) { vout_t *vo; vo = vout_get_info(VOUT_DVO2HDMI); #ifdef SIL902X_PLUG_POLL { int plugin; if( ReadByte(0x3D) & 0x1 ){ WriteByte(0x3D,0x1); plugin = sil902x_check_plugin(1); govrh_set_dvo_enable(plugin); vout_change_status(vo,VOCTL_CHKPLUG,0,plugin); #ifdef CONFIG_WMT_CEC wmt_cec_hotplug_notify(plugin); #endif } else { plugin = (ReadByte(0x3D) & 0x04)? 1:0; } #ifdef SIL902X_CONTENT_PROTECT if( plugin ){ if ((sil902x_cp_linkProtectionLevel == (EXTENDED_LINK_PROTECTION_NONE | LOCAL_LINK_PROTECTION_NONE)) && (sil902x_cp_start == 0)){ char reg; reg = ReadByte(0x29); DBGMSG("[SIL902X] HDCP detect %d\n",(reg&0x2)); if (reg & 0x2){ // Is CP avaialable sil902x_CP_enable(1); } } } else { vo->status &= ~VPP_VOUT_STS_CONTENT_PROTECT; } #endif } #endif #ifdef SIL902X_CP_POLL { char status; vo = vout_get_info(VOUT_DVO2HDMI); if( !(vo->status & VPP_VOUT_STS_PLUGIN) ){ return; } status = ReadByte(0x3D) & 0xA0; #ifndef SIL902X_CP_POLL_LINK_STATUS status &= ~0x20; #endif #ifndef SIL902X_CP_POLL_CP_STATE status &= ~0x80; #endif switch( sil902x_CP_check_status(status) ){ case 1: // cp ok sil902x_CP_get_bksv((char *)&g_vpp.hdmi_bksv[0]); vo->status |= VPP_VOUT_STS_CONTENT_PROTECT; break; case -1: // cp fail vo->status &= ~VPP_VOUT_STS_CONTENT_PROTECT; break; default: break; } } #endif }