From 67f57cd267e10eccb4f732f5570be42a46fe433a Mon Sep 17 00:00:00 2001 From: Sagar Gore Date: Wed, 16 Mar 2016 14:39:19 -0700 Subject: [PATCH] msm: camera: isp: Add camif raw path output format support Add changes to enable different output formats on supported target. This change enables camif raw path to output data in multiple other formats along with legacy packed. Change-Id: Ie763455df2cffcb4fc9447a1bbcc8d9c7d577c6c Signed-off-by: Sagar Gore --- .../platform/msm/camera_v2/isp/msm_isp.h | 1 - .../platform/msm/camera_v2/isp/msm_isp40.c | 76 +++++++++---------- .../platform/msm/camera_v2/isp/msm_isp47.c | 42 ++++++++++ 3 files changed, 79 insertions(+), 40 deletions(-) diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h index 8a9a4f2a1c30..bc22a3987f85 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h @@ -721,7 +721,6 @@ struct vfe_device { uint32_t isp_raw0_debug; uint32_t isp_raw1_debug; uint32_t isp_raw2_debug; - uint8_t is_camif_raw_crop_supported; /* irq info */ uint32_t irq0_mask; diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c index 337ae59f88e8..850cffaef3a4 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp40.c @@ -433,8 +433,6 @@ static void msm_vfe40_init_hardware_reg(struct vfe_device *vfe_dev) break; case VFE40_8937_VERSION: case VFE40_8953_VERSION: - vfe_dev->is_camif_raw_crop_supported = 1; - break; default: ISP_DBG("%s: No special QOS\n", __func__); } @@ -1400,44 +1398,44 @@ static void msm_vfe40_cfg_camif(struct vfe_device *vfe_dev, msm_camera_io_w((subsample_cfg->line_skip << 16) | subsample_cfg->pixel_skip, vfe_dev->vfe_base + 0x30C); - if (vfe_dev->is_camif_raw_crop_supported) { - /* Pdaf output will be sent in PLAIN16 format*/ - val = msm_camera_io_r(vfe_dev->vfe_base + 0x54); - switch (subsample_cfg->output_format) { - case CAMIF_PLAIN_8: - val |= 4 << 9; - break; - case CAMIF_PLAIN_16: - val |= 5 << 9; - break; - case CAMIF_MIPI_RAW: - val |= 1 << 9; - break; - case CAMIF_QCOM_RAW: - default: - break; - } - msm_camera_io_w(val, vfe_dev->vfe_base + 0x54); - if (subsample_cfg->first_pixel || - subsample_cfg->last_pixel || - subsample_cfg->first_line || - subsample_cfg->last_line) { - msm_camera_io_w( - subsample_cfg->first_pixel << 16 | - subsample_cfg->last_pixel, - vfe_dev->vfe_base + 0x8A4); - msm_camera_io_w( - subsample_cfg->first_line << 16 | - subsample_cfg->last_line, - vfe_dev->vfe_base + 0x8A8); - val = msm_camera_io_r( - vfe_dev->vfe_base + 0x2F8); - val |= 1 << 22; - msm_camera_io_w(val, - vfe_dev->vfe_base + 0x2F8); - } - } + if (subsample_cfg->first_pixel || + subsample_cfg->last_pixel || + subsample_cfg->first_line || + subsample_cfg->last_line) { + msm_camera_io_w( + subsample_cfg->first_pixel << 16 | + subsample_cfg->last_pixel, + vfe_dev->vfe_base + 0x8A4); + msm_camera_io_w( + subsample_cfg->first_line << 16 | + subsample_cfg->last_line, + vfe_dev->vfe_base + 0x8A8); + val = msm_camera_io_r( + vfe_dev->vfe_base + 0x2F8); + val |= 1 << 22; + msm_camera_io_w(val, + vfe_dev->vfe_base + 0x2F8); + } + ISP_DBG("%s:camif raw op fmt %d\n", + __func__, subsample_cfg->output_format); + /* Pdaf output will be sent in PLAIN16 format*/ + val = msm_camera_io_r(vfe_dev->vfe_base + 0x54); + switch (subsample_cfg->output_format) { + case CAMIF_PLAIN_8: + val |= 4 << 9; + break; + case CAMIF_PLAIN_16: + val |= 5 << 9; + break; + case CAMIF_MIPI_RAW: + val |= 1 << 9; + break; + case CAMIF_QCOM_RAW: + default: + break; + } + msm_camera_io_w(val, vfe_dev->vfe_base + 0x54); } } diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c index 054d736a2dc3..ea3c8f71912b 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c @@ -1317,6 +1317,48 @@ static void msm_vfe47_cfg_camif(struct vfe_device *vfe_dev, msm_camera_io_w(0xFFFFFFFF, vfe_dev->vfe_base + 0x49C); } + if (subsample_cfg->first_pixel || + subsample_cfg->last_pixel || + subsample_cfg->first_line || + subsample_cfg->last_line) { + msm_camera_io_w( + subsample_cfg->first_pixel << 16 | + subsample_cfg->last_pixel, + vfe_dev->vfe_base + 0xCE4); + msm_camera_io_w( + subsample_cfg->first_line << 16 | + subsample_cfg->last_line, + vfe_dev->vfe_base + 0xCE4); + val = msm_camera_io_r( + vfe_dev->vfe_base + 0x47C); + ISP_DBG("%s: camif raw crop enabled\n", __func__); + val |= 1 << 22; + msm_camera_io_w(val, + vfe_dev->vfe_base + 0x47C); + } + + ISP_DBG("%s: camif raw op fmt %d\n", + __func__, subsample_cfg->output_format); + /* Pdaf output can be sent in below formats */ + val = msm_camera_io_r(vfe_dev->vfe_base + 0x88); + switch (subsample_cfg->output_format) { + case CAMIF_PLAIN_8: + val |= PLAIN8 << 9; + break; + case CAMIF_PLAIN_16: + val |= PLAIN16 << 9; + break; + case CAMIF_MIPI_RAW: + val |= MIPI << 9; + break; + case CAMIF_QCOM_RAW: + val |= QCOM << 9; + break; + default: + break; + } + msm_camera_io_w(val, vfe_dev->vfe_base + 0x88); + val = msm_camera_io_r(vfe_dev->vfe_base + 0x46C); val |= camif_cfg->camif_input; msm_camera_io_w(val, vfe_dev->vfe_base + 0x46C);