msm: camera: common: Fixes the exit module code flow

Fixes exit call flow as a part of rmmod.

CRs-Fixed: 2675526
Change-Id: I47111a737cb06d9bb3d0a417a471c5c9fb545999
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
This commit is contained in:
Jigarkumar Zala
2020-04-07 14:26:03 -07:00
parent f65f27de96
commit 279dfebf8c
32 changed files with 391 additions and 89 deletions

View File

@@ -1072,24 +1072,39 @@ int cam_synx_sync_signal(int32_t sync_obj, uint32_t synx_status)
return rc;
}
static int cam_sync_register_synx_bind_ops(void)
static int cam_sync_register_synx_bind_ops(
struct synx_register_params *object)
{
int rc = 0;
struct synx_register_params params;
params.name = CAM_SYNC_NAME;
params.type = SYNX_TYPE_CSL;
params.ops.register_callback = cam_sync_register_callback;
params.ops.deregister_callback = cam_sync_deregister_callback;
params.ops.enable_signaling = cam_sync_get_obj_ref;
params.ops.signal = cam_synx_sync_signal;
rc = synx_register_ops(&params);
rc = synx_register_ops(object);
if (rc)
CAM_ERR(CAM_SYNC, "synx registration fail with rc=%d", rc);
return rc;
}
static void cam_sync_unregister_synx_bind_ops(
struct synx_register_params *object)
{
int rc = 0;
rc = synx_deregister_ops(object);
if (rc)
CAM_ERR(CAM_SYNC, "sync unregistration fail with %d", rc);
}
static void cam_sync_configure_synx_obj(struct synx_register_params *object)
{
struct synx_register_params *params = object;
params->name = CAM_SYNC_NAME;
params->type = SYNX_TYPE_CSL;
params->ops.register_callback = cam_sync_register_callback;
params->ops.deregister_callback = cam_sync_deregister_callback;
params->ops.enable_signaling = cam_sync_get_obj_ref;
params->ops.signal = cam_synx_sync_signal;
}
#endif
static int cam_sync_component_bind(struct device *dev,
@@ -1167,8 +1182,9 @@ static int cam_sync_component_bind(struct device *dev,
trigger_cb_without_switch = false;
cam_sync_create_debugfs();
#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX)
CAM_INFO(CAM_SYNC, "Registering with synx driver");
rc = cam_sync_register_synx_bind_ops();
CAM_DBG(CAM_SYNC, "Registering with synx driver");
cam_sync_configure_synx_obj(&sync_dev->params);
rc = cam_sync_register_synx_bind_ops(&sync_dev->params);
if (rc)
goto v4l2_fail;
#endif
@@ -1195,6 +1211,9 @@ static void cam_sync_component_unbind(struct device *dev,
v4l2_device_unregister(sync_dev->vdev->v4l2_dev);
cam_sync_media_controller_cleanup(sync_dev);
#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX)
cam_sync_unregister_synx_bind_ops(&sync_dev->params);
#endif
video_unregister_device(sync_dev->vdev);
video_device_release(sync_dev->vdev);
debugfs_remove_recursive(sync_dev->dentry);

View File

@@ -17,6 +17,10 @@
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX)
#include <synx_api.h>
#endif
#ifdef CONFIG_CAM_SYNC_DBG
#define CDBG(fmt, args...) pr_err(fmt, ##args)
#else
@@ -177,6 +181,7 @@ struct cam_signalable_info {
* @work_queue : Work queue used for dispatching kernel callbacks
* @cam_sync_eventq : Event queue used to dispatch user payloads to user space
* @bitmap : Bitmap representation of all sync objects
* @params : Parameters for synx call back registration
*/
struct sync_device {
struct video_device *vdev;
@@ -190,6 +195,9 @@ struct sync_device {
struct v4l2_fh *cam_sync_eventq;
spinlock_t cam_sync_eventq_lock;
DECLARE_BITMAP(bitmap, CAM_SYNC_MAX_OBJS);
#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX)
struct synx_register_params params;
#endif
};