diff --git a/drivers/cam_core/cam_context.h b/drivers/cam_core/cam_context.h index d4c07994ee..1e621f7813 100644 --- a/drivers/cam_core/cam_context.h +++ b/drivers/cam_core/cam_context.h @@ -211,7 +211,7 @@ struct cam_ctx_ops { * @ctxt_to_hw_map: Context to hardware mapping pointer * @hw_mgr_ctx_id: Hw Mgr context id returned from hw mgr * @ctx_id_string: Context id string constructed with dev type, - * ctx id, hw mgr ctx id + * ctx id, hw mgr ctx id, hw id * @refcount: Context object refcount * @node: The main node to which this context belongs * @sync_mutex: mutex to sync with sync cb thread diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index b6cd221e06..ec7d9e67c7 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -7373,6 +7373,8 @@ static int __cam_isp_ctx_acquire_hw_v2(struct cam_context *ctx, for (j = 0; j < CAM_MAX_HW_SPLIT; j++) cmd->hw_info.acquired_hw_path[i][j] = param.acquired_hw_path[i][j]; + + ctx_isp->hw_idx = param.acquired_hw_id[0]; } cmd->hw_info.valid_acquired_hw = param.valid_acquired_hw; @@ -7430,6 +7432,14 @@ static int __cam_isp_ctx_acquire_hw_v2(struct cam_context *ctx, ctx_isp->hw_ctx = param.ctxt_to_hw_map; ctx_isp->hw_acquired = true; ctx->ctxt_to_hw_map = param.ctxt_to_hw_map; + ctx->hw_mgr_ctx_id = param.hw_mgr_ctx_id; + + snprintf(ctx->ctx_id_string, sizeof(ctx->ctx_id_string), + "%s_ctx[%d]_hwmgrctx[%d]_hwidx[0x%x]", + ctx->dev_name, + ctx->ctx_id, + ctx->hw_mgr_ctx_id, + ctx_isp->hw_idx); trace_cam_context_state("ISP", ctx); CAM_INFO(CAM_ISP, @@ -8393,6 +8403,66 @@ static int __cam_isp_ctx_apply_default_settings( return rc; } +void __cam_isp_ctx_notify_cpas(struct cam_context *ctx, uint32_t evt_id) +{ + uint64_t request_id = 0; + struct cam_isp_context *ctx_isp = + (struct cam_isp_context *)ctx->ctx_priv; + struct cam_ctx_request *req = NULL; + char ctx_evt_id_string[128]; + + switch (evt_id) { + case CAM_ISP_HW_EVENT_SOF: + if (!list_empty(&ctx->wait_req_list)) { + req = list_first_entry(&ctx->wait_req_list, struct cam_ctx_request, list); + request_id = req->request_id; + } else + request_id = 0; + if (ctx_isp->substate_activated == CAM_ISP_CTX_ACTIVATED_EPOCH && + !list_empty(&ctx->active_req_list)) { + req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); + request_id = req->request_id; + CAM_DBG(CAM_ISP, "EPCR notify cpas"); + } + break; + case CAM_ISP_HW_EVENT_EOF: + if (!list_empty(&ctx->active_req_list)) { + req = list_first_entry(&ctx->active_req_list, struct cam_ctx_request, list); + request_id = req->request_id; + } else + request_id = 0; + break; + case CAM_ISP_HW_EVENT_EPOCH: + if (list_empty(&ctx->wait_req_list)) { + if (!list_empty(&ctx->active_req_list)) { + req = list_last_entry(&ctx->active_req_list, + struct cam_ctx_request, list); + request_id = req->request_id; + } else + request_id = 0; + } else { + req = list_first_entry(&ctx->wait_req_list, struct cam_ctx_request, list); + request_id = req->request_id; + } + break; + default: + return; + } + + snprintf(ctx_evt_id_string, sizeof(ctx_evt_id_string), + "%s_frame[%llu]_%s", + ctx->ctx_id_string, + ctx_isp->frame_id, + cam_isp_hw_evt_type_to_string(evt_id)); + CAM_DBG(CAM_ISP, "Substate[%s] ctx: %s frame: %llu evt: %s req: %llu", + __cam_isp_ctx_substate_val_to_type(ctx_isp->substate_activated), + ctx->ctx_id_string, + ctx_isp->frame_id, + cam_isp_hw_evt_type_to_string(evt_id), + request_id); + cam_cpas_notify_event(ctx_evt_id_string, request_id); +} + static int __cam_isp_ctx_handle_irq_in_activated(void *context, uint32_t evt_id, void *evt_data) { @@ -8428,7 +8498,8 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context, (evt_id == CAM_ISP_HW_EVENT_EPOCH)) __cam_isp_ctx_update_frame_timing_record(evt_id, ctx_isp); - CAM_DBG(CAM_ISP, "Exit: State %d Substate[%s] on ctx: %d", + __cam_isp_ctx_notify_cpas(ctx, evt_id); + CAM_DBG(CAM_ISP, "Exit: State %d Substate[%s], ctx: %u link: 0x%x", ctx->state, __cam_isp_ctx_substate_val_to_type( ctx_isp->substate_activated), ctx->ctx_id, ctx->link_hdl); diff --git a/drivers/cam_isp/cam_isp_context.h b/drivers/cam_isp/cam_isp_context.h index 653538efda..a35964bb18 100644 --- a/drivers/cam_isp/cam_isp_context.h +++ b/drivers/cam_isp/cam_isp_context.h @@ -372,6 +372,7 @@ struct cam_isp_context_debug_monitors { * This is decided based on the max mode switch delay published * by other devices on the link as part of link setup * @mode_switch_en: Indicates if mode switch is enabled + * @hw_idx: Hardware ID * */ struct cam_isp_context { @@ -437,6 +438,7 @@ struct cam_isp_context { atomic_t mswitch_default_apply_delay_ref_cnt; bool handle_mswitch; bool mode_switch_en; + uint32_t hw_idx; }; /** diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c index fc606fc074..4be5cbf591 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c @@ -1414,8 +1414,6 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, payload->ts.mono_time.tv_nsec; } - cam_cpas_notify_event("IFE SOF", evt_info.hw_idx); - if (camif_priv->event_cb) camif_priv->event_cb(camif_priv->priv, CAM_ISP_HW_EVENT_SOF, (void *)&evt_info); @@ -1432,8 +1430,6 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, camif_priv->epoch_ts.tv_nsec = payload->ts.mono_time.tv_nsec; - cam_cpas_notify_event("IFE EPOCH", evt_info.hw_idx); - if (camif_priv->event_cb) camif_priv->event_cb(camif_priv->priv, CAM_ISP_HW_EVENT_EPOCH, (void *)&evt_info); @@ -1449,8 +1445,6 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, camif_priv->eof_ts.tv_nsec = payload->ts.mono_time.tv_nsec; - cam_cpas_notify_event("IFE EOF", evt_info.hw_idx); - if (camif_priv->event_cb) camif_priv->event_cb(camif_priv->priv, CAM_ISP_HW_EVENT_EOF, (void *)&evt_info); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver4.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver4.c index ac2cca324f..5450f6ab8a 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver4.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver4.c @@ -1319,8 +1319,6 @@ static int cam_vfe_handle_sof(struct cam_vfe_mux_ver4_data *vfe_priv, } vfe_priv->top_priv->sof_cnt++; - cam_cpas_notify_event("IFE SOF", vfe_priv->hw_intf->hw_idx); - return 0; } @@ -1333,7 +1331,6 @@ static int cam_vfe_handle_epoch(struct cam_vfe_mux_ver4_data *vfe_priv, vfe_priv->epoch_ts.tv_sec = payload->ts.mono_time.tv_sec; vfe_priv->epoch_ts.tv_nsec = payload->ts.mono_time.tv_nsec; - cam_cpas_notify_event("IFE EPOCH", vfe_priv->hw_intf->hw_idx); return 0; } @@ -1355,7 +1352,6 @@ static int cam_vfe_handle_eof(struct cam_vfe_mux_ver4_data *vfe_priv, vfe_priv->eof_ts.tv_sec = payload->ts.mono_time.tv_sec; vfe_priv->eof_ts.tv_nsec = payload->ts.mono_time.tv_nsec; - cam_cpas_notify_event("IFE EOF", vfe_priv->hw_intf->hw_idx); return 0; }