|
@@ -1106,6 +1106,8 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
|
int sync_slot_idx = 0, sync_rd_idx = 0, rc = 0;
|
|
|
int32_t sync_num_slots = 0;
|
|
|
uint64_t sync_frame_duration = 0;
|
|
|
+ uint64_t sof_timestamp_delta = 0;
|
|
|
+ uint64_t master_slave_diff = 0;
|
|
|
bool ready = true, sync_ready = true;
|
|
|
|
|
|
if (!link->sync_link) {
|
|
@@ -1139,6 +1141,11 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
|
else
|
|
|
sync_frame_duration = DEFAULT_FRAME_DURATION;
|
|
|
|
|
|
+ sof_timestamp_delta =
|
|
|
+ link->sof_timestamp >= sync_link->sof_timestamp
|
|
|
+ ? link->sof_timestamp - sync_link->sof_timestamp
|
|
|
+ : sync_link->sof_timestamp - link->sof_timestamp;
|
|
|
+
|
|
|
CAM_DBG(CAM_CRM,
|
|
|
"sync link %x last frame_duration is %d ns",
|
|
|
sync_link->link_hdl, sync_frame_duration);
|
|
@@ -1260,11 +1267,10 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
|
* difference of two SOF timestamp less than
|
|
|
* (sync_frame_duration / 5).
|
|
|
*/
|
|
|
- do_div(sync_frame_duration, 5);
|
|
|
- if ((link->sof_timestamp > sync_link->sof_timestamp) &&
|
|
|
- (sync_link->sof_timestamp > 0) &&
|
|
|
- (link->sof_timestamp - sync_link->sof_timestamp <
|
|
|
- sync_frame_duration) &&
|
|
|
+ master_slave_diff = sync_frame_duration;
|
|
|
+ do_div(master_slave_diff, 5);
|
|
|
+ if ((sync_link->sof_timestamp > 0) &&
|
|
|
+ (sof_timestamp_delta < master_slave_diff) &&
|
|
|
(sync_rd_slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC)) {
|
|
|
|
|
|
/*
|
|
@@ -1287,6 +1293,11 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
|
"sync link %x too quickly, skip next frame of sync link",
|
|
|
sync_link->link_hdl);
|
|
|
link->sync_link_sof_skip = true;
|
|
|
+ } else if (sync_link->req.in_q->slot[sync_slot_idx].status !=
|
|
|
+ CRM_SLOT_STATUS_REQ_APPLIED) {
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
+ "link %x other not applied", link->link_hdl);
|
|
|
+ return -EAGAIN;
|
|
|
}
|
|
|
}
|
|
|
|