Ejemplo n.º 1
0
static int Fb_pan_display(struct fb_var_screeninfo *var,struct fb_info *info)
{
	__u32 sel = 0;
	__u32 num_screens;

	num_screens = bsp_disp_feat_get_num_screens();

	//__inf("Fb_pan_display\n");

	for(sel = 0; sel < num_screens; sel++) {
		if(((sel==0) && (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1))
		    || ((sel==1) && (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0))) {
			__s32 layer_hdl = g_fbi.layer_hdl[info->node][sel];
			__disp_layer_info_t layer_para;
			__u32 buffer_num = 1;
			__u32 y_offset = 0;

			if(g_fbi.fb_mode[info->node] == FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS)	{
				if(sel != var->reserved[0])	{
					return -1;
				}
			}

			if(g_fbi.fb_mode[info->node] == FB_MODE_DUAL_SAME_SCREEN_TB) {
				buffer_num = 2;
			}
			if((sel==0) && (g_fbi.fb_mode[info->node] == FB_MODE_DUAL_SAME_SCREEN_TB)) {
				y_offset = var->yres / 2;
			}

			bsp_disp_layer_get_para(sel, layer_hdl, &layer_para);

			if(layer_para.mode == DISP_LAYER_WORK_MODE_SCALER) {
				layer_para.src_win.x = var->xoffset;
				layer_para.src_win.y = var->yoffset + y_offset;
				layer_para.src_win.width = var->xres;
				layer_para.src_win.height = var->yres / buffer_num;

				bsp_disp_layer_set_src_window(sel, layer_hdl, &(layer_para.src_win));
			}	else {
				layer_para.src_win.x = var->xoffset;
				layer_para.src_win.y = var->yoffset + y_offset;
				layer_para.src_win.width = var->xres;
				layer_para.src_win.height = var->yres / buffer_num;

				layer_para.scn_win.width = var->xres;
				layer_para.scn_win.height = var->yres / buffer_num;

				bsp_disp_layer_set_src_window(sel, layer_hdl, &(layer_para.src_win));
				bsp_disp_layer_set_screen_window(sel, layer_hdl, &(layer_para.scn_win));
			}
		}
	}

	Fb_wait_for_vsync(info);

	return 0;
}
Ejemplo n.º 2
0
static ssize_t disp_layer_mode_show(struct device *dev,
    struct device_attribute *attr, char *buf)
{
    __disp_layer_info_t para;
    int ret;

    ret = bsp_disp_layer_get_para(sel, hid, &para);
    if(0 == ret)
  {
      return sprintf(buf, "%d\n", para.mode);
    }else
    {
        return sprintf(buf, "%s\n", "not used!");
    }
}
Ejemplo n.º 3
0
static int Fb_set_par(struct fb_info *info)//todo
{
	__u32 sel = 0;
	__u32 num_screens;

	num_screens = bsp_disp_feat_get_num_screens();

	__inf("Fb_set_par\n");

	for(sel = 0; sel < num_screens; sel++) {
		if(((sel==0) && (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1))
		    || ((sel==1) && (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0))) {
			struct fb_var_screeninfo *var = &info->var;
			struct fb_fix_screeninfo * fix = &info->fix;
			__s32 layer_hdl = g_fbi.layer_hdl[info->node][sel];
			__disp_layer_info_t layer_para;
			__u32 buffer_num = 1;
			__u32 y_offset = 0;

			if(g_fbi.fb_mode[info->node] == FB_MODE_DUAL_SAME_SCREEN_TB) {
				buffer_num = 2;
			}
			if((sel==0) && (g_fbi.fb_mode[info->node] == FB_MODE_DUAL_SAME_SCREEN_TB)) {
				y_offset = var->yres / 2;
			}
			bsp_disp_layer_get_para(sel, layer_hdl, &layer_para);

			var_to_disp_fb(&(layer_para.fb), var, fix);
			layer_para.src_win.x = var->xoffset;
			layer_para.src_win.y = var->yoffset + y_offset;
			layer_para.src_win.width = var->xres;
			layer_para.src_win.height = var->yres / buffer_num;
			if(layer_para.mode != DISP_LAYER_WORK_MODE_SCALER) {
				layer_para.scn_win.width = layer_para.src_win.width;
				layer_para.scn_win.height = layer_para.src_win.height;
			}
			bsp_disp_layer_set_para(sel, layer_hdl, &layer_para);
		}
	}
	return 0;
}
Ejemplo n.º 4
0
static ssize_t disp_layer_mode_store(struct device *dev,
        struct device_attribute *attr,
        const char *buf, size_t count)
{
  int err;
    unsigned long val;
    int ret;
    __disp_layer_info_t para;

  err = strict_strtoul(buf, 10, &val);
  if (err) {
    printk("Invalid size\n");
    return err;
  }

    if((val>4))
    {
        printk("Invalid value, <5 is expected!\n");

    }else
    {
        ret = bsp_disp_layer_get_para(sel, hid, &para);
        if(0 == ret)
        {
            para.mode = (__disp_layer_work_mode_t)val;
            if(para.mode == DISP_LAYER_WORK_MODE_SCALER)
            {
                para.scn_win.width = bsp_disp_get_screen_width(sel);
                para.scn_win.height = bsp_disp_get_screen_height(sel);
            }
            bsp_disp_layer_set_para(sel, hid, &para);
        }else
        {
            printk("not used!\n");
        }
  }

  return count;
}
Ejemplo n.º 5
0
static ssize_t disp_layer_para_show(struct device *dev,
    struct device_attribute *attr, char *buf)
{
    __disp_layer_info_t layer_para;
    __s32 ret = 0;

