Esempio n. 1
0
static long msm_vpe_subdev_ioctl(struct v4l2_subdev *sd,
			unsigned int subdev_cmd, void *arg)
{
	struct msm_mctl_pp_params *vpe_params;
	struct msm_mctl_pp_cmd *cmd;
	int rc = 0;

	if (subdev_cmd == VIDIOC_MSM_VPE_INIT) {
		struct msm_cam_media_controller *mctl =
			(struct msm_cam_media_controller *)arg;
		msm_vpe_subdev_init(sd, mctl);
	} else if (subdev_cmd == VIDIOC_MSM_VPE_RELEASE) {
		msm_vpe_subdev_release();
	} else if (subdev_cmd == VIDIOC_MSM_VPE_CFG) {
		vpe_params = (struct msm_mctl_pp_params *)arg;
		cmd = vpe_params->cmd;
		switch (cmd->id) {
		case VPE_CMD_INIT:
		case VPE_CMD_DEINIT:
			break;
		case VPE_CMD_RESET:
			rc = vpe_reset();
			break;
		case VPE_CMD_OPERATION_MODE_CFG:
			rc = vpe_operation_config(cmd->value);
			break;
		case VPE_CMD_INPUT_PLANE_CFG:
			vpe_input_plane_config(cmd->value);
			break;
		case VPE_CMD_OUTPUT_PLANE_CFG:
			vpe_output_plane_config(cmd->value);
			break;
		case VPE_CMD_SCALE_CFG_TYPE:
			vpe_update_scale_coef(cmd->value);
			break;
		case VPE_CMD_ZOOM: {
			rc = msm_vpe_do_pp(cmd,
			(struct msm_mctl_pp_frame_info *)vpe_params->data);
			break;
		}
		case VPE_CMD_ENABLE: {
			struct msm_vpe_clock_rate *clk_rate = cmd->value;
			int turbo_mode = (int)clk_rate->rate;
			rc = turbo_mode ?
				vpe_enable(VPE_TURBO_MODE_CLOCK_RATE) :
				vpe_enable(VPE_NORMAL_MODE_CLOCK_RATE);
			break;
		}
		case VPE_CMD_DISABLE:
			rc = vpe_disable();
			break;
		case VPE_CMD_INPUT_PLANE_UPDATE:
		case VPE_CMD_FLUSH:
		default:
			break;
		}
		CDBG("%s: end, id = %d, rc = %d", __func__, cmd->id, rc);
	}
	return rc;
}
Esempio n. 2
0
/* This function is called by open() function, so we need to init HW*/
static int msm_isp_open(struct v4l2_subdev *sd,
	struct v4l2_subdev *sd_vpe,
	struct msm_sync *sync)
{
	/* init vfe and senor, register sync callbacks for init*/
	int rc = 0;
	D("%s\n", __func__);
	if (!sync) {
		pr_err("%s: param is NULL", __func__);
		return -EINVAL;
	}


