msm: camera: common: Change shutdown sequence for subdevices

In subdev close call if CRM is still active wait for shutdown
from CRM [media device]. Remove subdevice check for active
handles, shutdown to happen irrespective of any active context.

If CRM is not active, subdevice shutdown should ensure there is
no access to kernel allocated buffers since at this point
memmgr is de-initialized.

As part of ICP close, remove usage of HFI queues, trigger PIL
to transfer FW memory ownership back to HLOS and power off ICP.

CRs-Fixed: 2976107
Change-Id: Ib05b3fbdcc33f4072da7ef77cf0118a807860e8c
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
Dieser Commit ist enthalten in:
Karthik Anantha Ram
2021-06-24 15:09:00 -07:00
Ursprung 1c49642a1f
Commit d785949196
40 geänderte Dateien mit 85 neuen und 397 gelöschten Zeilen

Datei anzeigen

@@ -610,31 +610,6 @@ int cam_context_handle_stop_dev(struct cam_context *ctx,
return rc;
}
int cam_context_handle_shutdown_dev(struct cam_context *ctx,
struct cam_control *cmd, struct v4l2_subdev_fh *fh)
{
int rc = 0;
if (!ctx || !ctx->state_machine) {
CAM_ERR(CAM_CORE, "Context is not ready");
return -EINVAL;
}
if (!cmd) {
CAM_ERR(CAM_CORE, "Invalid stop device command payload");
return -EINVAL;
}
if (ctx->state_machine[ctx->state].ioctl_ops.shutdown_dev)
rc = ctx->state_machine[ctx->state].ioctl_ops.shutdown_dev(
(struct v4l2_subdev *)cmd->handle, fh);
else
CAM_WARN(CAM_CORE, "No shutdown device in dev %d, state %d",
ctx->dev_hdl, ctx->state);
return rc;
}
int cam_context_handle_info_dump(void *context,
enum cam_context_dump_id id)
{

Datei anzeigen

@@ -98,7 +98,6 @@ struct cam_ctx_request {
* @acquire_hw: Function pointer for acquire hw
* @release_hw: Function pointer for release hw
* @dump_dev: Function pointer for dump dev
* @shutdown_dev: Function pointer for shutdown dev
*
*/
struct cam_ctx_ioctl_ops {
@@ -118,8 +117,6 @@ struct cam_ctx_ioctl_ops {
int (*release_hw)(struct cam_context *ctx, void *args);
int (*dump_dev)(struct cam_context *ctx,
struct cam_dump_req_cmd *cmd);
int (*shutdown_dev)(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
};
/**
@@ -517,19 +514,6 @@ int cam_context_handle_start_dev(struct cam_context *ctx,
int cam_context_handle_stop_dev(struct cam_context *ctx,
struct cam_start_stop_dev_cmd *cmd);
/**
* cam_context_handle_shutdown_dev()
*
* @brief: Handle shutdown device command
*
* @ctx: Object pointer for cam_context
* @cmd: Shutdown device command payload
* @fh: Pointer to struct v4l2_subdev_fh
*
*/
int cam_context_handle_shutdown_dev(struct cam_context *ctx,
struct cam_control *cmd, struct v4l2_subdev_fh *fh);
/**
* cam_context_handle_dump_dev()
*

Datei anzeigen

@@ -297,27 +297,6 @@ static int __cam_node_handle_stop_dev(struct cam_node *node,
return rc;
}
int cam_node_handle_shutdown_dev(struct cam_node *node,
struct cam_control *cmd, struct v4l2_subdev_fh *fh)
{
struct cam_context *ctx = NULL;
int32_t dev_index = -1;
int rc = 0, ret = 0;
while ((dev_index = cam_get_dev_handle_info(cmd->handle,
&ctx, dev_index)) < CAM_REQ_MGR_MAX_HANDLES_V2) {
ret = cam_context_handle_shutdown_dev(ctx, cmd, fh);
if (ret) {
rc = ret;
CAM_ERR(CAM_CORE, "Shutdown failure for node %s",
node->name);
continue;
}
}
return rc;
}
static int __cam_node_handle_config_dev(struct cam_node *node,
struct cam_config_dev_cmd *config)
{

Datei anzeigen

@@ -27,21 +27,25 @@
* @ctx_size: Context list size
* @hw_mgr_intf: Interface for cam_node to HW
* @crm_node_intf: Interface for the CRM to cam_node
* @sd_handler: Shutdown handler for this subdev
*
*/
struct cam_node {
char name[CAM_CTX_DEV_NAME_MAX_LENGTH];
uint32_t state;
char name[CAM_CTX_DEV_NAME_MAX_LENGTH];
uint32_t state;
/* context pool */
struct mutex list_mutex;
struct list_head free_ctx_list;
struct cam_context *ctx_list;
uint32_t ctx_size;
struct mutex list_mutex;
struct list_head free_ctx_list;
struct cam_context *ctx_list;
uint32_t ctx_size;
/* interfaces */
struct cam_hw_mgr_intf hw_mgr_intf;
struct cam_req_mgr_kmd_ops crm_node_intf;
struct cam_hw_mgr_intf hw_mgr_intf;
struct cam_req_mgr_kmd_ops crm_node_intf;
int (*sd_handler)(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
};
/**
@@ -113,17 +117,4 @@ void cam_node_put_ctxt_to_free_list(struct kref *ref);
int32_t cam_get_dev_handle_info(uint64_t handle,
struct cam_context **ctx, int32_t dev_index);
/**
* cam_node_handle_shutdown_dev()
*
* @brief: Shutdowns all the active devices.
*
* @node: pointer to struct node
* @cmd: pointer to struct cmd
* @fh: pointer to struct v4l2_subdev_fh
*
*/
int cam_node_handle_shutdown_dev(struct cam_node *node,
struct cam_control *cmd, struct v4l2_subdev_fh *fh);
#endif /* _CAM_NODE_H_ */

Datei anzeigen

@@ -46,7 +46,6 @@ static long cam_subdev_ioctl(struct v4l2_subdev *sd, unsigned int cmd,
struct cam_node *node =
(struct cam_node *) v4l2_get_subdevdata(sd);
struct v4l2_subdev_fh *fh = (struct v4l2_subdev_fh *)arg;
struct cam_control cntrl_cmd;
if (!node || node->state == CAM_NODE_STATE_UNINIT) {
rc = -EINVAL;
@@ -64,12 +63,19 @@ static long cam_subdev_ioctl(struct v4l2_subdev *sd, unsigned int cmd,
return 0;
}
cntrl_cmd.op_code = CAM_SD_SHUTDOWN;
cntrl_cmd.handle = (uint64_t)sd;
rc = cam_node_handle_shutdown_dev(node, &cntrl_cmd, fh);
if (!node->sd_handler) {
CAM_ERR(CAM_CORE,
"No shutdown routine for %s", node->name);
rc = -EINVAL;
goto end;
}
CAM_DBG(CAM_CORE, "Shutdown for %s from media device", node->name);
rc = node->sd_handler(sd, fh);
if (rc)
CAM_ERR(CAM_CORE, "shutdown device failed(rc = %d)",
rc);
CAM_ERR(CAM_CORE,
"shutdown device failed(rc = %d) for %s",
rc, node->name);
break;
default:
CAM_ERR(CAM_CORE, "Invalid command %d for %s", cmd,

Datei anzeigen

@@ -805,7 +805,7 @@ static int __cam_cpas_subdev_close(struct v4l2_subdev *sd,
static int cam_cpas_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_CPAS);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_CPAS, "CRM is ACTIVE, close should be from CRM");

Datei anzeigen

@@ -58,7 +58,7 @@ static int cam_cre_subdev_open(struct v4l2_subdev *sd,
return 0;
}
static int cam_cre_subdev_close(struct v4l2_subdev *sd,
static int cam_cre_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -88,6 +88,19 @@ end:
return rc;
}
static int cam_cre_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_ICP, "CRM is ACTIVE, close should be from CRM");
return 0;
}
return cam_cre_subdev_close_internal(sd, fh);
}
static const struct v4l2_subdev_internal_ops cam_cre_subdev_internal_ops = {
.close = cam_cre_subdev_close,
.open = cam_cre_subdev_open,
@@ -139,6 +152,7 @@ static int cam_cre_subdev_component_bind(struct device *dev,
goto ctx_init_fail;
}
node->sd_handler = cam_cre_subdev_close_internal;
cam_smmu_set_client_page_fault_handler(iommu_hdl,
cam_cre_dev_iommu_fault_handler, node);

Datei anzeigen

@@ -1605,19 +1605,6 @@ static int __cam_custom_ctx_apply_default_req(
return rc;
}
static int __cam_custom_ctx_shutdown_dev(
struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
int rc = -EINVAL;
if (!sd || !fh) {
CAM_ERR(CAM_CUSTOM, "Invalid input pointer");
return rc;
}
return cam_custom_subdev_close_internal(sd, fh);
}
/* top state machine */
static struct cam_ctx_ops
cam_custom_dev_ctx_top_state_machine[CAM_CTX_STATE_MAX] = {
@@ -1632,7 +1619,6 @@ static struct cam_ctx_ops
.ioctl_ops = {
.acquire_dev =
__cam_custom_ctx_acquire_dev_in_available,
.shutdown_dev = __cam_custom_ctx_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
@@ -1644,7 +1630,6 @@ static struct cam_ctx_ops
.release_dev = __cam_custom_release_dev_in_acquired,
.config_dev = __cam_custom_ctx_config_dev_in_acquired,
.release_hw = __cam_custom_ctx_release_hw_in_top_state,
.shutdown_dev = __cam_custom_ctx_shutdown_dev,
},
.crm_ops = {
.link = __cam_custom_ctx_link_in_acquired,
@@ -1663,7 +1648,6 @@ static struct cam_ctx_ops
.release_dev = __cam_custom_release_dev_in_acquired,
.config_dev = __cam_custom_ctx_config_dev,
.release_hw = __cam_custom_ctx_release_hw_in_top_state,
.shutdown_dev = __cam_custom_ctx_shutdown_dev,
},
.crm_ops = {
.unlink = __cam_custom_ctx_unlink_in_ready,
@@ -1681,7 +1665,6 @@ static struct cam_ctx_ops
.config_dev = __cam_custom_ctx_config_dev_in_flushed,
.release_hw =
__cam_custom_ctx_release_hw_in_activated_state,
.shutdown_dev = __cam_custom_ctx_shutdown_dev,
},
.crm_ops = {
.unlink = __cam_custom_ctx_unlink_in_ready,
@@ -1698,7 +1681,6 @@ static struct cam_ctx_ops
.config_dev = __cam_custom_ctx_config_dev,
.release_hw =
__cam_custom_ctx_release_hw_in_activated_state,
.shutdown_dev = __cam_custom_ctx_shutdown_dev,
},
.crm_ops = {
.unlink = __cam_custom_ctx_unlink_in_activated,

Datei anzeigen

@@ -150,16 +150,4 @@ int cam_custom_dev_context_init(struct cam_custom_context *ctx,
*/
int cam_custom_dev_context_deinit(struct cam_custom_context *ctx);
/**
* cam_custom_subdev_close_internal()
*
* @brief: Close function for the Custom context
*
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*
*/
int cam_custom_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* _CAM_CUSTOM_CONTEXT_H_ */

Datei anzeigen

@@ -58,7 +58,7 @@ static int cam_custom_subdev_open(struct v4l2_subdev *sd,
return 0;
}
int cam_custom_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_custom_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -89,7 +89,7 @@ end:
static int cam_custom_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_CUSTOM);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_CUSTOM, "CRM is ACTIVE, close should be from CRM");
@@ -152,6 +152,7 @@ static int cam_custom_component_bind(struct device *dev,
goto unregister;
}
node->sd_handler = cam_custom_subdev_close_internal;
cam_smmu_set_client_page_fault_handler(iommu_hdl,
cam_custom_dev_iommu_fault_handler, node);

Datei anzeigen

@@ -169,19 +169,6 @@ static int __cam_fd_ctx_handle_irq_in_activated(void *context,
return rc;
}
static int __cam_fd_shutdown_dev(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = -EINVAL;
if (!sd || !fh) {
CAM_ERR(CAM_FD, "Invalid input pointer");
return rc;
}
return cam_fd_dev_close_internal(sd, fh);
}
/* top state machine */
static struct cam_ctx_ops
cam_fd_ctx_state_machine[CAM_CTX_STATE_MAX] = {
@@ -195,7 +182,6 @@ static struct cam_ctx_ops
{
.ioctl_ops = {
.acquire_dev = __cam_fd_ctx_acquire_dev_in_available,
.shutdown_dev = __cam_fd_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
@@ -206,24 +192,19 @@ static struct cam_ctx_ops
.release_dev = __cam_fd_ctx_release_dev_in_acquired,
.config_dev = __cam_fd_ctx_config_dev_in_acquired,
.start_dev = __cam_fd_ctx_start_dev_in_acquired,
.shutdown_dev = __cam_fd_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
},
/* Ready */
{
.ioctl_ops = {
.shutdown_dev = __cam_fd_shutdown_dev,
},
.ioctl_ops = {},
.crm_ops = {},
.irq_ops = NULL,
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_fd_shutdown_dev,
},
.ioctl_ops = {},
},
/* Activated */
{
@@ -233,7 +214,6 @@ static struct cam_ctx_ops
.config_dev = __cam_fd_ctx_config_dev_in_activated,
.flush_dev = __cam_fd_ctx_flush_dev_in_activated,
.dump_dev = __cam_fd_ctx_dump_dev_in_activated,
.shutdown_dev = __cam_fd_shutdown_dev,
},
.crm_ops = {},
.irq_ops = __cam_fd_ctx_handle_irq_in_activated,

Datei anzeigen

@@ -27,15 +27,4 @@ int cam_fd_context_init(struct cam_fd_context *fd_ctx,
uint32_t ctx_id);
int cam_fd_context_deinit(struct cam_fd_context *ctx);
/**
* cam_fd_dev_close_internal()
*
* @brief: Close function for the fd dev
*
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*/
int cam_fd_dev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* _CAM_FD_CONTEXT_H_ */

Datei anzeigen

@@ -91,7 +91,7 @@ static int cam_fd_dev_close_internal(struct v4l2_subdev *sd,
static int cam_fd_dev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_FD);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_FD, "CRM is ACTIVE, close should be from CRM");
@@ -151,6 +151,7 @@ static int cam_fd_dev_component_bind(struct device *dev,
goto deinit_ctx;
}
node->sd_handler = cam_fd_dev_close_internal;
mutex_init(&g_fd_dev.lock);
g_fd_dev.probe_done = true;
CAM_DBG(CAM_FD, "Component bound successfully");

Datei anzeigen

@@ -221,12 +221,6 @@ static int __cam_icp_handle_buf_done_in_ready(void *ctx,
return cam_context_buf_done_from_hw(ctx, done, evt_id);
}
static int __cam_icp_shutdown_dev(
struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
return cam_icp_subdev_close_internal(sd, fh);
}
static struct cam_ctx_ops
cam_icp_ctx_state_machine[CAM_CTX_STATE_MAX] = {
/* Uninit */
@@ -239,7 +233,6 @@ static struct cam_ctx_ops
{
.ioctl_ops = {
.acquire_dev = __cam_icp_acquire_dev_in_available,
.shutdown_dev = __cam_icp_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
@@ -252,7 +245,6 @@ static struct cam_ctx_ops
.config_dev = __cam_icp_config_dev_in_ready,
.flush_dev = __cam_icp_flush_dev_in_ready,
.dump_dev = __cam_icp_dump_dev_in_ready,
.shutdown_dev = __cam_icp_shutdown_dev,
},
.crm_ops = {},
.irq_ops = __cam_icp_handle_buf_done_in_ready,
@@ -266,7 +258,6 @@ static struct cam_ctx_ops
.config_dev = __cam_icp_config_dev_in_ready,
.flush_dev = __cam_icp_flush_dev_in_ready,
.dump_dev = __cam_icp_dump_dev_in_ready,
.shutdown_dev = __cam_icp_shutdown_dev,
},
.crm_ops = {},
.irq_ops = __cam_icp_handle_buf_done_in_ready,
@@ -274,15 +265,11 @@ static struct cam_ctx_ops
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_icp_shutdown_dev,
},
.ioctl_ops = {},
},
/* Activated */
{
.ioctl_ops = {
.shutdown_dev = __cam_icp_shutdown_dev,
},
.ioctl_ops = {},
.crm_ops = {},
.irq_ops = NULL,
.pagefault_ops = cam_icp_context_dump_active_request,

Datei anzeigen

@@ -39,12 +39,4 @@ int cam_icp_context_init(struct cam_icp_context *ctx,
*/
int cam_icp_context_deinit(struct cam_icp_context *ctx);
/**
* cam_icp_subdev_close_internal() - Close function for the icp dev
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*/
int cam_icp_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* _CAM_ICP_CONTEXT_H_ */

Datei anzeigen

@@ -98,7 +98,7 @@ end:
return rc;
}
int cam_icp_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_icp_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -138,7 +138,7 @@ end:
static int cam_icp_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_ICP);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_ICP, "CRM is ACTIVE, close should be from CRM");
@@ -210,6 +210,7 @@ static int cam_icp_component_bind(struct device *dev,
goto ctx_fail;
}
node->sd_handler = cam_icp_subdev_close_internal;
cam_smmu_set_client_page_fault_handler(iommu_hdl,
cam_icp_dev_iommu_fault_handler, node);

Datei anzeigen

@@ -3363,42 +3363,6 @@ static int cam_icp_mgr_proc_boot(struct cam_icp_hw_mgr *hw_mgr)
return rc;
}
static int __resume_and_idle(struct cam_icp_hw_mgr *hw_mgr)
{
struct cam_hw_intf *icp_dev_intf = hw_mgr->icp_dev_intf;
int rc;
rc = icp_dev_intf->hw_ops.init(icp_dev_intf->hw_priv, NULL, 0);
if (rc) {
CAM_ERR(CAM_ICP, "icp hw init failed rc=%d", rc);
return rc;
}
rc = cam_icp_mgr_proc_resume(hw_mgr);
if (rc) {
CAM_ERR(CAM_ICP, "icp resume failed rc=%d", rc);
goto out_deinit;
}
if (hw_mgr->icp_pc_flag) {
rc = cam_icp_mgr_send_pc_prep(hw_mgr);
if (rc) {
CAM_ERR(CAM_ICP,
"send power collapse prep failed rc=%d",
rc);
goto out_collapse;
}
}
return 0;
out_collapse:
cam_icp_mgr_proc_suspend(hw_mgr);
out_deinit:
icp_dev_intf->hw_ops.deinit(icp_dev_intf->hw_priv, NULL, 0);
return rc;
}
static void cam_icp_mgr_proc_shutdown(struct cam_icp_hw_mgr *hw_mgr)
{
struct cam_hw_intf *icp_dev_intf = hw_mgr->icp_dev_intf;
@@ -3408,13 +3372,12 @@ static void cam_icp_mgr_proc_shutdown(struct cam_icp_hw_mgr *hw_mgr)
return;
}
if (!hw_mgr->icp_resumed && __resume_and_idle(hw_mgr))
return;
icp_dev_intf->hw_ops.init(icp_dev_intf->hw_priv, NULL, 0);
icp_dev_intf->hw_ops.process_cmd(
icp_dev_intf->hw_priv,
CAM_ICP_CMD_PROC_SHUTDOWN,
NULL, 0);
icp_dev_intf->hw_priv,
CAM_ICP_CMD_PROC_SHUTDOWN,
NULL, 0);
icp_dev_intf->hw_ops.deinit(icp_dev_intf->hw_priv, NULL, 0);

Datei anzeigen

@@ -6409,12 +6409,6 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context,
return rc;
}
static int __cam_isp_shutdown_dev(
struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
return cam_isp_subdev_close_internal(sd, fh);
}
/* top state machine */
static struct cam_ctx_ops
cam_isp_ctx_top_state_machine[CAM_CTX_STATE_MAX] = {
@@ -6428,7 +6422,6 @@ static struct cam_ctx_ops
{
.ioctl_ops = {
.acquire_dev = __cam_isp_ctx_acquire_dev_in_available,
.shutdown_dev = __cam_isp_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
@@ -6440,7 +6433,6 @@ static struct cam_ctx_ops
.release_dev = __cam_isp_ctx_release_dev_in_top_state,
.config_dev = __cam_isp_ctx_config_dev_in_acquired,
.release_hw = __cam_isp_ctx_release_hw_in_top_state,
.shutdown_dev = __cam_isp_shutdown_dev,
},
.crm_ops = {
.link = __cam_isp_ctx_link_in_acquired,
@@ -6460,7 +6452,6 @@ static struct cam_ctx_ops
.release_dev = __cam_isp_ctx_release_dev_in_top_state,
.config_dev = __cam_isp_ctx_config_dev_in_top_state,
.release_hw = __cam_isp_ctx_release_hw_in_top_state,
.shutdown_dev = __cam_isp_shutdown_dev,
},
.crm_ops = {
.unlink = __cam_isp_ctx_unlink_in_ready,
@@ -6478,7 +6469,6 @@ static struct cam_ctx_ops
.release_dev = __cam_isp_ctx_release_dev_in_activated,
.config_dev = __cam_isp_ctx_config_dev_in_flushed,
.release_hw = __cam_isp_ctx_release_hw_in_activated,
.shutdown_dev = __cam_isp_shutdown_dev,
},
.crm_ops = {
.unlink = __cam_isp_ctx_unlink_in_ready,
@@ -6495,7 +6485,6 @@ static struct cam_ctx_ops
.release_dev = __cam_isp_ctx_release_dev_in_activated,
.config_dev = __cam_isp_ctx_config_dev_in_top_state,
.release_hw = __cam_isp_ctx_release_hw_in_activated,
.shutdown_dev = __cam_isp_shutdown_dev,
},
.crm_ops = {
.unlink = __cam_isp_ctx_unlink_in_activated,

Datei anzeigen

@@ -372,16 +372,4 @@ int cam_isp_context_init(struct cam_isp_context *ctx,
*/
int cam_isp_context_deinit(struct cam_isp_context *ctx);
/**
* cam_isp_subdev_close_internal()
*
* @brief: Close function for the isp dev
*
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*
*/
int cam_isp_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* __CAM_ISP_CONTEXT_H__ */

Datei anzeigen

@@ -55,7 +55,7 @@ static int cam_isp_subdev_open(struct v4l2_subdev *sd,
return 0;
}
int cam_isp_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_isp_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -86,7 +86,7 @@ end:
static int cam_isp_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_ISP);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_ISP, "CRM is ACTIVE, close should be from CRM");
@@ -188,6 +188,7 @@ static int cam_isp_dev_component_bind(struct device *dev,
goto kfree;
}
node->sd_handler = cam_isp_subdev_close_internal;
cam_smmu_set_client_page_fault_handler(iommu_hdl,
cam_isp_dev_iommu_fault_handler, node);

Datei anzeigen

@@ -135,12 +135,6 @@ static int __cam_jpeg_ctx_stop_dev_in_acquired(struct cam_context *ctx,
return rc;
}
static int __cam_jpeg_shutdown_dev(
struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
return cam_jpeg_subdev_close_internal(sd, fh);
}
/* top state machine */
static struct cam_ctx_ops
cam_jpeg_ctx_state_machine[CAM_CTX_STATE_MAX] = {
@@ -154,7 +148,6 @@ static struct cam_ctx_ops
{
.ioctl_ops = {
.acquire_dev = __cam_jpeg_ctx_acquire_dev_in_available,
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
.crm_ops = { },
.irq_ops = NULL,
@@ -167,7 +160,6 @@ static struct cam_ctx_ops
.stop_dev = __cam_jpeg_ctx_stop_dev_in_acquired,
.flush_dev = __cam_jpeg_ctx_flush_dev_in_acquired,
.dump_dev = __cam_jpeg_ctx_dump_dev_in_acquired,
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
.crm_ops = { },
.irq_ops = __cam_jpeg_ctx_handle_buf_done_in_acquired,
@@ -175,21 +167,15 @@ static struct cam_ctx_ops
},
/* Ready */
{
.ioctl_ops = {
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
.ioctl_ops = {},
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
.ioctl_ops = {},
},
/* Activated */
{
.ioctl_ops = {
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
.ioctl_ops = {},
},
};

Datei anzeigen

@@ -64,16 +64,4 @@ int cam_jpeg_context_init(struct cam_jpeg_context *ctx,
*/
int cam_jpeg_context_deinit(struct cam_jpeg_context *ctx);
/**
* cam_jpeg_subdev_close_internal()
*
* @brief: Close function for the jpeg dev
*
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*
*/
int cam_jpeg_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* __CAM_JPEG_CONTEXT_H__ */

Datei anzeigen

@@ -56,7 +56,7 @@ static int cam_jpeg_subdev_open(struct v4l2_subdev *sd,
return 0;
}
int cam_jpeg_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_jpeg_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -88,7 +88,7 @@ end:
static int cam_jpeg_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_JPEG);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_JPEG, "CRM is ACTIVE, close should be from CRM");
@@ -148,6 +148,7 @@ static int cam_jpeg_dev_component_bind(struct device *dev,
goto ctx_init_fail;
}
node->sd_handler = cam_jpeg_subdev_close_internal;
cam_smmu_set_client_page_fault_handler(iommu_hdl,
cam_jpeg_dev_iommu_fault_handler, node);

Datei anzeigen

@@ -172,12 +172,6 @@ static int __cam_lrme_ctx_handle_irq_in_activated(void *context,
return rc;
}
static int __cam_lrme_shutdown_dev(
struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
return cam_lrme_dev_close_internal(sd, fh);
}
/* top state machine */
static struct cam_ctx_ops
cam_lrme_ctx_state_machine[CAM_CTX_STATE_MAX] = {
@@ -191,7 +185,6 @@ static struct cam_ctx_ops
{
.ioctl_ops = {
.acquire_dev = __cam_lrme_ctx_acquire_dev_in_available,
.shutdown_dev = __cam_lrme_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
@@ -202,24 +195,19 @@ static struct cam_ctx_ops
.config_dev = __cam_lrme_ctx_config_dev_in_activated,
.release_dev = __cam_lrme_ctx_release_dev_in_acquired,
.start_dev = __cam_lrme_ctx_start_dev_in_acquired,
.shutdown_dev = __cam_lrme_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
},
/* Ready */
{
.ioctl_ops = {
.shutdown_dev = __cam_lrme_shutdown_dev,
},
.ioctl_ops = {},
.crm_ops = {},
.irq_ops = NULL,
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_lrme_shutdown_dev,
},
.ioctl_ops = {},
},
/* Activate */
{
@@ -229,7 +217,6 @@ static struct cam_ctx_ops
.stop_dev = __cam_lrme_ctx_stop_dev_in_activated,
.flush_dev = __cam_lrme_ctx_flush_dev_in_activated,
.dump_dev = __cam_lrme_ctx_dump_dev_in_activated,
.shutdown_dev = __cam_lrme_shutdown_dev,
},
.crm_ops = {},
.irq_ops = __cam_lrme_ctx_handle_irq_in_activated,

Datei anzeigen

@@ -30,16 +30,4 @@ int cam_lrme_context_init(struct cam_lrme_context *lrme_ctx,
uint32_t index);
int cam_lrme_context_deinit(struct cam_lrme_context *lrme_ctx);
/**
* cam_lrme_dev_close_internal()
*
* @brief: Close function for the jpeg dev
*
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*
*/
int cam_lrme_dev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* _CAM_LRME_CONTEXT_H_ */

Datei anzeigen

@@ -72,7 +72,7 @@ static int cam_lrme_dev_open(struct v4l2_subdev *sd,
return 0;
}
int cam_lrme_dev_close_internal(struct v4l2_subdev *sd,
static int cam_lrme_dev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -109,7 +109,7 @@ end:
static int cam_lrme_dev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_LRME);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_LRME, "CRM is ACTIVE, close should be from CRM");
@@ -173,6 +173,7 @@ static int cam_lrme_component_bind(struct device *dev,
goto deinit_ctx;
}
node->sd_handler = cam_lrme_dev_close_internal;
CAM_DBG(CAM_LRME, "Component bound successfully");
return 0;

Datei anzeigen

@@ -195,12 +195,6 @@ static int __cam_ope_handle_buf_done_in_ready(void *ctx,
return cam_context_buf_done_from_hw(ctx, done, evt_id);
}
static int __cam_ope_shutdown_dev(
struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
return cam_ope_subdev_close_internal(sd, fh);
}
static struct cam_ctx_ops
cam_ope_ctx_state_machine[CAM_CTX_STATE_MAX] = {
/* Uninit */
@@ -213,7 +207,6 @@ static struct cam_ctx_ops
{
.ioctl_ops = {
.acquire_dev = __cam_ope_acquire_dev_in_available,
.shutdown_dev = __cam_ope_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
@@ -226,7 +219,6 @@ static struct cam_ctx_ops
.config_dev = __cam_ope_config_dev_in_ready,
.flush_dev = __cam_ope_flush_dev_in_ready,
.dump_dev = __cam_ope_dump_dev_in_ready,
.shutdown_dev = __cam_ope_shutdown_dev,
},
.crm_ops = {},
.irq_ops = __cam_ope_handle_buf_done_in_ready,
@@ -240,7 +232,6 @@ static struct cam_ctx_ops
.config_dev = __cam_ope_config_dev_in_ready,
.flush_dev = __cam_ope_flush_dev_in_ready,
.dump_dev = __cam_ope_dump_dev_in_ready,
.shutdown_dev = __cam_ope_shutdown_dev,
},
.crm_ops = {},
.irq_ops = __cam_ope_handle_buf_done_in_ready,
@@ -248,15 +239,11 @@ static struct cam_ctx_ops
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_ope_shutdown_dev,
},
.ioctl_ops = {},
},
/* Activated */
{
.ioctl_ops = {
.shutdown_dev = __cam_ope_shutdown_dev,
},
.ioctl_ops = {},
.crm_ops = {},
.irq_ops = NULL,
.pagefault_ops = cam_ope_context_dump_active_request,

Datei anzeigen

@@ -41,12 +41,4 @@ int cam_ope_context_init(struct cam_ope_context *ctx,
*/
int cam_ope_context_deinit(struct cam_ope_context *ctx);
/**
* cam_ope_subdev_close_internal() - Close function for the icp dev
* @sd: Pointer to struct v4l2_subdev
* @fh: Pointer to struct v4l2_subdev_fh
*/
int cam_ope_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh);
#endif /* _CAM_OPE_CONTEXT_H_ */

Datei anzeigen

@@ -95,7 +95,7 @@ end:
return rc;
}
int cam_ope_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_ope_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -137,7 +137,7 @@ end:
static int cam_ope_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_OPE);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_OPE, "CRM is ACTIVE, close should be from CRM");
@@ -215,6 +215,7 @@ static int cam_ope_subdev_component_bind(struct device *dev,
g_ope_dev.open_cnt = 0;
mutex_init(&g_ope_dev.ope_lock);
node->sd_handler = cam_ope_subdev_close_internal;
CAM_DBG(CAM_OPE, "Subdev component bound successfully");
return rc;

Datei anzeigen

@@ -124,7 +124,6 @@ static int cam_req_mgr_open(struct file *filep)
spin_unlock_bh(&g_dev.cam_eventq_lock);
g_dev.open_cnt++;
g_dev.read_active_dev_id_hdls = 0;
rc = cam_mem_mgr_init();
if (rc) {
g_dev.open_cnt--;
@@ -192,7 +191,6 @@ static int cam_req_mgr_close(struct file *filep)
g_dev.open_cnt--;
g_dev.shutdown_state = false;
g_dev.read_active_dev_id_hdls = 0;
v4l2_fh_release(filep);
spin_lock_bh(&g_dev.cam_eventq_lock);
@@ -687,21 +685,12 @@ static int cam_req_mgr_ordered_list_cmp(void *priv,
return 0;
}
bool cam_req_mgr_is_open(uint64_t dev_id)
bool cam_req_mgr_is_open(void)
{
bool crm_status;
bool dev_id_status;
bool crm_status = false;
mutex_lock(&g_dev.cam_lock);
crm_status = g_dev.open_cnt ? true : false;
if (!g_dev.read_active_dev_id_hdls) {
g_dev.active_dev_id_hdls = cam_get_dev_handle_status();
g_dev.read_active_dev_id_hdls++;
}
dev_id_status = (g_dev.active_dev_id_hdls & dev_id) ? true : false;
crm_status &= dev_id_status;
mutex_unlock(&g_dev.cam_lock);
return crm_status;

Datei anzeigen

@@ -20,8 +20,6 @@
* @cam_eventq: event queue
* @cam_eventq_lock: lock for event queue
* @shutdown_state: shutdown state
* @active_dev_id_hdls: active dev id handles
* @read_active_dev_id_hdls: read active_dev_id_hdls status
*/
struct cam_req_mgr_device {
struct video_device *video;
@@ -34,8 +32,6 @@ struct cam_req_mgr_device {
struct v4l2_fh *cam_eventq;
spinlock_t cam_eventq_lock;
bool shutdown_state;
uint64_t active_dev_id_hdls;
int read_active_dev_id_hdls;
};
#define CAM_REQ_MGR_GET_PAYLOAD_PTR(ev, type) \

Datei anzeigen

@@ -14,7 +14,6 @@
#include <media/cam_req_mgr.h>
#include "cam_req_mgr_util.h"
#include "cam_debug_util.h"
#include "cam_context.h"
static struct cam_req_mgr_util_hdl_tbl *hdl_tbl;
static DEFINE_SPINLOCK(hdl_tbl_lock);
@@ -210,36 +209,6 @@ int32_t cam_create_device_hdl(struct cam_create_dev_hdl *hdl_data)
return handle;
}
int32_t cam_get_dev_handle_info(uint64_t handle,
struct cam_context **ctx, int32_t dev_index)
{
int32_t idx;
struct v4l2_subdev *sd = (struct v4l2_subdev *)handle;
for (idx = dev_index + 1; idx < CAM_REQ_MGR_MAX_HANDLES_V2; idx++) {
if (hdl_tbl->hdl[idx].state == HDL_ACTIVE) {
*ctx = (struct cam_context *)cam_get_device_priv(
hdl_tbl->hdl[idx].hdl_value);
if ((*ctx) && !strcmp(sd->name, (*ctx)->dev_name))
return idx;
}
}
*ctx = NULL;
return CAM_REQ_MGR_MAX_HANDLES_V2;
}
uint64_t cam_get_dev_handle_status(void)
{
int32_t idx;
uint64_t active_dev_hdls = 0;
for (idx = 0; idx < CAM_REQ_MGR_MAX_HANDLES_V2; idx++)
if (hdl_tbl->hdl[idx].state == HDL_ACTIVE)
active_dev_hdls |= hdl_tbl->hdl[idx].dev_id;
return active_dev_hdls;
}
void *cam_get_device_priv(int32_t dev_hdl)
{
int idx;

Datei anzeigen

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_REQ_MGR_UTIL_API_H_
@@ -166,11 +166,4 @@ int32_t cam_req_mgr_util_deinit(void);
*/
int32_t cam_req_mgr_util_free_hdls(void);
/**
* cam_get_dev_handle_status() - get dev handles status
*
* Returns dev handle status
*/
uint64_t cam_get_dev_handle_status(void);
#endif /* _CAM_REQ_MGR_UTIL_API_H_ */

Datei anzeigen

@@ -134,9 +134,8 @@ int cam_unregister_subdev(struct cam_subdev *sd);
*
* @brief: This common utility function returns the crm active status
*
* @dev_id: device id type
*/
bool cam_req_mgr_is_open(uint64_t dev_id);
bool cam_req_mgr_is_open(void);
/**
* cam_req_mgr_is_shutdown()

Datei anzeigen

@@ -31,7 +31,7 @@ static int cam_actuator_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_actuator_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_ACTUATOR);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_ACTUATOR,

Datei anzeigen

@@ -113,7 +113,7 @@ static int cam_csiphy_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_csiphy_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_CSIPHY);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_CSIPHY, "CRM is ACTIVE, close should be from CRM");

Datei anzeigen

@@ -31,7 +31,7 @@ static int cam_eeprom_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_eeprom_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_EEPROM);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_EEPROM, "CRM is ACTIVE, close should be from CRM");

Datei anzeigen

@@ -257,7 +257,7 @@ static int cam_flash_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_flash_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_FLASH);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_FLASH, "CRM is ACTIVE, close should be from CRM");

Datei anzeigen

@@ -31,7 +31,7 @@ static int cam_ois_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_ois_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_OIS);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_OIS, "CRM is ACTIVE, close should be from CRM");

Datei anzeigen

@@ -30,7 +30,7 @@ static int cam_sensor_subdev_close_internal(struct v4l2_subdev *sd,
static int cam_sensor_subdev_close(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
bool crm_active = cam_req_mgr_is_open(CAM_SENSOR);
bool crm_active = cam_req_mgr_is_open();
if (crm_active) {
CAM_DBG(CAM_SENSOR, "CRM is ACTIVE, close should be from CRM");