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

Commit 8cf34aed authored by Sridhar Gujje's avatar Sridhar Gujje
Browse files

Merge commit 'b9474406' into msm-4.9.c6 - PC225



* commit 'b9474406':
  msm: camera: Replace mutex lock with context spin lock
  msm: camera: isp: Handle bus error in bottom half
  msm: camera: isp: support composite fence id
  msm: camera: sync: Add warning logs
  msm: camera: reqmgr: Remove mem_mgr init & deinit calls
  msm: camera: icp: Change spin lock type
  msm: camera: flash: Remove opcode reset for NOP operation
  msm: camera: delete i2c data in release dev
  msm: camera: Disable camif sof irq logs
  msm: camera: icp: Execute irq callbacks with locks

Change-Id: Ic9d1690b1b7405503974c2dd72339c42d78af88a
Signed-off-by: default avatarSridhar Gujje <sgujje@codeaurora.org>
parents 01d21edd b9474406
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@ int cam_context_handle_crm_apply_req(struct cam_context *ctx,
		return -EINVAL;
	}

	mutex_lock(&ctx->ctx_mutex);
	if (ctx->state_machine[ctx->state].crm_ops.apply_req) {
		rc = ctx->state_machine[ctx->state].crm_ops.apply_req(ctx,
			apply);
@@ -170,7 +169,6 @@ int cam_context_handle_crm_apply_req(struct cam_context *ctx,
			ctx->dev_hdl, ctx->state);
		rc = -EPROTO;
	}
	mutex_unlock(&ctx->ctx_mutex);

	return rc;
}
+22 −6
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
	uint64_t packet_addr;
	struct cam_packet *packet;
	size_t len = 0;
	int32_t i = 0;
	int32_t i = 0, j = 0;

	if (!ctx || !cmd) {
		CAM_ERR(CAM_CTXT, "Invalid input params %pK %pK", ctx, cmd);
@@ -355,6 +355,15 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
	req->status = 1;
	req->req_priv = cfg.priv;

	for (i = 0; i < req->num_out_map_entries; i++) {
		rc = cam_sync_get_obj_ref(req->out_map_entries[i].sync_id);
		if (rc) {
			CAM_ERR(CAM_CTXT, "Can't get ref for sync %d",
				req->out_map_entries[i].sync_id);
			goto put_ref;
		}
	}

	if (req->num_in_map_entries > 0) {
		spin_lock(&ctx->lock);
		list_add_tail(&req->list, &ctx->pending_req_list);
@@ -365,17 +374,17 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
				"[%s][%d] : Moving req[%llu] from free_list to pending_list",
				ctx->dev_name, ctx->ctx_id, req->request_id);

		for (i = 0; i < req->num_in_map_entries; i++) {
		for (j = 0; j < req->num_in_map_entries; j++) {
			cam_context_getref(ctx);
			rc = cam_sync_register_callback(
					cam_context_sync_callback,
					(void *)req,
					req->in_map_entries[i].sync_id);
					req->in_map_entries[j].sync_id);
			if (rc) {
				CAM_ERR(CAM_CTXT,
					"[%s][%d] Failed register fence cb: %d ret = %d",
					ctx->dev_name, ctx->ctx_id,
					req->in_map_entries[i].sync_id, rc);
					req->in_map_entries[j].sync_id, rc);
				spin_lock(&ctx->lock);
				list_del_init(&req->list);
				spin_unlock(&ctx->lock);
@@ -388,16 +397,23 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,

				cam_context_putref(ctx);

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

	return rc;

put_ref:
	for (--i; i >= 0; i--) {
		rc = cam_sync_put_obj_ref(req->out_map_entries[i].sync_id);
		if (rc)
			CAM_ERR(CAM_CTXT, "Failed to put ref of fence %d",
				req->out_map_entries[i].sync_id);
	}
free_req:
	spin_lock(&ctx->lock);
	list_add_tail(&req->list, &ctx->free_req_list);
+5 −0
Original line number Diff line number Diff line
@@ -354,9 +354,11 @@ irqreturn_t cam_a5_irq(int irq_num, void *data)
		CAM_ERR_RATE_LIMIT(CAM_ICP, "watch dog interrupt from A5");
	}

	spin_lock(&a5_dev->hw_lock);
	if (core_info->irq_cb.icp_hw_mgr_cb)
		core_info->irq_cb.icp_hw_mgr_cb(irq_status,
					core_info->irq_cb.data);
	spin_unlock(&a5_dev->hw_lock);

	return IRQ_HANDLED;
}
@@ -369,6 +371,7 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
	struct cam_a5_device_core_info *core_info = NULL;
	struct cam_a5_device_hw_info *hw_info = NULL;
	struct a5_soc_info *a5_soc = NULL;
	unsigned long flags;
	int rc = 0;

	if (!device_priv) {
@@ -414,8 +417,10 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
			return -EINVAL;
		}

		spin_lock_irqsave(&a5_dev->hw_lock, flags);
		core_info->irq_cb.icp_hw_mgr_cb = irq_cb->icp_hw_mgr_cb;
		core_info->irq_cb.data = irq_cb->data;
		spin_unlock_irqrestore(&a5_dev->hw_lock, flags);
		break;
	}

+11 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#include "cam_soc_util.h"
#include "cam_trace.h"
#include "cam_cpas_api.h"
#include "cam_common_util.h"

