Loading drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +49 −10 Original line number Diff line number Diff line Loading @@ -1979,16 +1979,6 @@ int cam_req_mgr_link(struct cam_req_mgr_link_info *link_info) goto setup_failed; } /* Start watchdong timer to detect if camera hw goes into bad state */ rc = crm_timer_init(&link->watchdog, CAM_REQ_MGR_WATCHDOG_TIMEOUT, link, &__cam_req_mgr_sof_freeze); if (rc < 0) { kfree(link->workq->task.pool[0].payload); __cam_req_mgr_destroy_link_info(link); cam_req_mgr_workq_destroy(&link->workq); goto setup_failed; } mutex_unlock(&link->lock); mutex_unlock(&g_crm_core_dev->crm_lock); return rc; Loading Loading @@ -2203,6 +2193,55 @@ int cam_req_mgr_flush_requests( return rc; } int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control) { int rc = 0; int i; struct cam_req_mgr_core_link *link = NULL; if (!control) { CAM_ERR(CAM_CRM, "Control command is NULL"); rc = -EINVAL; goto end; } mutex_lock(&g_crm_core_dev->crm_lock); for (i = 0; i < control->num_links; i++) { link = (struct cam_req_mgr_core_link *) cam_get_device_priv(control->link_hdls[i]); if (!link) { CAM_ERR(CAM_CRM, "Link(%d) is NULL on session 0x%x", i, control->session_hdl); rc = -EINVAL; break; } mutex_lock(&link->lock); if (control->ops == CAM_REQ_MGR_LINK_ACTIVATE) { /* Start SOF watchdog timer */ rc = crm_timer_init(&link->watchdog, CAM_REQ_MGR_WATCHDOG_TIMEOUT, link, &__cam_req_mgr_sof_freeze); if (rc < 0) { CAM_ERR(CAM_CRM, "SOF timer start fails: link=0x%x", link->link_hdl); rc = -EFAULT; } } else if (control->ops == CAM_REQ_MGR_LINK_DEACTIVATE) { /* Destroy SOF watchdog timer */ crm_timer_exit(&link->watchdog); } else { CAM_ERR(CAM_CRM, "Invalid link control command"); rc = -EINVAL; } mutex_unlock(&link->lock); } mutex_unlock(&g_crm_core_dev->crm_lock); end: return rc; } int cam_req_mgr_core_device_init(void) { Loading drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +8 −0 Original line number Diff line number Diff line Loading @@ -415,5 +415,13 @@ int cam_req_mgr_core_device_deinit(void); * @brief: Handles camera close */ void cam_req_mgr_handle_core_shutdown(void); /** * cam_req_mgr_link_control() * @brief: Handles link control operations * @control: Link control command */ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control); #endif drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_dev.c +18 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,24 @@ static long cam_private_ioctl(struct file *file, void *fh, rc = -EINVAL; } break; case CAM_REQ_MGR_LINK_CONTROL: { struct cam_req_mgr_link_control cmd; if (k_ioctl->size != sizeof(cmd)) return -EINVAL; if (copy_from_user(&cmd, (void __user *)k_ioctl->handle, k_ioctl->size)) { rc = -EFAULT; break; } rc = cam_req_mgr_link_control(&cmd); if (rc) rc = -EINVAL; } break; default: return -ENOIOCTLCMD; } Loading include/uapi/media/cam_req_mgr.h +23 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ #define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0 #define CAM_REQ_MGR_SOF_EVENT_ERROR 1 /* Link control operations */ #define CAM_REQ_MGR_LINK_ACTIVATE 0 #define CAM_REQ_MGR_LINK_DEACTIVATE 1 /** * Request Manager : flush_type * @CAM_REQ_MGR_FLUSH_TYPE_ALL: Req mgr will remove all the pending Loading Loading @@ -181,6 +185,24 @@ struct cam_req_mgr_sync_mode { int32_t reserved; }; /** * struct cam_req_mgr_link_control * @ops: Link operations: activate/deactive * @session_hdl: Input param - Identifier for CSL session * @num_links: Input Param - Num of links * @reserved: reserved field * @link_hdls: Input Param - Links to be activated/deactivated * * @opcode: CAM_REQ_MGR_LINK_CONTROL */ struct cam_req_mgr_link_control { int32_t ops; int32_t session_hdl; int32_t num_links; int32_t reserved; int32_t link_hdls[MAX_LINKS_PER_SESSION]; }; /** * cam_req_mgr specific opcode ids */ Loading @@ -196,6 +218,7 @@ struct cam_req_mgr_sync_mode { #define CAM_REQ_MGR_MAP_BUF (CAM_COMMON_OPCODE_MAX + 10) #define CAM_REQ_MGR_RELEASE_BUF (CAM_COMMON_OPCODE_MAX + 11) #define CAM_REQ_MGR_CACHE_OPS (CAM_COMMON_OPCODE_MAX + 12) #define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13) /* end of cam_req_mgr opcodes */ #define CAM_MEM_FLAG_HW_READ_WRITE (1<<0) Loading Loading
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +49 −10 Original line number Diff line number Diff line Loading @@ -1979,16 +1979,6 @@ int cam_req_mgr_link(struct cam_req_mgr_link_info *link_info) goto setup_failed; } /* Start watchdong timer to detect if camera hw goes into bad state */ rc = crm_timer_init(&link->watchdog, CAM_REQ_MGR_WATCHDOG_TIMEOUT, link, &__cam_req_mgr_sof_freeze); if (rc < 0) { kfree(link->workq->task.pool[0].payload); __cam_req_mgr_destroy_link_info(link); cam_req_mgr_workq_destroy(&link->workq); goto setup_failed; } mutex_unlock(&link->lock); mutex_unlock(&g_crm_core_dev->crm_lock); return rc; Loading Loading @@ -2203,6 +2193,55 @@ int cam_req_mgr_flush_requests( return rc; } int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control) { int rc = 0; int i; struct cam_req_mgr_core_link *link = NULL; if (!control) { CAM_ERR(CAM_CRM, "Control command is NULL"); rc = -EINVAL; goto end; } mutex_lock(&g_crm_core_dev->crm_lock); for (i = 0; i < control->num_links; i++) { link = (struct cam_req_mgr_core_link *) cam_get_device_priv(control->link_hdls[i]); if (!link) { CAM_ERR(CAM_CRM, "Link(%d) is NULL on session 0x%x", i, control->session_hdl); rc = -EINVAL; break; } mutex_lock(&link->lock); if (control->ops == CAM_REQ_MGR_LINK_ACTIVATE) { /* Start SOF watchdog timer */ rc = crm_timer_init(&link->watchdog, CAM_REQ_MGR_WATCHDOG_TIMEOUT, link, &__cam_req_mgr_sof_freeze); if (rc < 0) { CAM_ERR(CAM_CRM, "SOF timer start fails: link=0x%x", link->link_hdl); rc = -EFAULT; } } else if (control->ops == CAM_REQ_MGR_LINK_DEACTIVATE) { /* Destroy SOF watchdog timer */ crm_timer_exit(&link->watchdog); } else { CAM_ERR(CAM_CRM, "Invalid link control command"); rc = -EINVAL; } mutex_unlock(&link->lock); } mutex_unlock(&g_crm_core_dev->crm_lock); end: return rc; } int cam_req_mgr_core_device_init(void) { Loading
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +8 −0 Original line number Diff line number Diff line Loading @@ -415,5 +415,13 @@ int cam_req_mgr_core_device_deinit(void); * @brief: Handles camera close */ void cam_req_mgr_handle_core_shutdown(void); /** * cam_req_mgr_link_control() * @brief: Handles link control operations * @control: Link control command */ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control); #endif
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_dev.c +18 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,24 @@ static long cam_private_ioctl(struct file *file, void *fh, rc = -EINVAL; } break; case CAM_REQ_MGR_LINK_CONTROL: { struct cam_req_mgr_link_control cmd; if (k_ioctl->size != sizeof(cmd)) return -EINVAL; if (copy_from_user(&cmd, (void __user *)k_ioctl->handle, k_ioctl->size)) { rc = -EFAULT; break; } rc = cam_req_mgr_link_control(&cmd); if (rc) rc = -EINVAL; } break; default: return -ENOIOCTLCMD; } Loading
include/uapi/media/cam_req_mgr.h +23 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ #define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0 #define CAM_REQ_MGR_SOF_EVENT_ERROR 1 /* Link control operations */ #define CAM_REQ_MGR_LINK_ACTIVATE 0 #define CAM_REQ_MGR_LINK_DEACTIVATE 1 /** * Request Manager : flush_type * @CAM_REQ_MGR_FLUSH_TYPE_ALL: Req mgr will remove all the pending Loading Loading @@ -181,6 +185,24 @@ struct cam_req_mgr_sync_mode { int32_t reserved; }; /** * struct cam_req_mgr_link_control * @ops: Link operations: activate/deactive * @session_hdl: Input param - Identifier for CSL session * @num_links: Input Param - Num of links * @reserved: reserved field * @link_hdls: Input Param - Links to be activated/deactivated * * @opcode: CAM_REQ_MGR_LINK_CONTROL */ struct cam_req_mgr_link_control { int32_t ops; int32_t session_hdl; int32_t num_links; int32_t reserved; int32_t link_hdls[MAX_LINKS_PER_SESSION]; }; /** * cam_req_mgr specific opcode ids */ Loading @@ -196,6 +218,7 @@ struct cam_req_mgr_sync_mode { #define CAM_REQ_MGR_MAP_BUF (CAM_COMMON_OPCODE_MAX + 10) #define CAM_REQ_MGR_RELEASE_BUF (CAM_COMMON_OPCODE_MAX + 11) #define CAM_REQ_MGR_CACHE_OPS (CAM_COMMON_OPCODE_MAX + 12) #define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13) /* end of cam_req_mgr opcodes */ #define CAM_MEM_FLAG_HW_READ_WRITE (1<<0) Loading