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, ®ion[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 = ®ion[0]; } /* send the AEC/AWB STATS configuration command to driver */ rc = msm_isp_subdev_ioctl(sd, cfgcmd, data); return rc; }
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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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, ®ion[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 = ®ion[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; }