msm: camera: isp: Add timestamp for CSID CAMIF events

This commit saves the timestamp for CSID CAMIF IRQs and
print in case of overflow. In case of IFE, it avoids
dumping timestamps if no IRQ are subsribed.

CRs-Fixed: 3249483
Change-Id: Icac71f60f0616fc14aeb5e5b6efd5d203b27ddcc
Signed-off-by: Gaurav Jindal <quic_gjindal@quicinc.com>
This commit is contained in:
Gaurav Jindal
2022-07-18 15:00:51 +05:30
committed by Camera Software Integration
parent 1d0a29d2b7
commit f0a55aadf7
3 changed files with 77 additions and 8 deletions

View File

@@ -108,6 +108,56 @@ static bool cam_ife_csid_ver2_disable_sof_retime(
return false;
}
static void cam_ife_csid_ver2_print_camif_timestamps(
struct cam_ife_csid_ver2_hw *csid_hw)
{
struct cam_ife_csid_ver2_path_cfg *path_cfg;
struct cam_isp_resource_node *res;
bool found = false;
int i;
for (i = CAM_IFE_PIX_PATH_RES_RDI_0; i < CAM_IFE_PIX_PATH_RES_MAX; i++) {
res = &csid_hw->path_res[i];
path_cfg = (struct cam_ife_csid_ver2_path_cfg *)res->res_priv;
if (!path_cfg || !path_cfg->irq_handle)
continue;
switch (res->res_id) {
case CAM_IFE_PIX_PATH_RES_RDI_0:
case CAM_IFE_PIX_PATH_RES_RDI_1:
case CAM_IFE_PIX_PATH_RES_RDI_2:
case CAM_IFE_PIX_PATH_RES_RDI_3:
case CAM_IFE_PIX_PATH_RES_RDI_4:
if (path_cfg->handle_camif_irq &&
res->is_rdi_primary_res)
found = true;
break;
case CAM_IFE_PIX_PATH_RES_IPP:
if (path_cfg->handle_camif_irq)
found = true;
break;
default:
break;
}
if (found)
break;
}
if (found && path_cfg)
CAM_INFO(CAM_ISP, "CSID[%u] %s SOF[%lld:%lld] EPOCH[%lld:%lld] EOF[%lld:%lld]",
csid_hw->hw_intf->hw_idx, res->res_name,
path_cfg->sof_ts.tv_sec, path_cfg->sof_ts.tv_nsec,
path_cfg->epoch_ts.tv_sec, path_cfg->epoch_ts.tv_nsec,
path_cfg->eof_ts.tv_sec, path_cfg->eof_ts.tv_nsec);
}
static void cam_ife_csid_ver2_update_event_ts(
struct timespec64 *dst_ts, struct timespec64 *src_ts)
{
dst_ts->tv_sec = src_ts->tv_sec;
dst_ts->tv_nsec = src_ts->tv_nsec;
}
static int cam_ife_csid_ver2_set_debug(
struct cam_ife_csid_ver2_hw *csid_hw,
struct cam_ife_csid_debug_cfg_args *debug_args)
@@ -1102,6 +1152,8 @@ static int cam_ife_csid_ver2_handle_event_err(
evt.in_core_idx =
cam_ife_csid_ver2_input_core_to_hw_idx(csid_hw->top_cfg.input_core_type);
cam_ife_csid_ver2_print_camif_timestamps(csid_hw);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_ERROR, (void *)&evt);
return 0;
@@ -1793,17 +1845,23 @@ static int cam_ife_csid_ver2_ipp_bottom_half(
}
path_reg = csid_reg->path_reg[res->res_id];
if (irq_status_ipp & path_reg->eof_irq_mask)
if (irq_status_ipp & path_reg->eof_irq_mask) {
cam_ife_csid_ver2_update_event_ts(&path_cfg->eof_ts, &payload->timestamp);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_EOF, (void *)&evt_info);
}
if (irq_status_ipp & path_reg->sof_irq_mask)
if (irq_status_ipp & path_reg->sof_irq_mask) {
cam_ife_csid_ver2_update_event_ts(&path_cfg->sof_ts, &payload->timestamp);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_SOF, (void *)&evt_info);
}
if (irq_status_ipp & path_reg->rup_irq_mask)
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_REG_UPDATE, (void *)&evt_info);
if (irq_status_ipp & path_reg->epoch0_irq_mask)
if (irq_status_ipp & path_reg->epoch0_irq_mask) {
cam_ife_csid_ver2_update_event_ts(&path_cfg->epoch_ts, &payload->timestamp);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_EPOCH, (void *)&evt_info);
}
if (irq_status_ipp & IFE_CSID_VER2_PATH_SENSOR_SWITCH_OUT_OF_SYNC_FRAME_DROP) {
atomic_inc(&path_cfg->switch_out_of_sync_cnt);
@@ -2044,14 +2102,17 @@ static int cam_ife_csid_ver2_rdi_bottom_half(
CAM_ISP_HW_ERROR_CSID_SENSOR_FRAME_DROP, is_secondary, res);
}
if (irq_status_rdi & rdi_reg->eof_irq_mask)
if (irq_status_rdi & rdi_reg->eof_irq_mask) {
cam_ife_csid_ver2_update_event_ts(&path_cfg->eof_ts, &payload->timestamp);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_EOF, (void *)&evt_info);
}
if ((irq_status_rdi & rdi_reg->sof_irq_mask)) {
if (path_cfg->sec_evt_config.en_secondary_evt &&
(path_cfg->sec_evt_config.evt_type & CAM_IFE_CSID_EVT_SOF)) {
evt_info.is_secondary_evt = true;
}
cam_ife_csid_ver2_update_event_ts(&path_cfg->sof_ts, &payload->timestamp);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_SOF, (void *)&evt_info);
}
@@ -2063,6 +2124,7 @@ static int cam_ife_csid_ver2_rdi_bottom_half(
(path_cfg->sec_evt_config.evt_type & CAM_IFE_CSID_EVT_EPOCH)) {
evt_info.is_secondary_evt = true;
}
cam_ife_csid_ver2_update_event_ts(&path_cfg->epoch_ts, &payload->timestamp);
csid_hw->event_cb(csid_hw->token, CAM_ISP_HW_EVENT_EPOCH, (void *)&evt_info);
}
end:
@@ -4748,7 +4810,6 @@ int cam_ife_csid_ver2_stop(void *hw_priv,
res->res_type, res->res_id,
res->res_name);
}
if (csid_hw->buf_done_irq_handle) {
rc = cam_irq_controller_unsubscribe_irq(
csid_hw->top_irq_controller,

View File

@@ -135,8 +135,10 @@ struct cam_ife_csid_ver2_camif_data {
/*
* struct cam_ife_csid_ver2_path_cfg: place holder for path parameters
*
* @camif_data: CAMIF data
* @error_ts: Error timestamp
* @sof_ts: SOF timestamp
* @epoch_ts: Epoch timestamp
* @eof_ts: EOF timestamp
* @cid: cid value for path
* @path_format: Array of Path format which contains format
* info i.e Decode format, Packing format etc
@@ -180,6 +182,9 @@ struct cam_ife_csid_ver2_camif_data {
*/
struct cam_ife_csid_ver2_path_cfg {
struct timespec64 error_ts;
struct timespec64 sof_ts;
struct timespec64 epoch_ts;
struct timespec64 eof_ts;
struct cam_ife_csid_path_format path_format[CAM_ISP_VC_DT_CFG];
struct cam_csid_secondary_evt_config sec_evt_config;
uint32_t cid;

View File

@@ -474,6 +474,9 @@ int cam_vfe_top_ver4_dump_timestamps(
vfe_priv = res->res_priv;
if (!vfe_priv->frame_irq_handle)
continue;
if (vfe_priv->is_pixel_path) {
camif_res = res;
if (res->res_id == res_id)
@@ -1288,8 +1291,8 @@ static int cam_vfe_handle_eof(struct cam_vfe_mux_ver4_data *vfe_priv,
struct cam_isp_hw_event_info *evt_info)
{
CAM_DBG(CAM_ISP, "VFE:%d Received EOF", vfe_priv->hw_intf->hw_idx);
vfe_priv->epoch_ts.tv_sec = payload->ts.mono_time.tv_sec;
vfe_priv->epoch_ts.tv_nsec = payload->ts.mono_time.tv_nsec;
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;