Merge "msm: camera: req_mgr: Enhance camera v4l2 subdev shutdown sequence" into camera-kernel.lnx.5.0

This commit is contained in:
Savita Patted
2021-06-21 18:38:47 -07:00
کامیت شده توسط Gerrit - the friendly Code Review server
کامیت 68de607556
38فایلهای تغییر یافته به همراه865 افزوده شده و 176 حذف شده

مشاهده پرونده

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/debugfs.h>
@@ -135,6 +135,12 @@ 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] = {
@@ -148,6 +154,7 @@ 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,
@@ -160,11 +167,30 @@ 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,
.pagefault_ops = cam_jpeg_context_dump_active_request,
},
/* Ready */
{
.ioctl_ops = {
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
},
/* Flushed */
{
.ioctl_ops = {
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
},
/* Activated */
{
.ioctl_ops = {
.shutdown_dev = __cam_jpeg_shutdown_dev,
},
},
};
int cam_jpeg_context_init(struct cam_jpeg_context *ctx,

مشاهده پرونده

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018, 2021, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_JPEG_CONTEXT_H_
@@ -64,4 +64,16 @@ 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__ */

مشاهده پرونده

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/delay.h>
@@ -56,13 +56,12 @@ static int cam_jpeg_subdev_open(struct v4l2_subdev *sd,
return 0;
}
static int cam_jpeg_subdev_close(struct v4l2_subdev *sd,
int cam_jpeg_subdev_close_internal(struct v4l2_subdev *sd,
struct v4l2_subdev_fh *fh)
{
int rc = 0;
struct cam_node *node = v4l2_get_subdevdata(sd);
mutex_lock(&g_jpeg_dev.jpeg_mutex);
if (g_jpeg_dev.open_cnt <= 0) {
CAM_DBG(CAM_JPEG, "JPEG subdev is already closed");
@@ -86,6 +85,18 @@ end:
return rc;
}
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);
if (crm_active) {
CAM_DBG(CAM_JPEG, "CRM is ACTIVE, close should be from CRM");
return 0;
}
return cam_jpeg_subdev_close_internal(sd, fh);
}
static const struct v4l2_subdev_internal_ops cam_jpeg_subdev_internal_ops = {
.close = cam_jpeg_subdev_close,
.open = cam_jpeg_subdev_open,
@@ -102,6 +113,7 @@ static int cam_jpeg_dev_component_bind(struct device *dev,
struct platform_device *pdev = to_platform_device(dev);
g_jpeg_dev.sd.internal_ops = &cam_jpeg_subdev_internal_ops;
g_jpeg_dev.sd.close_seq_prior = CAM_SD_CLOSE_MEDIUM_PRIORITY;
rc = cam_subdev_probe(&g_jpeg_dev.sd, pdev, CAM_JPEG_DEV_NAME,
CAM_JPEG_DEVICE_TYPE);
if (rc) {