static s32 disp_smbl_enable(struct disp_smbl* smbl)
{
	struct disp_smbl_private_data *smblp = disp_smbl_get_priv(smbl);
	struct disp_device *dispdev = NULL;

	if((NULL == smbl) || (NULL == smblp)) {
		DE_INF("NULL hdl!\n");
		return -1;
	}
	if(smbl->manager)
		dispdev = smbl->manager->device;
	if(dispdev)
		dispdev->get_resolution(dispdev, &smblp->info.size.width,
			&smblp->info.size.height);
	if((0 == smblp->info.window.width) || (0 == smblp->info.window.height)) {
		smblp->info.window.width = smblp->info.size.width;
		smblp->info.window.height = smblp->info.size.height;
	}

	DE_INF("smbl %d enable\n", smbl->disp);
	disp_sys_lock((void *)&smblp->mlock);
	smblp->info.enable = 1;
	smblp->info.flags |= SMBL_DIRTY_ENABLE;
	disp_smbl_apply(smbl);
	disp_sys_unlock((void *)&smblp->mlock);

	return 0;
}
static s32 disp_vdevice_sw_enable(struct disp_device* vdevice)
{
	struct disp_vdevice_private_data *vdevicep = disp_vdevice_get_priv(vdevice);
	struct disp_manager *mgr = NULL;
	if((NULL == vdevice) || (NULL == vdevicep)) {
		DE_WRN("null  hdl!\n");
		return DIS_FAIL;
	}
	mgr = vdevice->manager;
	if(!mgr) {
		DE_WRN("%s%d's mgr is NULL\n", vdevice->name, vdevice->disp);
		return DIS_FAIL;
	}

	if(vdevicep->enabled == 1) {
		DE_WRN("%s%d is already enabled\n", vdevice->name, vdevice->disp);
		return DIS_FAIL;
	}

	if(vdevicep->func.get_video_timing_info == NULL) {
		DE_WRN("vdevice_get_video_timing_info func is null\n");
		return DIS_FAIL;
	}

	vdevicep->func.get_video_timing_info(&(vdevicep->video_info));

	if(vdevicep->video_info == NULL) {
		DE_WRN("video info is null\n");
		return DIS_FAIL;
	}

	if(vdevicep->func.get_interface_para == NULL) {
		DE_WRN("get_interface_para func is null\n");
		return DIS_FAIL;
	}
	vdevicep->func.get_interface_para((void*)&(vdevicep->intf));

	disp_sys_lock((void*)&vdevicep->mlock);
	memcpy(&vdevice->timings, vdevicep->video_info, sizeof(disp_video_timings));
	if(mgr->sw_enable)
		mgr->sw_enable(mgr);

	disp_sys_register_irq(vdevicep->irq_no,0,disp_vdevice_event_proc,(void*)vdevice,0,0);
	disp_sys_enable_irq(vdevicep->irq_no);

	vdevicep->enabled = 1;
	disp_sys_unlock((void*)&vdevicep->mlock);

	return 0;
}
static s32 disp_smbl_get_window(struct disp_smbl* smbl, disp_rect *window)
{
	struct disp_smbl_private_data *smblp = disp_smbl_get_priv(smbl);

	if((NULL == smbl) || (NULL == smblp)) {
		DE_INF("NULL hdl!\n");
		return -1;
	}
	disp_sys_lock((void *)&smblp->mlock);
	memcpy(window, &smblp->info.window, sizeof(disp_rect));
	disp_sys_unlock((void *)&smblp->mlock);

	return 0;
}
static s32 disp_smbl_unset_manager(struct disp_smbl* smbl)
{
	struct disp_smbl_private_data *smblp = disp_smbl_get_priv(smbl);

	if((NULL == smbl) || (NULL == smblp)) {
		DE_INF("NULL hdl!\n");
		return -1;
	}
	disp_sys_lock((void *)&smblp->mlock);
	if(smbl->manager)
		smbl->manager->smbl = NULL;
	smbl->manager = NULL;
	disp_sys_unlock((void *)&smblp->mlock);

	return 0;
}
s32 disp_smbl_force_update_regs(struct disp_smbl* smbl)
{
	struct disp_smbl_private_data *smblp = disp_smbl_get_priv(smbl);

	if((NULL == smbl) || (NULL == smblp)) {
		DE_INF("NULL hdl!\n");
		return -1;
	}
	DE_INF("disp_smbl_force_update_regs, smbl %d\n", smbl->disp);
	disp_sys_lock((void *)&smblp->mlock);
	smblp->info.flags = SMBL_DIRTY_ALL;
	disp_smbl_apply(smbl);
	disp_sys_unlock((void *)&smblp->mlock);

	return 0;
}
static s32 disp_smbl_set_manager(struct disp_smbl* smbl, struct disp_manager *mgr)
{
	struct disp_smbl_private_data *smblp = disp_smbl_get_priv(smbl);

	if((NULL == smbl) || (NULL == mgr) || (NULL == smblp)) {
		DE_INF("NULL hdl!\n");
		return -1;
	}

	DE_INF("smbl %d -> mgr %d\n", smbl->disp, mgr->disp);
	disp_sys_lock((void *)&smblp->mlock);
	smbl->manager = mgr;
	mgr->smbl = smbl;
	disp_sys_unlock((void *)&smblp->mlock);

	return 0;
}
static s32 disp_smbl_disable(struct disp_smbl* smbl)
{
	struct disp_smbl_private_data *smblp = disp_smbl_get_priv(smbl);

	if((NULL == smbl) || (NULL == smblp)) {
		DE_INF("NULL hdl!\n");
		return -1;
	}
	DE_INF("smbl %d disable\n", smbl->disp);

	disp_sys_lock((void *)&smblp->mlock);
	smblp->info.enable = 0;
	smblp->info.flags |= SMBL_DIRTY_ENABLE;
	disp_smbl_apply(smbl);
	disp_sys_unlock((void *)&smblp->mlock);

	return 0;
}
static s32 disp_vdevice_resume(struct disp_device* vdevice)
{
	struct disp_vdevice_private_data *vdevicep = disp_vdevice_get_priv(vdevice);
	DE_WRN("\n");
	if((NULL == vdevice) || (NULL == vdevicep)) {
		DE_WRN("null  hdl!\n");
		return DIS_FAIL;
	}

	disp_sys_lock((void*)&vdevicep->mlock);
	if(true == vdevicep->suspended) {
		if(vdevicep->func.resume != NULL) {
			vdevicep->func.resume();
		}
		vdevicep->suspended = false;
	}
	disp_sys_unlock((void*)&vdevicep->mlock);

	return 0;
}
static s32 disp_vdevice_enable(struct disp_device* vdevice)
{
	struct disp_vdevice_private_data *vdevicep = disp_vdevice_get_priv(vdevice);
	if((NULL == vdevice) || (NULL == vdevicep)) {
		DE_WRN("null  hdl!\n");
		return DIS_FAIL;
	}

	if(vdevicep->enabled == 1) {
		DE_WRN("%s%d is already enabled\n", vdevice->name, vdevice->disp);
		return DIS_FAIL;
	}

	disp_sys_lock((void*)&vdevicep->mlock);
	if(NULL != vdevicep->func.enable)
		vdevicep->func.enable();
	else
		DE_WRN("vdevice_enable is NULL\n");
	disp_sys_unlock((void*)&vdevicep->mlock);

	return 0;
}