    ret = bsp_disp_layer_get_para(sel, hid, &layer_para);
    if(ret != 0)
    {
        return sprintf(buf, "screen%d layer%d is not init\n", sel, HANDTOID(hid));
    }
    else
    {
        return sprintf(buf, "=== screen%d layer%d para ====\nmode: %d\naddr=<%x,%x,%x>\nfb.size=<%dx%d>\nfb.fmt=<%d, %d, %d>\ntrd_src=<%d, %d> trd_out=<%d, %d>\npipe:%d\tprio: %d\nalpha: <%d, %d>\tcolor_key_en: %d\nsrc_window:<%d,%d,%d,%d>\nscreen_window:<%d,%d,%d,%d>\npre_multiply=%d\n======= screen%d layer%d para ====\n",
        sel, HANDTOID(hid),layer_para.mode, layer_para.fb.addr[0], layer_para.fb.addr[1], layer_para.fb.addr[2],
        layer_para.fb.size.width, layer_para.fb.size.height, layer_para.fb.mode, layer_para.fb.format,
        layer_para.fb.seq, layer_para.fb.b_trd_src,  layer_para.fb.trd_mode,
        layer_para.b_trd_out, layer_para.out_trd_mode, layer_para.pipe,
        layer_para.prio, layer_para.alpha_en, layer_para.alpha_val,
        layer_para.ck_enable, layer_para.src_win.x, layer_para.src_win.y,
        layer_para.src_win.width, layer_para.src_win.height, layer_para.scn_win.x, layer_para.scn_win.y,
        layer_para.scn_win.width, layer_para.scn_win.height,layer_para.fb.pre_multiply, sel, HANDTOID(hid));
    }
}
Ejemplo n.º 6
0
static ssize_t disp_video_info_show(struct device *dev,
    struct device_attribute *attr, char *buf)
{
  __disp_layer_info_t layer_para;
    __disp_video_fb_t video_fb;
    __s32 ret = 0;
    __u32 i;
    __u32 cnt = 0;

    for(i=100; i<104; i++)
    {
        ret = bsp_disp_layer_get_para(sel, i, &layer_para);
        if(ret == 0)
        {
            ret = bsp_disp_video_get_fb(sel, i, &video_fb);
            if(ret == 0)
            {
                cnt += sprintf(buf+cnt, "=== screen%d layer%d para ====\nmode: %d\nfb.size=<%dx%d>\nfb.fmt=<%d, %d, %d>\ntrd_src=<%d, %d> trd_out=<%d, %d>\npipe:%d\tprio: %d\nalpha: <%d, %d>\tcolor_key_en: %d\nsrc_window:<%d,%d,%d,%d>\nscreen_window:<%d,%d,%d,%d>\npre_multiply=%d\n======= screen%d layer%d para ====\n",
                        sel, HANDTOID(i),layer_para.mode, layer_para.fb.size.width,
                        layer_para.fb.size.height, layer_para.fb.mode, layer_para.fb.format,
                        layer_para.fb.seq, layer_para.fb.b_trd_src,  layer_para.fb.trd_mode,
                        layer_para.b_trd_out, layer_para.out_trd_mode, layer_para.pipe,
                        layer_para.prio, layer_para.alpha_en, layer_para.alpha_val,
                        layer_para.ck_enable, layer_para.src_win.x, layer_para.src_win.y,
                        layer_para.src_win.width, layer_para.src_win.height, layer_para.scn_win.x, layer_para.scn_win.y,
                        layer_para.scn_win.width, layer_para.scn_win.height,layer_para.fb.pre_multiply, sel, HANDTOID(i));

                cnt += sprintf(buf+cnt, "=== video info ==\nid=%d\n%s\nmaf_valid=%d\tfre_frame_valid=%d\ttop_field_first=%d\n=== video info ===\n",
                    video_fb.id, (video_fb.interlace? "Interlace":"Progressive"), video_fb.maf_valid, video_fb.pre_frame_valid, video_fb.top_field_first);
            }
        }
    }

    return cnt;

}
Ejemplo n.º 7
0
int dispc_gralloc_queue(setup_dispc_data_t *psDispcData, int ui32DispcDataLength, void (*cb_fn)(void *, int), void *cb_arg)
{
	__disp_layer_info_t         layer_info;
	int i,disp,hdl;
	int start_idx, layer_num = 0;
	__u32 num_screens;

	num_screens = bsp_disp_feat_get_num_screens();

	bsp_disp_cmd_cache(0);
	bsp_disp_cmd_cache(1);
	for(disp = 0; disp < num_screens; disp++)	{
		if(disp == 0)	{
			start_idx = 0;
			layer_num = psDispcData->primary_display_layer_num;
		}	else {
			start_idx = psDispcData->primary_display_layer_num;
			layer_num = psDispcData->post2_layers - psDispcData->primary_display_layer_num;
		}

		for(i=0; i<4; i++) {
			hdl = 100 + i;

			bsp_disp_layer_get_para(disp, hdl, &layer_info);
			if(layer_info.mode == DISP_LAYER_WORK_MODE_SCALER) {
				if((i >= layer_num) || (psDispcData->layer_info[start_idx + i].mode == DISP_LAYER_WORK_MODE_NORMAL)) {
					bsp_disp_layer_release(disp, hdl);
					bsp_disp_layer_request(disp, DISP_LAYER_WORK_MODE_NORMAL);
				}
			}
		}
	}

	for(disp = 0; disp < num_screens; disp++) {
		int haveFbTarget = 0;

		if(disp == 0)	{
			start_idx = 0;
			layer_num = psDispcData->primary_display_layer_num;
		}	else {
			start_idx = psDispcData->primary_display_layer_num;
			layer_num = psDispcData->post2_layers - psDispcData->primary_display_layer_num;
		}

		for(i=0; i<4; i++) {
			hdl = 100 + i;

			if(i < layer_num)	{
				memcpy(&layer_info, &psDispcData->layer_info[start_idx + i], sizeof(__disp_layer_info_t));

				if(layer_info.fb.mode == DISP_MOD_NON_MB_PLANAR) {
					if(layer_info.fb.format == DISP_FORMAT_YUV420) {
						layer_info.fb.addr[2] = layer_info.fb.addr[0] + layer_info.fb.size.width * layer_info.fb.size.height;
						layer_info.fb.addr[1] = layer_info.fb.addr[2] + (layer_info.fb.size.width * layer_info.fb.size.height)/4;
					}
				}
				bsp_disp_layer_set_para(disp, hdl, &layer_info);
				bsp_disp_layer_open(disp, hdl);
				bsp_disp_layer_set_top(disp, hdl);

				if(i==1 && (psDispcData->layer_info[start_idx + 1].prio < psDispcData->layer_info[start_idx].prio))	{
					haveFbTarget = 1;
				}
			}	else {
				bsp_disp_layer_close(disp, hdl);
			}

			if(haveFbTarget) {
				bsp_disp_layer_set_top(disp, 100);
			}
		}
	}

	bsp_disp_cmd_submit(0);
	bsp_disp_cmd_submit(1);

	mutex_lock(&g_fbi.runtime_lock);
	if(g_fbi.b_no_output) {
		cb_fn(cb_arg, 1);
	}	else {
		g_fbi.cb_fn = cb_fn;
		if(g_fbi.cb_w_conut >= 9)	{
			g_fbi.cb_w_conut = 0;
		}	else {
			g_fbi.cb_w_conut++;
		}
		g_fbi.cb_arg[g_fbi.cb_w_conut] = cb_arg;
		//printk(KERN_WARNING "##w_conut:%d %x %d\n", g_fbi.cb_w_conut, (unsigned int)cb_arg, psDispcData->post2_layers);
	}

	/* have external display */
	if(psDispcData->post2_layers > psDispcData->primary_display_layer_num) {
		g_fbi.reg_active[0] = 0;
		g_fbi.reg_active[1] = 0;
	} else {
		g_fbi.reg_active[0] = 0;
		g_fbi.reg_active[1] = 1;
	}
	mutex_unlock(&g_fbi.runtime_lock);

	return 0;
}
Ejemplo n.º 8
0
static ssize_t disp_sys_status_show(struct device *dev,
    struct device_attribute *attr, char *buf)
{
  ssize_t count = 0;
	int num_screens, screen_id;
	int num_layers, layer_id;

