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

Commit dde94d7b authored by Jigarkumar Zala's avatar Jigarkumar Zala
Browse files

msm: camera: Bring over remaining camera driver changes



Bring over remaining camera driver changes as of msm-4.14
commit 9d664985 (Merge "msm: camera: reqmgr: Fix frame
skip condition").

Change-Id: Id7c2e6756f832924ba8c734b66275c83613b56eb
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent a3d9530a
Loading
Loading
Loading
Loading
+13 −15
Original line number Diff line number Diff line
@@ -502,8 +502,8 @@ int cam_hw_cdm_submit_bl(struct cam_hw_info *cdm_hw,

		if (!rc) {
			CAM_DBG(CAM_CDM,
				"write BL success for cnt=%d with tag=%d",
				i, core->bl_tag);
				"write BL success for cnt=%d with tag=%d total_cnt=%d",
				i, core->bl_tag, req->data->cmd_arrary_count);

			CAM_DBG(CAM_CDM, "Now commit the BL");
			if (cam_hw_cdm_commit_bl_write(cdm_hw)) {
@@ -543,18 +543,16 @@ static void cam_hw_cdm_work(struct work_struct *work)
		cdm_hw = payload->hw;
		core = (struct cam_cdm *)cdm_hw->core_info;

		CAM_DBG(CAM_CDM, "IRQ status=%x", payload->irq_status);
		CAM_DBG(CAM_CDM, "IRQ status=0x%x", payload->irq_status);
		if (payload->irq_status &
			CAM_CDM_IRQ_STATUS_INFO_INLINE_IRQ_MASK) {
			struct cam_cdm_bl_cb_request_entry *node;
			struct cam_cdm_bl_cb_request_entry *node, *tnode;

			CAM_DBG(CAM_CDM, "inline IRQ data=%x",
			CAM_DBG(CAM_CDM, "inline IRQ data=0x%x",
				payload->irq_data);
			mutex_lock(&cdm_hw->hw_mutex);
			node = cam_cdm_find_request_by_bl_tag(
					payload->irq_data,
					&core->bl_request_list);
			if (node) {
			list_for_each_entry_safe(node, tnode,
					&core->bl_request_list, entry) {
				if (node->request_type ==
					CAM_HW_CDM_BL_CB_CLIENT) {
					cam_cdm_notify_clients(cdm_hw,
@@ -567,11 +565,11 @@ static void cam_hw_cdm_work(struct work_struct *work)
						node->request_type);
				}
				list_del_init(&node->entry);
				if (node->bl_tag == payload->irq_data) {
					kfree(node);
					break;
				}
				kfree(node);
			} else {
				CAM_ERR(CAM_CDM,
					"Inval node, inline_irq st=%x data=%x",
					payload->irq_status, payload->irq_data);
			}
			mutex_unlock(&cdm_hw->hw_mutex);
		}
@@ -677,7 +675,7 @@ irqreturn_t cam_hw_cdm_irq(int irq_num, void *data)
			CAM_ERR(CAM_CDM, "Failed to Write CDM HW IRQ cmd");
		work_status = queue_work(cdm_core->work_queue, &payload->work);
		if (work_status == false) {
			CAM_ERR(CAM_CDM, "Failed to queue work for irq=%x",
			CAM_ERR(CAM_CDM, "Failed to queue work for irq=0x%x",
				payload->irq_status);
			kfree(payload);
		}
+1 −2
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ int cam_context_shutdown(struct cam_context *ctx)
	int rc = 0;
	struct cam_release_dev_cmd cmd;

	mutex_lock(&ctx->ctx_mutex);
	if (ctx->state > CAM_CTX_AVAILABLE && ctx->state < CAM_CTX_STATE_MAX) {
		cmd.session_handle = ctx->session_hdl;
		cmd.dev_handle = ctx->dev_hdl;
@@ -54,7 +53,6 @@ int cam_context_shutdown(struct cam_context *ctx)
			ctx->dev_name, ctx->ctx_id, ctx->state);
		rc = -EINVAL;
	}
	mutex_unlock(&ctx->ctx_mutex);

	rc = cam_destroy_device_hdl(ctx->dev_hdl);
	if (rc)
@@ -522,6 +520,7 @@ int cam_context_init(struct cam_context *ctx,
	ctx->dev_name = dev_name;
	ctx->dev_id = dev_id;
	ctx->ctx_id = ctx_id;
	ctx->last_flush_req = 0;
	ctx->ctx_crm_intf = NULL;
	ctx->crm_ctx_intf = crm_node_intf;
	ctx->hw_mgr_intf = hw_mgr_intf;
+15 −13
Original line number Diff line number Diff line
@@ -272,15 +272,13 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,

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

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "[%s][%d] HW interface is not ready",
			ctx->dev_name, ctx->ctx_id);
		rc = -EFAULT;
		goto end;
		return -EFAULT;
	}
	rc = cam_context_validate_thread();
	if (rc)
@@ -297,8 +295,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
	if (!req) {
		CAM_ERR(CAM_CTXT, "[%s][%d] No more request obj free",
			ctx->dev_name, ctx->ctx_id);
		rc = -ENOMEM;
		goto end;
		return -ENOMEM;
	}

	memset(req, 0, sizeof(*req));
@@ -324,7 +321,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
			"request %lld has been flushed, reject packet",
			packet->header.request_id);
		rc = -EINVAL;
		goto free_req;
		goto free_cpu_buf;
	}

	if (packet->header.request_id > ctx->last_flush_req)
@@ -350,7 +347,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
			"[%s][%d] Prepare config packet failed in HW layer",
			ctx->dev_name, ctx->ctx_id);
		rc = -EFAULT;
		goto free_req;
		goto free_cpu_buf;
	}
	req->num_hw_update_entries = cfg.num_hw_update_entries;
	req->num_out_map_entries = cfg.num_out_map_entries;
