static int fimc_is_dis_video_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { int ret = 0; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_ischain *device; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); BUG_ON(!ctrl); mdbgv_dis("%s\n", vctx, __func__); device = GET_DEVICE(vctx); switch (ctrl->id) { case V4L2_CID_IS_FORCE_DONE: set_bit(FIMC_IS_GROUP_REQUEST_FSTOP, &device->group_dis.state); break; default: ret = fimc_is_video_s_ctrl(file, vctx, ctrl); if (ret) { err("fimc_is_video_s_ctrl is fail(%d)", ret); goto p_err; } break; } p_err: return ret; }
static int fimc_is_ssx_video_close(struct file *file) { int ret = 0; int refcount; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_video *video; struct fimc_is_device_sensor *device; BUG_ON(!vctx); BUG_ON(!GET_VIDEO(vctx)); BUG_ON(!GET_DEVICE(vctx)); video = GET_VIDEO(vctx); device = GET_DEVICE(vctx); ret = fimc_is_sensor_close(device); if (ret) merr("fimc_is_sensor_close is fail(%d)", device, ret); ret = fimc_is_video_close(vctx); if (ret) merr("fimc_is_video_close is fail(%d)", device, ret); refcount = close_vctx(file, video, vctx); if (refcount < 0) merr("close_vctx is fail(%d)", device, refcount); minfo("[SS%d:V] %s(%d):%d\n", device, GET_SSX_ID(video), __func__, refcount, ret); return ret; }
static int fimc_is_ixc_video_close(struct file *file) { int ret = 0; int refcount; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_video *video; struct fimc_is_device_ischain *device; BUG_ON(!file); BUG_ON(!vctx); BUG_ON(!GET_VIDEO(vctx)); BUG_ON(!GET_DEVICE(vctx)); video = GET_VIDEO(vctx); device = GET_DEVICE(vctx); ret = fimc_is_ischain_subdev_close(device, vctx); if (ret) merr("fimc_is_ischain_subdev_close is fail(%d)", device, ret); ret = fimc_is_video_close(vctx); if (ret) merr("fimc_is_video_close is fail(%d)", device, ret); refcount = close_vctx(file, video, vctx); if (refcount < 0) merr("close_vctx is fail(%d)", device, refcount); minfo("[I%dC:V] %s(%d,%d):%d\n", device, GET_IXC_ID(video), __func__, atomic_read(&device->open_cnt), refcount, ret); return ret; }
static int fimc_is_ixc_start_streaming(struct vb2_queue *vbq, unsigned int count) { int ret = 0; struct fimc_is_video_ctx *vctx = vbq->drv_priv; struct fimc_is_queue *queue; struct fimc_is_device_ischain *device; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); mdbgv_ixc("%s\n", vctx, __func__); device = GET_DEVICE(vctx); queue = GET_QUEUE(vctx); ret = fimc_is_queue_start_streaming(queue, device); if (ret) { merr("fimc_is_queue_start_streaming is fail(%d)", device, ret); goto p_err; } p_err: return ret; }
static int fimc_is_ixc_buffer_finish(struct vb2_buffer *vb) { int ret = 0; struct fimc_is_video_ctx *vctx = vb->vb2_queue->drv_priv; struct fimc_is_device_ischain *device; struct fimc_is_subdev *subdev; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); #ifdef DBG_STREAMING mdbgv_ixc("%s(%d)\n", vctx, __func__, vb->v4l2_buf.index); #endif device = GET_DEVICE(vctx); subdev = &device->ixc; ret = fimc_is_subdev_buffer_finish(subdev, vb->v4l2_buf.index); if (ret) { merr("fimc_is_subdev_buffer_finish is fail(%d)", device, ret); goto p_err; } p_err: return ret; }
static void fimc_is_ixc_buffer_queue(struct vb2_buffer *vb) { int ret = 0; struct fimc_is_video_ctx *vctx = vb->vb2_queue->drv_priv; struct fimc_is_queue *queue; struct fimc_is_video *video; struct fimc_is_device_ischain *device; struct fimc_is_subdev *subdev; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); BUG_ON(!GET_VIDEO(vctx)); #ifdef DBG_STREAMING mdbgv_ixc("%s(%d)\n", vctx, __func__, vb->v4l2_buf.index); #endif device = GET_DEVICE(vctx); video = GET_VIDEO(vctx); queue = GET_QUEUE(vctx); subdev = &device->ixc; ret = fimc_is_queue_buffer_queue(queue, video->vb2, vb); if (ret) { merr("fimc_is_queue_buffer_queue is fail(%d)", device, ret); return; } ret = fimc_is_subdev_buffer_queue(subdev, vb->v4l2_buf.index); if (ret) { merr("fimc_is_subdev_buffer_queue is fail(%d)", device, ret); return; } }
static int fimc_is_scc_video_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { int ret = 0; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_ischain *device; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); BUG_ON(!ctrl); mdbgv_scc("%s\n", vctx, __func__); device = GET_DEVICE(vctx); switch (ctrl->id) { default: ret = fimc_is_video_s_ctrl(file, vctx, ctrl); if (ret) { err("fimc_is_video_s_ctrl is fail(%d)", ret); goto p_err; } break; } p_err: return ret; }
static int fimc_is_ixc_video_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *buf) { int ret = 0; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_ischain *device; struct fimc_is_subdev *leader, *subdev; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); BUG_ON(!GET_VIDEO(vctx)); mdbgv_ixc("%s(buffers : %d)\n", vctx, __func__, buf->count); device = GET_DEVICE(vctx); subdev = &device->ixc; leader = subdev->leader; if (leader && test_bit(FIMC_IS_SUBDEV_START, &leader->state)) { err("leader%d still running, subdev%d req is not applied", leader->id, subdev->id); ret = -EINVAL; goto p_err; } ret = fimc_is_video_reqbufs(file, vctx, buf); if (ret) { merr("fimc_is_video_reqbufs is fail(%d)", device, ret); goto p_err; } p_err: return ret; }
static int fimc_is_dis_video_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { int ret = 0; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_ischain *device; struct fimc_is_queue *queue; #ifdef DBG_STREAMING mdbgv_dis("%s\n", vctx, __func__); #endif device = GET_DEVICE(vctx); queue = GET_QUEUE(vctx); if (!test_bit(FIMC_IS_QUEUE_STREAM_ON, &queue->state)) { merr("stream off state, can NOT qbuf", vctx); ret = -EINVAL; goto p_err; } ret = fimc_is_video_qbuf(file, vctx, buf); if (ret) merr("fimc_is_video_qbuf is fail(%d)", vctx, ret); p_err: return ret; }
static int fimc_is_dis_video_s_input(struct file *file, void *priv, unsigned int input) { int ret = 0; u32 stream, module, vindex, memory, leader; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_ischain *device; BUG_ON(!vctx); BUG_ON(!vctx->device); mdbgv_dis("%s(input : %08X)\n", vctx, __func__, input); device = GET_DEVICE(vctx); stream = (input & INPUT_STREAM_MASK) >> INPUT_STREAM_SHIFT; module = (input & INPUT_MODULE_MASK) >> INPUT_MODULE_SHIFT; vindex = (input & INPUT_VINDEX_MASK) >> INPUT_VINDEX_SHIFT; memory = (input & INPUT_MEMORY_MASK) >> INPUT_MEMORY_SHIFT; leader = (input & INPUT_LEADER_MASK) >> INPUT_LEADER_SHIFT; ret = fimc_is_video_s_input(file, vctx); if (ret) { merr("fimc_is_video_s_input is fail(%d)", vctx, ret); goto p_err; } ret = fimc_is_ischain_dis_s_input(device, stream, module, vindex, memory, leader); if (ret) { merr("fimc_is_ischain_isp_s_input is fail(%d)", vctx, ret); goto p_err; } p_err: return ret; }
static int vpapi_reg_read(unsigned long arg) { VpModRegOpType data; VpLineIdType line_id; unsigned char cmd; unsigned short cmd_len; unsigned char *buff_p = NULL; unsigned char ec_val[] = {0x1, 0x2}; /* Get user data */ if(copy_from_user(&data, (void*)arg, sizeof(VpModRegOpType))) { printk("%s: copy_from_user failed\n", __func__); return -EFAULT; } line_id = data.lineId; cmd = data.cmd; cmd_len = data.cmdLen; buff_p = data.buff; VpMpiCmd(GET_DEVICE(line_id), ec_val[GET_LINE(line_id)], (cmd | 1), cmd_len, buff_p); /* Copy status and event info back to user */ if(copy_to_user((void*)arg, &data, sizeof(VpModRegOpType))) { printk("%s: copy_to_user failed\n", __func__); return -EFAULT; } return 0; }
static int vpapi_set_line_state(unsigned long arg) { VpApiModSetLnStType data; VpLineIdType lineId; VpDeviceIdType deviceId; VpLineStateType state; /* Get user data */ if(copy_from_user(&data, (void*)arg, sizeof(VpApiModSetLnStType))) { printk("%s: copy_from_user failed\n", __func__); return -EFAULT; } lineId = GET_LINE(data.lineId); deviceId = GET_DEVICE(data.lineId); state = data.state; data.status = VpSetLineState(&pLineCtx[deviceId][lineId], state); /* Copy status back to user */ if(copy_to_user((void*)arg, &data, sizeof(VpApiModSetLnStType))) { printk("%s: copy_to_user failed\n", __func__); return -EFAULT; } return 0; }
static int vpapi_cal_line(unsigned long arg) { VpApiModCalLnType data; VpLineIdType lineId; VpDeviceIdType deviceId; /* Get user data */ if(copy_from_user(&data, (void*)arg, sizeof(VpApiModCalLnType))) { printk("%s: copy_from_user failed\n", __func__); return -EFAULT; } lineId = GET_LINE(data.lineId); deviceId = GET_DEVICE(data.lineId); data.status = VpCalLine(&pLineCtx[deviceId][lineId]); if(data.status == VP_STATUS_SUCCESS) { total_lines++; REGISTER_LINE(data.lineId); } /* Copy status back to user */ if(copy_to_user((void*)arg, &data, sizeof(VpApiModCalLnType))) { printk("%s: copy_to_user failed\n", __func__); return -EFAULT; } return 0; }
static int fimc_is_comp_video_s_input(struct file *file, void *priv, unsigned int input) { int ret = 0; u32 scenario; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_companion *device = NULL; BUG_ON(!vctx); mdbgv_sensor("%s(input : %08X)\n", vctx, __func__, input); device = GET_DEVICE(vctx); scenario = (input & SENSOR_SCENARIO_MASK) >> SENSOR_SCENARIO_SHIFT; input = (input & SENSOR_MODULE_MASK) >> SENSOR_MODULE_SHIFT; ret = fimc_is_companion_s_input(device, input, scenario); if (ret) { merr("fimc_is_companion_s_input is fail(%d)", device, ret); goto p_err; } p_err: return ret; }
static int vpapi_map_line_id(unsigned long arg) { VpApiModMapLnIdType data; VpLineIdType lineId; VpDeviceIdType deviceId; /* Get user data */ if(copy_from_user(&data, (void*)arg, sizeof(VpApiModMapLnIdType))) { printk("%s: copy_from_user failed\n", __func__); return -EFAULT; } lineId = GET_LINE(data.lineId); deviceId = GET_DEVICE(data.lineId); data.status = VpMapLineId(&pLineCtx[deviceId][lineId], data.lineId); /* Copy status back to user */ if(copy_to_user((void*)arg, &data, sizeof(VpApiModMapLnIdType))) { printk("%s: copy_to_user failed\n", __func__); return -EFAULT; } return 0; }
static int vpapi_make_line_object(unsigned long arg) { VpApiModMkLnObjType data; VpTermType termType; VpLineIdType lineId; VpDeviceIdType deviceId; /* Get user data */ if(copy_from_user(&data, (void*)arg, sizeof(VpApiModMkLnObjType))) { printk("%s: copy_from_user failed\n", __func__); return -EFAULT; } termType = data.termType; lineId = GET_LINE(data.lineId); deviceId = GET_DEVICE(data.lineId); data.status = VpMakeLineObject(termType, lineId, &pLineCtx[deviceId][lineId], &pLineObj[deviceId][lineId], &pDevCtx[deviceId]); /* Copy status back to user */ if(copy_to_user((void*)arg, &data, sizeof(VpApiModMkLnObjType))) { printk("%s: copy_to_user failed\n", __func__); return -EFAULT; } return 0; }
int fimc_is_video_set_format_mplane(struct file *file, struct fimc_is_video_ctx *vctx, struct v4l2_format *format) { int ret = 0; u32 condition; void *device; struct fimc_is_video *video; struct fimc_is_queue *queue; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); BUG_ON(!GET_VIDEO(vctx)); BUG_ON(!format); device = GET_DEVICE(vctx); video = GET_VIDEO(vctx); queue = GET_QUEUE(vctx); /* capture video node can skip s_input */ if (video->type == FIMC_IS_VIDEO_TYPE_LEADER) condition = BIT(FIMC_IS_VIDEO_S_INPUT) | BIT(FIMC_IS_VIDEO_S_BUFS); else condition = BIT(FIMC_IS_VIDEO_S_INPUT) | BIT(FIMC_IS_VIDEO_S_BUFS) | BIT(FIMC_IS_VIDEO_OPEN); if (!(vctx->state & condition)) { err("[V%02d] invalid s_format is requested(%lX)", video->id, vctx->state); return -EINVAL; } ret = fimc_is_queue_set_format_mplane(queue, device, format); if (ret) { err("[V%02d] fimc_is_queue_set_format_mplane is fail(%d)", video->id, ret); goto p_err; } vctx->state = BIT(FIMC_IS_VIDEO_S_FORMAT); p_err: mdbgv_vid("set_format(%d x %d)\n", queue->framecfg.width, queue->framecfg.height); return ret; }
static void fimc_is_scc_stop_streaming(struct vb2_queue *vbq) { int ret = 0; struct fimc_is_video_ctx *vctx = vbq->drv_priv; struct fimc_is_queue *queue; struct fimc_is_device_ischain *device; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); mdbgv_scc("%s\n", vctx, __func__); device = GET_DEVICE(vctx); queue = GET_QUEUE(vctx); ret = fimc_is_queue_stop_streaming(queue, device); if (ret) { merr("fimc_is_queue_stop_streaming is fail(%d)", device, ret); return; } }
static int fimc_is_ssx_video_s_input(struct file *file, void *priv, unsigned int input) { int ret = 0; u32 scenario; #if defined(CONFIG_CAMERA_SUPPORT_PDAF) u32 pdaf_on; #endif struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_sensor *device; struct fimc_is_framemgr *framemgr; BUG_ON(!vctx); mdbgv_sensor("%s(input : %08X)\n", vctx, __func__, input); device = GET_DEVICE(vctx); framemgr = GET_FRAMEMGR(vctx); scenario = (input & SENSOR_SCENARIO_MASK) >> SENSOR_SCENARIO_SHIFT; #if defined(CONFIG_CAMERA_SUPPORT_PDAF) pdaf_on = (input & SENSOR_PDAFON_MASK) >> SENSOR_PDAFON_SHIFT; #endif input = (input & SENSOR_MODULE_MASK) >> SENSOR_MODULE_SHIFT; #if defined(CONFIG_CAMERA_SUPPORT_PDAF) device->pdaf_on = pdaf_on; #endif ret = fimc_is_video_s_input(file, vctx); if (ret) { merr("fimc_is_video_s_input is fail(%d)", vctx, ret); goto p_err; } ret = fimc_is_sensor_s_input(device, input, scenario); if (ret) { merr("fimc_is_sensor_s_input is fail(%d)", device, ret); goto p_err; } p_err: return ret; }
acl_tx_complete(void* cookie, status_t status, void* data, size_t actual_len) #endif { net_buffer* nbuf = (net_buffer*)cookie; bt_usb_dev* bdev = GET_DEVICE(nbuf); debugf("fetched=%p status=%ld type %lx %p\n", bdev, status, nbuf->type, data); if (status == B_OK) { bdev->stat.successfulTX++; bdev->stat.bytesTX += actual_len; } else { bdev->stat.errorTX++; // the packet has been lost, too late to requeue it } nb_destroy(nbuf); #ifdef BT_RESCHEDULING_AFTER_COMPLETITIONS schedTxProcessing(bdev); #endif }
int fimc_is_user_ioctl_handler(struct file *file, unsigned int cmd, unsigned long arg, void __user *p) { int ret = 0; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_sensor *device; BUG_ON(!vctx); device = GET_DEVICE(vctx); switch (cmd) { case SENSOR_IOCTL_GETDATAS: /* Get PD data */ { if(device->subdev_statflite) { ret = fimc_is_statdata_copy_to_user(device->subdev_statflite,p); } } break; default: return -EINVAL; } return ret; }
static int vpapi_free_line_context(unsigned long arg) { VpApiModFreeLnCtxType data; VpLineIdType lineId; VpDeviceIdType deviceId; /* Get user data */ if(copy_from_user(&data, (void*)arg, sizeof(VpApiModFreeLnCtxType))) { printk("%s: copy_from_user failed\n", __func__); return -EFAULT; } lineId = GET_LINE(data.lineId); deviceId = GET_DEVICE(data.lineId); data.status = VpFreeLineCtx(&pLineCtx[deviceId][lineId]); if(data.status == VP_STATUS_SUCCESS) { vpapi_line_status[data.lineId] = 0; total_lines--; #if defined(SLIC_TIMER_EVENT_SUPPORT) if(total_lines == 0) { atomic_set(&vpapi_init, 0); del_timer(&vpapi_timer); } #endif } /* Copy status back to user */ if(copy_to_user((void*)arg, &data, sizeof(VpApiModFreeLnCtxType))) { printk("%s: copy_to_user failed\n", __func__); return -EFAULT; } return 0; }
bool UIDirect3D9Window::HandleAppCommand(MSG *Message, long *Result) { if (!Message || !Result) return false; static const QString keycontext = "HID Keyboard"; static const QString mousecontext = "HID Mouse"; static const QString remotecontext = "HID Remote"; short command = GET_APPCOMMAND(Message->lParam); WORD device = GET_DEVICE(Message->lParam); QString context = device == WM_APPCOMMAND_KEY ? keycontext : device == WM_APPCOMMAND_OEM ? remotecontext : device == WM_APPCOMMAND_MOUSE ? mousecontext : QString(); if (command < 0 || command > WM_APPCOMMAND_MAX || context.isEmpty()) { LOG(VB_GENERAL, LOG_WARNING, QString("Unrecognised APPCOMMAND %1 (device %2)") .arg(command).arg(context)); return false; } int key = 0; switch (command) { // filter out commands that will also trigger a regular keypress case WM_APPCOMMAND_VOLUME_MUTE: case WM_APPCOMMAND_VOLUME_DOWN: case WM_APPCOMMAND_VOLUME_UP: LOG(VB_GENERAL, LOG_INFO, QString("Ignoring WM_APPCOMMAND: %1 device: %2").arg(command).arg(context)); break; // and allow the rest case WM_APPCOMMAND_BROWSER_BACKWARD: key = Qt::Key_Back; break; case WM_APPCOMMAND_BROWSER_FORWARD: key = Qt::Key_Forward; break; case WM_APPCOMMAND_BROWSER_REFRESH: key = Qt::Key_Refresh; break; case WM_APPCOMMAND_BROWSER_STOP: key = Qt::Key_Stop; break; case WM_APPCOMMAND_BROWSER_SEARCH: key = Qt::Key_Search; break; case WM_APPCOMMAND_BROWSER_FAVORITES: key = Qt::Key_Favorites; break; case WM_APPCOMMAND_BROWSER_HOME: key = Qt::Key_HomePage; break; case WM_APPCOMMAND_MEDIA_NEXTTRACK: key = Qt::Key_MediaNext; break; case WM_APPCOMMAND_MEDIA_PREVIOUSTRACK: key = Qt::Key_MediaPrevious; break; case WM_APPCOMMAND_MEDIA_STOP: key = Qt::Key_MediaStop; break; case WM_APPCOMMAND_MEDIA_PLAY_PAUSE: key = Qt::Key_MediaTogglePlayPause; break; case WM_APPCOMMAND_LAUNCH_MEDIA_SELECT: key = Qt::Key_LaunchMedia; break; case WM_APPCOMMAND_LAUNCH_APP1: key = Qt::Key_Launch0; break; case WM_APPCOMMAND_LAUNCH_APP2: key = Qt::Key_Launch1; break; case WM_APPCOMMAND_BASS_DOWN: key = Qt::Key_BassDown; break; case WM_APPCOMMAND_BASS_BOOST: key = Qt::Key_BassBoost; break; case WM_APPCOMMAND_BASS_UP: key = Qt::Key_BassUp; break; case WM_APPCOMMAND_TREBLE_DOWN: key = Qt::Key_TrebleDown; break; case WM_APPCOMMAND_TREBLE_UP: key = Qt::Key_TrebleUp; break; case WM_APPCOMMAND_MICROPHONE_VOLUME_MUTE: key = Qt::Key_Launch2; break; case WM_APPCOMMAND_MICROPHONE_VOLUME_DOWN: key = Qt::Key_Launch3; break; case WM_APPCOMMAND_MICROPHONE_VOLUME_UP: key = Qt::Key_Launch4; break; case WM_APPCOMMAND_HELP: key = Qt::Key_Help; break; case WM_APPCOMMAND_FIND: key = Qt::Key_F; break; case WM_APPCOMMAND_NEW: key = Qt::Key_N; break; case WM_APPCOMMAND_OPEN: key = Qt::Key_O; break; case WM_APPCOMMAND_CLOSE: key = Qt::Key_Close; break; case WM_APPCOMMAND_SAVE: key = Qt::Key_Save; break; case WM_APPCOMMAND_PRINT: key = Qt::Key_Print; break; case WM_APPCOMMAND_UNDO: key = Qt::Key_Context1; break; case WM_APPCOMMAND_REDO: key = Qt::Key_Context2; break; case WM_APPCOMMAND_COPY: key = Qt::Key_Copy; break; case WM_APPCOMMAND_CUT: key = Qt::Key_Cut; break; case WM_APPCOMMAND_PASTE: key = Qt::Key_Paste; break; case WM_APPCOMMAND_REPLY_TO_MAIL: key = Qt::Key_Reply; break; case WM_APPCOMMAND_FORWARD_MAIL: key = Qt::Key_MailForward; break; case WM_APPCOMMAND_SEND_MAIL: key = Qt::Key_Send; break; case WM_APPCOMMAND_SPELL_CHECK: key = Qt::Key_Spell; break; case WM_APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: key = Qt::Key_Context3; break; case WM_APPCOMMAND_MIC_ON_OFF_TOGGLE: key = Qt::Key_WebCam; break; case WM_APPCOMMAND_CORRECTION_LIST: key = Qt::Key_ToDoList; break; case WM_APPCOMMAND_MEDIA_PLAY: key = Qt::Key_MediaPlay; break; case WM_APPCOMMAND_MEDIA_PAUSE: key = Qt::Key_MediaPause; break; case WM_APPCOMMAND_MEDIA_RECORD: key = Qt::Key_MediaRecord; break; case WM_APPCOMMAND_MEDIA_FAST_FORWARD: key = Qt::Key_F22; break; // see TorcCECDevice for consistency case WM_APPCOMMAND_MEDIA_REWIND: key = Qt::Key_F23; break; case WM_APPCOMMAND_MEDIA_CHANNEL_UP: key = Qt::Key_F21; break; case WM_APPCOMMAND_MEDIA_CHANNEL_DOWN: key = Qt::Key_F20; break; } if (key) { QKeyEvent *keyevent = new QKeyEvent(QEvent::KeyPress, key, TORC_KEYEVENT_MODIFIERS, context); if (gLocalContext->GetUIObject()) QApplication::postEvent(gLocalContext->GetUIObject(), keyevent); LOG(VB_GENERAL, LOG_DEBUG, QString("APPCOMMAND: %1 device: %2").arg(command).arg(context)); *Result = TRUE; return true; } return false; }
int fimc_is_video_s_ctrl(struct file *file, struct fimc_is_video_ctx *vctx, struct v4l2_control *ctrl) { int ret = 0; /* hack for 64bit addr */ ulong value_to_addr = 0; struct fimc_is_video *video; struct fimc_is_device_ischain *device; struct fimc_is_resourcemgr *resourcemgr; BUG_ON(!vctx); BUG_ON(!GET_DEVICE(vctx)); BUG_ON(!GET_VIDEO(vctx)); BUG_ON(!ctrl); device = GET_DEVICE(vctx); video = GET_VIDEO(vctx); resourcemgr = device->resourcemgr; switch (ctrl->id) { case V4L2_CID_IS_END_OF_STREAM: ret = fimc_is_ischain_open_wrap(device, true); if (ret) { merr("fimc_is_ischain_open_wrap is fail(%d)", device, ret); goto p_err; } break; case V4L2_CID_IS_SET_SETFILE: if (test_bit(FIMC_IS_ISCHAIN_START, &device->state)) { merr("device is already started, setfile applying is fail", device); ret = -EINVAL; goto p_err; } device->setfile = ctrl->value; break; case V4L2_CID_IS_HAL_VERSION: if (ctrl->value < 0 || ctrl->value >= IS_HAL_VER_MAX) { merr("hal version(%d) is invalid", device, ctrl->value); ret = -EINVAL; goto p_err; } resourcemgr->hal_version = ctrl->value; break; case V4L2_CID_IS_DEBUG_DUMP: info("Print fimc-is info dump by HAL"); fimc_is_hw_logdump(device->interface); fimc_is_hw_regdump(device->interface); CALL_POPS(device, print_clk); if (ctrl->value) panic("intentional panic from camera HAL"); break; case V4L2_CID_IS_DVFS_CLUSTER0: case V4L2_CID_IS_DVFS_CLUSTER1: fimc_is_resource_ioctl(resourcemgr, ctrl); break; case V4L2_CID_IS_DEBUG_SYNC_LOG: fimc_is_logsync(device->interface, ctrl->value, IS_MSG_TEST_SYNC_LOG); break; case V4L2_CID_IS_MAP_BUFFER: { struct fimc_is_queue *queue; struct fimc_is_framemgr *framemgr; struct fimc_is_frame *frame; struct dma_buf *dmabuf; struct dma_buf_attachment *attachment; dma_addr_t dva; struct v4l2_buffer *buf; struct v4l2_plane *planes; size_t size; u32 plane, group_id; size = sizeof(struct v4l2_buffer); buf = kmalloc(size, GFP_KERNEL); if (!buf) { mverr("kmalloc is fail(%p)", device, video, buf); ret = -EINVAL; goto p_err; } /* hack for 64bit addr */ value_to_addr = ctrl->value; ret = copy_from_user(buf, (void __user *)value_to_addr, size); if (ret) { mverr("copy_from_user is fail(%d)", device, video, ret); kfree(buf); ret = -EINVAL; goto p_err; } if (!V4L2_TYPE_IS_OUTPUT(buf->type)) { mverr("capture video type is not supported", device, video); kfree(buf); ret = -EINVAL; goto p_err; } if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) { mverr("single plane is not supported", device, video); kfree(buf); ret = -EINVAL; goto p_err; } if (buf->index >= FRAMEMGR_MAX_REQUEST) { mverr("buffer index is invalid(%d)", device, video, buf->index); kfree(buf); ret = -EINVAL; goto p_err; } if (buf->length > VIDEO_MAX_PLANES) { mverr("planes[%d] is invalid", device, video, buf->length); kfree(buf); ret = -EINVAL; goto p_err; } queue = GET_QUEUE(vctx); if (queue->vbq->memory != V4L2_MEMORY_DMABUF) { mverr("memory type(%d) is not supported", device, video, queue->vbq->memory); kfree(buf); ret = -EINVAL; goto p_err; } size = sizeof(struct v4l2_plane) * buf->length; planes = kmalloc(size, GFP_KERNEL); if (!planes) { mverr("kmalloc is fail(%p)", device, video, planes); kfree(buf); ret = -EINVAL; goto p_err; } ret = copy_from_user(planes, (void __user *)buf->m.planes, size); if (ret) { mverr("copy_from_user is fail(%d)", device, video, ret); kfree(planes); kfree(buf); ret = -EINVAL; goto p_err; } framemgr = &queue->framemgr; frame = &framemgr->frame[buf->index]; if (test_bit(FRAME_MAP_MEM, &frame->memory)) { mverr("this buffer(%d) is already mapped", device, video, buf->index); kfree(planes); kfree(buf); ret = -EINVAL; goto p_err; } /* only last buffer need to map */ if (buf->length <= 1) { mverr("this buffer(%d) have no meta plane", device, video, buf->length); kfree(planes); kfree(buf); ret = -EINVAL; goto p_err; } plane = buf->length - 1; dmabuf = dma_buf_get(planes[plane].m.fd); if (IS_ERR(dmabuf)) { mverr("dma_buf_get is fail(%p)", device, video, dmabuf); kfree(planes); kfree(buf); ret = -EINVAL; goto p_err; } attachment = dma_buf_attach(dmabuf, &device->pdev->dev); if (IS_ERR(attachment)) { mverr("dma_buf_attach is fail(%p)", device, video, attachment); kfree(planes); kfree(buf); dma_buf_put(dmabuf); ret = -EINVAL; goto p_err; } /* only support output(read) video node */ dva = ion_iovmm_map(attachment, 0, dmabuf->size, 0, plane); if (IS_ERR_VALUE(dva)) { mverr("ion_iovmm_map is fail(%pa)", device, video, &dva); kfree(planes); kfree(buf); dma_buf_detach(dmabuf, attachment); dma_buf_put(dmabuf); ret = -EINVAL; goto p_err; } group_id = GROUP_ID(device->group_3aa.id); ret = fimc_is_itf_map(device, group_id, dva, dmabuf->size); if (ret) { mverr("fimc_is_itf_map is fail(%d)", device, video, ret); kfree(planes); kfree(buf); dma_buf_detach(dmabuf, attachment); dma_buf_put(dmabuf); goto p_err; } mvinfo(" B%d.P%d MAP\n", device, video, buf->index, plane); set_bit(FRAME_MAP_MEM, &frame->memory); dma_buf_detach(dmabuf, attachment); dma_buf_put(dmabuf); kfree(planes); kfree(buf); } break; default: err("unsupported ioctl(0x%X)", ctrl->id); ret = -EINVAL; break; } p_err: return ret; }
int fimc_is_video_reqbufs(struct file *file, struct fimc_is_video_ctx *vctx, struct v4l2_requestbuffers *request) { int ret = 0; struct fimc_is_queue *queue; struct fimc_is_framemgr *framemgr; BUG_ON(!vctx); BUG_ON(!request); if (!(vctx->state & (BIT(FIMC_IS_VIDEO_S_FORMAT) | BIT(FIMC_IS_VIDEO_STOP) | BIT(FIMC_IS_VIDEO_S_BUFS)))) { err("[V%02d] invalid reqbufs is requested(%lX)", vctx->video->id, vctx->state); return -EINVAL; } queue = GET_QUEUE(vctx); if (test_bit(FIMC_IS_QUEUE_STREAM_ON, &queue->state)) { err("video is stream on, not applied"); ret = -EINVAL; goto p_err; } ret = CALL_QOPS(queue, request_bufs, GET_DEVICE(vctx), request->count); if (ret) { err("request_bufs is fail(%d)", ret); goto p_err; } ret = vb2_reqbufs(queue->vbq, request); if (ret) { err("vb2_reqbufs is fail(%d)", ret); goto p_err; } framemgr = &queue->framemgr; queue->buf_maxcount = request->count; if (queue->buf_maxcount == 0) { queue->buf_req = 0; queue->buf_pre = 0; queue->buf_que = 0; queue->buf_com = 0; queue->buf_dqe = 0; queue->buf_refcount = 0; clear_bit(FIMC_IS_QUEUE_BUFFER_READY, &queue->state); clear_bit(FIMC_IS_QUEUE_BUFFER_PREPARED, &queue->state); fimc_is_frame_close(framemgr); } else { if (queue->buf_maxcount < queue->buf_rdycount) { err("buffer count is not invalid(%d < %d)", queue->buf_maxcount, queue->buf_rdycount); ret = -EINVAL; goto p_err; } ret = fimc_is_frame_open(framemgr, queue->buf_maxcount); if (ret) { err("[V%02d] fimc_is_frame_open is fail(%d)", vctx->video->id, ret); goto p_err; } } vctx->state = BIT(FIMC_IS_VIDEO_S_BUFS); p_err: return ret; }