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

Commit f7c7fd0f authored by Ravikishore Pampana's avatar Ravikishore Pampana
Browse files

msm: camera: isp: Stop CSID hardware immediately during shutdown



When camera server shutdown happens,  camera isp node gets shutdown
notification, isp need to stop the CSID hardware path immediately.
During the shutdown camera isp should not stop the hardware at
frame boundary.

Change-Id: Ia48b0a75ae2695d1af2432a6fc26a19b484483b4
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent ceef0a8a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -123,10 +123,12 @@ struct cam_hw_start_args {
 * struct cam_hw_stop_args - Payload for stop command
 *
 * @ctxt_to_hw_map:        HW context from the acquire
 * @args:                  Arguments to pass for stop
 *
 */
struct cam_hw_stop_args {
	void              *ctxt_to_hw_map;
	void              *args;
};

/**
+6 −4
Original line number Diff line number Diff line
@@ -2221,7 +2221,7 @@ static int __cam_isp_ctx_unlink_in_ready(struct cam_context *ctx,
}

static int __cam_isp_ctx_stop_dev_in_activated_unlock(
	struct cam_context *ctx)
	struct cam_context *ctx, struct cam_start_stop_dev_cmd *stop_cmd)
{
	int rc = 0;
	uint32_t i;
@@ -2240,6 +2240,7 @@ 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;
		ctx->hw_mgr_intf->hw_stop(ctx->hw_mgr_intf->hw_mgr_priv,
			&stop);
	}
@@ -2288,7 +2289,7 @@ static int __cam_isp_ctx_stop_dev_in_activated(struct cam_context *ctx,
{
	int rc = 0;

	__cam_isp_ctx_stop_dev_in_activated_unlock(ctx);
	__cam_isp_ctx_stop_dev_in_activated_unlock(ctx, cmd);
	ctx->state = CAM_CTX_ACQUIRED;
	trace_cam_context_state("ISP", ctx);
	return rc;
@@ -2299,7 +2300,7 @@ static int __cam_isp_ctx_release_dev_in_activated(struct cam_context *ctx,
{
	int rc = 0;

	rc = __cam_isp_ctx_stop_dev_in_activated_unlock(ctx);
	rc = __cam_isp_ctx_stop_dev_in_activated_unlock(ctx, NULL);
	if (rc)
		CAM_ERR(CAM_ISP, "Stop device failed rc=%d", rc);

@@ -2369,7 +2370,8 @@ static int __cam_isp_ctx_unlink_in_activated(struct cam_context *ctx,

	CAM_WARN(CAM_ISP,
		"Received unlink in activated state. It's unexpected");
	rc = __cam_isp_ctx_stop_dev_in_activated_unlock(ctx);

	rc = __cam_isp_ctx_stop_dev_in_activated_unlock(ctx, NULL);
	if (rc)
		CAM_WARN(CAM_ISP, "Stop device failed rc=%d", rc);

+11 −4
Original line number Diff line number Diff line
@@ -1686,6 +1686,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
	struct cam_hw_stop_args          *stop_args = stop_hw_args;
	struct cam_ife_hw_mgr_res        *hw_mgr_res;
	struct cam_ife_hw_mgr_ctx        *ctx;
	enum cam_ife_csid_halt_cmd        csid_halt_type;
	uint32_t                          i, master_base_idx = 0;

	if (!hw_mgr_priv || !stop_hw_args) {
@@ -1701,6 +1702,12 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
	CAM_DBG(CAM_ISP, " Enter...ctx id:%d",
		ctx->ctx_index);

	/* Set the csid halt command */
	if (!stop_args->args)
		csid_halt_type = CAM_CSID_HALT_IMMEDIATELY;
	else
		csid_halt_type = CAM_CSID_HALT_AT_FRAME_BOUNDARY;

	/* Note:stop resource will remove the irq mask from the hardware */

	if (!ctx->num_base) {
@@ -1725,7 +1732,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)

	/* Stop the master CSID path first */
	cam_ife_mgr_csid_stop_hw(ctx, &ctx->res_list_ife_csid,
			master_base_idx, CAM_CSID_HALT_AT_FRAME_BOUNDARY);
			master_base_idx, csid_halt_type);

	/* stop rest of the CSID paths  */
	for (i = 0; i < ctx->num_base; i++) {
@@ -1733,19 +1740,19 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
			continue;

		cam_ife_mgr_csid_stop_hw(ctx, &ctx->res_list_ife_csid,
			ctx->base[i].idx, CAM_CSID_HALT_AT_FRAME_BOUNDARY);
			ctx->base[i].idx, csid_halt_type);
	}

	/* Stop the master CIDs first */
	cam_ife_mgr_csid_stop_hw(ctx, &ctx->res_list_ife_cid,
			master_base_idx, CAM_CSID_HALT_AT_FRAME_BOUNDARY);
			master_base_idx, csid_halt_type);

	/* stop rest of the CIDs  */
	for (i = 0; i < ctx->num_base; i++) {
		if (i == master_base_idx)
			continue;
		cam_ife_mgr_csid_stop_hw(ctx, &ctx->res_list_ife_cid,
			ctx->base[i].idx, CAM_CSID_HALT_AT_FRAME_BOUNDARY);
			ctx->base[i].idx, csid_halt_type);
	}

	if (cam_cdm_stream_off(ctx->cdm_handle))
+2 −1
Original line number Diff line number Diff line
@@ -2543,7 +2543,8 @@ static int cam_ife_csid_stop(void *hw_priv,
	/*wait for the path to halt */
	for (i = 0; i < csid_stop->num_res; i++) {
		res = csid_stop->node_res[i];
		if (csid_stop->stop_cmd == CAM_CSID_HALT_AT_FRAME_BOUNDARY)
		if (res->res_type == CAM_ISP_RESOURCE_PIX_PATH &&
			csid_stop->stop_cmd == CAM_CSID_HALT_AT_FRAME_BOUNDARY)
			rc = cam_ife_csid_res_wait_for_halt(csid_hw, res);
		else
			res->res_state = CAM_ISP_RESOURCE_STATE_INIT_HW;