@@ -401,30 +398,35 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
						req->request_id);

				cam_context_putref(ctx);

				goto put_ref;
			}
			CAM_DBG(CAM_CTXT, "register in fence cb: %d ret = %d",
				req->in_map_entries[j].sync_id, rc);
		}
		goto end;
	}

	if (cam_mem_put_cpu_buf((int32_t) cmd->packet_handle))
		CAM_WARN(CAM_CTXT, "[%s][%d] Can not put packet address",
			ctx->dev_name, ctx->ctx_id);

	return rc;

put_ref:
	for (--i; i >= 0; i--) {
		rc = cam_sync_put_obj_ref(req->out_map_entries[i].sync_id);
		if (rc)
		if (cam_sync_put_obj_ref(req->out_map_entries[i].sync_id))
			CAM_ERR(CAM_CTXT, "Failed to put ref of fence %d",
				req->out_map_entries[i].sync_id);
	}
free_cpu_buf:
	if (cam_mem_put_cpu_buf((int32_t) cmd->packet_handle))
		CAM_WARN(CAM_CTXT, "[%s][%d] Can not put packet address",
			ctx->dev_name, ctx->ctx_id);
free_req:
	spin_lock(&ctx->lock);
	list_add_tail(&req->list, &ctx->free_req_list);
	req->ctx = NULL;
	spin_unlock(&ctx->lock);
end:

	return rc;
}

+6 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ static void cam_node_print_ctx_state(
	for (i = 0; i < node->ctx_size; i++) {
		ctx = &node->ctx_list[i];

		spin_lock(&ctx->lock);
		spin_lock_bh(&ctx->lock);
		CAM_INFO(CAM_CORE,
			"[%s][%d] : state=%d, refcount=%d, active_req_list=%d, pending_req_list=%d, wait_req_list=%d, free_req_list=%d",
			ctx->dev_name ? ctx->dev_name : "null",
@@ -34,7 +34,7 @@ static void cam_node_print_ctx_state(
			list_empty(&ctx->pending_req_list),
			list_empty(&ctx->wait_req_list),
			list_empty(&ctx->free_req_list));
		spin_unlock(&ctx->lock);
		spin_unlock_bh(&ctx->lock);
	}
	mutex_unlock(&node->list_mutex);
}
@@ -104,6 +104,7 @@ static int __cam_node_handle_acquire_dev(struct cam_node *node,
		goto err;
	}

	ctx->last_flush_req = 0;
	rc = cam_context_handle_acquire_dev(ctx, acquire);
	if (rc) {
		CAM_ERR(CAM_CORE, "Acquire device failed for node %s",
@@ -650,6 +651,7 @@ int cam_node_handle_ioctl(struct cam_node *node, struct cam_control *cmd)
					"acquire device failed(rc = %d)", rc);
				goto acquire_kfree;
			}
			CAM_INFO(CAM_CORE, "Acquire HW successful");
		}

		if (copy_to_user((void __user *)cmd->handle, acquire_ptr,
@@ -756,6 +758,8 @@ int cam_node_handle_ioctl(struct cam_node *node, struct cam_control *cmd)
					"release device failed(rc = %d)", rc);
		}

		CAM_INFO(CAM_CORE, "Release HW done(rc = %d)", rc);

release_kfree:
		kfree(release_ptr);
		break;
+13 −3
Original line number Diff line number Diff line
@@ -306,6 +306,9 @@ static int cam_cpas_util_axi_setup(struct cam_cpas *cpas_core,
			goto mnoc_node_get_fail;
		}
		axi_port->axi_port_mnoc_node = axi_port_mnoc_node;
		axi_port->ib_bw_voting_needed =
			of_property_read_bool(axi_port_node,
				"ib-bw-voting-needed");

		rc = cam_cpas_util_register_bus_client(soc_info,
			axi_port_mnoc_node, &axi_port->mnoc_bus);
@@ -655,12 +658,19 @@ static int cam_cpas_util_apply_client_axi_vote(
		axi_port->camnoc_bus.src, axi_port->camnoc_bus.dst,
		camnoc_bw, mnoc_bw);

	if (axi_port->ib_bw_voting_needed)
		rc = cam_cpas_util_vote_bus_client_bw(&axi_port->mnoc_bus,
			mnoc_bw, mnoc_bw, false);
	else
		rc = cam_cpas_util_vote_bus_client_bw(&axi_port->mnoc_bus,
			mnoc_bw, 0, false);

	if (rc) {
		CAM_ERR(CAM_CPAS,
			"Failed in mnoc vote ab[%llu] ib[%llu] rc=%d",
			mnoc_bw, mnoc_bw, rc);
			mnoc_bw,
			(axi_port->ib_bw_voting_needed ? mnoc_bw : 0),
			rc);
		goto unlock_axi_port;
	}

Loading