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

Commit 39f82918 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Merge commit '12ce5ba9' into msm-4.9 - PC222"

parents b089d2b0 6d4f98b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ int cam_context_shutdown(struct cam_context *ctx)
	}

	if (!rc)
		cam_destroy_device_hdl(ctx_hdl);
		rc = cam_destroy_device_hdl(ctx_hdl);
	return rc;
}

+3 −0
Original line number Diff line number Diff line
@@ -490,6 +490,7 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx,
	release.ctxt_to_hw_map = ctx->ctxt_to_hw_map;
	ctx->hw_mgr_intf->hw_release(ctx->hw_mgr_intf->hw_mgr_priv, &release);
	ctx->ctxt_to_hw_map = NULL;
	ctx->dev_hdl = -1;
end:
	return rc;
}
@@ -504,6 +505,7 @@ int32_t cam_context_flush_ctx_to_hw(struct cam_context *ctx)
	bool free_req;

	CAM_DBG(CAM_CTXT, "[%s] E: NRT flush ctx", ctx->dev_name);
	memset(&flush_args, 0, sizeof(flush_args));

	/*
	 * flush pending requests, take the sync lock to synchronize with the
@@ -670,6 +672,7 @@ int32_t cam_context_flush_req_to_hw(struct cam_context *ctx,

	CAM_DBG(CAM_CTXT, "[%s] E: NRT flush req", ctx->dev_name);

	memset(&flush_args, 0, sizeof(flush_args));
	flush_args.num_req_pending = 0;
	flush_args.num_req_active = 0;
	mutex_lock(&ctx->sync_mutex);
+5 −2
Original line number Diff line number Diff line
@@ -413,13 +413,16 @@ int cam_node_deinit(struct cam_node *node)
int cam_node_shutdown(struct cam_node *node)
{
	int i = 0;
	int rc = 0;

	if (!node)
		return -EINVAL;

	for (i = 0; i < node->ctx_size; i++) {
		if (node->ctx_list[i].dev_hdl >= 0) {
			cam_context_shutdown(&(node->ctx_list[i]));
		if (node->ctx_list[i].dev_hdl > 0) {
			rc = cam_context_shutdown(&(node->ctx_list[i]));
			if (rc)
				continue;
			cam_context_putref(&(node->ctx_list[i]));
		}
	}
+5 −9
Original line number Diff line number Diff line
@@ -3841,19 +3841,15 @@ static int cam_icp_mgr_hw_flush(void *hw_priv, void *hw_flush_args)
		return -EINVAL;
	}

	CAM_DBG(CAM_REQ, "ctx_id %d req %lld Flush type %d",
		ctx_data->ctx_id,
		*(int64_t *)flush_args->flush_req_pending[0],
		flush_args->flush_type);
	CAM_DBG(CAM_REQ, "ctx_id %d Flush type %d",
		ctx_data->ctx_id, flush_args->flush_type);

	switch (flush_args->flush_type) {
	case CAM_FLUSH_TYPE_ALL:
		mutex_lock(&hw_mgr->hw_mgr_mutex);
		if (!hw_mgr->recovery) {
			if (flush_args->num_req_active) {
		if (!hw_mgr->recovery && flush_args->num_req_active) {
			mutex_unlock(&hw_mgr->hw_mgr_mutex);
			cam_icp_mgr_abort_handle(ctx_data);
			}
		} else {
			mutex_unlock(&hw_mgr->hw_mgr_mutex);
		}
+81 −10
Original line number Diff line number Diff line
@@ -1395,12 +1395,56 @@ static int __cam_isp_ctx_flush_req_in_top_state(
	struct cam_context *ctx,
	struct cam_req_mgr_flush_request *flush_req)
{
	struct cam_isp_context           *ctx_isp =
		(struct cam_isp_context *) ctx->ctx_priv;
	struct cam_isp_stop_args          stop_isp;
	struct cam_hw_stop_args           stop_args;
	struct cam_isp_start_args         start_isp;
	int rc = 0;

	CAM_DBG(CAM_ISP, "try to flush pending list");
	spin_lock_bh(&ctx->lock);
	rc = __cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
	spin_unlock_bh(&ctx->lock);

	if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) {
		/* if active and wait list are empty, return */
		spin_lock_bh(&ctx->lock);
		if ((list_empty(&ctx->wait_req_list)) &&
			(list_empty(&ctx->active_req_list))) {
			spin_unlock_bh(&ctx->lock);
			CAM_DBG(CAM_ISP, "active and wait list are empty");
			goto end;
		}
		spin_unlock_bh(&ctx->lock);

		/* Stop hw first before active list flush */
		stop_args.ctxt_to_hw_map = ctx_isp->hw_ctx;
		stop_isp.hw_stop_cmd = CAM_ISP_HW_STOP_AT_FRAME_BOUNDARY;
		stop_isp.stop_only = true;
		stop_args.args = (void *)&stop_isp;
		ctx->hw_mgr_intf->hw_stop(ctx->hw_mgr_intf->hw_mgr_priv,
				&stop_args);

		spin_lock_bh(&ctx->lock);
		CAM_DBG(CAM_ISP, "try to flush wait list");
		rc = __cam_isp_ctx_flush_req(ctx, &ctx->wait_req_list,
		flush_req);
		CAM_DBG(CAM_ISP, "try to flush active list");
		rc = __cam_isp_ctx_flush_req(ctx, &ctx->active_req_list,
		flush_req);
		spin_unlock_bh(&ctx->lock);

		/* Start hw */
		start_isp.hw_config.ctxt_to_hw_map = ctx_isp->hw_ctx;
		start_isp.start_only = true;
		start_isp.hw_config.priv = NULL;

		rc = ctx->hw_mgr_intf->hw_start(ctx->hw_mgr_intf->hw_mgr_priv,
			&start_isp);
	}

