Loading Makefile +2 −0 Original line number Diff line number Diff line # SPDX-License-Identifier: GPL-2.0-only # auto-detect subdirs ifneq ($(CONFIG_ARCH_QTI_VM), y) ifeq ($(CONFIG_ARCH_KONA), y) include $(srctree)/techpack/camera/config/konacamera.conf endif Loading Loading @@ -36,6 +37,7 @@ ifeq ($(CONFIG_ARCH_LAHAINA), y) LINUXINCLUDE += \ -include $(srctree)/techpack/camera/config/lahainacameraconf.h endif endif ifneq (,$(filter $(CONFIG_SPECTRA_CAMERA), y m)) # Use USERINCLUDE when you must reference the UAPI directories only. Loading drivers/cam_cdm/cam_cdm_hw_core.c +27 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "cam_cdm_hw_reg_1_2.h" #include "cam_cdm_hw_reg_2_0.h" #include "camera_main.h" #include "cam_trace.h" #define CAM_CDM_BL_FIFO_WAIT_TIMEOUT 2000 #define CAM_CDM_DBG_GEN_IRQ_USR_DATA 0xff Loading Loading @@ -689,6 +690,8 @@ int cam_hw_cdm_submit_gen_irq( rc = -EIO; } trace_cam_log_event("CDM_START", "CDM_START_IRQ", req->data->cookie, 0); end: return rc; } Loading Loading @@ -1159,6 +1162,19 @@ irqreturn_t cam_hw_cdm_irq(int irq_num, void *data) INIT_WORK((struct work_struct *)&payload[i]->work, cam_hw_cdm_work); trace_cam_log_event("CDM_DONE", "CDM_DONE_IRQ", payload[i]->irq_status, cdm_hw->soc_info.index); if (cam_cdm_write_hw_reg(cdm_hw, cdm_core->offsets->irq_reg[i]->irq_clear, payload[i]->irq_status)) { CAM_ERR(CAM_CDM, "Failed to Write CDM HW IRQ Clear"); kfree(payload[i]); return IRQ_HANDLED; } work_status = queue_work( cdm_core->bl_fifo[i].work_queue, &payload[i]->work); Loading Loading @@ -1654,8 +1670,7 @@ static int cam_hw_cdm_component_bind(struct device *dev, platform_set_drvdata(pdev, cdm_hw_intf); snprintf(cdm_name, sizeof(cdm_name), "%s%d", cdm_hw->soc_info.label_name, cdm_hw->soc_info.index); snprintf(cdm_name, sizeof(cdm_name), "%s", cdm_hw->soc_info.label_name); rc = cam_smmu_get_handle(cdm_name, &cdm_core->iommu_hdl.non_secure); if (rc < 0) { Loading Loading @@ -1766,6 +1781,15 @@ static int cam_hw_cdm_component_bind(struct device *dev, } cdm_hw->open_count++; cdm_core->ops = cam_cdm_get_ops(cdm_core->hw_version, NULL, false); if (!cdm_core->ops) { CAM_ERR(CAM_CDM, "Failed to util ops for hw"); rc = -EINVAL; goto deinit; } if (!cam_cdm_set_cam_hw_version(cdm_core->hw_version, &cdm_core->version)) { CAM_ERR(CAM_CDM, "Failed to set cam hw version for hw"); Loading drivers/cam_cdm/cam_cdm_intf_api.h +8 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,14 @@ int cam_cdm_stream_off(uint32_t handle); */ int cam_cdm_reset_hw(uint32_t handle); /** * @brief : API to publish CDM ops to HW blocks like IFE * * @return : CDM operations * */ struct cam_cdm_utils_ops *cam_cdm_publish_ops(void); /** * @brief : API to register CDM hw to platform framework. * @return struct platform_device pointer on on success, or ERR_PTR() on error. Loading drivers/cam_cpas/cam_cpas_hw.c +14 −0 Original line number Diff line number Diff line Loading @@ -708,6 +708,20 @@ static int cam_cpas_util_apply_client_axi_vote( } mnoc_axi_port_updated[i] = true; } for (i = 0; i < cpas_core->num_camnoc_axi_ports; i++) { if (axi_vote->axi_path[0].camnoc_bw) { /* start case */ cpas_core->camnoc_axi_port[i].additional_bw += CAM_CPAS_DEFAULT_AXI_BW; } else { /* stop case */ cpas_core->camnoc_axi_port[i].additional_bw -= CAM_CPAS_DEFAULT_AXI_BW; } camnoc_axi_port_updated[i] = true; } goto vote_start_clients; } Loading drivers/cam_isp/cam_isp_context.c +161 −91 Original line number Diff line number Diff line Loading @@ -314,45 +314,52 @@ static int cam_isp_ctx_dump_req( size_t *offset, bool dump_to_buff) { int i = 0, rc = 0; int i, j, rc = 0; size_t len = 0; uint32_t *buf_addr; uint32_t *buf_start, *buf_end; size_t remain_len = 0; struct cam_cdm_cmd_buf_dump_info dump_info; uint32_t num_cfg; struct cam_hw_update_entry *cfg; for (i = 0; i < req_isp->num_cfg; i++) { for (j = 0; j < CAM_IFE_HW_NUM_MAX; j++) { num_cfg = req_isp->cfg_info[j].num_hw_entries; cfg = req_isp->cfg_info[j].hw_entries; for (i = 0; i < num_cfg; i++) { rc = cam_packet_util_get_cmd_mem_addr( req_isp->cfg[i].handle, &buf_addr, &len); cfg[i].handle, &buf_addr, &len); if (rc) { CAM_ERR_RATE_LIMIT(CAM_ISP, "Failed to get_cmd_mem_addr, rc=%d", rc); } else { if (req_isp->cfg[i].offset >= ((uint32_t)len)) { if (cfg[i].offset >= ((uint32_t)len)) { CAM_ERR(CAM_ISP, "Invalid offset exp %u actual %u", req_isp->cfg[i].offset, (uint32_t)len); return rc; cfg[i].offset, (uint32_t)len); return -EINVAL; } remain_len = len - req_isp->cfg[i].offset; remain_len = len - cfg[i].offset; if (req_isp->cfg[i].len > if (req_isp->cfg_info[j].hw_entries[i].len > ((uint32_t)remain_len)) { CAM_ERR(CAM_ISP, "Invalid len exp %u remain_len %u", req_isp->cfg[i].len, cfg[i].len, (uint32_t)remain_len); return rc; return -EINVAL; } buf_start = (uint32_t *)((uint8_t *) buf_addr + req_isp->cfg[i].offset); cfg[i].offset); buf_end = (uint32_t *)((uint8_t *) buf_start + req_isp->cfg[i].len - 1); cfg[i].len - 1); if (dump_to_buff) { if (!cpu_addr || !offset || !buf_len) { CAM_ERR(CAM_ISP, "Invalid args"); CAM_ERR(CAM_ISP, "Invalid args"); break; } dump_info.src_start = buf_start; Loading @@ -360,15 +367,18 @@ static int cam_isp_ctx_dump_req( dump_info.dst_start = cpu_addr; dump_info.dst_offset = *offset; dump_info.dst_max_size = buf_len; rc = cam_cdm_util_dump_cmd_bufs_v2(&dump_info); rc = cam_cdm_util_dump_cmd_bufs_v2( &dump_info); *offset = dump_info.dst_offset; if (rc) return rc; } else { cam_cdm_util_dump_cmd_buf(buf_start, buf_end); } else cam_cdm_util_dump_cmd_buf(buf_start, buf_end); } } } return rc; } Loading Loading @@ -419,13 +429,17 @@ static int __cam_isp_ctx_enqueue_request_in_order( static int __cam_isp_ctx_enqueue_init_request( struct cam_context *ctx, struct cam_ctx_request *req) { int rc = 0; int rc = 0, i = 0; struct cam_ctx_request *req_old; struct cam_isp_ctx_req *req_isp_old; struct cam_isp_ctx_req *req_isp_new; struct cam_isp_prepare_hw_update_data *req_update_old; struct cam_isp_prepare_hw_update_data *req_update_new; struct cam_isp_prepare_hw_update_data *hw_update_data; struct cam_hw_update_entry *cfg_old; struct cam_hw_update_entry *cfg_new; uint32_t num_cfg_old; uint32_t num_cfg_new; spin_lock_bh(&ctx->lock); if (list_empty(&ctx->pending_req_list)) { Loading @@ -441,9 +455,12 @@ static int __cam_isp_ctx_enqueue_init_request( req_isp_new = (struct cam_isp_ctx_req *) req->req_priv; if (req_isp_old->hw_update_data.packet_opcode_type == CAM_ISP_PACKET_INIT_DEV) { if ((req_isp_old->num_cfg + req_isp_new->num_cfg) >= if ((req_isp_old->total_num_cfg + req_isp_new->total_num_cfg) >= CAM_ISP_CTX_CFG_MAX) { CAM_WARN(CAM_ISP, "Can not merge INIT pkt"); CAM_WARN(CAM_ISP, "Can not merge INIT pkt total_num_cfgs = %d", (req_isp_old->total_num_cfg + req_isp_new->total_num_cfg)); rc = -ENOMEM; } Loading @@ -468,11 +485,19 @@ static int __cam_isp_ctx_enqueue_init_request( req_isp_old->num_fence_map_in = req_isp_new->num_fence_map_in; memcpy(&req_isp_old->cfg[req_isp_old->num_cfg], req_isp_new->cfg, sizeof(req_isp_new->cfg[0])* req_isp_new->num_cfg); req_isp_old->num_cfg += req_isp_new->num_cfg; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { cfg_old = req_isp_old->cfg_info[i].hw_entries; cfg_new = req_isp_new->cfg_info[i].hw_entries; num_cfg_old = req_isp_old->cfg_info[i].num_hw_entries; num_cfg_new = req_isp_old->cfg_info[i].num_hw_entries; memcpy(&cfg_old[num_cfg_old], cfg_new, sizeof(cfg_new[0]) * num_cfg_new); req_isp_old->cfg_info[i].num_hw_entries += num_cfg_new; } memcpy(&req_old->pf_data, &req->pf_data, sizeof(struct cam_hw_mgr_dump_pf_data)); Loading Loading @@ -757,15 +782,26 @@ static void __cam_isp_ctx_handle_buf_done_fail_log( "Resource Handles that fail to generate buf_done in prev frame"); for (i = 0; i < req_isp->num_fence_map_out; i++) { if (req_isp->fence_map_out[i].sync_id != -1) { if (isp_device_type == CAM_IFE_DEVICE_TYPE) if (isp_device_type == CAM_IFE_DEVICE_TYPE) { handle_type = __cam_isp_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle); else trace_cam_log_event("Buf_done Congestion", __cam_isp_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle), request_id, req_isp->fence_map_out[i].sync_id); } else { handle_type = __cam_isp_tfe_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle); trace_cam_log_event("Buf_done Congestion", __cam_isp_tfe_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle), request_id, req_isp->fence_map_out[i].sync_id); } CAM_WARN(CAM_ISP, "Resource_Handle: [%s][0x%x] Sync_ID: [0x%x]", handle_type, Loading Loading @@ -848,6 +884,9 @@ static int __cam_isp_ctx_handle_buf_done_for_request( "Duplicate BUF_DONE for req %lld : i=%d, j=%d, res=%s", req->request_id, i, j, handle_type); trace_cam_log_event("Duplicate BufDone", handle_type, req->request_id, ctx->ctx_id); if (done_next_req) { done_next_req->resource_handle [done_next_req->num_handles++] = Loading Loading @@ -1049,12 +1088,12 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( static int __cam_isp_ctx_apply_req_offline( void *priv, void *data) { int rc = 0; int rc = 0, i = 0; struct cam_context *ctx = NULL; struct cam_isp_context *ctx_isp = priv; struct cam_ctx_request *req; struct cam_isp_ctx_req *req_isp; struct cam_hw_config_args cfg; struct cam_isp_hw_config_args cfg; if (!ctx_isp) { CAM_ERR(CAM_ISP, "Invalid ctx_isp:%pK", ctx); Loading Loading @@ -1088,8 +1127,12 @@ static int __cam_isp_ctx_apply_req_offline( cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; cfg.request_id = req->request_id; cfg.hw_update_entries = req_isp->cfg; cfg.num_hw_update_entries = req_isp->num_cfg; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { cfg.hw_update_info[i].num_hw_entries = req_isp->cfg_info[i].num_hw_entries; cfg.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; } cfg.priv = &req_isp->hw_update_data; cfg.init_packet = 0; Loading Loading @@ -1528,6 +1571,8 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, CAM_WARN(CAM_ISP, "Notify CRM about Bubble req %lld frame %lld, ctx %u", req->request_id, ctx_isp->frame_id, ctx->ctx_id); trace_cam_log_event("Bubble", "Rcvd epoch in applied state", req->request_id, ctx->ctx_id); ctx->ctx_crm_intf->notify_err(¬ify); atomic_set(&ctx_isp->process_bubble, 1); } else { Loading Loading @@ -2455,13 +2500,13 @@ static int __cam_isp_ctx_apply_req_in_activated_state( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply, enum cam_isp_ctx_activated_substate next_state) { int rc = 0; int rc = 0, i; struct cam_ctx_request *req; struct cam_ctx_request *active_req = NULL; struct cam_isp_ctx_req *req_isp; struct cam_isp_ctx_req *active_req_isp; struct cam_isp_context *ctx_isp = NULL; struct cam_hw_config_args cfg; struct cam_isp_hw_config_args isp_cfg; if (list_empty(&ctx->pending_req_list)) { CAM_ERR(CAM_ISP, "No available request for Apply id %lld", Loading Loading @@ -2547,15 +2592,22 @@ static int __cam_isp_ctx_apply_req_in_activated_state( } req_isp->bubble_report = apply->report_if_bubble; cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; cfg.request_id = req->request_id; cfg.hw_update_entries = req_isp->cfg; cfg.num_hw_update_entries = req_isp->num_cfg; cfg.priv = &req_isp->hw_update_data; cfg.init_packet = 0; cfg.reapply = req_isp->reapply; memset(&isp_cfg, 0, sizeof(isp_cfg)); rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv, &cfg); isp_cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; isp_cfg.request_id = req->request_id; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { isp_cfg.hw_update_info[i].num_hw_entries = req_isp->cfg_info[i].num_hw_entries; isp_cfg.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; } isp_cfg.priv = &req_isp->hw_update_data; isp_cfg.init_packet = 0; isp_cfg.reapply = req_isp->reapply; rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv, &isp_cfg); if (rc) { CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not apply the configuration"); } else { Loading Loading @@ -3759,7 +3811,7 @@ static int __cam_isp_ctx_config_dev_in_top_state( struct cam_packet *packet; size_t len = 0; size_t remain_len = 0; struct cam_hw_prepare_update_args cfg; struct cam_isp_hw_update_args isp_cfg; struct cam_req_mgr_add_request add_req; struct cam_isp_context *ctx_isp = (struct cam_isp_context *) ctx->ctx_priv; Loading Loading @@ -3840,31 +3892,43 @@ static int __cam_isp_ctx_config_dev_in_top_state( } /* preprocess the configuration */ memset(&cfg, 0, sizeof(cfg)); cfg.packet = packet; cfg.remain_len = remain_len; cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; cfg.max_hw_update_entries = CAM_ISP_CTX_CFG_MAX; cfg.hw_update_entries = req_isp->cfg; cfg.max_out_map_entries = CAM_ISP_CTX_RES_MAX; cfg.max_in_map_entries = CAM_ISP_CTX_RES_MAX; cfg.out_map_entries = req_isp->fence_map_out; cfg.in_map_entries = req_isp->fence_map_in; cfg.priv = &req_isp->hw_update_data; cfg.pf_data = &(req->pf_data); memset(&isp_cfg, 0, sizeof(isp_cfg)); isp_cfg.packet = packet; isp_cfg.remain_len = remain_len; isp_cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; isp_cfg.max_hw_update_entries = CAM_ISP_CTX_CFG_MAX; isp_cfg.max_out_map_entries = CAM_ISP_CTX_RES_MAX; isp_cfg.max_in_map_entries = CAM_ISP_CTX_RES_MAX; isp_cfg.out_map_entries = req_isp->fence_map_out; isp_cfg.in_map_entries = req_isp->fence_map_in; isp_cfg.priv = &req_isp->hw_update_data; isp_cfg.pf_data = &(req->pf_data); for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) isp_cfg.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; CAM_DBG(CAM_ISP, "try to prepare config packet......"); rc = ctx->hw_mgr_intf->hw_prepare_update( ctx->hw_mgr_intf->hw_mgr_priv, &cfg); ctx->hw_mgr_intf->hw_mgr_priv, &isp_cfg); if (rc != 0) { CAM_ERR(CAM_ISP, "Prepare config packet failed in HW layer"); rc = -EFAULT; goto free_req; } req_isp->num_cfg = cfg.num_hw_update_entries; req_isp->num_fence_map_out = cfg.num_out_map_entries; req_isp->num_fence_map_in = cfg.num_in_map_entries; req_isp->total_num_cfg = 0; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { req_isp->cfg_info[i].num_hw_entries = isp_cfg.hw_update_info[i].num_hw_entries; req_isp->total_num_cfg += req_isp->cfg_info[i].num_hw_entries; } req_isp->num_fence_map_out = isp_cfg.num_out_map_entries; req_isp->num_fence_map_in = isp_cfg.num_in_map_entries; req_isp->num_acked = 0; req_isp->bubble_detected = false; Loading @@ -3878,7 +3942,7 @@ static int __cam_isp_ctx_config_dev_in_top_state( } CAM_DBG(CAM_ISP, "num_entry: %d, num fence out: %d, num fence in: %d", req_isp->num_cfg, req_isp->num_fence_map_out, req_isp->total_num_cfg, req_isp->num_fence_map_out, req_isp->num_fence_map_in); req->request_id = packet->header.request_id; Loading Loading @@ -4606,8 +4670,14 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, start_isp.hw_config.ctxt_to_hw_map = ctx_isp->hw_ctx; start_isp.hw_config.request_id = req->request_id; start_isp.hw_config.hw_update_entries = req_isp->cfg; start_isp.hw_config.num_hw_update_entries = req_isp->num_cfg; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { start_isp.hw_config.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; start_isp.hw_config.hw_update_info[i].num_hw_entries = req_isp->cfg_info[i].num_hw_entries; } start_isp.hw_config.priv = &req_isp->hw_update_data; start_isp.hw_config.init_packet = 1; start_isp.hw_config.reapply = 0; Loading Loading
Makefile +2 −0 Original line number Diff line number Diff line # SPDX-License-Identifier: GPL-2.0-only # auto-detect subdirs ifneq ($(CONFIG_ARCH_QTI_VM), y) ifeq ($(CONFIG_ARCH_KONA), y) include $(srctree)/techpack/camera/config/konacamera.conf endif Loading Loading @@ -36,6 +37,7 @@ ifeq ($(CONFIG_ARCH_LAHAINA), y) LINUXINCLUDE += \ -include $(srctree)/techpack/camera/config/lahainacameraconf.h endif endif ifneq (,$(filter $(CONFIG_SPECTRA_CAMERA), y m)) # Use USERINCLUDE when you must reference the UAPI directories only. Loading
drivers/cam_cdm/cam_cdm_hw_core.c +27 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "cam_cdm_hw_reg_1_2.h" #include "cam_cdm_hw_reg_2_0.h" #include "camera_main.h" #include "cam_trace.h" #define CAM_CDM_BL_FIFO_WAIT_TIMEOUT 2000 #define CAM_CDM_DBG_GEN_IRQ_USR_DATA 0xff Loading Loading @@ -689,6 +690,8 @@ int cam_hw_cdm_submit_gen_irq( rc = -EIO; } trace_cam_log_event("CDM_START", "CDM_START_IRQ", req->data->cookie, 0); end: return rc; } Loading Loading @@ -1159,6 +1162,19 @@ irqreturn_t cam_hw_cdm_irq(int irq_num, void *data) INIT_WORK((struct work_struct *)&payload[i]->work, cam_hw_cdm_work); trace_cam_log_event("CDM_DONE", "CDM_DONE_IRQ", payload[i]->irq_status, cdm_hw->soc_info.index); if (cam_cdm_write_hw_reg(cdm_hw, cdm_core->offsets->irq_reg[i]->irq_clear, payload[i]->irq_status)) { CAM_ERR(CAM_CDM, "Failed to Write CDM HW IRQ Clear"); kfree(payload[i]); return IRQ_HANDLED; } work_status = queue_work( cdm_core->bl_fifo[i].work_queue, &payload[i]->work); Loading Loading @@ -1654,8 +1670,7 @@ static int cam_hw_cdm_component_bind(struct device *dev, platform_set_drvdata(pdev, cdm_hw_intf); snprintf(cdm_name, sizeof(cdm_name), "%s%d", cdm_hw->soc_info.label_name, cdm_hw->soc_info.index); snprintf(cdm_name, sizeof(cdm_name), "%s", cdm_hw->soc_info.label_name); rc = cam_smmu_get_handle(cdm_name, &cdm_core->iommu_hdl.non_secure); if (rc < 0) { Loading Loading @@ -1766,6 +1781,15 @@ static int cam_hw_cdm_component_bind(struct device *dev, } cdm_hw->open_count++; cdm_core->ops = cam_cdm_get_ops(cdm_core->hw_version, NULL, false); if (!cdm_core->ops) { CAM_ERR(CAM_CDM, "Failed to util ops for hw"); rc = -EINVAL; goto deinit; } if (!cam_cdm_set_cam_hw_version(cdm_core->hw_version, &cdm_core->version)) { CAM_ERR(CAM_CDM, "Failed to set cam hw version for hw"); Loading
drivers/cam_cdm/cam_cdm_intf_api.h +8 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,14 @@ int cam_cdm_stream_off(uint32_t handle); */ int cam_cdm_reset_hw(uint32_t handle); /** * @brief : API to publish CDM ops to HW blocks like IFE * * @return : CDM operations * */ struct cam_cdm_utils_ops *cam_cdm_publish_ops(void); /** * @brief : API to register CDM hw to platform framework. * @return struct platform_device pointer on on success, or ERR_PTR() on error. Loading
drivers/cam_cpas/cam_cpas_hw.c +14 −0 Original line number Diff line number Diff line Loading @@ -708,6 +708,20 @@ static int cam_cpas_util_apply_client_axi_vote( } mnoc_axi_port_updated[i] = true; } for (i = 0; i < cpas_core->num_camnoc_axi_ports; i++) { if (axi_vote->axi_path[0].camnoc_bw) { /* start case */ cpas_core->camnoc_axi_port[i].additional_bw += CAM_CPAS_DEFAULT_AXI_BW; } else { /* stop case */ cpas_core->camnoc_axi_port[i].additional_bw -= CAM_CPAS_DEFAULT_AXI_BW; } camnoc_axi_port_updated[i] = true; } goto vote_start_clients; } Loading
drivers/cam_isp/cam_isp_context.c +161 −91 Original line number Diff line number Diff line Loading @@ -314,45 +314,52 @@ static int cam_isp_ctx_dump_req( size_t *offset, bool dump_to_buff) { int i = 0, rc = 0; int i, j, rc = 0; size_t len = 0; uint32_t *buf_addr; uint32_t *buf_start, *buf_end; size_t remain_len = 0; struct cam_cdm_cmd_buf_dump_info dump_info; uint32_t num_cfg; struct cam_hw_update_entry *cfg; for (i = 0; i < req_isp->num_cfg; i++) { for (j = 0; j < CAM_IFE_HW_NUM_MAX; j++) { num_cfg = req_isp->cfg_info[j].num_hw_entries; cfg = req_isp->cfg_info[j].hw_entries; for (i = 0; i < num_cfg; i++) { rc = cam_packet_util_get_cmd_mem_addr( req_isp->cfg[i].handle, &buf_addr, &len); cfg[i].handle, &buf_addr, &len); if (rc) { CAM_ERR_RATE_LIMIT(CAM_ISP, "Failed to get_cmd_mem_addr, rc=%d", rc); } else { if (req_isp->cfg[i].offset >= ((uint32_t)len)) { if (cfg[i].offset >= ((uint32_t)len)) { CAM_ERR(CAM_ISP, "Invalid offset exp %u actual %u", req_isp->cfg[i].offset, (uint32_t)len); return rc; cfg[i].offset, (uint32_t)len); return -EINVAL; } remain_len = len - req_isp->cfg[i].offset; remain_len = len - cfg[i].offset; if (req_isp->cfg[i].len > if (req_isp->cfg_info[j].hw_entries[i].len > ((uint32_t)remain_len)) { CAM_ERR(CAM_ISP, "Invalid len exp %u remain_len %u", req_isp->cfg[i].len, cfg[i].len, (uint32_t)remain_len); return rc; return -EINVAL; } buf_start = (uint32_t *)((uint8_t *) buf_addr + req_isp->cfg[i].offset); cfg[i].offset); buf_end = (uint32_t *)((uint8_t *) buf_start + req_isp->cfg[i].len - 1); cfg[i].len - 1); if (dump_to_buff) { if (!cpu_addr || !offset || !buf_len) { CAM_ERR(CAM_ISP, "Invalid args"); CAM_ERR(CAM_ISP, "Invalid args"); break; } dump_info.src_start = buf_start; Loading @@ -360,15 +367,18 @@ static int cam_isp_ctx_dump_req( dump_info.dst_start = cpu_addr; dump_info.dst_offset = *offset; dump_info.dst_max_size = buf_len; rc = cam_cdm_util_dump_cmd_bufs_v2(&dump_info); rc = cam_cdm_util_dump_cmd_bufs_v2( &dump_info); *offset = dump_info.dst_offset; if (rc) return rc; } else { cam_cdm_util_dump_cmd_buf(buf_start, buf_end); } else cam_cdm_util_dump_cmd_buf(buf_start, buf_end); } } } return rc; } Loading Loading @@ -419,13 +429,17 @@ static int __cam_isp_ctx_enqueue_request_in_order( static int __cam_isp_ctx_enqueue_init_request( struct cam_context *ctx, struct cam_ctx_request *req) { int rc = 0; int rc = 0, i = 0; struct cam_ctx_request *req_old; struct cam_isp_ctx_req *req_isp_old; struct cam_isp_ctx_req *req_isp_new; struct cam_isp_prepare_hw_update_data *req_update_old; struct cam_isp_prepare_hw_update_data *req_update_new; struct cam_isp_prepare_hw_update_data *hw_update_data; struct cam_hw_update_entry *cfg_old; struct cam_hw_update_entry *cfg_new; uint32_t num_cfg_old; uint32_t num_cfg_new; spin_lock_bh(&ctx->lock); if (list_empty(&ctx->pending_req_list)) { Loading @@ -441,9 +455,12 @@ static int __cam_isp_ctx_enqueue_init_request( req_isp_new = (struct cam_isp_ctx_req *) req->req_priv; if (req_isp_old->hw_update_data.packet_opcode_type == CAM_ISP_PACKET_INIT_DEV) { if ((req_isp_old->num_cfg + req_isp_new->num_cfg) >= if ((req_isp_old->total_num_cfg + req_isp_new->total_num_cfg) >= CAM_ISP_CTX_CFG_MAX) { CAM_WARN(CAM_ISP, "Can not merge INIT pkt"); CAM_WARN(CAM_ISP, "Can not merge INIT pkt total_num_cfgs = %d", (req_isp_old->total_num_cfg + req_isp_new->total_num_cfg)); rc = -ENOMEM; } Loading @@ -468,11 +485,19 @@ static int __cam_isp_ctx_enqueue_init_request( req_isp_old->num_fence_map_in = req_isp_new->num_fence_map_in; memcpy(&req_isp_old->cfg[req_isp_old->num_cfg], req_isp_new->cfg, sizeof(req_isp_new->cfg[0])* req_isp_new->num_cfg); req_isp_old->num_cfg += req_isp_new->num_cfg; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { cfg_old = req_isp_old->cfg_info[i].hw_entries; cfg_new = req_isp_new->cfg_info[i].hw_entries; num_cfg_old = req_isp_old->cfg_info[i].num_hw_entries; num_cfg_new = req_isp_old->cfg_info[i].num_hw_entries; memcpy(&cfg_old[num_cfg_old], cfg_new, sizeof(cfg_new[0]) * num_cfg_new); req_isp_old->cfg_info[i].num_hw_entries += num_cfg_new; } memcpy(&req_old->pf_data, &req->pf_data, sizeof(struct cam_hw_mgr_dump_pf_data)); Loading Loading @@ -757,15 +782,26 @@ static void __cam_isp_ctx_handle_buf_done_fail_log( "Resource Handles that fail to generate buf_done in prev frame"); for (i = 0; i < req_isp->num_fence_map_out; i++) { if (req_isp->fence_map_out[i].sync_id != -1) { if (isp_device_type == CAM_IFE_DEVICE_TYPE) if (isp_device_type == CAM_IFE_DEVICE_TYPE) { handle_type = __cam_isp_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle); else trace_cam_log_event("Buf_done Congestion", __cam_isp_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle), request_id, req_isp->fence_map_out[i].sync_id); } else { handle_type = __cam_isp_tfe_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle); trace_cam_log_event("Buf_done Congestion", __cam_isp_tfe_resource_handle_id_to_type( req_isp->fence_map_out[i].resource_handle), request_id, req_isp->fence_map_out[i].sync_id); } CAM_WARN(CAM_ISP, "Resource_Handle: [%s][0x%x] Sync_ID: [0x%x]", handle_type, Loading Loading @@ -848,6 +884,9 @@ static int __cam_isp_ctx_handle_buf_done_for_request( "Duplicate BUF_DONE for req %lld : i=%d, j=%d, res=%s", req->request_id, i, j, handle_type); trace_cam_log_event("Duplicate BufDone", handle_type, req->request_id, ctx->ctx_id); if (done_next_req) { done_next_req->resource_handle [done_next_req->num_handles++] = Loading Loading @@ -1049,12 +1088,12 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( static int __cam_isp_ctx_apply_req_offline( void *priv, void *data) { int rc = 0; int rc = 0, i = 0; struct cam_context *ctx = NULL; struct cam_isp_context *ctx_isp = priv; struct cam_ctx_request *req; struct cam_isp_ctx_req *req_isp; struct cam_hw_config_args cfg; struct cam_isp_hw_config_args cfg; if (!ctx_isp) { CAM_ERR(CAM_ISP, "Invalid ctx_isp:%pK", ctx); Loading Loading @@ -1088,8 +1127,12 @@ static int __cam_isp_ctx_apply_req_offline( cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; cfg.request_id = req->request_id; cfg.hw_update_entries = req_isp->cfg; cfg.num_hw_update_entries = req_isp->num_cfg; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { cfg.hw_update_info[i].num_hw_entries = req_isp->cfg_info[i].num_hw_entries; cfg.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; } cfg.priv = &req_isp->hw_update_data; cfg.init_packet = 0; Loading Loading @@ -1528,6 +1571,8 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, CAM_WARN(CAM_ISP, "Notify CRM about Bubble req %lld frame %lld, ctx %u", req->request_id, ctx_isp->frame_id, ctx->ctx_id); trace_cam_log_event("Bubble", "Rcvd epoch in applied state", req->request_id, ctx->ctx_id); ctx->ctx_crm_intf->notify_err(¬ify); atomic_set(&ctx_isp->process_bubble, 1); } else { Loading Loading @@ -2455,13 +2500,13 @@ static int __cam_isp_ctx_apply_req_in_activated_state( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply, enum cam_isp_ctx_activated_substate next_state) { int rc = 0; int rc = 0, i; struct cam_ctx_request *req; struct cam_ctx_request *active_req = NULL; struct cam_isp_ctx_req *req_isp; struct cam_isp_ctx_req *active_req_isp; struct cam_isp_context *ctx_isp = NULL; struct cam_hw_config_args cfg; struct cam_isp_hw_config_args isp_cfg; if (list_empty(&ctx->pending_req_list)) { CAM_ERR(CAM_ISP, "No available request for Apply id %lld", Loading Loading @@ -2547,15 +2592,22 @@ static int __cam_isp_ctx_apply_req_in_activated_state( } req_isp->bubble_report = apply->report_if_bubble; cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; cfg.request_id = req->request_id; cfg.hw_update_entries = req_isp->cfg; cfg.num_hw_update_entries = req_isp->num_cfg; cfg.priv = &req_isp->hw_update_data; cfg.init_packet = 0; cfg.reapply = req_isp->reapply; memset(&isp_cfg, 0, sizeof(isp_cfg)); rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv, &cfg); isp_cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; isp_cfg.request_id = req->request_id; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { isp_cfg.hw_update_info[i].num_hw_entries = req_isp->cfg_info[i].num_hw_entries; isp_cfg.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; } isp_cfg.priv = &req_isp->hw_update_data; isp_cfg.init_packet = 0; isp_cfg.reapply = req_isp->reapply; rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv, &isp_cfg); if (rc) { CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not apply the configuration"); } else { Loading Loading @@ -3759,7 +3811,7 @@ static int __cam_isp_ctx_config_dev_in_top_state( struct cam_packet *packet; size_t len = 0; size_t remain_len = 0; struct cam_hw_prepare_update_args cfg; struct cam_isp_hw_update_args isp_cfg; struct cam_req_mgr_add_request add_req; struct cam_isp_context *ctx_isp = (struct cam_isp_context *) ctx->ctx_priv; Loading Loading @@ -3840,31 +3892,43 @@ static int __cam_isp_ctx_config_dev_in_top_state( } /* preprocess the configuration */ memset(&cfg, 0, sizeof(cfg)); cfg.packet = packet; cfg.remain_len = remain_len; cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; cfg.max_hw_update_entries = CAM_ISP_CTX_CFG_MAX; cfg.hw_update_entries = req_isp->cfg; cfg.max_out_map_entries = CAM_ISP_CTX_RES_MAX; cfg.max_in_map_entries = CAM_ISP_CTX_RES_MAX; cfg.out_map_entries = req_isp->fence_map_out; cfg.in_map_entries = req_isp->fence_map_in; cfg.priv = &req_isp->hw_update_data; cfg.pf_data = &(req->pf_data); memset(&isp_cfg, 0, sizeof(isp_cfg)); isp_cfg.packet = packet; isp_cfg.remain_len = remain_len; isp_cfg.ctxt_to_hw_map = ctx_isp->hw_ctx; isp_cfg.max_hw_update_entries = CAM_ISP_CTX_CFG_MAX; isp_cfg.max_out_map_entries = CAM_ISP_CTX_RES_MAX; isp_cfg.max_in_map_entries = CAM_ISP_CTX_RES_MAX; isp_cfg.out_map_entries = req_isp->fence_map_out; isp_cfg.in_map_entries = req_isp->fence_map_in; isp_cfg.priv = &req_isp->hw_update_data; isp_cfg.pf_data = &(req->pf_data); for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) isp_cfg.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; CAM_DBG(CAM_ISP, "try to prepare config packet......"); rc = ctx->hw_mgr_intf->hw_prepare_update( ctx->hw_mgr_intf->hw_mgr_priv, &cfg); ctx->hw_mgr_intf->hw_mgr_priv, &isp_cfg); if (rc != 0) { CAM_ERR(CAM_ISP, "Prepare config packet failed in HW layer"); rc = -EFAULT; goto free_req; } req_isp->num_cfg = cfg.num_hw_update_entries; req_isp->num_fence_map_out = cfg.num_out_map_entries; req_isp->num_fence_map_in = cfg.num_in_map_entries; req_isp->total_num_cfg = 0; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { req_isp->cfg_info[i].num_hw_entries = isp_cfg.hw_update_info[i].num_hw_entries; req_isp->total_num_cfg += req_isp->cfg_info[i].num_hw_entries; } req_isp->num_fence_map_out = isp_cfg.num_out_map_entries; req_isp->num_fence_map_in = isp_cfg.num_in_map_entries; req_isp->num_acked = 0; req_isp->bubble_detected = false; Loading @@ -3878,7 +3942,7 @@ static int __cam_isp_ctx_config_dev_in_top_state( } CAM_DBG(CAM_ISP, "num_entry: %d, num fence out: %d, num fence in: %d", req_isp->num_cfg, req_isp->num_fence_map_out, req_isp->total_num_cfg, req_isp->num_fence_map_out, req_isp->num_fence_map_in); req->request_id = packet->header.request_id; Loading Loading @@ -4606,8 +4670,14 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, start_isp.hw_config.ctxt_to_hw_map = ctx_isp->hw_ctx; start_isp.hw_config.request_id = req->request_id; start_isp.hw_config.hw_update_entries = req_isp->cfg; start_isp.hw_config.num_hw_update_entries = req_isp->num_cfg; for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) { start_isp.hw_config.hw_update_info[i].hw_entries = req_isp->cfg_info[i].hw_entries; start_isp.hw_config.hw_update_info[i].num_hw_entries = req_isp->cfg_info[i].num_hw_entries; } start_isp.hw_config.priv = &req_isp->hw_update_data; start_isp.hw_config.init_packet = 1; start_isp.hw_config.reapply = 0; Loading