Exemple #1
0
static int msm_axi_config(struct v4l2_subdev *sd,
		struct msm_cam_media_controller *mctl, void __user *arg)
{
	struct msm_vfe_cfg_cmd cfgcmd;

	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
		ERR_COPY_FROM_USER();
		return -EFAULT;
	}

	switch (cfgcmd.cmd_type) {
	case CMD_AXI_CFG_PRIM:
	case CMD_AXI_CFG_SEC:
	case CMD_AXI_CFG_ZSL:
	case CMD_RAW_PICT_AXI_CFG:
	case CMD_AXI_CFG_PRIM_ALL_CHNLS:
	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC:
	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS:
	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC:
		return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);

	default:
		pr_err("%s: unknown command type %d\n",
			__func__,
			cfgcmd.cmd_type);
		return -EINVAL;
	}

	return 0;
}
Exemple #2
0
static int msm_put_stats_buffer(struct v4l2_subdev *sd,
			struct msm_cam_media_controller *mctl, void __user *arg)
{
	int rc = -EIO;

	struct msm_stats_buf buf;
	unsigned long pphy;
	struct msm_vfe_cfg_cmd cfgcmd;

	if (copy_from_user(&buf, arg,
				sizeof(struct msm_stats_buf))) {
		ERR_COPY_FROM_USER();
		return -EFAULT;
	}

	CDBG("%s\n", __func__);
	pphy = msm_pmem_stats_vtop_lookup(mctl, buf.buffer, buf.fd);

	if (pphy != 0) {
		if (buf.type == STAT_AF)
			cfgcmd.cmd_type = CMD_STATS_AF_BUF_RELEASE;
		else if (buf.type == STAT_AEC)
			cfgcmd.cmd_type = CMD_STATS_AEC_BUF_RELEASE;
		else if (buf.type == STAT_AWB)
			cfgcmd.cmd_type = CMD_STATS_AWB_BUF_RELEASE;
		else if (buf.type == STAT_IHIST)
			cfgcmd.cmd_type = CMD_STATS_IHIST_BUF_RELEASE;
		else if (buf.type == STAT_RS)
			cfgcmd.cmd_type = CMD_STATS_RS_BUF_RELEASE;
		else if (buf.type == STAT_CS)
			cfgcmd.cmd_type = CMD_STATS_CS_BUF_RELEASE;
		else if (buf.type == STAT_AEAW)
			cfgcmd.cmd_type = CMD_STATS_BUF_RELEASE;
		else if (buf.type == STAT_BG)
			cfgcmd.cmd_type = CMD_STATS_BG_BUF_RELEASE;
		else if (buf.type == STAT_BF)
			cfgcmd.cmd_type = CMD_STATS_BF_BUF_RELEASE;
		else if (buf.type == STAT_BHIST)
			cfgcmd.cmd_type = CMD_STATS_BHIST_BUF_RELEASE;

		else {
			pr_err("%s: invalid buf type %d\n",
				__func__,
				buf.type);
			rc = -EINVAL;
			goto put_done;
		}

		cfgcmd.value = (void *)&buf;

		rc = msm_isp_subdev_ioctl(sd, &cfgcmd, &pphy);
	} else {
		pr_err("%s: NULL physical address\n", __func__);
		rc = -EINVAL;
	}

put_done:
	return rc;
}
Exemple #3
0
static int msm_config_vfe(struct v4l2_subdev *sd,
	struct msm_cam_media_controller *mctl, void __user *arg)
{
	struct msm_vfe_cfg_cmd cfgcmd;
	struct axidata axi_data;

	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
		ERR_COPY_FROM_USER();
		return -EFAULT;
	}

	memset(&axi_data, 0, sizeof(axi_data));
	CDBG("%s: cmd_type %d\n", __func__, cfgcmd.cmd_type);
	switch (cfgcmd.cmd_type) {
	case CMD_STATS_BG_ENABLE:
	case CMD_STATS_BE_ENABLE:
	case CMD_STATS_BF_ENABLE:
	case CMD_STATS_BHIST_ENABLE:
	case CMD_STATS_AF_ENABLE:
	case CMD_STATS_AEC_ENABLE:
	case CMD_STATS_AWB_ENABLE:
	case CMD_STATS_AEC_AWB_ENABLE:
	case CMD_STATS_IHIST_ENABLE:
	case CMD_STATS_RS_ENABLE:
	case CMD_STATS_CS_ENABLE:
		return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
	case CMD_GENERAL:
	case CMD_STATS_DISABLE:
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	default:
		pr_err("%s: unknown command type %d\n",
			__func__, cfgcmd.cmd_type);
	}

	return -EINVAL;
}
static int msm_axi_config(struct v4l2_subdev *sd,
			struct msm_sync *sync, void __user *arg)
{
	struct msm_vfe_cfg_cmd cfgcmd;

	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
		ERR_COPY_FROM_USER();
		return -EFAULT;
	}

	switch (cfgcmd.cmd_type) {
	case CMD_AXI_CFG_VIDEO:
	case CMD_AXI_CFG_PREVIEW:
	case CMD_AXI_CFG_SNAP:
	case CMD_AXI_CFG_ZSL:
	case CMD_AXI_CFG_VIDEO_ALL_CHNLS:
	case CMD_AXI_CFG_ZSL_ALL_CHNLS:
	case CMD_RAW_PICT_AXI_CFG:
	case CMD_AXI_CFG_PRIM:
	case CMD_AXI_CFG_PRIM_ALL_CHNLS:
	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC:
	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS:
	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC:
		/* Dont need to pass buffer information.
		 * subdev will get the buffer from media
		 * controller free queue.
		 */
		return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
	case CMD_AXI_CFG_VPE:
		return 0;
		return msm_vpe_frame_cfg(sync, (void *)&cfgcmd);

	case CMD_STATS_AXI_CFG:
	case CMD_STATS_AF_AXI_CFG:
		return msm_stats_axi_cfg(sd, sync, &cfgcmd);

	default:
		pr_err("%s: unknown command type %d\n",
			__func__,
			cfgcmd.cmd_type);
		return -EINVAL;
	}

	return 0;
}
Exemple #5
0
static int msm_axi_config(struct v4l2_subdev *sd,
                          struct msm_cam_media_controller *mctl, void __user *arg)
{
    struct msm_vfe_cfg_cmd cfgcmd;