	rc = msm_vfe_subdev_init(sd, sync, sync->pdev);
	if (rc < 0) {
		pr_err("%s: vfe_init failed at %d\n",
					__func__, rc);
	}
	D("%s: init vpe subdev", __func__);
	rc = msm_vpe_subdev_init(sd_vpe, sync, sync->pdev);
	if (rc < 0) {
		pr_err("%s: vpe_init failed at %d\n",
					__func__, rc);
	}
	return rc;
}
Esempio n. 3
0
static long msm_vpe_subdev_ioctl(struct v4l2_subdev *sd,
			unsigned int cmd, void *arg)
{
	struct msm_vpe_cfg_cmd *vpe_cmd;
	int rc = 0;
	struct msm_cam_media_controller *mctl;
	mctl = v4l2_get_subdev_hostdata(sd);
	switch (cmd) {
	case VIDIOC_MSM_VPE_INIT: {
		msm_vpe_subdev_init(sd);
		break;
		}

	case VIDIOC_MSM_VPE_RELEASE:
		msm_vpe_subdev_release(sd);
		break;

	case MSM_CAM_V4L2_IOCTL_CFG_VPE: {
		vpe_cmd = (struct msm_vpe_cfg_cmd *)arg;
		rc = msm_vpe_process_vpe_cmd(vpe_cmd, mctl);
		if (rc < 0) {
			pr_err("%s Error processing VPE cmd %d ",
				__func__, vpe_cmd->cmd_type);
			break;
		}
		break;
		}

	case MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD: {
		struct msm_device_queue *queue = &vpe_ctrl->eventData_q;
		struct msm_queue_cmd *event_qcmd;
		struct msm_mctl_pp_event_info pp_event_info;
		struct msm_mctl_pp_frame_info *pp_frame_info;
		struct msm_camera_v4l2_ioctl_t *v4l2_ioctl = arg;

		event_qcmd = msm_dequeue(queue, list_eventdata);
		if (!event_qcmd) {
			pr_err("%s No events in the queue", __func__);
			return -EFAULT;
		}
		pp_frame_info = event_qcmd->command;

		D("%s Unmapping source and destination buffers ",
			__func__);
		msm_mctl_unmap_user_frame(&pp_frame_info->src_frame,
			pp_frame_info->p_mctl->client, mctl->domain_num);
		msm_mctl_unmap_user_frame(&pp_frame_info->dest_frame,
			pp_frame_info->p_mctl->client, mctl->domain_num);

		pp_event_info.event = MCTL_PP_EVENT_CMD_ACK;
		pp_event_info.ack.cmd = pp_frame_info->user_cmd;
		pp_event_info.ack.status = 0;
		pp_event_info.ack.cookie = pp_frame_info->pp_frame_cmd.cookie;
		D("%s Sending payload %d %d %d", __func__,
			pp_event_info.ack.cmd, pp_event_info.ack.status,
			pp_event_info.ack.cookie);
		if (copy_to_user((void __user *)v4l2_ioctl->ioctl_ptr,
			&pp_event_info,	sizeof(struct msm_mctl_pp_event_info)))
			pr_err("%s PAYLOAD Copy to user failed ", __func__);

		kfree(pp_frame_info);
		kfree(event_qcmd);
#ifdef CONFIG_PANTECH_CAMERA // pp_fram_info init
		pp_frame_info = NULL;
		event_qcmd = NULL;
#endif
		break;
		}

	default:
		break;
	}
	return rc;
}
static long msm_vpe_subdev_ioctl(struct v4l2_subdev *sd,
			unsigned int cmd, void *arg)
{
	struct msm_vpe_cfg_cmd *vpe_cmd;
	int rc = 0;

	switch (cmd) {
	case VIDIOC_MSM_VPE_INIT: {
		msm_vpe_subdev_init(sd);
		break;
		}

	case VIDIOC_MSM_VPE_RELEASE:
		msm_vpe_subdev_release();
		break;

	case MSM_CAM_V4L2_IOCTL_CFG_VPE: {
		vpe_cmd = (struct msm_vpe_cfg_cmd *)arg;
		rc = msm_vpe_process_vpe_cmd(vpe_cmd);
		if (rc < 0) {
			pr_err("%s Error processing VPE cmd %d ",
				__func__, vpe_cmd->cmd_type);
			break;
		}
		break;
		}

	case MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD: {
		struct msm_device_queue *queue = &vpe_ctrl->eventData_q;
		struct msm_queue_cmd *event_qcmd;
		struct msm_mctl_pp_event_info pp_event_info;
		struct msm_mctl_pp_frame_info *pp_frame_info;
		struct msm_camera_v4l2_ioctl_t *v4l2_ioctl = arg;

		event_qcmd = msm_dequeue(queue, list_eventdata);
		if (!event_qcmd) {
			pr_err("%s No events in the queue", __func__);
			return -EFAULT;
		}
		pp_frame_info = event_qcmd->command;
		pp_event_info.event = MCTL_PP_EVENT_CMD_ACK;
		pp_event_info.ack.cmd = pp_frame_info->user_cmd;
		pp_event_info.ack.status = 0;
		pp_event_info.ack.cookie = pp_frame_info->pp_frame_cmd.cookie;
		D("%s Sending payload %d %d %d", __func__,
			pp_event_info.ack.cmd, pp_event_info.ack.status,
			pp_event_info.ack.cookie);
		if (copy_to_user((void __user *)v4l2_ioctl->ioctl_ptr,
			&pp_event_info,
			sizeof(struct msm_mctl_pp_event_info)))
			pr_err("%s EVENTPAYLOAD Copy to user failed ",
				__func__);
		kfree(pp_frame_info);
		event_qcmd->command = NULL;
		free_qcmd(event_qcmd);
		break;
		}

	default:
		break;
	}
	return rc;
}