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

Commit bf1f4e42 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: ife: use universal qtime-to-boottime offset for all cams"...

Merge "msm: camera: ife: use universal qtime-to-boottime offset for all cams" into camera-kernel.lnx.1.0
parents 6ae2412f 923271ed
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@
/* Max CSI Rx irq error count threshold value */
#define CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT               100

/* factor to conver qtime to boottime */
static int64_t qtime_to_boottime;

static int cam_ife_csid_reset_regs(
	struct cam_ife_csid_hw *csid_hw, bool reset_hw);

@@ -3394,7 +3397,6 @@ 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;
@@ -3466,20 +3468,19 @@ 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) {
	/* use a universal qtime-2-boottime offset for all cameras
	 * this enables uniform timestamp comparision between cameras
	 */
	if (qtime_to_boottime == 0) {
		get_monotonic_boottime64(&ts);
		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;
		qtime_to_boottime =
			(int64_t)((ts.tv_sec * 1000000000) + ts.tv_nsec) -
			(int64_t)time_stamp->time_stamp_val;
		CAM_DBG(CAM_ISP, "qtime_to_boottime:%lld", qtime_to_boottime);
	}

	time_stamp->boot_timestamp = time_stamp->time_stamp_val +
		qtime_to_boottime;
	csid_hw->prev_qtimer_ts = time_stamp->time_stamp_val;
	csid_hw->prev_boot_timestamp = time_stamp->boot_timestamp;