    if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
        ERR_COPY_FROM_USER();
        return -EFAULT;
    }

    switch (cfgcmd.cmd_type) {
    case CMD_AXI_CFG_PRIM:
    case CMD_AXI_CFG_SEC:
    case CMD_AXI_CFG_ZSL:
    case CMD_RAW_PICT_AXI_CFG:
    case CMD_AXI_CFG_PRIM_ALL_CHNLS:
    case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC:
    case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS:
    case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC:
    case CMD_AXI_START:
    case CMD_AXI_STOP:
    case CMD_AXI_CFG_TERT1:
    case CMD_AXI_CFG_TERT2:
#if 1 //#ifdef F_PANTECH_CAMERA_QPATCH_JPEG_ZSL
    case CMD_AXI_CFG_TERT3:
#endif
        /* Dont need to pass buffer information.
         * subdev will get the buffer from media
         * controller free queue.
         */
        return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);

    default:
        pr_err("%s: unknown command type %d\n",
               __func__,
               cfgcmd.cmd_type);
        return -EINVAL;
    }

    return 0;
}
Exemple #6
0
static int msm_stats_axi_cfg(struct v4l2_subdev *sd,
		struct msm_sync *sync, struct msm_vfe_cfg_cmd *cfgcmd)
{
	int rc = -EIO;
	struct axidata axi_data;
	void *data = &axi_data;
	struct msm_pmem_region region[3];
	int pmem_type = MSM_PMEM_MAX;

	memset(&axi_data, 0, sizeof(axi_data));

	switch (cfgcmd->cmd_type) {
	case CMD_STATS_AF_AXI_CFG:
		pmem_type = MSM_PMEM_AF;
		break;
	case CMD_GENERAL:
		data = NULL;
		break;
	default:
		pr_err("%s: unknown command type %d\n",
			__func__, cfgcmd->cmd_type);
		return -EINVAL;
	}

