int msm_mctl_pp_reserve_free_frame( struct msm_cam_media_controller *p_mctl, void __user *arg) { struct msm_cam_evt_divert_frame frame; int msg_type, image_mode, rc = 0; struct msm_free_buf free_buf; int idx; struct msm_cam_v4l2_dev_inst *pcam_inst; memset(&free_buf, 0, sizeof(struct msm_free_buf)); if (copy_from_user(&frame, arg, sizeof(struct msm_cam_evt_divert_frame))) return -EFAULT; switch (frame.frame.path) { case OUTPUT_TYPE_P: msg_type = VFE_MSG_OUTPUT_P; image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW; break; case OUTPUT_TYPE_S: msg_type = VFE_MSG_OUTPUT_S; image_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN; break; case OUTPUT_TYPE_V: msg_type = VFE_MSG_OUTPUT_V; image_mode = MSM_V4L2_EXT_CAPTURE_MODE_VIDEO; break; case OUTPUT_TYPE_T: default: rc = -EFAULT; return rc; } idx = msm_mctl_out_type_to_inst_index( p_mctl->sync.pcam_sync, msg_type); if (idx < 0) { pr_err("%s Invalid instance. returning\n", __func__); return -EINVAL; } pcam_inst = p_mctl->sync.pcam_sync->dev_inst[idx]; rc = msm_mctl_reserve_free_buf(p_mctl, msg_type, &free_buf); if (rc == 0) { msm_mctl_pp_get_phy_addr(pcam_inst, free_buf.vb, &frame.frame); if (copy_to_user((void *)arg, &frame, sizeof(frame))) { ERR_COPY_TO_USER(); rc = -EFAULT; } } D("%s: reserve free buf, rc = %d, phy = 0x%x", __func__, rc, free_buf.ch_paddr[0]); return rc; }
int msm_mctl_pp_reserve_free_frame( struct msm_cam_media_controller *p_mctl, void __user *arg) { struct msm_cam_evt_divert_frame frame; int msg_type, image_mode, rc = 0; struct msm_free_buf free_buf; memset(&free_buf, 0, sizeof(struct msm_free_buf)); if (copy_from_user(&frame, arg, sizeof(struct msm_cam_evt_divert_frame))) return -EFAULT; switch (frame.frame.path) { case OUTPUT_TYPE_P: msg_type = VFE_MSG_OUTPUT_P; image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW; break; case OUTPUT_TYPE_S: msg_type = VFE_MSG_OUTPUT_S; image_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN; break; case OUTPUT_TYPE_V: msg_type = VFE_MSG_OUTPUT_V; image_mode = MSM_V4L2_EXT_CAPTURE_MODE_VIDEO; break; case OUTPUT_TYPE_T: default: rc = -EFAULT; return rc; } rc = msm_mctl_reserve_free_buf(p_mctl, msg_type, &free_buf); if (rc == 0) { frame.frame.sp.phy_addr = free_buf.ch_paddr[0]; frame.frame.handle = free_buf.vb; if (copy_to_user((void *)arg, &frame, sizeof(frame))) { ERR_COPY_TO_USER(); rc = -EFAULT; } } D("%s: reserve free buf, rc = %d, phy = 0x%x", __func__, rc, free_buf.ch_paddr[0]); return rc; }
static int msm_isp_notify_VFE_BUF_EVT(struct v4l2_subdev *sd, void *arg) { int rc = -EINVAL; struct msm_vfe_resp *vdata = (struct msm_vfe_resp *)arg; struct msm_free_buf free_buf, temp_free_buf; struct msm_camvfe_params vfe_params; struct msm_vfe_cfg_cmd cfgcmd; struct msm_cam_media_controller *pmctl = (struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd); struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr; struct msm_frame_info *frame_info = (struct msm_frame_info *)vdata->evt_msg.data; uint32_t vfe_id; struct msm_cam_buf_handle buf_handle; if (!pcam) { pr_debug("%s pcam is null. return\n", __func__); msm_isp_sync_free(vdata); return rc; } if (frame_info) { vfe_id = frame_info->path; buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE; buf_handle.inst_handle = frame_info->inst_handle; } else { vfe_id = vdata->evt_msg.msg_id; buf_handle.buf_lookup_type = BUF_LOOKUP_BY_IMG_MODE; buf_handle.image_mode = msm_isp_vfe_msg_to_img_mode(pmctl, vfe_id); } switch (vdata->type) { case VFE_MSG_START: case VFE_MSG_START_RECORDING: case VFE_MSG_PREVIEW: D("%s Got V32_START_*: Getting ping addr id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(pmctl, NULL, &buf_handle, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); msm_mctl_reserve_free_buf(pmctl, NULL, &buf_handle, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_CAPTURE: pr_debug("%s Got V32_CAPTURE: getting buffer for id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(pmctl, NULL, &buf_handle, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); temp_free_buf = free_buf; if (msm_mctl_reserve_free_buf(pmctl, NULL, &buf_handle, &free_buf)) { /* Write the same buffer into PONG */ free_buf = temp_free_buf; } cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_JPEG_CAPTURE: D("%s:VFE_MSG_JPEG_CAPTURE vdata->type %d\n", __func__, vdata->type); free_buf.num_planes = 2; free_buf.ch_paddr[0] = pmctl->ping_imem_y; free_buf.ch_paddr[1] = pmctl->ping_imem_cbcr; cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; D("%s:VFE_MSG_JPEG_CAPTURE y_ping=%x cbcr_ping=%x\n", __func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]); rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); /* Write the same buffer into PONG */ free_buf.ch_paddr[0] = pmctl->pong_imem_y; free_buf.ch_paddr[1] = pmctl->pong_imem_cbcr; cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; D("%s:VFE_MSG_JPEG_CAPTURE y_pong=%x cbcr_pong=%x\n", __func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]); rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_OUTPUT_IRQ: D("%s Got OUTPUT_IRQ: Getting free buf id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(pmctl, NULL, &buf_handle, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_FREE_BUF_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; default: pr_err("%s: Invalid vdata type: %d\n", __func__, vdata->type); break; } return rc; }
static int msm_isp_notify_VFE_BUF_EVT(struct v4l2_subdev *sd, void *arg) { int rc = -EINVAL, image_mode; struct msm_vfe_resp *vdata = (struct msm_vfe_resp *)arg; struct msm_free_buf free_buf, temp_free_buf; struct msm_camvfe_params vfe_params; struct msm_vfe_cfg_cmd cfgcmd; struct msm_cam_media_controller *pmctl = (struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd); struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr; int vfe_id = vdata->evt_msg.msg_id; if (!pcam) { pr_debug("%s pcam is null. return\n", __func__); msm_isp_sync_free(vdata); return rc; } image_mode = msm_isp_vfe_msg_to_img_mode(pmctl, vfe_id); BUG_ON(image_mode < 0); switch (vdata->type) { case VFE_MSG_V32_START: case VFE_MSG_V32_START_RECORDING: case VFE_MSG_V2X_PREVIEW: D("%s Got V32_START_*: Getting ping addr id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(pmctl, NULL, image_mode, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); msm_mctl_reserve_free_buf(pmctl, NULL, image_mode, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_V32_CAPTURE: case VFE_MSG_V2X_CAPTURE: pr_debug("%s Got V32_CAPTURE: getting buffer for id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(pmctl, NULL, image_mode, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); temp_free_buf = free_buf; if (msm_mctl_reserve_free_buf(pmctl, NULL, image_mode, &free_buf)) { free_buf = temp_free_buf; } cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_V32_JPEG_CAPTURE: D("%s:VFE_MSG_V32_JPEG_CAPTURE vdata->type %d\n", __func__, vdata->type); free_buf.num_planes = 2; free_buf.ch_paddr[0] = pmctl->ping_imem_y; free_buf.ch_paddr[1] = pmctl->ping_imem_cbcr; cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; D("%s:VFE_MSG_V32_JPEG_CAPTURE y_ping=%x cbcr_ping=%x\n", __func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]); rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); free_buf.ch_paddr[0] = pmctl->pong_imem_y; free_buf.ch_paddr[1] = pmctl->pong_imem_cbcr; cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; D("%s:VFE_MSG_V32_JPEG_CAPTURE y_pong=%x cbcr_pong=%x\n", __func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]); rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_OUTPUT_IRQ: D("%s Got OUTPUT_IRQ: Getting free buf id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(pmctl, NULL, image_mode, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_FREE_BUF_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; default: pr_err("%s: Invalid vdata type: %d\n", __func__, vdata->type); break; } return rc; }
static int msm_isp_notify_VFE_BUF_EVT(struct v4l2_subdev *sd, void *arg) { int rc = -EINVAL; struct msm_vfe_resp *vdata = (struct msm_vfe_resp *)arg; struct msm_free_buf free_buf; struct msm_camvfe_params vfe_params; struct msm_vfe_cfg_cmd cfgcmd; struct msm_sync *sync = (struct msm_sync *)v4l2_get_subdev_hostdata(sd); struct msm_cam_v4l2_device *pcam = sync->pcam_sync; int vfe_id = vdata->evt_msg.msg_id; if (!pcam) { pr_err("%s pcam is null. return\n", __func__); msm_isp_sync_free(vdata); return rc; } switch (vdata->type) { case VFE_MSG_V32_START: case VFE_MSG_V32_START_RECORDING: D("%s Got V32_START_*: Getting ping addr id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(&pcam->mctl, vfe_id, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); msm_mctl_reserve_free_buf(&pcam->mctl, vfe_id, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_V32_CAPTURE: pr_err("%s Got V32_CAPTURE: getting buffer for id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(&pcam->mctl, vfe_id, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); /* Write the same buffer into PONG */ cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; case VFE_MSG_OUTPUT_IRQ: D("%s Got OUTPUT_IRQ: Getting free buf id = %d", __func__, vfe_id); msm_mctl_reserve_free_buf(&pcam->mctl, vfe_id, &free_buf); cfgcmd.cmd_type = CMD_CONFIG_FREE_BUF_ADDR; cfgcmd.value = &vfe_id; vfe_params.vfe_cfg = &cfgcmd; vfe_params.data = (void *)&free_buf; rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params); break; default: pr_err("%s: Invalid vdata type: %d\n", __func__, vdata->type); break; } msm_isp_sync_free(vdata); return rc; }