From fd65327ebd7acaa23f32a12cba6708256dfd945a Mon Sep 17 00:00:00 2001 From: Chandan Kumar Jha Date: Tue, 8 Jun 2021 13:27:39 +0530 Subject: [PATCH] msm: camera: isp: Add support of new out ports for VFE 780 Add support of new stats out ports in vfe driver for VFE 780. CRs-Fixed: 2948116 Change-Id: I2d0a13fe90f49b66839ea90b5d9882fd7c6528be Signed-off-by: Chandan Kumar Jha --- drivers/cam_isp/cam_isp_context.c | 4 ++ .../isp_hw/vfe_hw/vfe17x/cam_vfe780.h | 36 ++++++++--------- .../isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c | 39 ++++++++----------- .../isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h | 3 +- include/uapi/camera/media/cam_isp_ife.h | 3 +- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index fd179be63b..37cdb62151 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -667,6 +667,10 @@ static const char *__cam_isp_resource_handle_id_to_type( return "PREPROCESS_RAW"; case CAM_ISP_IFE_OUT_RES_SPARSE_PD: return "SPARSE_PD"; + case CAM_ISP_IFE_OUT_RES_STATS_CAF: + return "STATS_CAF"; + case CAM_ISP_IFE_OUT_RES_STATS_BAYER_RS: + return "STATS_BAYER_RS"; default: return "CAM_ISP_Invalid_Resource_Type"; } diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe780.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe780.h index 21871ae0c2..a032fd2cb8 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe780.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe780.h @@ -350,7 +350,7 @@ static struct cam_vfe_top_ver4_wr_client_desc vfe780_wr_client_desc[] = { }, { .wm_id = 16, - .desc = "STATS_BAF", + .desc = "STATS_CAF", }, { .wm_id = 17, @@ -358,7 +358,7 @@ static struct cam_vfe_top_ver4_wr_client_desc vfe780_wr_client_desc[] = { }, { .wm_id = 18, - .desc = "STATS_RS", + .desc = "STATS_BAYER_RS", }, { .wm_id = 19, @@ -366,15 +366,15 @@ static struct cam_vfe_top_ver4_wr_client_desc vfe780_wr_client_desc[] = { }, { .wm_id = 20, - .desc = "PDAF_0", + .desc = "PDAF_0_2PD", }, { .wm_id = 21, - .desc = "PDAF_1", + .desc = "PDAF_1_PREPROCESS_2PD", }, { .wm_id = 22, - .desc = "PDAF_2", + .desc = "PDAF_2_LCR", }, { .wm_id = 23, @@ -636,7 +636,7 @@ static struct cam_vfe_top_ver4_hw_info vfe780_top_hw_info = { .path_port_map = { {CAM_ISP_HW_VFE_IN_PDLIB, CAM_ISP_IFE_OUT_RES_2PD}, {CAM_ISP_HW_VFE_IN_PDLIB, CAM_ISP_IFE_OUT_RES_PREPROCESS_2PD}, - {CAM_ISP_HW_VFE_IN_PDLIB, CAM_ISP_IFE_OUT_RES_PDAF_PARSED_DATA} + {CAM_ISP_HW_VFE_IN_PDLIB, CAM_ISP_IFE_OUT_RES_LCR} }, .num_top_errors = ARRAY_SIZE(vfe780_top_irq_err_desc), .top_err_desc = vfe780_top_irq_err_desc, @@ -1207,7 +1207,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { .comp_group = CAM_VFE_BUS_VER3_COMP_GRP_6, .ubwc_regs = NULL, }, - /* BUS Client 16 STATS BAF */ + /* BUS Client 16 STATS CAF */ { .cfg = 0x00001E00, .image_addr = 0x00001E04, @@ -1267,7 +1267,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { .comp_group = CAM_VFE_BUS_VER3_COMP_GRP_8, .ubwc_regs = NULL, }, - /* BUS Client 18 STATS RS */ + /* BUS Client 18 STATS BAYER RS */ { .cfg = 0x00002000, .image_addr = 0x00002004, @@ -1327,7 +1327,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { .comp_group = CAM_VFE_BUS_VER3_COMP_GRP_10, .ubwc_regs = NULL, }, - /* BUS Client 20 PDAF_0 */ + /* BUS Client 20 PDAF_0_2PD */ { .cfg = 0x00002200, .image_addr = 0x00002204, @@ -1357,7 +1357,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { .comp_group = CAM_VFE_BUS_VER3_COMP_GRP_11, .ubwc_regs = NULL, }, - /* BUS Client 21 PDAF V2.0 PD DATA PDAF_1 */ + /* BUS Client 21 PDAF V2.0 PD DATA PDAF_1_PREPROCESS_2PD */ { .cfg = 0x00002300, .image_addr = 0x00002304, @@ -1387,7 +1387,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { .comp_group = CAM_VFE_BUS_VER3_COMP_GRP_11, .ubwc_regs = NULL, }, - /* BUS Client 22 PDAF V2.0 PDAF_2 */ + /* BUS Client 22 PDAF V2.0 PDAF_2_LCR */ { .cfg = 0x00002400, .image_addr = 0x00002404, @@ -1676,7 +1676,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { 20, }, .name = { - "2PD_SAD", + "PDAF_0_2PD", }, }, { @@ -1695,7 +1695,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { }, }, { - .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BF, + .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_CAF, .max_width = -1, .max_height = -1, .source_group = CAM_VFE_BUS_VER3_SRC_GRP_0, @@ -1737,7 +1737,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { }, }, { - .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_RS, + .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BAYER_RS, .max_width = -1, .max_height = -1, .source_group = CAM_VFE_BUS_VER3_SRC_GRP_0, @@ -1822,7 +1822,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { 21, }, .name = { - "PREPROCESS_2PD", + "PDAF_1_PREPROCESS_2PD", }, }, { @@ -1840,7 +1840,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { }, }, { - .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_PDAF_PARSED, + .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_LCR, .max_width = -1, .max_height = -1, .source_group = CAM_VFE_BUS_VER3_SRC_GRP_1, @@ -1850,7 +1850,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { 22, }, .name = { - "PDAF_PARSED", + "PDAF_2_LCR", }, }, { @@ -2022,7 +2022,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = { .support_consumed_addr = true, .comp_done_shift = 0, .top_irq_shift = 1, - .max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 34, + .max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 35, .pack_align_shift = 5, }; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c index 23703033ac..b4056c6345 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c @@ -314,6 +314,8 @@ static bool cam_vfe_bus_ver3_can_be_secure(uint32_t out_type) case CAM_VFE_BUS_VER3_VFE_OUT_STATS_RS: case CAM_VFE_BUS_VER3_VFE_OUT_STATS_CS: case CAM_VFE_BUS_VER3_VFE_OUT_STATS_IHIST: + case CAM_VFE_BUS_VER3_VFE_OUT_STATS_CAF: + case CAM_VFE_BUS_VER3_VFE_OUT_STATS_BAYER_RS: default: return false; } @@ -408,7 +410,6 @@ static enum cam_vfe_bus_ver3_vfe_out_type case CAM_ISP_IFE_OUT_RES_STATS_AEC_BE: vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_AEC_BE; break; - case CAM_ISP_IFE_OUT_RES_LTM_STATS: vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_LTM_STATS; break; @@ -421,8 +422,11 @@ static enum cam_vfe_bus_ver3_vfe_out_type case CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW: vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW; break; - case CAM_ISP_IFE_OUT_RES_PDAF_PARSED_DATA: - vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_PDAF_PARSED; + case CAM_ISP_IFE_OUT_RES_STATS_CAF: + vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_CAF; + break; + case CAM_ISP_IFE_OUT_RES_STATS_BAYER_RS: + vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BAYER_RS; break; default: CAM_WARN(CAM_ISP, "Invalid isp res id: %d , assigning max", @@ -537,8 +541,11 @@ static int cam_vfe_bus_ver3_get_comp_vfe_out_res_id_list( if (comp_mask & (BIT(CAM_VFE_BUS_VER3_VFE_OUT_SPARSE_PD))) out_list[count++] = CAM_ISP_IFE_OUT_RES_SPARSE_PD; - if (comp_mask & (BIT(CAM_VFE_BUS_VER3_VFE_OUT_PDAF_PARSED))) - out_list[count++] = CAM_VFE_BUS_VER3_VFE_OUT_PDAF_PARSED; + if (comp_mask & (BIT(CAM_VFE_BUS_VER3_VFE_OUT_STATS_CAF))) + out_list[count++] = CAM_ISP_IFE_OUT_RES_STATS_CAF; + + if (comp_mask & (BIT(CAM_VFE_BUS_VER3_VFE_OUT_STATS_BAYER_RS))) + out_list[count++] = CAM_ISP_IFE_OUT_RES_STATS_BAYER_RS; *num_out = count; return 0; @@ -1097,12 +1104,14 @@ static int cam_vfe_bus_ver3_acquire_wm( } rsrc_data->en_cfg = 0x1; - } else if (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_STATS_BF) { + } else if ((vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_STATS_BF) || + (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_STATS_CAF)) { rsrc_data->en_cfg = (0x1 << 16) | 0x1; - } else if ((vfe_out_res_id >= CAM_VFE_BUS_VER3_VFE_OUT_STATS_HDR_BE) && - (vfe_out_res_id <= CAM_VFE_BUS_VER3_VFE_OUT_STATS_IHIST)) { + } else if (((vfe_out_res_id >= CAM_VFE_BUS_VER3_VFE_OUT_STATS_HDR_BE) && + (vfe_out_res_id <= CAM_VFE_BUS_VER3_VFE_OUT_STATS_IHIST)) || + (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_STATS_BAYER_RS)) { rsrc_data->width = 0; rsrc_data->height = 0; @@ -1242,20 +1251,6 @@ static int cam_vfe_bus_ver3_acquire_wm( return -EINVAL; } - } else if (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_PDAF_PARSED) { - switch (rsrc_data->format) { - case CAM_FORMAT_PLAIN16_16: - rsrc_data->stride = ALIGNUP(rsrc_data->width * 2, 8); - rsrc_data->en_cfg = 0x1; - /* LSB aligned */ - rsrc_data->pack_fmt |= (1 << - ver3_bus_priv->common_data.pack_align_shift); - break; - default: - CAM_ERR(CAM_ISP, "Invalid format %d out_type:%d", - rsrc_data->format, vfe_out_res_id); - return -EINVAL; - } } else { CAM_ERR(CAM_ISP, "Invalid out_type:%d requested", vfe_out_res_id); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h index 6e5a2a3215..faf266dffb 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h @@ -85,7 +85,8 @@ enum cam_vfe_bus_ver3_vfe_out_type { CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST, CAM_VFE_BUS_VER3_VFE_OUT_STATS_BG, CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW, - CAM_VFE_BUS_VER3_VFE_OUT_PDAF_PARSED, + CAM_VFE_BUS_VER3_VFE_OUT_STATS_CAF, + CAM_VFE_BUS_VER3_VFE_OUT_STATS_BAYER_RS, CAM_VFE_BUS_VER3_VFE_OUT_MAX, }; diff --git a/include/uapi/camera/media/cam_isp_ife.h b/include/uapi/camera/media/cam_isp_ife.h index 56328c5224..6b83c5f5e1 100644 --- a/include/uapi/camera/media/cam_isp_ife.h +++ b/include/uapi/camera/media/cam_isp_ife.h @@ -42,7 +42,8 @@ #define CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST (CAM_ISP_IFE_OUT_RES_BASE + 30) #define CAM_ISP_IFE_LITE_OUT_RES_STATS_BG (CAM_ISP_IFE_OUT_RES_BASE + 31) #define CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW (CAM_ISP_IFE_OUT_RES_BASE + 32) -#define CAM_ISP_IFE_OUT_RES_PDAF_PARSED_DATA (CAM_ISP_IFE_OUT_RES_BASE + 33) +#define CAM_ISP_IFE_OUT_RES_STATS_CAF (CAM_ISP_IFE_OUT_RES_BASE + 33) +#define CAM_ISP_IFE_OUT_RES_STATS_BAYER_RS (CAM_ISP_IFE_OUT_RES_BASE + 34) /* IFE input port resource type (global unique) */ #define CAM_ISP_IFE_IN_RES_BASE 0x4000