Loading drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +56 −1 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link) link->last_flush_id = 0; link->last_flush_id = 0; link->initial_sync_req = -1; link->initial_sync_req = -1; link->in_msync_mode = false; link->in_msync_mode = false; link->retry_cnt = 0; } } void cam_req_mgr_handle_core_shutdown(void) void cam_req_mgr_handle_core_shutdown(void) Loading Loading @@ -166,6 +167,46 @@ static int __cam_req_mgr_inject_delay( return rc; return rc; } } /** * __cam_req_mgr_notify_error_on_link() * * @brief : Notify userspace on exceeding max retry * attempts to apply same req * @link : link on which the req could not be applied * */ static int __cam_req_mgr_notify_error_on_link( struct cam_req_mgr_core_link *link) { struct cam_req_mgr_core_session *session = NULL; struct cam_req_mgr_message msg; int rc = 0; session = (struct cam_req_mgr_core_session *)link->parent; CAM_ERR(CAM_CRM, "Notifying userspace to trigger recovery on link 0x%x for session %d", link->link_hdl, session->session_hdl); memset(&msg, 0, sizeof(msg)); msg.session_hdl = session->session_hdl; msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_RECOVERY; 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 (rc) CAM_ERR(CAM_CRM, "Error in notifying recovery for session %d link 0x%x rc %d", session->session_hdl, link->link_hdl, rc); return rc; } /** /** * __cam_req_mgr_traverse() * __cam_req_mgr_traverse() * * Loading Loading @@ -1092,7 +1133,20 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, if (rc < 0) { if (rc < 0) { /* Apply req failed retry at next sof */ /* Apply req failed retry at next sof */ slot->status = CRM_SLOT_STATUS_REQ_PENDING; slot->status = CRM_SLOT_STATUS_REQ_PENDING; link->retry_cnt++; if (link->retry_cnt == MAXIMUM_RETRY_ATTEMPTS) { CAM_DBG(CAM_CRM, "Max retry attempts reached on link[0x%x] for req [%lld]", link->link_hdl, in_q->slot[in_q->rd_idx].req_id); __cam_req_mgr_notify_error_on_link(link); link->retry_cnt = 0; } } else { } else { if (link->retry_cnt) link->retry_cnt = 0; link->trigger_mask |= trigger; link->trigger_mask |= trigger; CAM_DBG(CAM_CRM, "Applied req[%lld] on link[%x] success", CAM_DBG(CAM_CRM, "Applied req[%lld] on link[%x] success", Loading Loading @@ -1342,7 +1396,7 @@ static int __cam_req_mgr_process_sof_freeze(void *priv, void *data) memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg)); msg.session_hdl = session->session_hdl; msg.session_hdl = session->session_hdl; msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_DEVICE; msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_RECOVERY; msg.u.err_msg.request_id = 0; msg.u.err_msg.request_id = 0; msg.u.err_msg.link_hdl = link->link_hdl; msg.u.err_msg.link_hdl = link->link_hdl; Loading Loading @@ -1586,6 +1640,7 @@ static void __cam_req_mgr_free_link(struct cam_req_mgr_core_link *link) link->req.in_q = NULL; link->req.in_q = NULL; i = link - g_links; i = link - g_links; CAM_DBG(CAM_CRM, "free link index %d", i); CAM_DBG(CAM_CRM, "free link index %d", i); cam_req_mgr_core_link_reset(link); atomic_set(&g_links[i].is_used, 0); atomic_set(&g_links[i].is_used, 0); } } Loading drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,8 @@ #define MAXIMUM_LINKS_PER_SESSION 4 #define MAXIMUM_LINKS_PER_SESSION 4 #define MAXIMUM_RETRY_ATTEMPTS 3 /** /** * enum crm_workq_task_type * enum crm_workq_task_type * @codes: to identify which type of task is present * @codes: to identify which type of task is present Loading Loading @@ -310,6 +312,8 @@ struct cam_req_mgr_connected_device { * @in_msync_mode : Flag to determine if a link is in master-slave mode * @in_msync_mode : Flag to determine if a link is in master-slave mode * @initial_sync_req : The initial req which is required to sync with the * @initial_sync_req : The initial req which is required to sync with the * other link * other link * @retry_cnt : Counter that tracks number of attempts to apply * the same req */ */ struct cam_req_mgr_core_link { struct cam_req_mgr_core_link { int32_t link_hdl; int32_t link_hdl; Loading @@ -336,6 +340,7 @@ struct cam_req_mgr_core_link { bool initial_skip; bool initial_skip; bool in_msync_mode; bool in_msync_mode; int64_t initial_sync_req; int64_t initial_sync_req; uint32_t retry_cnt; }; }; /** /** Loading Loading
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +56 −1 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link) link->last_flush_id = 0; link->last_flush_id = 0; link->initial_sync_req = -1; link->initial_sync_req = -1; link->in_msync_mode = false; link->in_msync_mode = false; link->retry_cnt = 0; } } void cam_req_mgr_handle_core_shutdown(void) void cam_req_mgr_handle_core_shutdown(void) Loading Loading @@ -166,6 +167,46 @@ static int __cam_req_mgr_inject_delay( return rc; return rc; } } /** * __cam_req_mgr_notify_error_on_link() * * @brief : Notify userspace on exceeding max retry * attempts to apply same req * @link : link on which the req could not be applied * */ static int __cam_req_mgr_notify_error_on_link( struct cam_req_mgr_core_link *link) { struct cam_req_mgr_core_session *session = NULL; struct cam_req_mgr_message msg; int rc = 0; session = (struct cam_req_mgr_core_session *)link->parent; CAM_ERR(CAM_CRM, "Notifying userspace to trigger recovery on link 0x%x for session %d", link->link_hdl, session->session_hdl); memset(&msg, 0, sizeof(msg)); msg.session_hdl = session->session_hdl; msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_RECOVERY; 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 (rc) CAM_ERR(CAM_CRM, "Error in notifying recovery for session %d link 0x%x rc %d", session->session_hdl, link->link_hdl, rc); return rc; } /** /** * __cam_req_mgr_traverse() * __cam_req_mgr_traverse() * * Loading Loading @@ -1092,7 +1133,20 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, if (rc < 0) { if (rc < 0) { /* Apply req failed retry at next sof */ /* Apply req failed retry at next sof */ slot->status = CRM_SLOT_STATUS_REQ_PENDING; slot->status = CRM_SLOT_STATUS_REQ_PENDING; link->retry_cnt++; if (link->retry_cnt == MAXIMUM_RETRY_ATTEMPTS) { CAM_DBG(CAM_CRM, "Max retry attempts reached on link[0x%x] for req [%lld]", link->link_hdl, in_q->slot[in_q->rd_idx].req_id); __cam_req_mgr_notify_error_on_link(link); link->retry_cnt = 0; } } else { } else { if (link->retry_cnt) link->retry_cnt = 0; link->trigger_mask |= trigger; link->trigger_mask |= trigger; CAM_DBG(CAM_CRM, "Applied req[%lld] on link[%x] success", CAM_DBG(CAM_CRM, "Applied req[%lld] on link[%x] success", Loading Loading @@ -1342,7 +1396,7 @@ static int __cam_req_mgr_process_sof_freeze(void *priv, void *data) memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg)); msg.session_hdl = session->session_hdl; msg.session_hdl = session->session_hdl; msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_DEVICE; msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_RECOVERY; msg.u.err_msg.request_id = 0; msg.u.err_msg.request_id = 0; msg.u.err_msg.link_hdl = link->link_hdl; msg.u.err_msg.link_hdl = link->link_hdl; Loading Loading @@ -1586,6 +1640,7 @@ static void __cam_req_mgr_free_link(struct cam_req_mgr_core_link *link) link->req.in_q = NULL; link->req.in_q = NULL; i = link - g_links; i = link - g_links; CAM_DBG(CAM_CRM, "free link index %d", i); CAM_DBG(CAM_CRM, "free link index %d", i); cam_req_mgr_core_link_reset(link); atomic_set(&g_links[i].is_used, 0); atomic_set(&g_links[i].is_used, 0); } } Loading
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,8 @@ #define MAXIMUM_LINKS_PER_SESSION 4 #define MAXIMUM_LINKS_PER_SESSION 4 #define MAXIMUM_RETRY_ATTEMPTS 3 /** /** * enum crm_workq_task_type * enum crm_workq_task_type * @codes: to identify which type of task is present * @codes: to identify which type of task is present Loading Loading @@ -310,6 +312,8 @@ struct cam_req_mgr_connected_device { * @in_msync_mode : Flag to determine if a link is in master-slave mode * @in_msync_mode : Flag to determine if a link is in master-slave mode * @initial_sync_req : The initial req which is required to sync with the * @initial_sync_req : The initial req which is required to sync with the * other link * other link * @retry_cnt : Counter that tracks number of attempts to apply * the same req */ */ struct cam_req_mgr_core_link { struct cam_req_mgr_core_link { int32_t link_hdl; int32_t link_hdl; Loading @@ -336,6 +340,7 @@ struct cam_req_mgr_core_link { bool initial_skip; bool initial_skip; bool in_msync_mode; bool in_msync_mode; int64_t initial_sync_req; int64_t initial_sync_req; uint32_t retry_cnt; }; }; /** /** Loading