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

Commit ca2295da authored by Pavan Kumar Chilamkurthi's avatar Pavan Kumar Chilamkurthi
Browse files

msm: camera: core: Pass ctx hw map in start args



Validate input args and fix issue where ctx_to_hw_map
handle passing was missing while calling start().
Without passing hw_map pointer hw_mgr drivers cannot
know corresponding hw context and would fail to start.

Change-Id: Iecaee9906b29fdec3b65a26860ccf75599a7149c
Signed-off-by: default avatarPavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
parent ab38cca9
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -34,6 +34,11 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx,
	struct cam_hw_done_event_data *done =
		(struct cam_hw_done_event_data *)done_event_data;

	if (!ctx || !done) {
		CAM_ERR(CAM_CTXT, "Invalid input params %pK %pK", ctx, done);
		return -EINVAL;
	}

	if (list_empty(&ctx->active_req_list)) {
		CAM_ERR(CAM_CTXT, "no active request");
		return -EIO;
@@ -78,6 +83,12 @@ int cam_context_apply_req_to_hw(struct cam_context *ctx,
	struct cam_ctx_request *req;
	struct cam_hw_config_args cfg;

	if (!ctx || !apply) {
		CAM_ERR(CAM_CTXT, "Invalid input params %pK %pK", ctx, apply);
		rc = -EINVAL;
		goto end;
	}

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "HW interface is not ready");
		rc = -EFAULT;
@@ -119,6 +130,11 @@ static void cam_context_sync_callback(int32_t sync_obj, int status, void *data)
	struct cam_ctx_request *req = NULL;
	struct cam_req_mgr_apply_request apply;

	if (!ctx) {
		CAM_ERR(CAM_CTXT, "Invalid input param");
		return;
	}

	spin_lock(&ctx->lock);
	if (!list_empty(&ctx->pending_req_list))
		req = list_first_entry(&ctx->pending_req_list,
@@ -144,6 +160,11 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx,
	struct cam_hw_release_args arg;
	struct cam_ctx_request *req;

	if (!ctx) {
		CAM_ERR(CAM_CTXT, "Invalid input param");
		return -EINVAL;
	}

	if ((!ctx->hw_mgr_intf) || (!ctx->hw_mgr_intf->hw_release)) {
		CAM_ERR(CAM_CTXT, "HW interface is not ready");
		return -EINVAL;
@@ -209,6 +230,12 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
	size_t len = 0;
	int32_t i = 0;

	if (!ctx || !cmd) {
		CAM_ERR(CAM_CTXT, "Invalid input params %pK %pK", ctx, cmd);
		rc = -EINVAL;
		goto end;
	}

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "HW interface is not ready");
		rc = -EFAULT;
@@ -304,6 +331,12 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx,
	struct cam_create_dev_hdl req_hdl_param;
	struct cam_hw_release_args release;

	if (!ctx || !cmd) {
		CAM_ERR(CAM_CTXT, "Invalid input params %pK %pK", ctx, cmd);
		rc = -EINVAL;
		goto end;
	}

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "HW interface is not ready");
		rc = -EFAULT;
@@ -377,6 +410,12 @@ int32_t cam_context_start_dev_to_hw(struct cam_context *ctx,
	int rc = 0;
	struct cam_hw_start_args arg;

	if (!ctx || !cmd) {
		CAM_ERR(CAM_CTXT, "Invalid input params %pK %pK", ctx, cmd);
		rc = -EINVAL;
		goto end;
	}

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "HW interface is not ready");
		rc = -EFAULT;
@@ -392,6 +431,7 @@ int32_t cam_context_start_dev_to_hw(struct cam_context *ctx,
	}

	if (ctx->hw_mgr_intf->hw_start) {
		arg.ctxt_to_hw_map = ctx->ctxt_to_hw_map;
		rc = ctx->hw_mgr_intf->hw_start(ctx->hw_mgr_intf->hw_mgr_priv,
				&arg);
		if (rc) {
@@ -412,6 +452,12 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx)
	struct cam_hw_stop_args stop;
	struct cam_ctx_request *req;

	if (!ctx) {
		CAM_ERR(CAM_CTXT, "Invalid input param");
		rc = -EINVAL;
		goto end;
	}

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "HW interface is not ready");
		rc = -EFAULT;