	if (cfgcmd->cmd_type != CMD_GENERAL) {
		axi_data.bufnum1 =
			msm_pmem_region_lookup(&sync->pmem_stats, pmem_type,
				&region[0], NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
	}

	/* send the AEC/AWB STATS configuration command to driver */
	rc = msm_isp_subdev_ioctl(sd, cfgcmd, data);
	return rc;
}
Exemple #7
0
static int msm_vfe_stats_buf_ioctl(struct v4l2_subdev *sd,
	unsigned int cmd,
	struct msm_cam_media_controller *mctl,
	void __user *arg)
{
	struct msm_vfe_cfg_cmd cfgcmd;
	int rc = 0;
	switch (cmd) {
	case MSM_CAM_IOCTL_STATS_REQBUF: {
		struct msm_stats_reqbuf reqbuf;
		if (copy_from_user(&reqbuf, arg,
			sizeof(struct msm_stats_reqbuf))) {
			ERR_COPY_FROM_USER();
			return -EFAULT;
		}
	cfgcmd.cmd_type = VFE_CMD_STATS_REQBUF;
	cfgcmd.value = (void *)&reqbuf;
	cfgcmd.length = sizeof(struct msm_stats_reqbuf);
	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, (void *)mctl->client);
	break;
	}
	case MSM_CAM_IOCTL_STATS_ENQUEUEBUF: {
		struct msm_stats_buf_info buf_info;
		if (copy_from_user(&buf_info, arg,
			sizeof(struct msm_stats_buf_info))) {
			ERR_COPY_FROM_USER();
			return -EFAULT;
		}
	cfgcmd.cmd_type = VFE_CMD_STATS_ENQUEUEBUF;
	cfgcmd.value = (void *)&buf_info;
	cfgcmd.length = sizeof(struct msm_stats_buf_info);
	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
	break;
	}
	case MSM_CAM_IOCTL_STATS_FLUSH_BUFQ: {
		struct msm_stats_flush_bufq bufq_info;
		if (copy_from_user(&bufq_info, arg,
			sizeof(struct msm_stats_flush_bufq))) {
			ERR_COPY_FROM_USER();
			return -EFAULT;
		}
	cfgcmd.cmd_type = VFE_CMD_STATS_FLUSH_BUFQ;
	cfgcmd.value = (void *)&bufq_info;
	cfgcmd.length = sizeof(struct msm_stats_flush_bufq);
	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
	break;
	}
	case MSM_CAM_IOCTL_STATS_UNREG_BUF: {
		struct msm_stats_reqbuf reqbuf;
		if (copy_from_user(&reqbuf, arg,
			sizeof(struct msm_stats_reqbuf))) {
			ERR_COPY_FROM_USER();
			return -EFAULT;
		}
	cfgcmd.cmd_type = VFE_CMD_STATS_UNREGBUF;
	cfgcmd.value = (void *)&reqbuf;
	cfgcmd.length = sizeof(struct msm_stats_reqbuf);
	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, (void *)mctl->client);
	break;
	}
	default:
		rc = -1;
	break;
	}
	CDBG("%s\n", __func__);
	return rc;
}
Exemple #8
0
static int msm_config_vfe(struct v4l2_subdev *sd,
	struct msm_cam_media_controller *mctl, void __user *arg)
{
	struct msm_vfe_cfg_cmd cfgcmd;
	struct msm_pmem_region region[8];
	struct axidata axi_data;

	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
		ERR_COPY_FROM_USER();
		return -EFAULT;
	}

	memset(&axi_data, 0, sizeof(axi_data));
	CDBG("%s: cmd_type %d\n", __func__, cfgcmd.cmd_type);
	switch (cfgcmd.cmd_type) {
	case CMD_STATS_BG_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_BAYER_GRID, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_BF_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_BAYER_FOCUS, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_BHIST_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_BAYER_HIST, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_AF_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_AF, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_AEC_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_AEC, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_AWB_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_AWB, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_AEC_AWB_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_AEC_AWB, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_IHIST_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_IHIST, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_RS_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_RS, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_STATS_CS_ENABLE:
		axi_data.bufnum1 =
			msm_pmem_region_lookup(
				&mctl->stats_info.pmem_stats_list,
				MSM_PMEM_CS, &region[0],
				NUM_STAT_OUTPUT_BUFFERS);
		if (!axi_data.bufnum1) {
			pr_err("%s %d: pmem region lookup error\n",
				__func__, __LINE__);
			return -EINVAL;
		}
		axi_data.region = &region[0];
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	case CMD_GENERAL:
	case CMD_STATS_DISABLE:
		return msm_isp_subdev_ioctl(sd, &cfgcmd,
							&axi_data);
	default:
		pr_err("%s: unknown command type %d\n",
			__func__, cfgcmd.cmd_type);
	}

	return -EINVAL;
}