|
@@ -21,6 +21,8 @@ static struct cam_req_mgr_core_link g_links[MAXIMUM_LINKS_PER_SESSION];
|
|
|
|
|
|
void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|
void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|
{
|
|
{
|
|
|
|
+ uint32_t pd = 0;
|
|
|
|
+
|
|
link->link_hdl = 0;
|
|
link->link_hdl = 0;
|
|
link->num_devs = 0;
|
|
link->num_devs = 0;
|
|
link->max_delay = CAM_PIPELINE_DELAY_0;
|
|
link->max_delay = CAM_PIPELINE_DELAY_0;
|
|
@@ -49,9 +51,13 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|
link->initial_skip = true;
|
|
link->initial_skip = true;
|
|
link->sof_timestamp = 0;
|
|
link->sof_timestamp = 0;
|
|
link->prev_sof_timestamp = 0;
|
|
link->prev_sof_timestamp = 0;
|
|
- link->enable_apply_default = false;
|
|
|
|
link->skip_init_frame = false;
|
|
link->skip_init_frame = false;
|
|
atomic_set(&link->eof_event_cnt, 0);
|
|
atomic_set(&link->eof_event_cnt, 0);
|
|
|
|
+
|
|
|
|
+ for (pd = 0; pd < CAM_PIPELINE_DELAY_MAX; pd++) {
|
|
|
|
+ link->req.apply_data[pd].req_id = -1;
|
|
|
|
+ link->req.prev_apply_data[pd].req_id = -1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void cam_req_mgr_handle_core_shutdown(void)
|
|
void cam_req_mgr_handle_core_shutdown(void)
|
|
@@ -212,32 +218,77 @@ static void __cam_req_mgr_find_dev_name(
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * __cam_req_mgr_apply_default()
|
|
|
|
|
|
+ * __cam_req_mgr_notify_frame_skip()
|
|
*
|
|
*
|
|
- * @brief : Apply default settings to all devices
|
|
|
|
|
|
+ * @brief : Notify all devices of frame skipping
|
|
* @link : link on which we are applying these settings
|
|
* @link : link on which we are applying these settings
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
-static void __cam_req_mgr_apply_default(
|
|
|
|
- struct cam_req_mgr_core_link *link)
|
|
|
|
|
|
+static int __cam_req_mgr_notify_frame_skip(
|
|
|
|
+ struct cam_req_mgr_core_link *link,
|
|
|
|
+ uint32_t trigger)
|
|
{
|
|
{
|
|
- int i;
|
|
|
|
- struct cam_req_mgr_apply_request apply_req;
|
|
|
|
|
|
+ int rc = 0, i, pd, idx;
|
|
|
|
+ struct cam_req_mgr_apply_request frame_skip;
|
|
|
|
+ struct cam_req_mgr_apply *apply_data = NULL;
|
|
struct cam_req_mgr_connected_device *dev = NULL;
|
|
struct cam_req_mgr_connected_device *dev = NULL;
|
|
|
|
+ struct cam_req_mgr_tbl_slot *slot = NULL;
|
|
|
|
|
|
- if (!link->enable_apply_default)
|
|
|
|
- return;
|
|
|
|
|
|
+ apply_data = link->req.prev_apply_data;
|
|
|
|
|
|
for (i = 0; i < link->num_devs; i++) {
|
|
for (i = 0; i < link->num_devs; i++) {
|
|
dev = &link->l_dev[i];
|
|
dev = &link->l_dev[i];
|
|
- apply_req.request_id = 0;
|
|
|
|
- apply_req.dev_hdl = dev->dev_hdl;
|
|
|
|
- apply_req.link_hdl = link->link_hdl;
|
|
|
|
- apply_req.trigger_point = 0;
|
|
|
|
- apply_req.report_if_bubble = 0;
|
|
|
|
- if (dev->ops && dev->ops->apply_default)
|
|
|
|
- dev->ops->apply_default(&apply_req);
|
|
|
|
|
|
+ if (!dev)
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ pd = dev->dev_info.p_delay;
|
|
|
|
+ if (pd >= CAM_PIPELINE_DELAY_MAX) {
|
|
|
|
+ CAM_WARN(CAM_CRM, "pd %d greater than max",
|
|
|
|
+ pd);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ idx = apply_data[pd].idx;
|
|
|
|
+ slot = &dev->pd_tbl->slot[idx];
|
|
|
|
+
|
|
|
|
+ if ((slot->ops.dev_hdl == dev->dev_hdl) &&
|
|
|
|
+ (slot->ops.is_applied)) {
|
|
|
|
+ slot->ops.is_applied = false;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * If apply_at_eof is enabled do not apply at SOF
|
|
|
|
+ * e.x. Flash device
|
|
|
|
+ */
|
|
|
|
+ if ((trigger == CAM_TRIGGER_POINT_SOF) &&
|
|
|
|
+ (dev->dev_hdl == slot->ops.dev_hdl) &&
|
|
|
|
+ (slot->ops.apply_at_eof))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * If apply_at_eof is not enabled ignore EOF
|
|
|
|
+ */
|
|
|
|
+ if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
|
|
+ (dev->dev_hdl == slot->ops.dev_hdl) &&
|
|
|
|
+ (!slot->ops.apply_at_eof))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ frame_skip.dev_hdl = dev->dev_hdl;
|
|
|
|
+ frame_skip.link_hdl = link->link_hdl;
|
|
|
|
+ frame_skip.request_id =
|
|
|
|
+ apply_data[pd].req_id;
|
|
|
|
+ frame_skip.trigger_point = trigger;
|
|
|
|
+ frame_skip.report_if_bubble = 0;
|
|
|
|
+
|
|
|
|
+ CAM_DBG(CAM_REQ,
|
|
|
|
+ "Notify_frame_skip: pd %d req_id %lld",
|
|
|
|
+ link->link_hdl, pd, apply_data[pd].req_id);
|
|
|
|
+ if ((dev->ops) && (dev->ops->notify_frame_skip))
|
|
|
|
+ dev->ops->notify_frame_skip(&frame_skip);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return rc;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -716,6 +767,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
struct cam_req_mgr_apply_request apply_req;
|
|
struct cam_req_mgr_apply_request apply_req;
|
|
struct cam_req_mgr_link_evt_data evt_data;
|
|
struct cam_req_mgr_link_evt_data evt_data;
|
|
struct cam_req_mgr_tbl_slot *slot = NULL;
|
|
struct cam_req_mgr_tbl_slot *slot = NULL;
|
|
|
|
+ struct cam_req_mgr_apply *apply_data = NULL;
|
|
|
|
|
|
apply_req.link_hdl = link->link_hdl;
|
|
apply_req.link_hdl = link->link_hdl;
|
|
apply_req.report_if_bubble = 0;
|
|
apply_req.report_if_bubble = 0;
|
|
@@ -725,6 +777,8 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
apply_req.re_apply = true;
|
|
apply_req.re_apply = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ apply_data = link->req.apply_data;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* This For loop is to address the special operation requested
|
|
* This For loop is to address the special operation requested
|
|
* by device
|
|
* by device
|
|
@@ -740,7 +794,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- idx = link->req.apply_data[pd].idx;
|
|
|
|
|
|
+ idx = apply_data[pd].idx;
|
|
slot = &dev->pd_tbl->slot[idx];
|
|
slot = &dev->pd_tbl->slot[idx];
|
|
|
|
|
|
if (slot->ops.dev_hdl < 0) {
|
|
if (slot->ops.dev_hdl < 0) {
|
|
@@ -772,20 +826,21 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
(!slot->ops.apply_at_eof)) {
|
|
(!slot->ops.apply_at_eof)) {
|
|
CAM_DBG(CAM_CRM, "NO EOF DATA FOR REQ: %llu",
|
|
CAM_DBG(CAM_CRM, "NO EOF DATA FOR REQ: %llu",
|
|
- link->req.apply_data[pd].req_id);
|
|
|
|
|
|
+ apply_data[pd].req_id);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
apply_req.dev_hdl = dev->dev_hdl;
|
|
apply_req.dev_hdl = dev->dev_hdl;
|
|
apply_req.request_id =
|
|
apply_req.request_id =
|
|
- link->req.apply_data[pd].req_id;
|
|
|
|
|
|
+ apply_data[pd].req_id;
|
|
apply_req.trigger_point = trigger;
|
|
apply_req.trigger_point = trigger;
|
|
if ((dev->ops) && (dev->ops->apply_req) &&
|
|
if ((dev->ops) && (dev->ops->apply_req) &&
|
|
(!slot->ops.is_applied)) {
|
|
(!slot->ops.is_applied)) {
|
|
rc = dev->ops->apply_req(&apply_req);
|
|
rc = dev->ops->apply_req(&apply_req);
|
|
if (rc) {
|
|
if (rc) {
|
|
*failed_dev = dev;
|
|
*failed_dev = dev;
|
|
- __cam_req_mgr_apply_default(link);
|
|
|
|
|
|
+ __cam_req_mgr_notify_frame_skip(link,
|
|
|
|
+ trigger);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -801,7 +856,8 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
CAM_DBG(CAM_REQ,
|
|
CAM_DBG(CAM_REQ,
|
|
"SEND: link_hdl: %x pd: %d req_id %lld",
|
|
"SEND: link_hdl: %x pd: %d req_id %lld",
|
|
link->link_hdl, pd, apply_req.request_id);
|
|
link->link_hdl, pd, apply_req.request_id);
|
|
- __cam_req_mgr_apply_default(link);
|
|
|
|
|
|
+ __cam_req_mgr_notify_frame_skip(link,
|
|
|
|
+ trigger);
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
} else if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
} else if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
|
(slot->ops.apply_at_eof)) {
|
|
(slot->ops.apply_at_eof)) {
|
|
@@ -810,7 +866,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
atomic_dec(&link->eof_event_cnt);
|
|
atomic_dec(&link->eof_event_cnt);
|
|
CAM_DBG(CAM_REQ,
|
|
CAM_DBG(CAM_REQ,
|
|
"Req_id: %llu eof_event_cnt : %d",
|
|
"Req_id: %llu eof_event_cnt : %d",
|
|
- link->req.apply_data[pd].req_id,
|
|
|
|
|
|
+ apply_data[pd].req_id,
|
|
link->eof_event_cnt);
|
|
link->eof_event_cnt);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -830,27 +886,27 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
if (!(dev->dev_info.trigger & trigger))
|
|
if (!(dev->dev_info.trigger & trigger))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- if (link->req.apply_data[pd].skip_idx ||
|
|
|
|
- (link->req.apply_data[pd].req_id < 0)) {
|
|
|
|
|
|
+ if (apply_data[pd].skip_idx ||
|
|
|
|
+ (apply_data[pd].req_id < 0)) {
|
|
CAM_DBG(CAM_CRM,
|
|
CAM_DBG(CAM_CRM,
|
|
"dev %s skip %d req_id %lld",
|
|
"dev %s skip %d req_id %lld",
|
|
dev->dev_info.name,
|
|
dev->dev_info.name,
|
|
- link->req.apply_data[pd].skip_idx,
|
|
|
|
- link->req.apply_data[pd].req_id);
|
|
|
|
|
|
+ apply_data[pd].skip_idx,
|
|
|
|
+ apply_data[pd].req_id);
|
|
apply_req.dev_hdl = dev->dev_hdl;
|
|
apply_req.dev_hdl = dev->dev_hdl;
|
|
- apply_req.request_id = 0;
|
|
|
|
|
|
+ apply_req.request_id =
|
|
|
|
+ link->req.prev_apply_data[pd].req_id;
|
|
apply_req.trigger_point = 0;
|
|
apply_req.trigger_point = 0;
|
|
apply_req.report_if_bubble = 0;
|
|
apply_req.report_if_bubble = 0;
|
|
- if ((link->enable_apply_default) &&
|
|
|
|
- (dev->ops) && (dev->ops->apply_default))
|
|
|
|
- dev->ops->apply_default(&apply_req);
|
|
|
|
|
|
+ if ((dev->ops) && (dev->ops->notify_frame_skip))
|
|
|
|
+ dev->ops->notify_frame_skip(&apply_req);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
apply_req.dev_hdl = dev->dev_hdl;
|
|
apply_req.dev_hdl = dev->dev_hdl;
|
|
apply_req.request_id =
|
|
apply_req.request_id =
|
|
- link->req.apply_data[pd].req_id;
|
|
|
|
- idx = link->req.apply_data[pd].idx;
|
|
|
|
|
|
+ apply_data[pd].req_id;
|
|
|
|
+ idx = apply_data[pd].idx;
|
|
slot = &dev->pd_tbl->slot[idx];
|
|
slot = &dev->pd_tbl->slot[idx];
|
|
apply_req.report_if_bubble =
|
|
apply_req.report_if_bubble =
|
|
in_q->slot[idx].recover;
|
|
in_q->slot[idx].recover;
|
|
@@ -880,7 +936,7 @@ 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",
|
|
|
|
|
|
+ "SEND: %d link_hdl: %x pd %d req_id %lld",
|
|
link->link_hdl, pd, apply_req.request_id);
|
|
link->link_hdl, 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);
|
|
@@ -906,8 +962,13 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
|
if (dev->ops && dev->ops->process_evt)
|
|
if (dev->ops && dev->ops->process_evt)
|
|
dev->ops->process_evt(&evt_data);
|
|
dev->ops->process_evt(&evt_data);
|
|
}
|
|
}
|
|
- __cam_req_mgr_apply_default(link);
|
|
|
|
|
|
+ __cam_req_mgr_notify_frame_skip(link, trigger);
|
|
|
|
+ } else {
|
|
|
|
+ memcpy(link->req.prev_apply_data, link->req.apply_data,
|
|
|
|
+ CAM_PIPELINE_DELAY_MAX *
|
|
|
|
+ sizeof(struct cam_req_mgr_apply));
|
|
}
|
|
}
|
|
|
|
+
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1598,7 +1659,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
|
rc = -EPERM;
|
|
rc = -EPERM;
|
|
}
|
|
}
|
|
spin_unlock_bh(&link->link_state_spin_lock);
|
|
spin_unlock_bh(&link->link_state_spin_lock);
|
|
- __cam_req_mgr_apply_default(link);
|
|
|
|
|
|
+ __cam_req_mgr_notify_frame_skip(link, trigger);
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2197,38 +2258,6 @@ static void __cam_req_mgr_unreserve_link(
|
|
|
|
|
|
/* Workqueue context processing section */
|
|
/* Workqueue context processing section */
|
|
|
|
|
|
-/**
|
|
|
|
- * cam_req_mgr_process_send_req()
|
|
|
|
- *
|
|
|
|
- * @brief: This runs in workque thread context. Call core funcs to send
|
|
|
|
- * apply request id to drivers.
|
|
|
|
- * @priv : link information.
|
|
|
|
- * @data : contains information about frame_id, link etc.
|
|
|
|
- *
|
|
|
|
- * @return: 0 on success.
|
|
|
|
- */
|
|
|
|
-int cam_req_mgr_process_send_req(void *priv, void *data)
|
|
|
|
-{
|
|
|
|
- int rc = 0;
|
|
|
|
- struct cam_req_mgr_core_link *link = NULL;
|
|
|
|
- struct cam_req_mgr_send_request *send_req = NULL;
|
|
|
|
- struct cam_req_mgr_req_queue *in_q = NULL;
|
|
|
|
- struct cam_req_mgr_connected_device *dev;
|
|
|
|
-
|
|
|
|
- if (!data || !priv) {
|
|
|
|
- CAM_ERR(CAM_CRM, "input args NULL %pK %pK", data, priv);
|
|
|
|
- rc = -EINVAL;
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
- link = (struct cam_req_mgr_core_link *)priv;
|
|
|
|
- send_req = (struct cam_req_mgr_send_request *)data;
|
|
|
|
- in_q = send_req->in_q;
|
|
|
|
-
|
|
|
|
- rc = __cam_req_mgr_send_req(link, in_q, CAM_TRIGGER_POINT_SOF, &dev);
|
|
|
|
-end:
|
|
|
|
- return rc;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* cam_req_mgr_process_flush_req()
|
|
* cam_req_mgr_process_flush_req()
|
|
*
|
|
*
|
|
@@ -2242,6 +2271,7 @@ end:
|
|
int cam_req_mgr_process_flush_req(void *priv, void *data)
|
|
int cam_req_mgr_process_flush_req(void *priv, void *data)
|
|
{
|
|
{
|
|
int rc = 0, i = 0, idx = -1;
|
|
int rc = 0, i = 0, idx = -1;
|
|
|
|
+ uint32_t pd = 0;
|
|
struct cam_req_mgr_flush_info *flush_info = NULL;
|
|
struct cam_req_mgr_flush_info *flush_info = NULL;
|
|
struct cam_req_mgr_core_link *link = NULL;
|
|
struct cam_req_mgr_core_link *link = NULL;
|
|
struct cam_req_mgr_req_queue *in_q = NULL;
|
|
struct cam_req_mgr_req_queue *in_q = NULL;
|
|
@@ -2306,6 +2336,12 @@ int cam_req_mgr_process_flush_req(void *priv, void *data)
|
|
if (device->ops && device->ops->flush_req)
|
|
if (device->ops && device->ops->flush_req)
|
|
rc = device->ops->flush_req(&flush_req);
|
|
rc = device->ops->flush_req(&flush_req);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ for (pd = 0; pd < CAM_PIPELINE_DELAY_MAX; pd++) {
|
|
|
|
+ link->req.apply_data[pd].req_id = -1;
|
|
|
|
+ link->req.prev_apply_data[pd].req_id = -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
complete(&link->workq_comp);
|
|
complete(&link->workq_comp);
|
|
mutex_unlock(&link->req.lock);
|
|
mutex_unlock(&link->req.lock);
|
|
|
|
|
|
@@ -3297,9 +3333,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;
|
|
|
|
|
|
- if (dev->dev_info.enable_apply_default)
|
|
|
|
- link->enable_apply_default = true;
|
|
|
|
-
|
|
|
|
subscribe_event |= (uint32_t)dev->dev_info.trigger;
|
|
subscribe_event |= (uint32_t)dev->dev_info.trigger;
|
|
}
|
|
}
|
|
|
|
|