From dc64ec28dd5444c5097bb1e8eefde72f75f25db3 Mon Sep 17 00:00:00 2001 From: Karthik Anantha Ram Date: Wed, 12 Aug 2020 09:44:58 -0700 Subject: [PATCH] msm: camera: isp: Fix boot ts when custom is enabled When custom is enabled, we can generate boot time independent of qtimer update from CSID. CRs-Fixed: 2753196 Change-Id: I39255ddcc419d9a89981e57e8d3a9f466c62e7e6 Signed-off-by: Karthik Anantha Ram --- drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c | 26 ++++++++++++------- .../isp_hw/ife_csid_hw/cam_ife_csid_core.c | 4 ++- 2 files changed, 20 insertions(+), 10 deletions(-) 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 c41af53f91e6..344b8263a8ff 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 @@ -7340,6 +7340,7 @@ static int cam_ife_hw_mgr_handle_hw_sof( struct cam_ife_hw_mgr_ctx *ife_hw_mgr_ctx = ctx; cam_hw_event_cb_func ife_hw_irq_sof_cb; struct cam_isp_hw_sof_event_data sof_done_event_data; + struct timespec64 ts; memset(&sof_done_event_data, 0, sizeof(sof_done_event_data)); @@ -7349,20 +7350,27 @@ static int cam_ife_hw_mgr_handle_hw_sof( switch (event_info->res_id) { case CAM_ISP_HW_VFE_IN_CAMIF: case CAM_ISP_HW_VFE_IN_RD: - if (ife_hw_mgr_ctx->is_offline) - cam_ife_hw_mgr_get_offline_sof_timestamp( + /* if frame header is enabled reset qtimer ts */ + if (ife_hw_mgr_ctx->custom_config & + CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS) { + sof_done_event_data.timestamp = 0x0; + ktime_get_boottime_ts64(&ts); + sof_done_event_data.boot_time = + (uint64_t)((ts.tv_sec * 1000000000) + + ts.tv_nsec); + CAM_DBG(CAM_ISP, "boot_time 0x%llx", + sof_done_event_data.boot_time); + } else { + if (ife_hw_mgr_ctx->is_offline) + cam_ife_hw_mgr_get_offline_sof_timestamp( &sof_done_event_data.timestamp, &sof_done_event_data.boot_time); - else - cam_ife_mgr_cmd_get_sof_timestamp( + else + cam_ife_mgr_cmd_get_sof_timestamp( ife_hw_mgr_ctx, &sof_done_event_data.timestamp, &sof_done_event_data.boot_time); - - /* if frame header is enabled reset qtimer ts */ - if (ife_hw_mgr_ctx->custom_config & - CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS) - sof_done_event_data.timestamp = 0x0; + } if (atomic_read(&ife_hw_mgr_ctx->overflow_pending)) break; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index dd85eb45d4ab..0566a3fb05eb 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -3111,7 +3111,7 @@ static int cam_ife_csid_get_time_stamp( const struct cam_ife_csid_udi_reg_offset *udi_reg; struct timespec64 ts; uint32_t time_32, id; - uint64_t time_delta; + uint64_t time_delta = 0; time_stamp = (struct cam_csid_get_time_stamp_args *)cmd_args; res = time_stamp->node_res; @@ -3196,6 +3196,8 @@ static int cam_ife_csid_get_time_stamp( csid_hw->prev_qtimer_ts; time_stamp->boot_timestamp = csid_hw->prev_boot_timestamp + time_delta; + if (time_delta == 0) + CAM_WARN(CAM_ISP, "No qtimer update"); } csid_hw->prev_qtimer_ts = time_stamp->time_stamp_val; csid_hw->prev_boot_timestamp = time_stamp->boot_timestamp;