diff options
author | Vishalsingh Hajeri <vhajeri@codeaurora.org> | 2018-08-02 16:40:10 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-08-10 04:36:08 -0700 |
commit | 00968d8ec2d4eecfd3412eb1603fb04b7a741082 (patch) | |
tree | 2ae0eb5f747a738b24685eb50aba8bd89a866967 | |
parent | 5e25bce008de797d176a9be9fda2430f07c41c7e (diff) |
msm: camera: crm: Perform the notification in workq on sof freezeLA.UM.6.3.r4-05000-sdm845.0
In case of SOF freeze perform the task of notifying the devices
in a workq instead of timer callback context to avoid watchdog
bite from mutex lock.
Change-Id: Ie787900e4a7f28209d9aa1d7e580186982f918db
Signed-off-by: Vishalsingh Hajeri <vhajeri@codeaurora.org>
-rw-r--r-- | drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c | 61 | ||||
-rw-r--r-- | drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h | 1 |
2 files changed, 50 insertions, 12 deletions
diff --git a/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c b/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c index 346cd5678379..61fd7a85290d 100644 --- a/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c @@ -1142,24 +1142,26 @@ static void __cam_req_mgr_notify_sof_freeze( } /** - * __cam_req_mgr_sof_freeze() + * __cam_req_mgr_process_sof_freeze() * * @brief : Apoptosis - Handles case when connected devices are not responding - * @data : timer pointer + * @priv : link information + * @data : task data * */ -static void __cam_req_mgr_sof_freeze(unsigned long data) +static int __cam_req_mgr_process_sof_freeze(void *priv, void *data) { - struct cam_req_mgr_timer *timer = (struct cam_req_mgr_timer *)data; struct cam_req_mgr_core_link *link = NULL; struct cam_req_mgr_core_session *session = NULL; struct cam_req_mgr_message msg; + int rc = 0; - if (!timer) { - CAM_ERR(CAM_CRM, "NULL timer"); - return; + if (!data || !priv) { + CAM_ERR(CAM_CRM, "input args NULL %pK %pK", data, priv); + return -EINVAL; } - link = (struct cam_req_mgr_core_link *)timer->parent; + + link = (struct cam_req_mgr_core_link *)priv; session = (struct cam_req_mgr_core_session *)link->parent; CAM_ERR(CAM_CRM, "SOF freeze for session %d link 0x%x", @@ -1173,12 +1175,47 @@ static void __cam_req_mgr_sof_freeze(unsigned long data) msg.u.err_msg.request_id = 0; msg.u.err_msg.link_hdl = link->link_hdl; + rc = cam_req_mgr_notify_message(&msg, + V4L_EVENT_CAM_REQ_MGR_ERROR, V4L_EVENT_CAM_REQ_MGR_EVENT); - if (cam_req_mgr_notify_message(&msg, - V4L_EVENT_CAM_REQ_MGR_ERROR, V4L_EVENT_CAM_REQ_MGR_EVENT)) + if (rc) CAM_ERR(CAM_CRM, - "Error notifying SOF freeze for session %d link 0x%x", - session->session_hdl, link->link_hdl); + "Error notifying SOF freeze for session %d link 0x%x rc %d", + session->session_hdl, link->link_hdl, rc); + + return rc; +} + +/** + * __cam_req_mgr_sof_freeze() + * + * @brief : Callback function for timer timeout indicating SOF freeze + * @data : timer pointer + * + */ +static void __cam_req_mgr_sof_freeze(unsigned long data) +{ + struct cam_req_mgr_timer *timer = (struct cam_req_mgr_timer *)data; + struct crm_workq_task *task = NULL; + struct cam_req_mgr_core_link *link = NULL; + struct crm_task_payload *task_data; + + if (!timer) { + CAM_ERR(CAM_CRM, "NULL timer"); + return; + } + + link = (struct cam_req_mgr_core_link *)timer->parent; + task = cam_req_mgr_workq_get_task(link->workq); + if (!task) { + CAM_ERR(CAM_CRM, "No empty task"); + return; + } + + task_data = (struct crm_task_payload *)task->payload; + task_data->type = CRM_WORKQ_TASK_NOTIFY_FREEZE; + task->process_cb = &__cam_req_mgr_process_sof_freeze; + cam_req_mgr_workq_enqueue_task(task, link, CRM_TASK_PRIORITY_0); } /** diff --git a/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h b/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h index 025c16aacfdf..68ec09b1e89e 100644 --- a/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +++ b/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h @@ -45,6 +45,7 @@ enum crm_workq_task_type { CRM_WORKQ_TASK_APPLY_REQ, CRM_WORKQ_TASK_NOTIFY_SOF, CRM_WORKQ_TASK_NOTIFY_ERR, + CRM_WORKQ_TASK_NOTIFY_FREEZE, CRM_WORKQ_TASK_SCHED_REQ, CRM_WORKQ_TASK_FLUSH_REQ, CRM_WORKQ_TASK_INVALID, |