Merge "msm: camera: reqmgr: Invoke custom device at every frame" into camera-kernel.lnx.4.0
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
f65f27de96
@@ -49,6 +49,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
||||
link->initial_skip = true;
|
||||
link->sof_timestamp = 0;
|
||||
link->prev_sof_timestamp = 0;
|
||||
link->enable_apply_default = false;
|
||||
atomic_set(&link->eof_event_cnt, 0);
|
||||
}
|
||||
|
||||
@@ -209,6 +210,35 @@ static void __cam_req_mgr_find_dev_name(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __cam_req_mgr_apply_default()
|
||||
*
|
||||
* @brief : Apply default settings to all devices
|
||||
* @link : link on which we are applying these settings
|
||||
*
|
||||
*/
|
||||
static void __cam_req_mgr_apply_default(
|
||||
struct cam_req_mgr_core_link *link)
|
||||
{
|
||||
int i;
|
||||
struct cam_req_mgr_apply_request apply_req;
|
||||
struct cam_req_mgr_connected_device *dev = NULL;
|
||||
|
||||
if (!link->enable_apply_default)
|
||||
return;
|
||||
|
||||
for (i = 0; i < link->num_devs; 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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __cam_req_mgr_notify_error_on_link()
|
||||
*
|
||||
@@ -738,6 +768,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
||||
rc = dev->ops->apply_req(&apply_req);
|
||||
if (rc) {
|
||||
*failed_dev = dev;
|
||||
__cam_req_mgr_apply_default(link);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -750,6 +781,10 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
||||
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_apply_default(link);
|
||||
return -EAGAIN;
|
||||
} else if ((trigger == CAM_TRIGGER_POINT_EOF) &&
|
||||
(slot->ops.apply_at_eof)) {
|
||||
@@ -774,16 +809,27 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
||||
pd);
|
||||
continue;
|
||||
}
|
||||
if (link->req.apply_data[pd].skip_idx ||
|
||||
link->req.apply_data[pd].req_id < 0) {
|
||||
CAM_DBG(CAM_CRM, "skip %d req_id %lld",
|
||||
link->req.apply_data[pd].skip_idx,
|
||||
link->req.apply_data[pd].req_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(dev->dev_info.trigger & trigger))
|
||||
continue;
|
||||
|
||||
if (link->req.apply_data[pd].skip_idx ||
|
||||
(link->req.apply_data[pd].req_id < 0)) {
|
||||
CAM_DBG(CAM_CRM,
|
||||
"dev %s skip %d req_id %lld",
|
||||
dev->dev_info.name,
|
||||
link->req.apply_data[pd].skip_idx,
|
||||
link->req.apply_data[pd].req_id);
|
||||
apply_req.dev_hdl = dev->dev_hdl;
|
||||
apply_req.request_id = 0;
|
||||
apply_req.trigger_point = 0;
|
||||
apply_req.report_if_bubble = 0;
|
||||
if ((link->enable_apply_default) &&
|
||||
(dev->ops) && (dev->ops->apply_default))
|
||||
dev->ops->apply_default(&apply_req);
|
||||
continue;
|
||||
}
|
||||
|
||||
apply_req.dev_hdl = dev->dev_hdl;
|
||||
apply_req.request_id =
|
||||
link->req.apply_data[pd].req_id;
|
||||
@@ -843,6 +889,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
|
||||
if (dev->ops && dev->ops->process_evt)
|
||||
dev->ops->process_evt(&evt_data);
|
||||
}
|
||||
__cam_req_mgr_apply_default(link);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -1534,6 +1581,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
|
||||
rc = -EPERM;
|
||||
}
|
||||
spin_unlock_bh(&link->link_state_spin_lock);
|
||||
__cam_req_mgr_apply_default(link);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -3223,6 +3271,9 @@ static int __cam_req_mgr_setup_link_info(struct cam_req_mgr_core_link *link,
|
||||
if (dev->dev_info.p_delay > max_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;
|
||||
}
|
||||
|
||||
|
@@ -365,6 +365,10 @@ struct cam_req_mgr_connected_device {
|
||||
* applying the settings
|
||||
* @trigger_cnt : trigger count value per device initiating the trigger
|
||||
* @eof_event_cnt : Atomic variable to track the number of EOF requests
|
||||
* @enable_apply_default : Link will apply a default settings to devices on
|
||||
* frames where actual settings are not available.
|
||||
* This will account for all devices irrespective of
|
||||
* pipeline delay
|
||||
*/
|
||||
struct cam_req_mgr_core_link {
|
||||
int32_t link_hdl;
|
||||
@@ -398,6 +402,7 @@ struct cam_req_mgr_core_link {
|
||||
bool dual_trigger;
|
||||
uint32_t trigger_cnt[CAM_REQ_MGR_MAX_TRIGGERS];
|
||||
atomic_t eof_event_cnt;
|
||||
bool enable_apply_default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -54,6 +54,7 @@ typedef int (*cam_req_mgr_notify_stop)(struct cam_req_mgr_notify_stop *);
|
||||
typedef int (*cam_req_mgr_get_dev_info) (struct cam_req_mgr_device_info *);
|
||||
typedef int (*cam_req_mgr_link_setup)(struct cam_req_mgr_core_dev_link_setup *);
|
||||
typedef int (*cam_req_mgr_apply_req)(struct cam_req_mgr_apply_request *);
|
||||
typedef int (*cam_req_mgr_apply_default)(struct cam_req_mgr_apply_request *);
|
||||
typedef int (*cam_req_mgr_flush_req)(struct cam_req_mgr_flush_request *);
|
||||
typedef int (*cam_req_mgr_process_evt)(struct cam_req_mgr_link_evt_data *);
|
||||
typedef int (*cam_req_mgr_dump_req)(struct cam_req_mgr_dump_info *);
|
||||
@@ -81,6 +82,7 @@ struct cam_req_mgr_crm_cb {
|
||||
* @get_dev_info : payload to fetch device details
|
||||
* @link_setup : payload to establish link with device
|
||||
* @apply_req : payload to apply request id on a device linked
|
||||
* @apply_default: payload to trigger default apply settings
|
||||
* @flush_req : payload to flush request
|
||||
* @process_evt : payload to generic event
|
||||
* @dump_req : payload to dump request
|
||||
@@ -89,6 +91,7 @@ struct cam_req_mgr_kmd_ops {
|
||||
cam_req_mgr_get_dev_info get_dev_info;
|
||||
cam_req_mgr_link_setup link_setup;
|
||||
cam_req_mgr_apply_req apply_req;
|
||||
cam_req_mgr_apply_default apply_default;
|
||||
cam_req_mgr_flush_req flush_req;
|
||||
cam_req_mgr_process_evt process_evt;
|
||||
cam_req_mgr_dump_req dump_req;
|
||||
@@ -293,6 +296,9 @@ struct cam_req_mgr_notify_stop {
|
||||
* @p_delay : delay between time settings applied and take effect
|
||||
* @trigger : Trigger point for the client
|
||||
* @trigger_on : This device provides trigger
|
||||
* @enable_apply_default : Device requests CRM to apply default
|
||||
* settings for devices on a link if actual
|
||||
* settings for a given frame is not available
|
||||
*/
|
||||
struct cam_req_mgr_device_info {
|
||||
int32_t dev_hdl;
|
||||
@@ -301,6 +307,7 @@ struct cam_req_mgr_device_info {
|
||||
enum cam_pipeline_delay p_delay;
|
||||
uint32_t trigger;
|
||||
bool trigger_on;
|
||||
bool enable_apply_default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user