static int Fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { long ret = 0; int secure_id_buf_num = 0; unsigned long layer_hdl = 0; switch (cmd) { case FBIOGET_LAYER_HDL_0: if (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1) { layer_hdl = g_fbi.layer_hdl[info->node][0]; ret = copy_to_user((void __user *)arg, &layer_hdl, sizeof(unsigned long)); } else { ret = -1; } break; case FBIOGET_LAYER_HDL_1: if (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0) { layer_hdl = g_fbi.layer_hdl[info->node][1]; ret = copy_to_user((void __user *)arg, &layer_hdl, sizeof(unsigned long)); } else { ret = -1; } break; #if 0 case FBIOGET_VBLANK: { struct fb_vblank vblank; __disp_tcon_timing_t tt; __u32 line = 0; __u32 sel; sel = (g_fbi.fb_mode[info->node] == FB_MODE_SCREEN1) ? 1 : 0; line = BSP_disp_get_cur_line(sel); BSP_disp_get_timing(sel, &tt); memset(&vblank, 0, sizeof(struct fb_vblank)); vblank.flags |= FB_VBLANK_HAVE_VBLANK; vblank.flags |= FB_VBLANK_HAVE_VSYNC; if (line <= (tt.ver_total_time - tt.ver_pixels)) vblank.flags |= FB_VBLANK_VBLANKING; if ((line > tt.ver_front_porch) && (line < (tt.ver_front_porch + tt.ver_sync_time))) vblank.flags |= FB_VBLANK_VSYNCING; if (copy_to_user((void __user *)arg, &vblank, sizeof(struct fb_vblank))) ret = -EFAULT; break; } #endif case FBIO_WAITFORVSYNC: { ret = Fb_wait_for_vsync(info); break; } #ifdef CONFIG_FB_SUNXI_UMP case GET_UMP_SECURE_ID_BUF2: /* flow trough */ secure_id_buf_num = 1; case GET_UMP_SECURE_ID_BUF1: { if (!disp_get_ump_secure_id) request_module("disp_ump"); if (disp_get_ump_secure_id) return disp_get_ump_secure_id(info, &g_fbi, arg, secure_id_buf_num); else return -ENOTSUPP; } #endif default: //__inf("not supported fb io cmd:%x\n", cmd); break; } return ret; }
static int Fb_ioctl(struct fb_info *info, unsigned int cmd,unsigned long arg) { long ret = 0; unsigned long layer_hdl = 0; #ifdef CONFIG_LYCHEE_FB_UMP_SUN4I u32 __user *psecureid = (u32 __user *) arg; ump_secure_id secure_id; #endif switch (cmd) { case FBIOGET_LAYER_HDL_0: if(g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1) { layer_hdl = g_fbi.layer_hdl[info->node][0]; ret = copy_to_user((void __user *)arg, &layer_hdl, sizeof(unsigned long)); } else { ret = -1; } break; case FBIOGET_LAYER_HDL_1: if(g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0) { layer_hdl = g_fbi.layer_hdl[info->node][1]; ret = copy_to_user((void __user *)arg, &layer_hdl, sizeof(unsigned long)); } else { ret = -1; } break; #if 0 case FBIOGET_VBLANK: { struct fb_vblank vblank; __disp_tcon_timing_t tt; __u32 line = 0; __u32 sel; sel = (g_fbi.fb_mode[info->node] == FB_MODE_SCREEN1)?1:0; line = BSP_disp_get_cur_line(sel); BSP_disp_get_timming(sel, &tt); memset(&vblank, 0, sizeof(struct fb_vblank)); vblank.flags |= FB_VBLANK_HAVE_VBLANK; vblank.flags |= FB_VBLANK_HAVE_VSYNC; if(line <= (tt.ver_total_time-tt.ver_pixels)) { vblank.flags |= FB_VBLANK_VBLANKING; } if((line > tt.ver_front_porch) && (line < (tt.ver_front_porch+tt.ver_sync_time))) { vblank.flags |= FB_VBLANK_VSYNCING; } if (copy_to_user((void __user *)arg, &vblank, sizeof(struct fb_vblank))) ret = -EFAULT; break; } #endif case FBIO_WAITFORVSYNC: { ret = Fb_wait_for_vsync(info); break; } #ifdef CONFIG_LYCHEE_FB_UMP_SUN4I case GET_UMP_SECURE_ID: { secure_id = ump_dd_secure_id_get( ump_wrapped_buffer ); return put_user( (unsigned int)secure_id, psecureid ); break; } #endif default: //__inf("not supported fb io cmd:%x\n", cmd); break; } return ret; }