Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 169e32f2 authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Modify shutdown sequence in KMD" into dev/msm-4.14-camx

parents 434058ca 33f75cf3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ int cam_context_shutdown(struct cam_context *ctx)
	int rc = 0;
	int32_t ctx_hdl = ctx->dev_hdl;

	mutex_lock(&ctx->ctx_mutex);
	if (ctx->state_machine[ctx->state].ioctl_ops.stop_dev) {
		rc = ctx->state_machine[ctx->state].ioctl_ops.stop_dev(
			ctx, NULL);
@@ -56,6 +57,7 @@ int cam_context_shutdown(struct cam_context *ctx)
		if (rc < 0)
			CAM_ERR(CAM_CORE, "Error while dev release %d", rc);
	}
	mutex_unlock(&ctx->ctx_mutex);

	if (!rc)
		rc = cam_destroy_device_hdl(ctx_hdl);
+3 −0
Original line number Diff line number Diff line
@@ -430,6 +430,9 @@ int cam_node_shutdown(struct cam_node *node)

	for (i = 0; i < node->ctx_size; i++) {
		if (node->ctx_list[i].dev_hdl > 0) {
			CAM_DBG(CAM_CORE,
				"Node [%s] invoking shutdown on context [%d]",
				node->name, i);
			rc = cam_context_shutdown(&(node->ctx_list[i]));
			if (rc)
				continue;
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static int cam_icp_subdev_close(struct v4l2_subdev *sd,

	mutex_lock(&g_icp_dev.icp_lock);
	if (g_icp_dev.open_cnt <= 0) {
		CAM_ERR(CAM_ICP, "ICP subdev is already closed");
		CAM_DBG(CAM_ICP, "ICP subdev is already closed");
		rc = -EINVAL;
		goto end;
	}
+27 −3
Original line number Diff line number Diff line
@@ -55,23 +55,47 @@ static const struct of_device_id cam_isp_dt_match[] = {
	{}
};

static int cam_isp_subdev_open(struct v4l2_subdev *sd,
	struct v4l2_subdev_fh *fh)
{
	mutex_lock(&g_isp_dev.isp_mutex);
	g_isp_dev.open_cnt++;
	mutex_unlock(&g_isp_dev.isp_mutex);

	return 0;
}

static int cam_isp_subdev_close(struct v4l2_subdev *sd,
	struct v4l2_subdev_fh *fh)
{
	int rc = 0;
	struct cam_node *node = v4l2_get_subdevdata(sd);

	mutex_lock(&g_isp_dev.isp_mutex);
	if (g_isp_dev.open_cnt <= 0) {
		CAM_DBG(CAM_ISP, "ISP subdev is already closed");
		rc = -EINVAL;
		goto end;
	}

	g_isp_dev.open_cnt--;
	if (!node) {
		CAM_ERR(CAM_ISP, "Node ptr is NULL");
		return -EINVAL;
		rc = -EINVAL;
		goto end;
	}

	if (g_isp_dev.open_cnt == 0)
		cam_node_shutdown(node);

	return 0;
end:
	mutex_unlock(&g_isp_dev.isp_mutex);
	return rc;
}

static const struct v4l2_subdev_internal_ops cam_isp_subdev_internal_ops = {
	.close = cam_isp_subdev_close,
	.open = cam_isp_subdev_open,
};

static int cam_isp_dev_remove(struct platform_device *pdev)
+4 −1
Original line number Diff line number Diff line
@@ -24,12 +24,15 @@
 * @sd:                    Commone camera subdevice node
 * @ctx:                   Isp base context storage
 * @ctx_isp:               Isp private context storage
 *
 * @isp_mutex:             ISP dev mutex
 * @open_cnt:              Open device count
 */
struct cam_isp_dev {
	struct cam_subdev          sd;
	struct cam_context         ctx[CAM_CTX_MAX];
	struct cam_isp_context     ctx_isp[CAM_CTX_MAX];
	struct mutex               isp_mutex;
	int32_t                    open_cnt;
};

#endif /* __CAM_ISP_DEV_H__ */
Loading