#define ICP_WORKQ_TASK_CMD_TYPE 1
#define ICP_WORKQ_TASK_MSG_TYPE 2
@@ -2001,6 +2002,11 @@ int32_t cam_icp_hw_mgr_cb(uint32_t irq_status, void *data)
	struct crm_workq_task *task;
	struct hfi_msg_work_data *task_data;

	if (!data) {
		CAM_ERR(CAM_ICP, "irq cb data is NULL");
		return rc;
	}

	spin_lock_irqsave(&hw_mgr->hw_mgr_lock, flags);
	task = cam_req_mgr_workq_get_task(icp_hw_mgr.msg_work);
	if (!task) {
@@ -3388,6 +3394,11 @@ static int cam_icp_mgr_process_io_cfg(struct cam_icp_hw_mgr *hw_mgr,
			io_cfg_ptr[i].resource_type);
	}

	if (prepare_args->num_in_map_entries > 1)
		prepare_args->num_in_map_entries =
			cam_common_util_remove_duplicate_arr(
			sync_in_obj, prepare_args->num_in_map_entries);

	if (prepare_args->num_in_map_entries > 1) {
		rc = cam_sync_merge(&sync_in_obj[0],
			prepare_args->num_in_map_entries, &merged_sync_in_obj);
+34 −10
Original line number Diff line number Diff line
@@ -1157,7 +1157,7 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
{
	int rc = 0;
	struct cam_ctx_request          *req;
	struct cam_ctx_request          *active_req;
	struct cam_ctx_request          *active_req = NULL;
	struct cam_isp_ctx_req          *req_isp;
	struct cam_isp_ctx_req          *active_req_isp;
	struct cam_isp_context          *ctx_isp = NULL;
@@ -1177,8 +1177,10 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
	 *
	 */
	ctx_isp = (struct cam_isp_context *) ctx->ctx_priv;
	spin_lock_bh(&ctx->lock);
	req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request,
		list);
	spin_unlock_bh(&ctx->lock);

	/*
	 * Check whehter the request id is matching the tip, if not, this means
@@ -1201,17 +1203,23 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
			"Reject apply request (id %lld) due to congestion(cnt = %d)",
			req->request_id,
			ctx_isp->active_req_cnt);
		if (!list_empty(&ctx->active_req_list)) {

		spin_lock_bh(&ctx->lock);
		if (!list_empty(&ctx->active_req_list))
			active_req = list_first_entry(&ctx->active_req_list,
				struct cam_ctx_request, list);
			active_req_isp =
				(struct cam_isp_ctx_req *) active_req->req_priv;
			__cam_isp_ctx_handle_buf_done_fail_log(active_req_isp);
		} else {
		else
			CAM_ERR_RATE_LIMIT(CAM_ISP,
				"WARNING: should not happen (cnt = %d) but active_list empty",
				ctx_isp->active_req_cnt);
		spin_unlock_bh(&ctx->lock);

		if (active_req) {
			active_req_isp =
				(struct cam_isp_ctx_req *) active_req->req_priv;
			__cam_isp_ctx_handle_buf_done_fail_log(active_req_isp);
		}

		rc = -EFAULT;
		goto end;
	}
@@ -1997,7 +2005,7 @@ static int __cam_isp_ctx_release_dev_in_top_state(struct cam_context *ctx,
static int __cam_isp_ctx_config_dev_in_top_state(
	struct cam_context *ctx, struct cam_config_dev_cmd *cmd)
{
	int rc = 0;
	int rc = 0, i;
	struct cam_ctx_request           *req = NULL;
	struct cam_isp_ctx_req           *req_isp;
	uint64_t                          packet_addr;
@@ -2073,6 +2081,15 @@ static int __cam_isp_ctx_config_dev_in_top_state(
	req_isp->num_fence_map_in = cfg.num_in_map_entries;
	req_isp->num_acked = 0;

	for (i = 0; i < req_isp->num_fence_map_out; i++) {
		rc = cam_sync_get_obj_ref(req_isp->fence_map_out[i].sync_id);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can't get ref for fence %d",
				req_isp->fence_map_out[i].sync_id);
			goto put_ref;
		}
	}

	CAM_DBG(CAM_ISP, "num_entry: %d, num fence out: %d, num fence in: %d",
		req_isp->num_cfg, req_isp->num_fence_map_out,
		req_isp->num_fence_map_in);
@@ -2114,7 +2131,7 @@ static int __cam_isp_ctx_config_dev_in_top_state(
		}
	}
	if (rc)
		goto free_req;
		goto put_ref;

	CAM_DBG(CAM_REQ,
		"Preprocessing Config req_id %lld successful on ctx %u",
@@ -2122,6 +2139,13 @@ static int __cam_isp_ctx_config_dev_in_top_state(

	return rc;

put_ref:
	for (--i; i >= 0; i--) {
		rc = cam_sync_put_obj_ref(req_isp->fence_map_out[i].sync_id);
		if (rc)
			CAM_ERR(CAM_CTXT, "Failed to put ref of fence %d",
				req_isp->fence_map_out[i].sync_id);
	}
free_req:
	spin_lock_bh(&ctx->lock);
	list_add_tail(&req->list, &ctx->free_req_list);
Loading