diff --git a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index 6a5b2240f389..b600e51b1fdb 100644 --- a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -6500,6 +6500,7 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv, return rc; frame_header_enable = true; + prepare_hw_data->frame_header_res_id = 0x0; } if (ctx->internal_cdm) @@ -6605,6 +6606,14 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv, } } + /* Check if frame header was enabled for any WM */ + if ((ctx->custom_config & CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS) && + (prepare->num_out_map_entries) && + (!prepare_hw_data->frame_header_res_id)) { + CAM_ERR(CAM_ISP, "Failed to configure frame header"); + goto end; + } + /* * reg update will be done later for the initial configure. * need to plus one to the op_code and only take the lower diff --git a/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c b/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c index fe6b43330b30..4147efe58af0 100644 --- a/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c +++ b/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c @@ -700,6 +700,7 @@ int cam_isp_add_io_buffers( wm_update.num_buf = plane_id; wm_update.io_cfg = &io_cfg[i]; wm_update.frame_header = 0; + wm_update.fh_enabled = false; for (plane_id = 0; plane_id < CAM_PACKET_MAX_PLANES; plane_id++) @@ -709,14 +710,8 @@ int cam_isp_add_io_buffers( if ((frame_header_info->frame_header_enable) && !(frame_header_info->frame_header_res_id)) { wm_update.frame_header = iova_addr; - frame_header_info->frame_header_res_id = - res->res_id; wm_update.local_id = prepare->packet->header.request_id; - CAM_DBG(CAM_ISP, - "Frame header enabled for res: 0x%x iova: %pK", - frame_header_info->frame_header_res_id, - wm_update.frame_header); } update_buf.cmd.size = kmd_buf_remain_size; @@ -736,6 +731,16 @@ int cam_isp_add_io_buffers( rc = -ENOMEM; return rc; } + + if (wm_update.fh_enabled) { + frame_header_info->frame_header_res_id = + res->res_id; + CAM_DBG(CAM_ISP, + "Frame header enabled for res: 0x%x iova: %pK", + frame_header_info->frame_header_res_id, + wm_update.frame_header); + } + io_cfg_used_bytes += update_buf.cmd.used_bytes; if (!out_map_entries) { diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h index 2e5be6f75d5a..21c0e0e27a90 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h @@ -249,6 +249,7 @@ struct cam_isp_hw_cmd_buf_update { * @ image_buf_offset: image buffer address offset array * @ num_buf: Number of buffers in the image_buf array * @ frame_header: frame header iova + * @ fh_enabled: flag to indicate if this WM enables frame header * @ local_id: local id for the wm * @ width: width of scratch buffer * @ height: height of scratch buffer @@ -262,6 +263,7 @@ struct cam_isp_hw_get_wm_update { uint32_t image_buf_offset[CAM_PACKET_MAX_PLANES]; uint32_t num_buf; uint64_t frame_header; + bool fh_enabled; uint32_t local_id; uint32_t width; uint32_t height; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe480.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe480.h index b70ad12bb26a..d12ed2904f3e 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe480.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe480.h @@ -481,9 +481,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = { .image_cfg_1 = 0x0000AE10, .image_cfg_2 = 0x0000AE14, .packer_cfg = 0x0000AE18, - .frame_header_addr = 0x0000AE20, - .frame_header_incr = 0x0000AE24, - .frame_header_cfg = 0x0000AE28, .line_done_cfg = 0, .irq_subsample_period = 0x0000AE30, .irq_subsample_pattern = 0x0000AE34, @@ -510,9 +507,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = { .image_cfg_1 = 0x0000AF10, .image_cfg_2 = 0x0000AF14, .packer_cfg = 0x0000AF18, - .frame_header_addr = 0x0000AF20, - .frame_header_incr = 0x0000AF24, - .frame_header_cfg = 0x0000AF28, .line_done_cfg = 0, .irq_subsample_period = 0x0000AF30, .irq_subsample_pattern = 0x0000AF34, @@ -597,9 +591,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = { .image_cfg_1 = 0x0000B210, .image_cfg_2 = 0x0000B214, .packer_cfg = 0x0000B218, - .frame_header_addr = 0x0000B220, - .frame_header_incr = 0x0000B224, - .frame_header_cfg = 0x0000B228, .line_done_cfg = 0, .irq_subsample_period = 0x0000B230, .irq_subsample_pattern = 0x0000B234, @@ -626,9 +617,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = { .image_cfg_1 = 0x0000B310, .image_cfg_2 = 0x0000B314, .packer_cfg = 0x0000B318, - .frame_header_addr = 0x0000B320, - .frame_header_incr = 0x0000B324, - .frame_header_cfg = 0x0000B328, .line_done_cfg = 0, .irq_subsample_period = 0x0000B330, .irq_subsample_pattern = 0x0000B334, @@ -684,9 +672,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = { .image_cfg_1 = 0x0000B510, .image_cfg_2 = 0x0000B514, .packer_cfg = 0x0000B518, - .frame_header_addr = 0x0000B520, - .frame_header_incr = 0x0000B524, - .frame_header_cfg = 0x0000B528, .line_done_cfg = 0, .irq_subsample_period = 0x0000B530, .irq_subsample_pattern = 0x0000B534, diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe680.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe680.h index 2f2fb4cb667e..2abeaff9cee7 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe680.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe680.h @@ -280,9 +280,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe680_bus_hw_info = { .image_cfg_1 = 0x00001010, .image_cfg_2 = 0x00001014, .packer_cfg = 0x00001018, - .frame_header_addr = 0x00001020, - .frame_header_incr = 0x00001024, - .frame_header_cfg = 0x00001028, .irq_subsample_period = 0x00001030, .irq_subsample_pattern = 0x00001034, .framedrop_period = 0x00001038, @@ -309,9 +306,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe680_bus_hw_info = { .image_cfg_1 = 0x00001110, .image_cfg_2 = 0x00001114, .packer_cfg = 0x00001118, - .frame_header_addr = 0x00001120, - .frame_header_incr = 0x00001124, - .frame_header_cfg = 0x00001128, .irq_subsample_period = 0x00001130, .irq_subsample_pattern = 0x00001134, .framedrop_period = 0x00001138, @@ -396,9 +390,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe680_bus_hw_info = { .image_cfg_1 = 0x00001410, .image_cfg_2 = 0x00001414, .packer_cfg = 0x00001418, - .frame_header_addr = 0x00001420, - .frame_header_incr = 0x00001424, - .frame_header_cfg = 0x00001428, .irq_subsample_period = 0x00001430, .irq_subsample_pattern = 0x00001434, .framedrop_period = 0x00001438, @@ -425,9 +416,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe680_bus_hw_info = { .image_cfg_1 = 0x00001510, .image_cfg_2 = 0x00001514, .packer_cfg = 0x00001518, - .frame_header_addr = 0x00001520, - .frame_header_incr = 0x00001524, - .frame_header_cfg = 0x00001528, .irq_subsample_period = 0x00001530, .irq_subsample_pattern = 0x00001534, .framedrop_period = 0x00001538, @@ -483,9 +471,6 @@ static struct cam_vfe_bus_ver3_hw_info vfe680_bus_hw_info = { .image_cfg_1 = 0x00001710, .image_cfg_2 = 0x00001714, .packer_cfg = 0x00001718, - .frame_header_addr = 0x00001720, - .frame_header_incr = 0x00001724, - .frame_header_cfg = 0x00001728, .irq_subsample_period = 0x00001730, .irq_subsample_pattern = 0x00001734, .framedrop_period = 0x00001738, 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 40bf7427546b..47090497f9b7 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 @@ -2820,7 +2820,6 @@ static int cam_vfe_bus_ver3_update_wm(void *priv, void *cmd_args, uint32_t i, j, k, size = 0; uint32_t frame_inc = 0, val; uint32_t loop_size = 0; - bool frame_header_enable = false; bus_priv = (struct cam_vfe_bus_ver3_priv *) priv; update_buf = (struct cam_isp_hw_get_cmd_update *) cmd_args; @@ -2859,20 +2858,22 @@ static int cam_vfe_bus_ver3_update_wm(void *priv, void *cmd_args, wm_data->en_cfg &= ~(1 << 2); if (update_buf->wm_update->frame_header && - !frame_header_enable) { - wm_data->en_cfg |= 1 << 2; - frame_header_enable = true; - CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j, - wm_data->hw_regs->frame_header_addr, - update_buf->wm_update->frame_header); - CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j, - wm_data->hw_regs->frame_header_cfg, + !update_buf->wm_update->fh_enabled) { + if (wm_data->hw_regs->frame_header_addr) { + wm_data->en_cfg |= 1 << 2; + update_buf->wm_update->fh_enabled = true; + CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j, + wm_data->hw_regs->frame_header_addr, + update_buf->wm_update->frame_header); + CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j, + wm_data->hw_regs->frame_header_cfg, + update_buf->wm_update->local_id); + CAM_DBG(CAM_ISP, + "WM: %d en_cfg 0x%x frame_header %pK local_id %u", + wm_data->index, wm_data->en_cfg, + update_buf->wm_update->frame_header, update_buf->wm_update->local_id); - CAM_DBG(CAM_ISP, - "WM: %d en_cfg 0x%x frame_header %pK local_id %u", - wm_data->index, wm_data->en_cfg, - update_buf->wm_update->frame_header, - update_buf->wm_update->local_id); + } } CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j,