diff options
author | Nick Chung <nickchung@google.com> | 2020-05-25 14:00:59 +0800 |
---|---|---|
committer | Nick Chung <nickchung@google.com> | 2020-05-28 04:55:21 +0000 |
commit | 58fa5351fbef3c40d854c9ef514bffcbb35608c9 (patch) | |
tree | d5d7d3fbdd18d451a698b22105ce97dddfa3f3d6 | |
parent | 63a282f67a297f355ee9f91f54a797eee135cb70 (diff) | |
download | camera-kernel-58fa5351fbef3c40d854c9ef514bffcbb35608c9.tar.gz |
techpack: camera: Publish timestamps of VCM trigger and BF
Publish AF IFE HW stats(BF) timestamp to UMD through
cam_req_mgr_notify_message function.
Publish VCM trigger timestamp to UMD through
sending the data buffer to UMD receiver.
Bug: 149801288
Test: build pass, publish timestamp from KMD to UMD
Change-Id: Ib7daacbdb0c4ca5a0ab6310b3578d346970fd6e4
Signed-off-by: Nick Chung <nickchung@google.com>
-rw-r--r-- | drivers/cam_isp/cam_isp_context.c | 18 | ||||
-rw-r--r-- | drivers/cam_isp/cam_isp_context.h | 1 | ||||
-rw-r--r-- | drivers/cam_sensor_module/cam_actuator/cam_actuator_core.c | 24 | ||||
-rw-r--r-- | include/uapi/media/cam_req_mgr.h | 2 |
4 files changed, 43 insertions, 2 deletions
diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index 8c5536c..0edea5b 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -617,6 +617,7 @@ static void __cam_isp_ctx_send_sof_boot_timestamp( req_msg.u.frame_msg.frame_id = ctx_isp->frame_id; req_msg.u.frame_msg.request_id = request_id; req_msg.u.frame_msg.timestamp = ctx_isp->boot_timestamp; + req_msg.u.frame_msg.bf_timestamp = ctx_isp->bf_timestamp; req_msg.u.frame_msg.link_hdl = ctx_isp->base->link_hdl; req_msg.u.frame_msg.sof_status = sof_event_status; req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta; @@ -628,9 +629,11 @@ static void __cam_isp_ctx_send_sof_boot_timestamp( } CAM_DBG(CAM_ISP, - "request id:%lld frame number:%lld boot time stamp:0x%llx status:%u", + "request id:%lld frame number:%lld boot time stamp:0x%llx, bf timestamp:%llu status:%u", request_id, ctx_isp->frame_id, - ctx_isp->boot_timestamp, sof_event_status); + ctx_isp->boot_timestamp, + ctx_isp->bf_timestamp, + sof_event_status); if (cam_req_mgr_notify_message(&req_msg, V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS, @@ -757,6 +760,8 @@ static int __cam_isp_ctx_handle_buf_done_for_request( struct cam_isp_ctx_req *req_isp; struct cam_context *ctx = ctx_isp->base; uint64_t buf_done_req_id; + struct timespec ts; + uint64_t bf_timestamp_val; trace_cam_buf_done("ISP", ctx, req); @@ -823,6 +828,15 @@ static int __cam_isp_ctx_handle_buf_done_for_request( continue; } + if (done->resource_handle[i] == CAM_ISP_IFE_OUT_RES_STATS_BF) { + get_monotonic_boottime(&ts); + bf_timestamp_val = (uint64_t)ts.tv_sec * 1000000000LL + ts.tv_nsec; + CAM_DBG(CAM_ISP, "[%lld] BF timestamp %llu", + req->request_id, + bf_timestamp_val); + ctx_isp->bf_timestamp = bf_timestamp_val; + } + if (!req_isp->bubble_detected) { CAM_DBG(CAM_ISP, "Sync with success: req %lld res 0x%x fd 0x%x, ctx %u", diff --git a/drivers/cam_isp/cam_isp_context.h b/drivers/cam_isp/cam_isp_context.h index 5f8847c..e7fa006 100644 --- a/drivers/cam_isp/cam_isp_context.h +++ b/drivers/cam_isp/cam_isp_context.h @@ -275,6 +275,7 @@ struct cam_isp_context { void *hw_ctx; uint64_t sof_timestamp_val; uint64_t boot_timestamp; + uint64_t bf_timestamp; int32_t active_req_cnt; int64_t reported_req_id; uint32_t subscribe_event; diff --git a/drivers/cam_sensor_module/cam_actuator/cam_actuator_core.c b/drivers/cam_sensor_module/cam_actuator/cam_actuator_core.c index 0b6e255..fe1ce9f 100644 --- a/drivers/cam_sensor_module/cam_actuator/cam_actuator_core.c +++ b/drivers/cam_sensor_module/cam_actuator/cam_actuator_core.c @@ -418,6 +418,9 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl, struct cam_cmd_buf_desc *cmd_desc = NULL; struct cam_actuator_soc_private *soc_private = NULL; struct cam_sensor_power_ctrl_t *power_info = NULL; + struct timespec ts; + uint64_t *actuator_trigger_timestamp; + uint64_t vcm_trigger_time; if (!a_ctrl || !arg) { CAM_ERR(CAM_ACTUATOR, "Invalid Args"); @@ -609,6 +612,10 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl, offset = (uint32_t *)&csl_packet->payload; offset += csl_packet->cmd_buf_offset / sizeof(uint32_t); cmd_desc = (struct cam_cmd_buf_desc *)(offset); + + get_monotonic_boottime(&ts); + vcm_trigger_time = (uint64_t)ts.tv_sec * 1000000000LL + ts.tv_nsec; + rc = cam_sensor_i2c_command_parser( &a_ctrl->io_master_info, i2c_reg_settings, @@ -618,6 +625,23 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl, "Auto move lens parsing failed: %d", rc); goto end; } + + rc = cam_mem_get_cpu_buf(cmd_desc[0].mem_handle, + &generic_ptr, &len_of_buff); + if (rc < 0) { + CAM_ERR(CAM_OIS, "Failed to get cpu buf"); + return rc; + } + if (!generic_ptr) { + CAM_ERR(CAM_OIS, "invalid generic_ptr"); + return -EINVAL; + } + + offset = (uint32_t *)((uint8_t *)generic_ptr + + cmd_desc->offset); + actuator_trigger_timestamp = (uint64_t *)offset; + *actuator_trigger_timestamp = vcm_trigger_time; + cam_actuator_update_req_mgr(a_ctrl, csl_packet); break; case CAM_ACTUATOR_PACKET_MANUAL_MOVE_LENS: diff --git a/include/uapi/media/cam_req_mgr.h b/include/uapi/media/cam_req_mgr.h index f80959c..2002488 100644 --- a/include/uapi/media/cam_req_mgr.h +++ b/include/uapi/media/cam_req_mgr.h @@ -449,6 +449,7 @@ struct cam_req_mgr_error_msg { * @request_id: request id of the frame * @frame_id: frame id of the frame * @timestamp: timestamp of the frame + * @bf_timestamp: timestamp of the AF STATS BF frame * @link_hdl: link handle associated with this message * @sof_status: sof status success or fail * @frame_id_meta: refers to the meta for @@ -459,6 +460,7 @@ struct cam_req_mgr_frame_msg { uint64_t request_id; uint64_t frame_id; uint64_t timestamp; + uint64_t bf_timestamp; int32_t link_hdl; uint32_t sof_status; uint32_t frame_id_meta; |