end:
	CAM_DBG(CAM_ISP, "Flush request in top state %d",
		 ctx->state);
	return rc;
@@ -2366,7 +2410,7 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
	struct cam_start_stop_dev_cmd *cmd)
{
	int rc = 0;
	struct cam_hw_config_args        arg;
	struct cam_isp_start_args        start_isp;
	struct cam_ctx_request          *req;
	struct cam_isp_ctx_req          *req_isp;
	struct cam_isp_context          *ctx_isp =
@@ -2395,12 +2439,13 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
		goto end;
	}

	arg.ctxt_to_hw_map = ctx_isp->hw_ctx;
	arg.request_id = req->request_id;
	arg.hw_update_entries = req_isp->cfg;
	arg.num_hw_update_entries = req_isp->num_cfg;
	arg.priv  = &req_isp->hw_update_data;
	arg.init_packet = 1;
	start_isp.hw_config.ctxt_to_hw_map = ctx_isp->hw_ctx;
	start_isp.hw_config.request_id = req->request_id;
	start_isp.hw_config.hw_update_entries = req_isp->cfg;
	start_isp.hw_config.num_hw_update_entries = req_isp->num_cfg;
	start_isp.hw_config.priv  = &req_isp->hw_update_data;
	start_isp.hw_config.init_packet = 1;
	start_isp.start_only = false;

	ctx_isp->frame_id = 0;
	ctx_isp->active_req_cnt = 0;
@@ -2417,7 +2462,8 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
	 */
	ctx->state = CAM_CTX_ACTIVATED;
	trace_cam_context_state("ISP", ctx);
	rc = ctx->hw_mgr_intf->hw_start(ctx->hw_mgr_intf->hw_mgr_priv, &arg);
	rc = ctx->hw_mgr_intf->hw_start(ctx->hw_mgr_intf->hw_mgr_priv,
		&start_isp);
	if (rc) {
		/* HW failure. user need to clean up the resource */
		CAM_ERR(CAM_ISP, "Start HW failed");
@@ -2458,6 +2504,7 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
	struct cam_isp_ctx_req          *req_isp;
	struct cam_isp_context          *ctx_isp =
		(struct cam_isp_context *) ctx->ctx_priv;
	struct cam_isp_stop_args         stop_isp;

	/* Mask off all the incoming hardware events */
	spin_lock_bh(&ctx->lock);
@@ -2468,7 +2515,15 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
	/* stop hw first */
	if (ctx_isp->hw_ctx) {
		stop.ctxt_to_hw_map = ctx_isp->hw_ctx;
		stop.args = stop_cmd;

		if (stop_cmd)
			stop_isp.hw_stop_cmd =
				CAM_ISP_HW_STOP_AT_FRAME_BOUNDARY;
		else
			stop_isp.hw_stop_cmd = CAM_ISP_HW_STOP_IMMEDIATELY;

		stop_isp.stop_only = false;
		stop.args = (void *) &stop_isp;
		ctx->hw_mgr_intf->hw_stop(ctx->hw_mgr_intf->hw_mgr_priv,
			&stop);
	}
@@ -2489,6 +2544,22 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
		list_add_tail(&req->list, &ctx->free_req_list);
	}

	while (!list_empty(&ctx->wait_req_list)) {
		req = list_first_entry(&ctx->wait_req_list,
				struct cam_ctx_request, list);
		list_del_init(&req->list);
		req_isp = (struct cam_isp_ctx_req *) req->req_priv;
		CAM_DBG(CAM_ISP, "signal fence in wait list. fence num %d",
			 req_isp->num_fence_map_out);
		for (i = 0; i < req_isp->num_fence_map_out; i++)
			if (req_isp->fence_map_out[i].sync_id != -1) {
				cam_sync_signal(
					req_isp->fence_map_out[i].sync_id,
					CAM_SYNC_STATE_SIGNALED_ERROR);
			}
		list_add_tail(&req->list, &ctx->free_req_list);
	}

	while (!list_empty(&ctx->active_req_list)) {
		req = list_first_entry(&ctx->active_req_list,
				struct cam_ctx_request, list);
Loading