Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69c67ebc authored by Alok Pandey's avatar Alok Pandey Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: ife: calculate accurate boot timestamp at CSID SOF



The boot timestamp is calculated in tasklet context. Due to system
performance and scheduling delay, it may vary. It is somtimes causing
failure for few time bound test cases.
To handle above problem, This change also considers qtime difference
to calculate accurate boot time at CSID each SOF.

CRs-Fixed: 2557758
Change-Id: I36b21a0f2c12cc1c83c209ab01ea90c0ac226995
Signed-off-by: default avatarAlok Pandey <akumarpa@codeaurora.org>
parent 22c15f22
Loading
Loading
Loading
Loading
+32 −31
Original line number Diff line number Diff line
@@ -5888,7 +5888,9 @@ static int cam_ife_mgr_cmd_get_sof_timestamp(
	struct cam_hw_intf                   *hw_intf;
	struct cam_csid_get_time_stamp_args   csid_get_time;

	list_for_each_entry(hw_mgr_res, &ife_ctx->res_list_ife_csid, list) {
	hw_mgr_res = list_first_entry(&ife_ctx->res_list_ife_csid,
		struct cam_ife_hw_mgr_res, list);

	for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
		if (!hw_mgr_res->hw_res[i])
			continue;
@@ -5925,7 +5927,6 @@ static int cam_ife_mgr_cmd_get_sof_timestamp(
			}
		}
	}
	}

	if (rc)
		CAM_ERR_RATE_LIMIT(CAM_ISP, "Getting sof time stamp failed");
+19 −3
Original line number Diff line number Diff line
@@ -534,6 +534,7 @@ static int cam_ife_csid_global_reset(struct cam_ife_csid_hw *csid_hw)
		CAM_ERR(CAM_ISP, "CSID:%d IRQ value after reset rc = %d",
			csid_hw->hw_intf->hw_idx, val);
	csid_hw->error_irq_count = 0;
	csid_hw->prev_boot_timestamp = 0;

	return rc;
}
@@ -1329,6 +1330,7 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
	spin_unlock_irqrestore(&csid_hw->lock_state, flags);
	csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	csid_hw->error_irq_count = 0;
	csid_hw->prev_boot_timestamp = 0;

	return rc;
}
@@ -2928,6 +2930,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;

	time_stamp = (struct cam_csid_get_time_stamp_args  *)cmd_args;
	res = time_stamp->node_res;
@@ -2999,9 +3002,22 @@ static int cam_ife_csid_get_time_stamp(
		CAM_IFE_CSID_QTIMER_MUL_FACTOR,
		CAM_IFE_CSID_QTIMER_DIV_FACTOR);

	if (!csid_hw->prev_boot_timestamp) {
		get_monotonic_boottime64(&ts);
	time_stamp->boot_timestamp = (uint64_t)((ts.tv_sec * 1000000000) +
		time_stamp->boot_timestamp =
			(uint64_t)((ts.tv_sec * 1000000000) +
			ts.tv_nsec);
		csid_hw->prev_qtimer_ts = 0;
		CAM_DBG(CAM_ISP, "timestamp:%lld",
			time_stamp->boot_timestamp);
	} else {
		time_delta = time_stamp->time_stamp_val -
			csid_hw->prev_qtimer_ts;
		time_stamp->boot_timestamp =
			csid_hw->prev_boot_timestamp + time_delta;
	}
	csid_hw->prev_qtimer_ts = time_stamp->time_stamp_val;
	csid_hw->prev_boot_timestamp = time_stamp->boot_timestamp;

	return 0;
}
+4 −0
Original line number Diff line number Diff line
@@ -550,6 +550,8 @@ struct cam_ife_csid_path_cfg {
 * @binning_enable            Flag is set if hardware supports QCFA binning
 * @binning_supported         Flag is set if sensor supports QCFA binning
 *
 * @first_sof_ts              first bootime stamp at the start
 * @prev_qtimer_ts            stores csid timestamp
 */
struct cam_ife_csid_hw {
	struct cam_hw_intf              *hw_intf;
@@ -581,6 +583,8 @@ struct cam_ife_csid_hw {
	spinlock_t                       lock_state;
	uint32_t                         binning_enable;
	uint32_t                         binning_supported;
	uint64_t                         prev_boot_timestamp;
	uint64_t                         prev_qtimer_ts;
};

int cam_ife_csid_hw_probe_init(struct cam_hw_intf  *csid_hw_intf,