	num_screens = bsp_disp_feat_get_num_screens();
	for(screen_id=0; screen_id < num_screens; screen_id ++) {
		count += sprintf(buf + count, "screen %d:\n", screen_id);
		/* output */
		if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_LCD) {
			count += sprintf(buf + count, "\tlcd output\tbacklight(%3d)", bsp_disp_lcd_get_bright(screen_id));
		} else if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_HDMI) {
			count += sprintf(buf + count, "\thdmi output");
			if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_720P_50HZ) {
				count += sprintf(buf + count, "%16s", "720p50hz");
			} else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_720P_60HZ) {
				count += sprintf(buf + count, "%16s", "720p60hz");
			} else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080P_60HZ) {
				count += sprintf(buf + count, "%16s", "1080p60hz");
			} else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080P_50HZ) {
				count += sprintf(buf + count, "%16s", "1080p50hz");
			} else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080I_50HZ) {
				count += sprintf(buf + count, "%16s", "1080i50hz");
			} else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080I_60HZ) {
				count += sprintf(buf + count, "%16s", "1080i60hz");
			}
		}

		if(bsp_disp_get_output_type(screen_id) != DISP_OUTPUT_TYPE_NONE) {
			count += sprintf(buf + count, "\t%4dx%4d", bsp_disp_get_screen_width(screen_id), bsp_disp_get_screen_height(screen_id));
			count += sprintf(buf + count, "\tfps(%3d.%1d)", bsp_disp_get_fps(screen_id)/10, bsp_disp_get_fps(screen_id)%10);
			count += sprintf(buf + count, "\n");
		}
		/* hdmi hpd */
		if((bsp_disp_feat_get_supported_output_types(screen_id) & DISP_OUTPUT_TYPE_HDMI)) {
			int hpd;

			hpd = bsp_disp_hdmi_get_hpd_status(screen_id);
			count += sprintf(buf + count, "\t%11s\n", hpd? "hdmi plugin":"hdmi unplug");
		}
		count += sprintf(buf + count, "    type  |  status | id | pipe | z | pre_mult |    alpha   | colorkey |  format  | framebuffer |       source crop     |          frame        |   trd   |         address\n");
		count += sprintf(buf + count, "----------+---------+----+------+---+----------+------------+----------+----------+-------------+-----------------------+-----------------------+---------+-----------------------------\n");
		num_layers = bsp_disp_feat_get_num_layers(screen_id);
		/* layer info */
		for(layer_id=0; layer_id<num_layers; layer_id++) {
			__disp_layer_info_t layer_para;
			int ret;

			ret = bsp_disp_layer_get_para(screen_id, IDTOHAND(layer_id), &layer_para);
			if(ret == 0) {
				count += sprintf(buf + count, " %8s |", (layer_para.mode == DISP_LAYER_WORK_MODE_SCALER)? "SCALER":"NORAML");
				count += sprintf(buf + count, " %7s |", bsp_disp_layer_is_open(screen_id, IDTOHAND(layer_id))?"enable":"disable");
				count += sprintf(buf + count, " %2d |", layer_id);
				count += sprintf(buf + count, " %4d |", layer_para.pipe);
				count += sprintf(buf + count, " %1d |", layer_para.prio);
				count += sprintf(buf + count, " %8s |", (layer_para.fb.pre_multiply)? "Y":"N");
				count += sprintf(buf + count, " %5s(%3d) |", (layer_para.alpha_en)? "globl":"pixel", layer_para.alpha_val);
				count += sprintf(buf + count, " %8s |", (layer_para.ck_enable)? "enable":"disable");
				count += sprintf(buf + count, " %2d,%2d,%2d |", layer_para.fb.mode, layer_para.fb.format, layer_para.fb.seq);
				count += sprintf(buf + count, " [%4d,%4d] |", layer_para.fb.size.width, layer_para.fb.size.height);
				count += sprintf(buf + count, " [%4d,%4d,%4d,%4d] |", layer_para.src_win.x, layer_para.src_win.y, layer_para.src_win.width, layer_para.src_win.height);
				count += sprintf(buf + count, " [%4d,%4d,%4d,%4d] |", layer_para.scn_win.x, layer_para.scn_win.y, layer_para.scn_win.width, layer_para.scn_win.height);
				count += sprintf(buf + count, " [%1d%1d,%1d%1d] |", layer_para.fb.b_trd_src, layer_para.fb.trd_mode, layer_para.b_trd_out, layer_para.out_trd_mode);
				count += sprintf(buf + count, " [%8x,%8x,%8x]", layer_para.fb.addr[0], layer_para.fb.addr[1], layer_para.fb.addr[2]);
				count += sprintf(buf + count, "\n");
			}
		}
		if(bsp_disp_feat_get_smart_backlight_support(screen_id)) {
			__disp_rect_t window;
			count += sprintf(buf + count, "\n\tsmart backlight: %s", bsp_disp_drc_get_enable(screen_id)? "enable":"disable");
			if(bsp_disp_drc_get_enable(screen_id)) {
				bsp_disp_drc_get_window(screen_id, &window);
				count += sprintf(buf + count, "\twindow[%4d,%4d,%4d,%4d]", window.x, window.y, window.width, window.height);
			}
			count += sprintf(buf + count, "\n");
		}
	}

	return count;
}
long disp_ioctl(void *hd, unsigned int cmd, void *arg)
{
	unsigned long karg[4];
	unsigned long ubuffer[4] = {0};
	__s32 ret = 0;

	if(!display_opens)
	{
		printf("de not open\n");
		return -1;
	}
	if (copy_from_user((void*)karg,(void __user*)arg,4*sizeof(unsigned long)))
	{
		__wrn("copy_from_user fail %d \n",__LINE__);
		return -EFAULT;
	}

	ubuffer[0] = *(unsigned long*)karg;
	ubuffer[1] = (*(unsigned long*)(karg+1));
	ubuffer[2] = (*(unsigned long*)(karg+2));
	ubuffer[3] = (*(unsigned long*)(karg+3));

    if(cmd < DISP_CMD_FB_REQUEST)
    {
        if((ubuffer[0] != 0) && (ubuffer[0] != 1))
        {
            __wrn("para err in disp_ioctl, cmd = 0x%x,screen id = %d\n", cmd, (int)ubuffer[0]);
            return -1;
        }
    }
    if(suspend_status & 2)
    {
        __wrn("ioctl:%x fail when in suspend!\n", cmd);
        return -1;
    }

#if 0
    if(cmd!=DISP_CMD_TV_GET_INTERFACE && cmd!=DISP_CMD_HDMI_GET_HPD_STATUS && cmd!=DISP_CMD_GET_OUTPUT_TYPE
    	&& cmd!=DISP_CMD_SCN_GET_WIDTH && cmd!=DISP_CMD_SCN_GET_HEIGHT
    	&& cmd!=DISP_CMD_VIDEO_SET_FB && cmd!=DISP_CMD_VIDEO_GET_FRAME_ID)
    {
        OSAL_PRINTF("cmd:0x%x,%ld,%ld\n",cmd, ubuffer[0], ubuffer[1]);
    }
#endif

    switch(cmd)
    {
    //----disp global----
    	case DISP_CMD_SET_BKCOLOR:
	    {
	        __disp_color_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_color_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
		    ret = bsp_disp_set_bk_color(ubuffer[0], &para);
		    break;
	    }

    	case DISP_CMD_SET_COLORKEY:
    	{
    	    __disp_colorkey_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_colorkey_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_set_color_key(ubuffer[0], &para);
		    break;
		}

    	case DISP_CMD_SET_PALETTE_TBL:
    	    if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
    	    {
    	        __wrn("para invalid in disp ioctrl DISP_CMD_SET_PALETTE_TBL,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
    	        return -1;
    	    }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[3]))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_set_palette_table(ubuffer[0], (__u32 *)gbuffer, ubuffer[2], ubuffer[3]);
    		break;

    	case DISP_CMD_GET_PALETTE_TBL:
    	    if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
    	    {
    	        __wrn("para invalid in disp ioctrl DISP_CMD_GET_PALETTE_TBL,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
    	        return -1;
    	    }
    		ret = bsp_disp_get_palette_table(ubuffer[0], (__u32 *)gbuffer, ubuffer[2], ubuffer[3]);
    		if(copy_to_user((void __user *)ubuffer[1], gbuffer,ubuffer[3]))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;

    	case DISP_CMD_START_CMD_CACHE:
    		ret = bsp_disp_cmd_cache(ubuffer[0]);
    		break;

    	case DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE:
    		ret = bsp_disp_cmd_submit(ubuffer[0]);
    		break;

    	case DISP_CMD_GET_OUTPUT_TYPE:
    		ret =  bsp_disp_get_output_type(ubuffer[0]);
    		break;

    	case DISP_CMD_SCN_GET_WIDTH:
    		ret = bsp_disp_get_screen_width(ubuffer[0]);
    		break;

    	case DISP_CMD_SCN_GET_HEIGHT:
    		ret = bsp_disp_get_screen_height(ubuffer[0]);
    		break;

    	case DISP_CMD_SET_GAMMA_TABLE:
    	    if((ubuffer[1] == 0) || ((int)ubuffer[2] <= 0))
    	    {
    	        __wrn("para invalid in disp ioctrl DISP_CMD_SET_GAMMA_TABLE,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[2]);
    	        return -1;
    	    }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[2]))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_set_gamma_table(ubuffer[0], (__u32 *)gbuffer, ubuffer[2]);
    		break;

    	case DISP_CMD_GAMMA_CORRECTION_ON:
    		ret = bsp_disp_gamma_correction_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_GAMMA_CORRECTION_OFF:
    		ret = bsp_disp_gamma_correction_disable(ubuffer[0]);
    		break;

        case DISP_CMD_SET_BRIGHT:
            ret = bsp_disp_cmu_set_bright(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_BRIGHT:
            ret = bsp_disp_cmu_get_bright(ubuffer[0]);
    		break;

        case DISP_CMD_SET_CONTRAST:
            ret = bsp_disp_cmu_set_contrast(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_CONTRAST:
            ret = bsp_disp_cmu_get_contrast(ubuffer[0]);
    		break;

        case DISP_CMD_SET_SATURATION:
            ret = bsp_disp_cmu_set_saturation(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_SATURATION:
            ret = bsp_disp_cmu_get_saturation(ubuffer[0]);
    		break;

        case DISP_CMD_SET_HUE:
            ret = bsp_disp_cmu_set_hue(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_HUE:
            ret = bsp_disp_cmu_get_hue(ubuffer[0]);
    		break;

        case DISP_CMD_ENHANCE_ON:
            ret = bsp_disp_cmu_enable(ubuffer[0], 1);
    		break;

        case DISP_CMD_ENHANCE_OFF:
            ret = bsp_disp_cmu_enable(ubuffer[0], 0);
    		break;

        case DISP_CMD_GET_ENHANCE_EN:
            ret = bsp_disp_cmu_get_enable(ubuffer[0]);
    		break;

        case DISP_CMD_SET_ENHANCE_MODE:
            ret = bsp_disp_cmu_set_mode(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_ENHANCE_MODE:
            ret = bsp_disp_cmu_get_mode(ubuffer[0]);
    		break;

        case DISP_CMD_SET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;

            if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
            ret = bsp_disp_cmu_set_window(ubuffer[0], &para);
    		break;
        }

        case DISP_CMD_GET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;

            ret = bsp_disp_cmu_get_window(ubuffer[0], &para);
            if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_CAPTURE_SCREEN:
    	    ret = bsp_disp_capture_screen(ubuffer[0], (__disp_capture_screen_para_t *)ubuffer[1]);
    	    break;

        case DISP_CMD_SET_SCREEN_SIZE:
            ret = bsp_disp_set_screen_size(ubuffer[0], (__disp_rectsz_t*)ubuffer[1]);
            break;

        case DISP_CMD_DE_FLICKER_ON:
            ret = bsp_disp_de_flicker_enable(ubuffer[0], 1);
            break;

        case DISP_CMD_DE_FLICKER_OFF:
            ret = bsp_disp_de_flicker_enable(ubuffer[0], 0);
            break;

        case DISP_CMD_DRC_ON:
            ret = bsp_disp_drc_enable(ubuffer[0], 1);
            break;

        case DISP_CMD_DRC_OFF:
            ret = bsp_disp_drc_enable(ubuffer[0], 0);
            break;

        case DISP_CMD_GET_DRC_EN:
            ret = bsp_disp_drc_get_enable(ubuffer[0]);
            break;

        case DISP_CMD_DRC_SET_WINDOW:
        {
            __disp_rect_t para;

            if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_rect_t)))
            {
                __wrn("copy_from_user fail\n");
                return  -EFAULT;
            }

            ret = bsp_disp_drc_set_window(ubuffer[0], &para);
            break;
       }

       case DISP_CMD_DRC_GET_WINDOW:
        {
            __disp_rect_t para;

            ret = bsp_disp_drc_get_window(ubuffer[0], &para);
            if(copy_to_user((void __user *)ubuffer[1], &para,sizeof(__disp_rect_t)))
            {
                __wrn("copy_to_user fail\n");
                return  -EFAULT;
            }

            return ret;
            break;
       }
    //----layer----
    	case DISP_CMD_LAYER_REQUEST:
    		ret = bsp_disp_layer_request(ubuffer[0], (__disp_layer_work_mode_t)ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_RELEASE:
    		ret = bsp_disp_layer_release(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_OPEN:
    		ret = bsp_disp_layer_open(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_CLOSE:
    		ret = bsp_disp_layer_close(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_SET_FB:
    	{
    	    __disp_fb_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_framebuffer(ubuffer[0], ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
    	}

    	case DISP_CMD_LAYER_GET_FB:
    	{
    	    __disp_fb_t para;

    		ret = bsp_disp_layer_get_framebuffer(ubuffer[0], ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2], &para,sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_SET_SRC_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_src_window(ubuffer[0],ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
        }

    	case DISP_CMD_LAYER_GET_SRC_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_layer_get_src_window(ubuffer[0],ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2], &para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_SET_SCN_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_screen_window(ubuffer[0],ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
        }

    	case DISP_CMD_LAYER_GET_SCN_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_layer_get_screen_window(ubuffer[0],ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2], &para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_SET_PARA:
    	{
    	    __disp_layer_info_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_para(ubuffer[0], ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
        }

    	case DISP_CMD_LAYER_GET_PARA:
    	{
    	    __disp_layer_info_t para;

    		ret = bsp_disp_layer_get_para(ubuffer[0], ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_TOP:
    		ret = bsp_disp_layer_set_top(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_BOTTOM:
    		ret = bsp_disp_layer_set_bottom(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_ALPHA_ON:
    		ret = bsp_disp_layer_alpha_enable(ubuffer[0], ubuffer[1], 1);
    		break;

    	case DISP_CMD_LAYER_ALPHA_OFF:
    		ret = bsp_disp_layer_alpha_enable(ubuffer[0], ubuffer[1], 0);
    		break;

    	case DISP_CMD_LAYER_SET_ALPHA_VALUE:
    		ret = bsp_disp_layer_set_alpha_value(ubuffer[0], ubuffer[1], ubuffer[2]);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;

    	case DISP_CMD_LAYER_CK_ON:
    		ret = bsp_disp_layer_colorkey_enable(ubuffer[0], ubuffer[1], 1);
    		break;

    	case DISP_CMD_LAYER_CK_OFF:
    		ret = bsp_disp_layer_colorkey_enable(ubuffer[0], ubuffer[1], 0);
    		break;

    	case DISP_CMD_LAYER_SET_PIPE:
    		ret = bsp_disp_layer_set_pipe(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

    	case DISP_CMD_LAYER_GET_ALPHA_VALUE:
    		ret = bsp_disp_layer_get_alpha_value(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_ALPHA_EN:
    		ret = bsp_disp_layer_get_alpha_enable(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_CK_EN:
    		ret = bsp_disp_layer_get_colorkey_enable(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_PRIO:
    		ret = bsp_disp_layer_get_piro(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_PIPE:
    		ret = bsp_disp_layer_get_pipe(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_SMOOTH:
            ret = bsp_disp_layer_set_smooth(ubuffer[0], ubuffer[1],(__disp_video_smooth_t) ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_SMOOTH:
            ret = bsp_disp_layer_get_smooth(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_BRIGHT:
            ret = bsp_disp_cmu_layer_set_bright(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_BRIGHT:
            ret = bsp_disp_cmu_layer_get_bright(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_CONTRAST:
            ret = bsp_disp_cmu_layer_set_contrast(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_CONTRAST:
            ret = bsp_disp_cmu_layer_get_contrast(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_SATURATION:
            ret = bsp_disp_cmu_layer_set_saturation(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_SATURATION:
            ret = bsp_disp_cmu_layer_get_saturation(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_HUE:
            ret = bsp_disp_cmu_layer_set_hue(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_HUE:
            ret = bsp_disp_cmu_layer_get_hue(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_ENHANCE_ON:
            ret = bsp_disp_cmu_layer_enable(ubuffer[0], ubuffer[1], 1);
    		break;

        case DISP_CMD_LAYER_ENHANCE_OFF:
            ret = bsp_disp_cmu_layer_enable(ubuffer[0], ubuffer[1], 0);
    		break;

        case DISP_CMD_LAYER_GET_ENHANCE_EN:
            ret = bsp_disp_cmu_layer_get_enable(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_ENHANCE_MODE:
            ret = bsp_disp_cmu_layer_set_mode(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_ENHANCE_MODE:
            ret = bsp_disp_cmu_layer_get_mode(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;
            if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
            ret = bsp_disp_cmu_layer_set_window(ubuffer[0], ubuffer[1], &para);
    		break;
       }

        case DISP_CMD_LAYER_GET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;
            ret = bsp_disp_cmu_layer_get_window(ubuffer[0], ubuffer[1], &para);
            if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
       }
        case DISP_CMD_LAYER_VPP_ON:
            ret = bsp_disp_deu_enable(ubuffer[0], ubuffer[1], 1);
    		break;

        case DISP_CMD_LAYER_VPP_OFF:
            ret = bsp_disp_deu_enable(ubuffer[0], ubuffer[1], 0);
    		break;

        case DISP_CMD_LAYER_GET_VPP_EN:
            ret = bsp_disp_deu_get_enable(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_LUMA_SHARP_LEVEL:
            ret = bsp_disp_deu_set_luma_sharp_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_LUMA_SHARP_LEVEL:
            ret = bsp_disp_deu_get_luma_sharp_level(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_CHROMA_SHARP_LEVEL:
            ret = bsp_disp_deu_set_chroma_sharp_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_CHROMA_SHARP_LEVEL:
            ret = bsp_disp_deu_get_chroma_sharp_level(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_WHITE_EXTEN_LEVEL:
            ret = bsp_disp_deu_set_white_exten_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_WHITE_EXTEN_LEVEL:
            ret = bsp_disp_deu_get_white_exten_level(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_BLACK_EXTEN_LEVEL:
            ret = bsp_disp_deu_set_black_exten_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_BLACK_EXTEN_LEVEL:
            ret = bsp_disp_deu_get_black_exten_level(ubuffer[0], ubuffer[1]);
    		break;
        case DISP_CMD_LAYER_VPP_SET_WINDOW:
        {
            __disp_rect_t para;

            if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
            {
                __wrn("copy_from_user fail\n");
                return  -EFAULT;
            }

            ret = bsp_disp_deu_set_window(ubuffer[0], ubuffer[1], &para);
            break;
       }

       case DISP_CMD_LAYER_VPP_GET_WINDOW:
        {
            __disp_rect_t para;

            ret = bsp_disp_deu_get_window(ubuffer[0], ubuffer[1], &para);
            if(copy_to_user((void __user *)ubuffer[2], &para,sizeof(__disp_rect_t)))
            {
                __wrn("copy_to_user fail\n");
                return  -EFAULT;
            }

            return ret;
            break;
       }

    //----scaler----
    	case DISP_CMD_SCALER_REQUEST:
    		ret = bsp_disp_scaler_request();
    		break;

    	case DISP_CMD_SCALER_RELEASE:
    		ret = bsp_disp_scaler_release(ubuffer[1]);
    		break;

    	case DISP_CMD_SCALER_EXECUTE:
    	{
    	    __disp_scaler_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_scaler_para_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_scaler_start(ubuffer[1],&para);
    		break;
        }

        case DISP_CMD_SCALER_EXECUTE_EX:
    	{
    	    __disp_scaler_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_scaler_para_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_scaler_start_ex(ubuffer[1],&para);
    		break;
        }

    //----hwc----
    	case DISP_CMD_HWC_OPEN:
    		ret =  bsp_disp_hwc_enable(ubuffer[0], 1);
    		break;

    	case DISP_CMD_HWC_CLOSE:
    		ret =  bsp_disp_hwc_enable(ubuffer[0], 0);
    		break;

    	case DISP_CMD_HWC_SET_POS:
    	{
    	    __disp_pos_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_pos_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_hwc_set_pos(ubuffer[0], &para);
    		break;
        }

    	case DISP_CMD_HWC_GET_POS:
    	{
    	    __disp_pos_t para;

    		ret = bsp_disp_hwc_get_pos(ubuffer[0], &para);
    		if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_pos_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_HWC_SET_FB:
    	{
    	    __disp_hwc_pattern_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_hwc_pattern_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_hwc_set_framebuffer(ubuffer[0], &para);
    		break;
        }

    	case DISP_CMD_HWC_SET_PALETTE_TABLE:
			if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
            {
                __wrn("para invalid in display ioctrl DISP_CMD_HWC_SET_PALETTE_TABLE,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
                return -1;
            }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[3]))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_hwc_set_palette(ubuffer[0], (void*)gbuffer, ubuffer[2], ubuffer[3]);
    		break;


    //----video----
    	case DISP_CMD_VIDEO_START:
    		ret = bsp_disp_video_start(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_VIDEO_STOP:
    		ret = bsp_disp_video_stop(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_VIDEO_SET_FB:
    	{
    	    __disp_video_fb_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_video_fb_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_video_set_fb(ubuffer[0], ubuffer[1], &para);
    		break;
        }

        case DISP_CMD_VIDEO_GET_FRAME_ID:
            ret = bsp_disp_video_get_frame_id(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_VIDEO_GET_DIT_INFO:
        {
            __disp_dit_info_t para;

            ret = bsp_disp_video_get_dit_info(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_dit_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    //----lcd----
    	case DISP_CMD_LCD_ON:
    		ret = DRV_lcd_open(ubuffer[0]);
    		output_type = DISP_OUTPUT_TYPE_LCD;
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_LCD;
            }
    		break;

    	case DISP_CMD_LCD_OFF:
    		ret = DRV_lcd_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_LCD_SET_BRIGHTNESS:
    		ret = bsp_disp_lcd_set_bright(ubuffer[0], ubuffer[1], 0);
    		break;

    	case DISP_CMD_LCD_GET_BRIGHTNESS:
    		ret = bsp_disp_lcd_get_bright(ubuffer[0]);
    		break;

//    	case DISP_CMD_LCD_CPUIF_XY_SWITCH:
// 		ret = bsp_disp_lcd_xy_switch(ubuffer[0], ubuffer[1]);
  //  		break;

    	case DISP_CMD_LCD_SET_SRC:
    		ret = bsp_disp_lcd_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

        case DISP_CMD_LCD_USER_DEFINED_FUNC:
            ret = bsp_disp_lcd_user_defined_func(ubuffer[0], ubuffer[1], ubuffer[2], ubuffer[3]);
            break;

    //----tv----
    	case DISP_CMD_TV_ON:
    		ret = bsp_disp_tv_open(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_TV;
            }
    		break;

    	case DISP_CMD_TV_OFF:
    		ret = bsp_disp_tv_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_TV_SET_MODE:
    		ret = bsp_disp_tv_set_mode(ubuffer[0], (__disp_tv_mode_t)ubuffer[1]);
    		break;

    	case DISP_CMD_TV_GET_MODE:
    		ret = bsp_disp_tv_get_mode(ubuffer[0]);
    		break;

    	case DISP_CMD_TV_AUTOCHECK_ON:
    		ret = bsp_disp_tv_auto_check_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_TV_AUTOCHECK_OFF:
    		ret = bsp_disp_tv_auto_check_disable(ubuffer[0]);
    		break;

    	case DISP_CMD_TV_GET_INTERFACE:
    	    if(suspend_status != 0)
    	    {
    	        ret = DISP_TV_NONE;
    	    }
    	    else
    	    {
    		    ret = bsp_disp_tv_get_interface(ubuffer[0]);
            }
    		break;

    	case DISP_CMD_TV_SET_SRC:
    		ret = bsp_disp_tv_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

        case DISP_CMD_TV_GET_DAC_STATUS:
            if(suspend_status != 0)
            {
                ret = 0;
            }
            else
            {
                ret =  bsp_disp_tv_get_dac_status(ubuffer[0], ubuffer[1]);
            }
            break;

        case DISP_CMD_TV_SET_DAC_SOURCE:
            ret =  bsp_disp_tv_set_dac_source(ubuffer[0], ubuffer[1], (__disp_tv_dac_source)ubuffer[2]);
            break;

        case DISP_CMD_TV_GET_DAC_SOURCE:
            ret =  bsp_disp_tv_get_dac_source(ubuffer[0], ubuffer[1]);
            break;

    //----hdmi----
    	case DISP_CMD_HDMI_ON:
    		ret = bsp_disp_hdmi_open(ubuffer[0]);
    		output_type = DISP_OUTPUT_TYPE_HDMI;
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_HDMI;
            }
    		break;

    	case DISP_CMD_HDMI_OFF:
    		ret = bsp_disp_hdmi_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_HDMI_SET_MODE:
    		ret = bsp_disp_hdmi_set_mode(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_HDMI_GET_MODE:
    		ret = bsp_disp_hdmi_get_mode(ubuffer[0]);
    		break;

    	case DISP_CMD_HDMI_GET_HPD_STATUS:
    	    if(suspend_status != 0)
    	    {
    	        ret = 0;
    	    }
    	    else
    	    {
    	        ret = bsp_disp_hdmi_get_hpd_status(ubuffer[0]);
    	    }
    		break;

    	case DISP_CMD_HDMI_SUPPORT_MODE:
    		ret = bsp_disp_hdmi_check_support_mode(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_HDMI_SET_SRC:
    		ret = bsp_disp_hdmi_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

    //----vga----
    	case DISP_CMD_VGA_ON:
    		ret = bsp_disp_vga_open(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_VGA;
            }
    		break;

    	case DISP_CMD_VGA_OFF:
    		ret = bsp_disp_vga_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_VGA_SET_MODE:
    		ret = bsp_disp_vga_set_mode(ubuffer[0], (__disp_vga_mode_t)ubuffer[1]);
    		break;

    	case DISP_CMD_VGA_GET_MODE:
    		ret = bsp_disp_vga_get_mode(ubuffer[0]);
    		break;

    	case DISP_CMD_VGA_SET_SRC:
    		ret = bsp_disp_vga_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

    //----sprite----
    /*
    	case DISP_CMD_SPRITE_OPEN:
    		ret = bsp_disp_sprite_open(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_CLOSE:
    		ret = bsp_disp_sprite_close(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_FORMAT:
    		ret = bsp_disp_sprite_set_format(ubuffer[0], (__disp_pixel_fmt_t)ubuffer[1], (__disp_pixel_seq_t)ubuffer[2]);
    		break;

    	case DISP_CMD_SPRITE_GLOBAL_ALPHA_ENABLE:
    		ret = bsp_disp_sprite_alpha_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_GLOBAL_ALPHA_DISABLE:
    		ret = bsp_disp_sprite_alpha_disable(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_ENABLE:
    		ret = bsp_disp_sprite_get_alpha_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_GLOBAL_ALPHA_VALUE:
    		ret = bsp_disp_sprite_set_alpha_vale(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_VALUE:
    		ret = bsp_disp_sprite_get_alpha_value(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_ORDER:
    		ret = bsp_disp_sprite_set_order(ubuffer[0], ubuffer[1],ubuffer[2]);
    		break;

    	case DISP_CMD_SPRITE_GET_TOP_BLOCK:
    		ret = bsp_disp_sprite_get_top_block(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_GET_BOTTOM_BLOCK:
    		ret = bsp_disp_sprite_get_bottom_block(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_PALETTE_TBL:
            if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
            {
                __wrn("para invalid in display ioctrl DISP_CMD_SPRITE_SET_PALETTE_TBL,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
                return -1;
            }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[3]))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret =  bsp_disp_sprite_set_palette_table(ubuffer[0], (__u32 * )gbuffer,ubuffer[2],ubuffer[3]);
    		break;

    	case DISP_CMD_SPRITE_GET_BLOCK_NUM:
    		ret = bsp_disp_sprite_get_block_number(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_REQUEST:
    	{
    	    __disp_sprite_block_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_sprite_block_para_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_request(ubuffer[0], &para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_RELEASE:
    		ret = bsp_disp_sprite_block_release(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_SET_SCREEN_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_screen_win(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_SCREEN_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_sprite_block_get_srceen_win(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_SET_SOURCE_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_src_win(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_SOURCE_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_sprite_block_get_src_win(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_SET_FB:
    	{
    	    __disp_fb_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_framebuffer(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_FB:
    	{
    	    __disp_fb_t para;

    		ret = bsp_disp_sprite_block_get_framebufer(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_SET_TOP:
    		ret = bsp_disp_sprite_block_set_top(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_SET_BOTTOM:
    		ret = bsp_disp_sprite_block_set_bottom(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_GET_PREV_BLOCK:
    		ret = bsp_disp_sprite_block_get_pre_block(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_GET_NEXT_BLOCK:
    		ret = bsp_disp_sprite_block_get_next_block(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_GET_PRIO:
    		ret = bsp_disp_sprite_block_get_prio(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_OPEN:
    		ret = bsp_disp_sprite_block_open(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_CLOSE:
    		ret = bsp_disp_sprite_block_close(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_SET_PARA:
    	{
    	    __disp_sprite_block_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_sprite_block_para_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_para(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_PARA:
    	{
    	    __disp_sprite_block_para_t para;

    		ret = bsp_disp_sprite_block_get_para(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_sprite_block_para_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }
        */
#ifdef __LINUX_OSAL__
	//----framebuffer----
    	case DISP_CMD_FB_REQUEST:
    	{
    	    __disp_fb_create_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_fb_create_para_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
			ret = Display_Fb_Request(ubuffer[0], &para);
			break;
        }

		case DISP_CMD_FB_RELEASE:
			ret = Display_Fb_Release(ubuffer[0]);
			break;

	    case DISP_CMD_FB_GET_PARA:
	    {
    	    __disp_fb_create_para_t para;

			ret = Display_Fb_get_para(ubuffer[0], &para);
    		if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_fb_create_para_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
			break;
        }

	    case DISP_CMD_GET_DISP_INIT_PARA:
	    {
    	    __disp_init_t para;

			ret = Display_get_disp_init_para(&para);
    		if(copy_to_user((void __user *)ubuffer[0],&para, sizeof(__disp_init_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
			break;
        }
//----for test----
		case DISP_CMD_MEM_REQUEST:
			ret =  disp_mem_request(ubuffer[0]);
			break;


		case DISP_CMD_MEM_RELASE:
			ret =  disp_mem_release(ubuffer[0]);
			break;

		case DISP_CMD_MEM_SELIDX:
			g_disp_mm_sel = ubuffer[0];
			break;

		case DISP_CMD_MEM_GETADR:
			ret = g_disp_mm[ubuffer[0]].mem_start;
			break;

		case DISP_CMD_MEM_GET_INFO:
		{
    	    __disp_mm_t para;

			ret = disp_mem_get_info(ubuffer[0], &para);
    		if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_mm_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
			break;
        }
		case DISP_CMD_SUSPEND:
		{
		    pm_message_t state;

			ret = disp_suspend(0, state);
			break;
        }

		case DISP_CMD_RESUME:
			ret = disp_resume(0);
			break;
#endif
		case DISP_CMD_SET_EXIT_MODE:
	    	ret =  g_disp_drv.exit_mode = ubuffer[0];
			break;

		case DISP_CMD_LCD_CHECK_OPEN_FINISH:
			ret = DRV_lcd_check_open_finished(ubuffer[0]);
			break;

		case DISP_CMD_LCD_CHECK_CLOSE_FINISH:
			ret = DRV_lcd_check_close_finished(ubuffer[0]);
			break;

        case DISP_CMD_PRINT_REG:
            ret = bsp_disp_print_reg(1, ubuffer[0]);
            break;

		default:
		    break;
    }

	return ret;
}