msm: camera: req_mgr: Enhance camera v4l2 subdev shutdown sequence

when provider crash occurred, there was a CSID lane overflow
observed due to shutdown sequence from CRM(sensor, csid, csiphy).
To fix the issue need to change the shutdown sequence
(csid, sensor, csiphy).

This change will update the devices sequence in order while registering
and close the sequence accordingly.

CRs-Fixed: 2852076
Change-Id: Ia6d8022e995823bf031400c33528eb8544dc2e29
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
This commit is contained in:
Alok Chauhan
2020-10-15 20:32:53 +05:30
committed by Gerrit - the friendly Code Review server
parent 2c537f74d5
commit 2ebae4fabe
38 changed files with 867 additions and 178 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/debugfs.h>
@@ -195,6 +195,12 @@ 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 */
@@ -207,6 +213,7 @@ 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,
@@ -219,6 +226,7 @@ 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,
@@ -232,14 +240,23 @@ 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,
.pagefault_ops = cam_ope_context_dump_active_request,
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_ope_shutdown_dev,
},
},
/* Activated */
{
.ioctl_ops = {},
.ioctl_ops = {
.shutdown_dev = __cam_ope_shutdown_dev,
},
.crm_ops = {},
.irq_ops = NULL,
.pagefault_ops = cam_ope_context_dump_active_request,

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_OPE_CONTEXT_H_
@@ -41,4 +41,12 @@ 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_ */

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/delay.h>
@@ -95,7 +95,7 @@ end:
return rc;
}
static int cam_ope_subdev_close(struct v4l2_subdev *sd,
int cam_ope_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
@@ -134,6 +134,19 @@ end:
return rc;
}
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);
if (crm_active) {
CAM_DBG(CAM_OPE, "CRM is ACTIVE, close should be from CRM");
return 0;
}
return cam_ope_subdev_close_internal(sd, fh);
}
const struct v4l2_subdev_internal_ops cam_ope_subdev_internal_ops = {
.open = cam_ope_subdev_open,
.close = cam_ope_subdev_close,
@@ -156,6 +169,7 @@ static int cam_ope_subdev_component_bind(struct device *dev,
g_ope_dev.sd.pdev = pdev;
g_ope_dev.sd.internal_ops = &cam_ope_subdev_internal_ops;
g_ope_dev.sd.close_seq_prior = CAM_SD_CLOSE_MEDIUM_PRIORITY;
rc = cam_subdev_probe(&g_ope_dev.sd, pdev, OPE_DEV_NAME,
CAM_OPE_DEVICE_TYPE);
if (rc) {