|
@@ -38,15 +38,15 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|
link->watchdog = NULL;
|
|
link->watchdog = NULL;
|
|
link->state = CAM_CRM_LINK_STATE_AVAILABLE;
|
|
link->state = CAM_CRM_LINK_STATE_AVAILABLE;
|
|
link->parent = NULL;
|
|
link->parent = NULL;
|
|
- link->subscribe_event = 0;
|
|
|
|
- link->trigger_mask = 0;
|
|
|
|
link->sync_link_sof_skip = false;
|
|
link->sync_link_sof_skip = false;
|
|
link->open_req_cnt = 0;
|
|
link->open_req_cnt = 0;
|
|
link->last_flush_id = 0;
|
|
link->last_flush_id = 0;
|
|
link->initial_sync_req = -1;
|
|
link->initial_sync_req = -1;
|
|
link->dual_trigger = false;
|
|
link->dual_trigger = false;
|
|
- link->trigger_cnt[0] = 0;
|
|
|
|
- link->trigger_cnt[1] = 0;
|
|
|
|
|
|
+ link->trigger_cnt[0][0] = 0;
|
|
|
|
+ link->trigger_cnt[0][1] = 0;
|
|
|
|
+ link->trigger_cnt[1][0] = 0;
|
|
|
|
+ link->trigger_cnt[1][1] = 0;
|
|
link->in_msync_mode = false;
|
|
link->in_msync_mode = false;
|
|
link->retry_cnt = 0;
|
|
link->retry_cnt = 0;
|
|
link->is_shutdown = false;
|
|
link->is_shutdown = false;
|
|
@@ -162,25 +162,34 @@ static void __cam_req_mgr_dec_idx(int32_t *val, int32_t step, int32_t max_val)
|
|
/**
|
|
/**
|
|
* __cam_req_mgr_inject_delay()
|
|
* __cam_req_mgr_inject_delay()
|
|
*
|
|
*
|
|
- * @brief : Check if any pd device is injecting delay
|
|
|
|
- * @tbl : cam_req_mgr_req_tbl
|
|
|
|
- * @curr_idx : slot idx
|
|
|
|
|
|
+ * @brief : Check if any pd device is injecting delay
|
|
|
|
+ * @tbl : cam_req_mgr_req_tbl
|
|
|
|
+ * @curr_idx : slot idx
|
|
|
|
+ * @trigger : Trigger point
|
|
*
|
|
*
|
|
* @return : 0 for success, negative for failure
|
|
* @return : 0 for success, negative for failure
|
|
*/
|
|
*/
|
|
static int __cam_req_mgr_inject_delay(
|
|
static int __cam_req_mgr_inject_delay(
|
|
- struct cam_req_mgr_req_tbl *tbl,
|
|
|
|
- int32_t curr_idx)
|
|
|
|
|
|
+ struct cam_req_mgr_req_tbl *tbl,
|
|
|
|
+ int32_t curr_idx, uint32_t trigger)
|
|
{
|
|
{
|
|
struct cam_req_mgr_tbl_slot *slot = NULL;
|
|
struct cam_req_mgr_tbl_slot *slot = NULL;
|
|
int rc = 0;
|
|
int rc = 0;
|
|
|
|
|
|
while (tbl) {
|
|
while (tbl) {
|
|
slot = &tbl->slot[curr_idx];
|
|
slot = &tbl->slot[curr_idx];
|
|
- if (slot->inject_delay > 0) {
|
|
|
|
- slot->inject_delay--;
|
|
|
|
|
|
+ if ((trigger == CAM_TRIGGER_POINT_SOF) &&
|
|
|
|
+ (slot->inject_delay_at_sof > 0)) {
|
|
|
|
+ slot->inject_delay_at_sof--;
|
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
|
+ "Delay injected by pd %d device at SOF",
|
|
|
|
+ tbl->pd);
|
|
|
|
+ rc = -EAGAIN;
|
|
|
|
+ } else if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
|
|
+ (slot->inject_delay_at_eof > 0)) {
|
|
|
|
+ slot->inject_delay_at_eof--;
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
- "Delay injected by pd %d device",
|
|
|
|
|
|
+ "Delay injected by pd %d device at EOF",
|
|
tbl->pd);
|
|
tbl->pd);
|
|
rc = -EAGAIN;
|
|
rc = -EAGAIN;
|
|
}
|
|
}
|
|
@@ -557,7 +566,6 @@ static void __cam_req_mgr_flush_req_slot(
|
|
tbl->slot[idx].req_ready_map = 0;
|
|
tbl->slot[idx].req_ready_map = 0;
|
|
tbl->slot[idx].state = CRM_REQ_STATE_EMPTY;
|
|
tbl->slot[idx].state = CRM_REQ_STATE_EMPTY;
|
|
tbl->slot[idx].ops.apply_at_eof = false;
|
|
tbl->slot[idx].ops.apply_at_eof = false;
|
|
- tbl->slot[idx].ops.skip_next_frame = false;
|
|
|
|
tbl->slot[idx].ops.dev_hdl = -1;
|
|
tbl->slot[idx].ops.dev_hdl = -1;
|
|
tbl->slot[idx].ops.is_applied = false;
|
|
tbl->slot[idx].ops.is_applied = false;
|
|
tbl = tbl->next;
|
|
tbl = tbl->next;
|
|
@@ -567,10 +575,10 @@ static void __cam_req_mgr_flush_req_slot(
|
|
atomic_set(&link->eof_event_cnt, 0);
|
|
atomic_set(&link->eof_event_cnt, 0);
|
|
in_q->wr_idx = 0;
|
|
in_q->wr_idx = 0;
|
|
in_q->rd_idx = 0;
|
|
in_q->rd_idx = 0;
|
|
- link->trigger_cnt[0] = 0;
|
|
|
|
- link->trigger_cnt[1] = 0;
|
|
|
|
- link->trigger_mask = 0;
|
|
|
|
- link->subscribe_event &= ~CAM_TRIGGER_POINT_EOF;
|
|
|
|
|
|
+ link->trigger_cnt[0][0] = 0;
|
|
|
|
+ link->trigger_cnt[0][1] = 0;
|
|
|
|
+ link->trigger_cnt[1][0] = 0;
|
|
|
|
+ link->trigger_cnt[1][1] = 0;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -611,8 +619,9 @@ static void __cam_req_mgr_reset_req_slot(struct cam_req_mgr_core_link *link,
|
|
tbl->pd, idx, tbl->slot[idx].state);
|
|
tbl->pd, idx, tbl->slot[idx].state);
|
|
tbl->slot[idx].req_ready_map = 0;
|
|
tbl->slot[idx].req_ready_map = 0;
|
|
tbl->slot[idx].state = CRM_REQ_STATE_EMPTY;
|
|
tbl->slot[idx].state = CRM_REQ_STATE_EMPTY;
|
|
|
|
+ tbl->slot[idx].inject_delay_at_sof = 0;
|
|
|
|
+ tbl->slot[idx].inject_delay_at_eof = 0;
|
|
tbl->slot[idx].ops.apply_at_eof = false;
|
|
tbl->slot[idx].ops.apply_at_eof = false;
|
|
- tbl->slot[idx].ops.skip_next_frame = false;
|
|
|
|
tbl->slot[idx].ops.dev_hdl = -1;
|
|
tbl->slot[idx].ops.dev_hdl = -1;
|
|
tbl->slot[idx].ops.is_applied = false;
|
|
tbl->slot[idx].ops.is_applied = false;
|
|
tbl = tbl->next;
|
|
tbl = tbl->next;
|
|
@@ -820,7 +829,8 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
|
|
|
|
if (slot->ops.dev_hdl < 0) {
|
|
if (slot->ops.dev_hdl < 0) {
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
- "No special ops detected for this table slot");
|
|
|
|
|
|
+ "No special ops detected for slot %d dev %s",
|
|
|
|
+ idx, dev->dev_info.name);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -831,6 +841,23 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (apply_data[pd].skip_idx ||
|
|
|
|
+ (apply_data[pd].req_id < 0)) {
|
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
|
+ "dev %s skip %d req_id %lld",
|
|
|
|
+ dev->dev_info.name,
|
|
|
|
+ apply_data[pd].skip_idx,
|
|
|
|
+ apply_data[pd].req_id);
|
|
|
|
+ apply_req.dev_hdl = dev->dev_hdl;
|
|
|
|
+ apply_req.request_id =
|
|
|
|
+ link->req.prev_apply_data[pd].req_id;
|
|
|
|
+ apply_req.trigger_point = 0;
|
|
|
|
+ apply_req.report_if_bubble = 0;
|
|
|
|
+ if ((dev->ops) && (dev->ops->notify_frame_skip))
|
|
|
|
+ dev->ops->notify_frame_skip(&apply_req);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* This one is to prevent EOF request to apply on SOF*/
|
|
/* This one is to prevent EOF request to apply on SOF*/
|
|
if ((trigger == CAM_TRIGGER_POINT_SOF) &&
|
|
if ((trigger == CAM_TRIGGER_POINT_SOF) &&
|
|
(slot->ops.apply_at_eof)) {
|
|
(slot->ops.apply_at_eof)) {
|
|
@@ -858,31 +885,24 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
trigger);
|
|
trigger);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ CAM_DBG(CAM_REQ,
|
|
|
|
+ "link_hdl: %x pd: %d req_id %lld has applied",
|
|
|
|
+ link->link_hdl, pd, apply_req.request_id);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
CAM_DBG(CAM_REQ,
|
|
CAM_DBG(CAM_REQ,
|
|
- "SEND: link_hdl: %x pd: %d req_id %lld",
|
|
|
|
- link->link_hdl, pd, apply_req.request_id);
|
|
|
|
|
|
+ "SEND: link_hdl %x dev %s pd %d req_id %lld",
|
|
|
|
+ link->link_hdl, dev->dev_info.name,
|
|
|
|
+ pd, apply_req.request_id);
|
|
|
|
|
|
- if (trigger == CAM_TRIGGER_POINT_SOF &&
|
|
|
|
- slot->ops.skip_next_frame) {
|
|
|
|
- slot->ops.skip_next_frame = false;
|
|
|
|
- slot->ops.is_applied = true;
|
|
|
|
- CAM_DBG(CAM_REQ,
|
|
|
|
- "SEND: link_hdl: %x pd: %d req_id %lld",
|
|
|
|
- link->link_hdl, pd, apply_req.request_id);
|
|
|
|
- __cam_req_mgr_notify_frame_skip(link,
|
|
|
|
- trigger);
|
|
|
|
- return -EAGAIN;
|
|
|
|
- } else if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
|
|
|
|
+ if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
(slot->ops.apply_at_eof)) {
|
|
(slot->ops.apply_at_eof)) {
|
|
|
|
+ slot->ops.is_applied = true;
|
|
slot->ops.apply_at_eof = false;
|
|
slot->ops.apply_at_eof = false;
|
|
if (atomic_read(&link->eof_event_cnt) > 0)
|
|
if (atomic_read(&link->eof_event_cnt) > 0)
|
|
atomic_dec(&link->eof_event_cnt);
|
|
atomic_dec(&link->eof_event_cnt);
|
|
- CAM_DBG(CAM_REQ,
|
|
|
|
- "Req_id: %llu eof_event_cnt : %d",
|
|
|
|
- apply_data[pd].req_id,
|
|
|
|
- link->eof_event_cnt);
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -964,8 +984,9 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
|
|
|
|
apply_req.trigger_point = trigger;
|
|
apply_req.trigger_point = trigger;
|
|
CAM_DBG(CAM_REQ,
|
|
CAM_DBG(CAM_REQ,
|
|
- "SEND: link_hdl: %x pd %d req_id %lld",
|
|
|
|
- link->link_hdl, pd, apply_req.request_id);
|
|
|
|
|
|
+ "SEND: link_hdl %x dev %s pd %d req_id %lld",
|
|
|
|
+ link->link_hdl, dev->dev_info.name,
|
|
|
|
+ pd, apply_req.request_id);
|
|
if (dev->ops && dev->ops->apply_req) {
|
|
if (dev->ops && dev->ops->apply_req) {
|
|
rc = dev->ops->apply_req(&apply_req);
|
|
rc = dev->ops->apply_req(&apply_req);
|
|
if (rc < 0) {
|
|
if (rc < 0) {
|
|
@@ -1163,7 +1184,6 @@ static int __cam_req_mgr_check_sync_for_mslave(
|
|
"No req applied on corresponding SOF on sync link: %x",
|
|
"No req applied on corresponding SOF on sync link: %x",
|
|
sync_link->link_hdl);
|
|
sync_link->link_hdl);
|
|
sync_link->sync_link_sof_skip = false;
|
|
sync_link->sync_link_sof_skip = false;
|
|
- __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1181,15 +1201,6 @@ static int __cam_req_mgr_check_sync_for_mslave(
|
|
}
|
|
}
|
|
|
|
|
|
if (link->is_master) {
|
|
if (link->is_master) {
|
|
- rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
- if (rc) {
|
|
|
|
- CAM_DBG(CAM_CRM,
|
|
|
|
- "Skip Process Req: %lld on link: %x",
|
|
|
|
- req_id, link->link_hdl);
|
|
|
|
- link->sync_link_sof_skip = true;
|
|
|
|
- return rc;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (sync_link->initial_skip) {
|
|
if (sync_link->initial_skip) {
|
|
CAM_DBG(CAM_CRM, "Link 0x%x [slave] not streamed on",
|
|
CAM_DBG(CAM_CRM, "Link 0x%x [slave] not streamed on",
|
|
sync_link->link_hdl);
|
|
sync_link->link_hdl);
|
|
@@ -1253,15 +1264,6 @@ static int __cam_req_mgr_check_sync_for_mslave(
|
|
if (link->initial_skip)
|
|
if (link->initial_skip)
|
|
link->initial_skip = false;
|
|
link->initial_skip = false;
|
|
|
|
|
|
- rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
- if (rc) {
|
|
|
|
- CAM_DBG(CAM_CRM,
|
|
|
|
- "Skip Process Req: %lld on link: %x",
|
|
|
|
- req_id, link->link_hdl);
|
|
|
|
- link->sync_link_sof_skip = true;
|
|
|
|
- return rc;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
rc = __cam_req_mgr_check_link_is_ready(link, slot->idx, true);
|
|
rc = __cam_req_mgr_check_link_is_ready(link, slot->idx, true);
|
|
if (rc) {
|
|
if (rc) {
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
@@ -1374,7 +1376,6 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
|
|
|
|
if (sync_link->initial_skip) {
|
|
if (sync_link->initial_skip) {
|
|
link->initial_skip = false;
|
|
link->initial_skip = false;
|
|
- __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
"sync link %x not streamed on",
|
|
"sync link %x not streamed on",
|
|
sync_link->link_hdl);
|
|
sync_link->link_hdl);
|
|
@@ -1408,7 +1409,6 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
* link, then we need to skip this frame, since the
|
|
* link, then we need to skip this frame, since the
|
|
* previous frame of sync link is also skipped.
|
|
* previous frame of sync link is also skipped.
|
|
*/
|
|
*/
|
|
- __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
"This frame sync with previous sync_link %x frame",
|
|
"This frame sync with previous sync_link %x frame",
|
|
sync_link->link_hdl);
|
|
sync_link->link_hdl);
|
|
@@ -1421,7 +1421,6 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
* we need to skip this SOF event since the sync
|
|
* we need to skip this SOF event since the sync
|
|
* link's SOF event is also skipped.
|
|
* link's SOF event is also skipped.
|
|
*/
|
|
*/
|
|
- __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
"The previous frame of sync link is skipped");
|
|
"The previous frame of sync link is skipped");
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
@@ -1433,18 +1432,9 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
"No req applied on corresponding SOF on sync link: %x",
|
|
"No req applied on corresponding SOF on sync link: %x",
|
|
sync_link->link_hdl);
|
|
sync_link->link_hdl);
|
|
sync_link->sync_link_sof_skip = false;
|
|
sync_link->sync_link_sof_skip = false;
|
|
- __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
}
|
|
}
|
|
|
|
|
|
- rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
|
|
|
|
- if (rc) {
|
|
|
|
- CAM_DBG(CAM_CRM,
|
|
|
|
- "Skip Process Req: %lld on link: %x",
|
|
|
|
- req_id, link->link_hdl);
|
|
|
|
- ready = false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
sync_slot_idx = __cam_req_mgr_find_slot_for_req(
|
|
sync_slot_idx = __cam_req_mgr_find_slot_for_req(
|
|
sync_link->req.in_q, req_id);
|
|
sync_link->req.in_q, req_id);
|
|
if (sync_slot_idx == -1) {
|
|
if (sync_slot_idx == -1) {
|
|
@@ -1564,7 +1554,8 @@ static int __cam_req_mgr_check_sync_req_is_ready(
|
|
|
|
|
|
static int __cam_req_mgr_check_multi_sync_link_ready(
|
|
static int __cam_req_mgr_check_multi_sync_link_ready(
|
|
struct cam_req_mgr_core_link *link,
|
|
struct cam_req_mgr_core_link *link,
|
|
- struct cam_req_mgr_slot *slot)
|
|
|
|
|
|
+ struct cam_req_mgr_slot *slot,
|
|
|
|
+ uint32_t trigger)
|
|
{
|
|
{
|
|
int i, rc = 0;
|
|
int i, rc = 0;
|
|
|
|
|
|
@@ -1618,6 +1609,16 @@ static int __cam_req_mgr_check_multi_sync_link_ready(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ rc = __cam_req_mgr_inject_delay(link->req.l_tbl,
|
|
|
|
+ slot->idx, trigger);
|
|
|
|
+ if (rc < 0) {
|
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
|
+ "Req: %lld needs to inject delay at %s",
|
|
|
|
+ slot->req_id,
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_SOF) ? "SOF" : "EOF");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* At this point all validation is successfully done
|
|
* At this point all validation is successfully done
|
|
* and we can proceed to apply the given request.
|
|
* and we can proceed to apply the given request.
|
|
@@ -1630,6 +1631,57 @@ static int __cam_req_mgr_check_multi_sync_link_ready(
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * __cam_req_mgr_check_for_eof()
|
|
|
|
+ *
|
|
|
|
+ * @brief : Checks for eof trigger type
|
|
|
|
+ * @link : pointer to link whose input queue and req tbl are
|
|
|
|
+ * traversed through
|
|
|
|
+ *
|
|
|
|
+ * @return : eof trigger type
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+enum crm_req_eof_trigger_type __cam_req_mgr_check_for_eof(
|
|
|
|
+ struct cam_req_mgr_core_link *link)
|
|
|
|
+{
|
|
|
|
+ int32_t curr_idx;
|
|
|
|
+ struct cam_req_mgr_req_queue *in_q;
|
|
|
|
+ enum crm_req_eof_trigger_type eof_trigger_type;
|
|
|
|
+ struct cam_req_mgr_tbl_slot *slot = NULL;
|
|
|
|
+ struct cam_req_mgr_req_tbl *tbl;
|
|
|
|
+
|
|
|
|
+ in_q = link->req.in_q;
|
|
|
|
+ tbl = link->req.l_tbl;
|
|
|
|
+ curr_idx = in_q->rd_idx;
|
|
|
|
+ eof_trigger_type = CAM_REQ_EOF_TRIGGER_NONE;
|
|
|
|
+
|
|
|
|
+ while (tbl != NULL) {
|
|
|
|
+ slot = &tbl->slot[curr_idx];
|
|
|
|
+
|
|
|
|
+ if (slot->ops.is_applied) {
|
|
|
|
+ eof_trigger_type = CAM_REQ_EOF_TRIGGER_APPLIED;
|
|
|
|
+ break;
|
|
|
|
+ } else if (slot->ops.apply_at_eof) {
|
|
|
|
+ eof_trigger_type = CAM_REQ_EOF_TRIGGER_NOT_APPLY;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (tbl->next)
|
|
|
|
+ __cam_req_mgr_dec_idx(&curr_idx, tbl->pd_delta,
|
|
|
|
+ tbl->num_slots);
|
|
|
|
+
|
|
|
|
+ tbl = tbl->next;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CAM_DBG(CAM_REQ,
|
|
|
|
+ "Req[%lld] idx %d req_status %d link_hdl %x eof_trigger_type %x",
|
|
|
|
+ in_q->slot[in_q->rd_idx].req_id, in_q->rd_idx,
|
|
|
|
+ in_q->slot[in_q->rd_idx].status, link->link_hdl,
|
|
|
|
+ eof_trigger_type);
|
|
|
|
+
|
|
|
|
+ return eof_trigger_type;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* __cam_req_mgr_process_req()
|
|
* __cam_req_mgr_process_req()
|
|
*
|
|
*
|
|
@@ -1652,6 +1704,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
struct cam_req_mgr_connected_device *dev = NULL;
|
|
struct cam_req_mgr_connected_device *dev = NULL;
|
|
struct cam_req_mgr_core_link *tmp_link = NULL;
|
|
struct cam_req_mgr_core_link *tmp_link = NULL;
|
|
uint32_t max_retry = 0;
|
|
uint32_t max_retry = 0;
|
|
|
|
+ enum crm_req_eof_trigger_type eof_trigger_type;
|
|
|
|
|
|
session = (struct cam_req_mgr_core_session *)link->parent;
|
|
session = (struct cam_req_mgr_core_session *)link->parent;
|
|
if (!session) {
|
|
if (!session) {
|
|
@@ -1669,10 +1722,11 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
* - if in no_req state, no new req
|
|
* - if in no_req state, no new req
|
|
*/
|
|
*/
|
|
CAM_DBG(CAM_REQ,
|
|
CAM_DBG(CAM_REQ,
|
|
- "SOF Req[%lld] idx %d req_status %d link_hdl %x wd_timeout %d ms",
|
|
|
|
|
|
+ "%s Req[%lld] idx %d req_status %d link_hdl %x wd_timeout %d ms trigger:%d",
|
|
|
|
+ ((trigger == CAM_TRIGGER_POINT_SOF) ? "SOF" : "EOF"),
|
|
in_q->slot[in_q->rd_idx].req_id, in_q->rd_idx,
|
|
in_q->slot[in_q->rd_idx].req_id, in_q->rd_idx,
|
|
in_q->slot[in_q->rd_idx].status, link->link_hdl,
|
|
in_q->slot[in_q->rd_idx].status, link->link_hdl,
|
|
- in_q->slot[in_q->rd_idx].additional_timeout);
|
|
|
|
|
|
+ in_q->slot[in_q->rd_idx].additional_timeout, trigger);
|
|
|
|
|
|
slot = &in_q->slot[in_q->rd_idx];
|
|
slot = &in_q->slot[in_q->rd_idx];
|
|
|
|
|
|
@@ -1680,10 +1734,11 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
(trigger != CAM_TRIGGER_POINT_EOF))
|
|
(trigger != CAM_TRIGGER_POINT_EOF))
|
|
goto end;
|
|
goto end;
|
|
|
|
|
|
|
|
+ eof_trigger_type = __cam_req_mgr_check_for_eof(link);
|
|
|
|
+
|
|
if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
- (!(link->trigger_mask & CAM_TRIGGER_POINT_SOF))) {
|
|
|
|
- CAM_DBG(CAM_CRM, "Applying for last SOF fails");
|
|
|
|
- rc = -EINVAL;
|
|
|
|
|
|
+ (eof_trigger_type == CAM_REQ_EOF_TRIGGER_NONE)) {
|
|
|
|
+ CAM_DBG(CAM_CRM, "Not any request to schedule at EOF");
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1711,17 +1766,12 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
link->wq_congestion = true;
|
|
link->wq_congestion = true;
|
|
else
|
|
else
|
|
link->wq_congestion = false;
|
|
link->wq_congestion = false;
|
|
|
|
+ }
|
|
|
|
|
|
- if (link->trigger_mask) {
|
|
|
|
- CAM_ERR_RATE_LIMIT(CAM_CRM,
|
|
|
|
- "Applying for last EOF fails");
|
|
|
|
- rc = -EINVAL;
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ if (slot->status != CRM_SLOT_STATUS_REQ_READY) {
|
|
if (slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) {
|
|
if (slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) {
|
|
rc = __cam_req_mgr_check_multi_sync_link_ready(
|
|
rc = __cam_req_mgr_check_multi_sync_link_ready(
|
|
- link, slot);
|
|
|
|
|
|
+ link, slot, trigger);
|
|
} else {
|
|
} else {
|
|
if (link->in_msync_mode) {
|
|
if (link->in_msync_mode) {
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
@@ -1738,11 +1788,34 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- rc = __cam_req_mgr_inject_delay(link->req.l_tbl,
|
|
|
|
- slot->idx);
|
|
|
|
- if (!rc)
|
|
|
|
- rc = __cam_req_mgr_check_link_is_ready(link,
|
|
|
|
- slot->idx, false);
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Validate that if the req is ready to apply before
|
|
|
|
+ * checking the inject delay.
|
|
|
|
+ */
|
|
|
|
+ rc = __cam_req_mgr_check_link_is_ready(link,
|
|
|
|
+ slot->idx, true);
|
|
|
|
+
|
|
|
|
+ if (!rc) {
|
|
|
|
+ rc = __cam_req_mgr_inject_delay(link->req.l_tbl,
|
|
|
|
+ slot->idx, trigger);
|
|
|
|
+ if (rc < 0)
|
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
|
+ "Req: %lld needs to inject delay at %s",
|
|
|
|
+ slot->req_id,
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_SOF) ? "SOF" : "EOF");
|
|
|
|
+
|
|
|
|
+ if (!rc)
|
|
|
|
+ rc = __cam_req_mgr_check_link_is_ready(link,
|
|
|
|
+ slot->idx, false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!rc) {
|
|
|
|
+ if ((trigger == CAM_TRIGGER_POINT_SOF) &&
|
|
|
|
+ (eof_trigger_type == CAM_REQ_EOF_TRIGGER_NOT_APPLY)) {
|
|
|
|
+ CAM_DBG(CAM_CRM, "EOF apply first");
|
|
|
|
+ rc = -EAGAIN;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (rc < 0) {
|
|
if (rc < 0) {
|
|
@@ -1769,6 +1842,12 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
__cam_req_mgr_notify_frame_skip(link, trigger);
|
|
__cam_req_mgr_notify_frame_skip(link, trigger);
|
|
__cam_req_mgr_validate_crm_wd_timer(link);
|
|
__cam_req_mgr_validate_crm_wd_timer(link);
|
|
goto end;
|
|
goto end;
|
|
|
|
+ } else {
|
|
|
|
+ slot->status = CRM_SLOT_STATUS_REQ_READY;
|
|
|
|
+ CAM_DBG(CAM_REQ,
|
|
|
|
+ "linx_hdl %x Req[%lld] idx %d ready to apply",
|
|
|
|
+ link->link_hdl, in_q->slot[in_q->rd_idx].req_id,
|
|
|
|
+ in_q->rd_idx);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1808,8 +1887,6 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
if (link->retry_cnt)
|
|
if (link->retry_cnt)
|
|
link->retry_cnt = 0;
|
|
link->retry_cnt = 0;
|
|
|
|
|
|
- link->trigger_mask |= trigger;
|
|
|
|
-
|
|
|
|
/* Check for any long exposure settings */
|
|
/* Check for any long exposure settings */
|
|
__cam_req_mgr_validate_crm_wd_timer(link);
|
|
__cam_req_mgr_validate_crm_wd_timer(link);
|
|
|
|
|
|
@@ -1826,16 +1903,17 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
if (link->sync_link_sof_skip)
|
|
if (link->sync_link_sof_skip)
|
|
link->sync_link_sof_skip = false;
|
|
link->sync_link_sof_skip = false;
|
|
|
|
|
|
- if (link->trigger_mask == link->subscribe_event) {
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Below two cases can move slot to APPLIED status,
|
|
|
|
+ * 1# there is no eof trigger request
|
|
|
|
+ * 2# eof trigger is applied and the devcies which need to
|
|
|
|
+ * be applied at SOF are also applied.
|
|
|
|
+ */
|
|
|
|
+ if (((eof_trigger_type == CAM_REQ_EOF_TRIGGER_NONE) ||
|
|
|
|
+ (eof_trigger_type == CAM_REQ_EOF_TRIGGER_APPLIED)) &&
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_SOF)) {
|
|
slot->status = CRM_SLOT_STATUS_REQ_APPLIED;
|
|
slot->status = CRM_SLOT_STATUS_REQ_APPLIED;
|
|
- link->trigger_mask = 0;
|
|
|
|
- if (!(atomic_read(&link->eof_event_cnt)) &&
|
|
|
|
- (trigger == CAM_TRIGGER_POINT_EOF)) {
|
|
|
|
- link->subscribe_event &= ~CAM_TRIGGER_POINT_EOF;
|
|
|
|
- CAM_DBG(CAM_CRM,
|
|
|
|
- "Update link subscribe_event: %d",
|
|
|
|
- link->subscribe_event);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
CAM_DBG(CAM_CRM, "req %d is applied on link %x",
|
|
CAM_DBG(CAM_CRM, "req %d is applied on link %x",
|
|
slot->req_id,
|
|
slot->req_id,
|
|
link->link_hdl);
|
|
link->link_hdl);
|
|
@@ -1937,7 +2015,6 @@ static struct cam_req_mgr_req_tbl *__cam_req_mgr_create_pd_tbl(int32_t delay)
|
|
CAM_DBG(CAM_CRM, "pd= %d slots= %d", delay, tbl->num_slots);
|
|
CAM_DBG(CAM_CRM, "pd= %d slots= %d", delay, tbl->num_slots);
|
|
for (i = 0; i < MAX_REQ_SLOTS; i++) {
|
|
for (i = 0; i < MAX_REQ_SLOTS; i++) {
|
|
tbl->slot[i].ops.apply_at_eof = false;
|
|
tbl->slot[i].ops.apply_at_eof = false;
|
|
- tbl->slot[i].ops.skip_next_frame = false;
|
|
|
|
tbl->slot[i].ops.dev_hdl = -1;
|
|
tbl->slot[i].ops.dev_hdl = -1;
|
|
tbl->slot[i].ops.is_applied = false;
|
|
tbl->slot[i].ops.is_applied = false;
|
|
}
|
|
}
|
|
@@ -2217,7 +2294,6 @@ static int __cam_req_mgr_disconnect_link(struct cam_req_mgr_core_link *link)
|
|
link_data.link_enable = 0;
|
|
link_data.link_enable = 0;
|
|
link_data.link_hdl = link->link_hdl;
|
|
link_data.link_hdl = link->link_hdl;
|
|
link_data.crm_cb = NULL;
|
|
link_data.crm_cb = NULL;
|
|
- link_data.subscribe_event = 0;
|
|
|
|
|
|
|
|
/* Using device ops unlink devices */
|
|
/* Using device ops unlink devices */
|
|
for (i = 0; i < link->num_devs; i++) {
|
|
for (i = 0; i < link->num_devs; i++) {
|
|
@@ -2659,23 +2735,31 @@ int cam_req_mgr_process_add_req(void *priv, void *data)
|
|
|
|
|
|
slot = &tbl->slot[idx];
|
|
slot = &tbl->slot[idx];
|
|
slot->ops.is_applied = false;
|
|
slot->ops.is_applied = false;
|
|
- if ((add_req->skip_before_applying & 0xFF) > slot->inject_delay) {
|
|
|
|
- slot->inject_delay = (add_req->skip_before_applying & 0xFF);
|
|
|
|
- if (add_req->skip_before_applying & SKIP_NEXT_FRAME) {
|
|
|
|
- slot->ops.skip_next_frame = true;
|
|
|
|
- slot->ops.dev_hdl = add_req->dev_hdl;
|
|
|
|
- }
|
|
|
|
- CAM_DBG(CAM_CRM, "Req_id %llu injecting delay %llu",
|
|
|
|
|
|
+
|
|
|
|
+ if ((add_req->skip_at_sof & 0xFF) > slot->inject_delay_at_sof) {
|
|
|
|
+ slot->inject_delay_at_sof = (add_req->skip_at_sof & 0xFF);
|
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
|
+ "Req_id %llu injecting delay %llu frame at SOF by %s",
|
|
|
|
+ add_req->req_id,
|
|
|
|
+ slot->inject_delay_at_sof,
|
|
|
|
+ device->dev_info.name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((add_req->skip_at_eof & 0xFF) > slot->inject_delay_at_eof) {
|
|
|
|
+ slot->inject_delay_at_eof = (add_req->skip_at_eof & 0xFF);
|
|
|
|
+ CAM_DBG(CAM_CRM,
|
|
|
|
+ "Req_id %llu injecting delay %llu frame at EOF by %s",
|
|
add_req->req_id,
|
|
add_req->req_id,
|
|
- (add_req->skip_before_applying & 0xFF));
|
|
|
|
|
|
+ slot->inject_delay_at_eof,
|
|
|
|
+ device->dev_info.name);
|
|
}
|
|
}
|
|
|
|
|
|
if (add_req->trigger_eof) {
|
|
if (add_req->trigger_eof) {
|
|
slot->ops.apply_at_eof = true;
|
|
slot->ops.apply_at_eof = true;
|
|
slot->ops.dev_hdl = add_req->dev_hdl;
|
|
slot->ops.dev_hdl = add_req->dev_hdl;
|
|
CAM_DBG(CAM_REQ,
|
|
CAM_DBG(CAM_REQ,
|
|
- "Req_id %llu added for EOF tigger for Device: %s",
|
|
|
|
- add_req->req_id, device->dev_info.name);
|
|
|
|
|
|
+ "Req_id %llu slot:%d added for EOF tigger for Device: %s",
|
|
|
|
+ add_req->req_id, idx, device->dev_info.name);
|
|
}
|
|
}
|
|
|
|
|
|
if (slot->state != CRM_REQ_STATE_PENDING &&
|
|
if (slot->state != CRM_REQ_STATE_PENDING &&
|
|
@@ -2804,7 +2888,7 @@ int cam_req_mgr_process_error(void *priv, void *data)
|
|
evt_data.dev_hdl = device->dev_hdl;
|
|
evt_data.dev_hdl = device->dev_hdl;
|
|
evt_data.evt_type =
|
|
evt_data.evt_type =
|
|
CAM_REQ_MGR_LINK_EVT_ERR;
|
|
CAM_REQ_MGR_LINK_EVT_ERR;
|
|
- evt_data.link_hdl = link->link_hdl;
|
|
|
|
|
|
+ evt_data.link_hdl = link->link_hdl;
|
|
evt_data.req_id = err_info->req_id;
|
|
evt_data.req_id = err_info->req_id;
|
|
evt_data.u.error = err_info->error;
|
|
evt_data.u.error = err_info->error;
|
|
if (device->ops &&
|
|
if (device->ops &&
|
|
@@ -2936,6 +3020,10 @@ static int cam_req_mgr_process_trigger(void *priv, void *data)
|
|
|
|
|
|
spin_unlock_bh(&link->link_state_spin_lock);
|
|
spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Move to next req at SOF only in case
|
|
|
|
+ * the rd_idx is updated at EOF.
|
|
|
|
+ */
|
|
if (in_q->slot[in_q->rd_idx].status == CRM_SLOT_STATUS_REQ_APPLIED) {
|
|
if (in_q->slot[in_q->rd_idx].status == CRM_SLOT_STATUS_REQ_APPLIED) {
|
|
/*
|
|
/*
|
|
* Do NOT reset req q slot data here, it can not be done
|
|
* Do NOT reset req q slot data here, it can not be done
|
|
@@ -3061,15 +3149,13 @@ static int cam_req_mgr_cb_add_req(struct cam_req_mgr_add_request *add_req)
|
|
dev_req->req_id = add_req->req_id;
|
|
dev_req->req_id = add_req->req_id;
|
|
dev_req->link_hdl = add_req->link_hdl;
|
|
dev_req->link_hdl = add_req->link_hdl;
|
|
dev_req->dev_hdl = add_req->dev_hdl;
|
|
dev_req->dev_hdl = add_req->dev_hdl;
|
|
- dev_req->skip_before_applying = add_req->skip_before_applying;
|
|
|
|
dev_req->trigger_eof = add_req->trigger_eof;
|
|
dev_req->trigger_eof = add_req->trigger_eof;
|
|
|
|
+ dev_req->skip_at_sof = add_req->skip_at_sof;
|
|
|
|
+ dev_req->skip_at_eof = add_req->skip_at_eof;
|
|
if (dev_req->trigger_eof) {
|
|
if (dev_req->trigger_eof) {
|
|
- link->subscribe_event |= CAM_TRIGGER_POINT_EOF;
|
|
|
|
atomic_inc(&link->eof_event_cnt);
|
|
atomic_inc(&link->eof_event_cnt);
|
|
- CAM_DBG(CAM_REQ,
|
|
|
|
- "Req_id: %llu, eof_event_cnt: %d, link subscribe event: %d",
|
|
|
|
- dev_req->req_id, link->eof_event_cnt,
|
|
|
|
- link->subscribe_event);
|
|
|
|
|
|
+ CAM_DBG(CAM_REQ, "Req_id: %llu, eof_event_cnt: %d",
|
|
|
|
+ dev_req->req_id, link->eof_event_cnt);
|
|
}
|
|
}
|
|
|
|
|
|
task->process_cb = &cam_req_mgr_process_add_req;
|
|
task->process_cb = &cam_req_mgr_process_add_req;
|
|
@@ -3147,35 +3233,38 @@ end:
|
|
}
|
|
}
|
|
|
|
|
|
static int __cam_req_mgr_check_for_dual_trigger(
|
|
static int __cam_req_mgr_check_for_dual_trigger(
|
|
- struct cam_req_mgr_core_link *link)
|
|
|
|
|
|
+ struct cam_req_mgr_core_link *link,
|
|
|
|
+ uint32_t trigger)
|
|
{
|
|
{
|
|
int rc = -EAGAIN;
|
|
int rc = -EAGAIN;
|
|
|
|
|
|
- CAM_DBG(CAM_CRM, "trigger_cnt [%u: %u]",
|
|
|
|
- link->trigger_cnt[0], link->trigger_cnt[1]);
|
|
|
|
|
|
+ CAM_DBG(CAM_CRM, "%s trigger_cnt [%u: %u]",
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_SOF) ? "SOF" : "EOF",
|
|
|
|
+ link->trigger_cnt[0][trigger], link->trigger_cnt[1][trigger]);
|
|
|
|
|
|
- if (link->trigger_cnt[0] == link->trigger_cnt[1]) {
|
|
|
|
- link->trigger_cnt[0] = 0;
|
|
|
|
- link->trigger_cnt[1] = 0;
|
|
|
|
|
|
+ if (link->trigger_cnt[0][trigger] == link->trigger_cnt[1][trigger]) {
|
|
|
|
+ link->trigger_cnt[0][trigger] = 0;
|
|
|
|
+ link->trigger_cnt[1][trigger] = 0;
|
|
rc = 0;
|
|
rc = 0;
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
- if ((link->trigger_cnt[0] &&
|
|
|
|
- (link->trigger_cnt[0] - link->trigger_cnt[1] > 1)) ||
|
|
|
|
- (link->trigger_cnt[1] &&
|
|
|
|
- (link->trigger_cnt[1] - link->trigger_cnt[0] > 1))) {
|
|
|
|
|
|
+ if ((link->trigger_cnt[0][trigger] &&
|
|
|
|
+ (link->trigger_cnt[0][trigger] - link->trigger_cnt[1][trigger] > 1)) ||
|
|
|
|
+ (link->trigger_cnt[1][trigger] &&
|
|
|
|
+ (link->trigger_cnt[1][trigger] - link->trigger_cnt[0][trigger] > 1))) {
|
|
|
|
|
|
CAM_WARN(CAM_CRM,
|
|
CAM_WARN(CAM_CRM,
|
|
"One of the devices could not generate trigger");
|
|
"One of the devices could not generate trigger");
|
|
|
|
|
|
- link->trigger_cnt[0] = 0;
|
|
|
|
- link->trigger_cnt[1] = 0;
|
|
|
|
|
|
+ link->trigger_cnt[0][trigger] = 0;
|
|
|
|
+ link->trigger_cnt[1][trigger] = 0;
|
|
CAM_DBG(CAM_CRM, "Reset the trigger cnt");
|
|
CAM_DBG(CAM_CRM, "Reset the trigger cnt");
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
- CAM_DBG(CAM_CRM, "Only one device has generated trigger");
|
|
|
|
|
|
+ CAM_DBG(CAM_CRM, "Only one device has generated trigger for %s",
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_SOF) ? "SOF" : "EOF");
|
|
|
|
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
@@ -3308,13 +3397,14 @@ static int cam_req_mgr_cb_notify_trigger(
|
|
struct cam_req_mgr_trigger_notify *trigger_data)
|
|
struct cam_req_mgr_trigger_notify *trigger_data)
|
|
{
|
|
{
|
|
int32_t rc = 0, trigger_id = 0;
|
|
int32_t rc = 0, trigger_id = 0;
|
|
|
|
+ uint32_t trigger;
|
|
struct crm_workq_task *task = NULL;
|
|
struct crm_workq_task *task = NULL;
|
|
struct cam_req_mgr_core_link *link = NULL;
|
|
struct cam_req_mgr_core_link *link = NULL;
|
|
struct cam_req_mgr_trigger_notify *notify_trigger;
|
|
struct cam_req_mgr_trigger_notify *notify_trigger;
|
|
struct crm_task_payload *task_data;
|
|
struct crm_task_payload *task_data;
|
|
|
|
|
|
if (!trigger_data) {
|
|
if (!trigger_data) {
|
|
- CAM_ERR(CAM_CRM, "sof_data is NULL");
|
|
|
|
|
|
+ CAM_ERR(CAM_CRM, "trigger_data is NULL");
|
|
rc = -EINVAL;
|
|
rc = -EINVAL;
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
@@ -3327,10 +3417,20 @@ static int cam_req_mgr_cb_notify_trigger(
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ CAM_DBG(CAM_REQ, "link_hdl %x frame_id %lld, trigger %x\n",
|
|
|
|
+ trigger_data->link_hdl,
|
|
|
|
+ trigger_data->frame_id,
|
|
|
|
+ trigger_data->trigger);
|
|
|
|
+
|
|
trigger_id = trigger_data->trigger_id;
|
|
trigger_id = trigger_data->trigger_id;
|
|
|
|
+ trigger = trigger_data->trigger;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Reduce the workq overhead when there is
|
|
|
|
+ * not any eof event found.
|
|
|
|
+ */
|
|
if ((!atomic_read(&link->eof_event_cnt)) &&
|
|
if ((!atomic_read(&link->eof_event_cnt)) &&
|
|
- (trigger_data->trigger == CAM_TRIGGER_POINT_EOF)) {
|
|
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_EOF)) {
|
|
CAM_DBG(CAM_CRM, "Not any request to schedule at EOF");
|
|
CAM_DBG(CAM_CRM, "Not any request to schedule at EOF");
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
@@ -3344,14 +3444,14 @@ static int cam_req_mgr_cb_notify_trigger(
|
|
}
|
|
}
|
|
|
|
|
|
if ((link->watchdog) && (link->watchdog->pause_timer) &&
|
|
if ((link->watchdog) && (link->watchdog->pause_timer) &&
|
|
- (trigger_data->trigger == CAM_TRIGGER_POINT_SOF))
|
|
|
|
|
|
+ (trigger == CAM_TRIGGER_POINT_SOF))
|
|
link->watchdog->pause_timer = false;
|
|
link->watchdog->pause_timer = false;
|
|
|
|
|
|
if (link->dual_trigger) {
|
|
if (link->dual_trigger) {
|
|
if ((trigger_id >= 0) && (trigger_id <
|
|
if ((trigger_id >= 0) && (trigger_id <
|
|
CAM_REQ_MGR_MAX_TRIGGERS)) {
|
|
CAM_REQ_MGR_MAX_TRIGGERS)) {
|
|
- link->trigger_cnt[trigger_id]++;
|
|
|
|
- rc = __cam_req_mgr_check_for_dual_trigger(link);
|
|
|
|
|
|
+ link->trigger_cnt[trigger_id][trigger]++;
|
|
|
|
+ rc = __cam_req_mgr_check_for_dual_trigger(link, trigger);
|
|
if (rc) {
|
|
if (rc) {
|
|
spin_unlock_bh(&link->link_state_spin_lock);
|
|
spin_unlock_bh(&link->link_state_spin_lock);
|
|
goto end;
|
|
goto end;
|
|
@@ -3424,7 +3524,6 @@ static int __cam_req_mgr_setup_link_info(struct cam_req_mgr_core_link *link,
|
|
struct cam_req_mgr_connected_device *dev;
|
|
struct cam_req_mgr_connected_device *dev;
|
|
struct cam_req_mgr_req_tbl *pd_tbl;
|
|
struct cam_req_mgr_req_tbl *pd_tbl;
|
|
enum cam_pipeline_delay max_delay;
|
|
enum cam_pipeline_delay max_delay;
|
|
- uint32_t subscribe_event = 0;
|
|
|
|
uint32_t num_trigger_devices = 0;
|
|
uint32_t num_trigger_devices = 0;
|
|
if (link_info->version == VERSION_1) {
|
|
if (link_info->version == VERSION_1) {
|
|
if (link_info->u.link_info_v1.num_devices >
|
|
if (link_info->u.link_info_v1.num_devices >
|
|
@@ -3512,8 +3611,6 @@ static int __cam_req_mgr_setup_link_info(struct cam_req_mgr_core_link *link,
|
|
}
|
|
}
|
|
if (dev->dev_info.p_delay > max_delay)
|
|
if (dev->dev_info.p_delay > max_delay)
|
|
max_delay = dev->dev_info.p_delay;
|
|
max_delay = dev->dev_info.p_delay;
|
|
-
|
|
|
|
- subscribe_event |= (uint32_t)dev->dev_info.trigger;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (dev->dev_info.trigger_on)
|
|
if (dev->dev_info.trigger_on)
|
|
@@ -3528,12 +3625,10 @@ static int __cam_req_mgr_setup_link_info(struct cam_req_mgr_core_link *link,
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
|
|
|
|
- link->subscribe_event = subscribe_event;
|
|
|
|
link_data.link_enable = 1;
|
|
link_data.link_enable = 1;
|
|
link_data.link_hdl = link->link_hdl;
|
|
link_data.link_hdl = link->link_hdl;
|
|
link_data.crm_cb = &cam_req_mgr_ops;
|
|
link_data.crm_cb = &cam_req_mgr_ops;
|
|
link_data.max_delay = max_delay;
|
|
link_data.max_delay = max_delay;
|
|
- link_data.subscribe_event = subscribe_event;
|
|
|
|
if (num_trigger_devices == CAM_REQ_MGR_MAX_TRIGGERS)
|
|
if (num_trigger_devices == CAM_REQ_MGR_MAX_TRIGGERS)
|
|
link->dual_trigger = true;
|
|
link->dual_trigger = true;
|
|
|
|
|
|
@@ -3968,6 +4063,11 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info)
|
|
goto setup_failed;
|
|
goto setup_failed;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ link->trigger_cnt[0][0] = 0;
|
|
|
|
+ link->trigger_cnt[0][1] = 0;
|
|
|
|
+ link->trigger_cnt[1][0] = 0;
|
|
|
|
+ link->trigger_cnt[1][1] = 0;
|
|
|
|
+
|
|
mutex_unlock(&link->lock);
|
|
mutex_unlock(&link->lock);
|
|
mutex_unlock(&g_crm_core_dev->crm_lock);
|
|
mutex_unlock(&g_crm_core_dev->crm_lock);
|
|
return rc;
|
|
return rc;
|