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

Commit f72c476e authored by YUE CHEN's avatar YUE CHEN Committed by Gerrit - the friendly Code Review server
Browse files

msm: ais: fix pause/resume issue



Use CDM to write image address before starting write master,
and remove some kernel logs.
For multiple issue, need some delay before software register
reset, and increase timeout value for ife configuration.

Change-Id: I4d74fafd3eea17898656529e15319727159bd827
Signed-off-by: default avatarYUE CHEN <yueche@codeaurora.org>
parent eb142de1
Loading
Loading
Loading
Loading
+0 −107
Original line number Diff line number Diff line
@@ -62,104 +62,6 @@ static void __cam_isp_ctx_update_state_monitor_array(
		jiffies_to_msecs(jiffies);
}

static const char *__cam_isp_ctx_substate_val_to_type(
	uint32_t type)
{
	switch (type) {
	case CAM_ISP_CTX_ACTIVATED_SOF:
		return "SOF";
	case CAM_ISP_CTX_ACTIVATED_APPLIED:
		return "APPLIED";
	case CAM_ISP_CTX_ACTIVATED_EPOCH:
		return "EPOCH";
	case CAM_ISP_CTX_ACTIVATED_BUBBLE:
		return "BUBBLE";
	case CAM_ISP_CTX_ACTIVATED_BUBBLE_APPLIED:
		return "BUBBLE_APPLIED";
	case CAM_ISP_CTX_ACTIVATED_HALT:
		return "HALT";
	default:
		return "CAM_ISP_CTX_INVALID_STATE";
	}
}

static const char *__cam_isp_hw_evt_val_to_type(
	uint32_t evt_id)
{
	switch (evt_id) {
	case CAM_ISP_HW_EVENT_ERROR:
		return "ERROR";
	case CAM_ISP_HW_EVENT_SOF:
		return "SOF";
	case CAM_ISP_HW_EVENT_REG_UPDATE:
		return "REG_UPDATE";
	case CAM_ISP_HW_EVENT_EPOCH:
		return "EPOCH";
	case CAM_ISP_HW_EVENT_EOF:
		return "EOF";
	case CAM_ISP_HW_EVENT_DONE:
		return "DONE";
	default:
		return "CAM_ISP_EVENT_INVALID";
	}
}

static void __cam_isp_ctx_dump_state_monitor_array(
	struct cam_isp_context *ctx_isp, bool log_rate_limit)
{
	int i = 0;
	uint64_t state_head = 0;
	uint64_t index;
	struct cam_isp_context_state_monitor   *ctx_monitor;

	state_head = atomic64_read(&ctx_isp->state_monitor_head);

	ctx_monitor = ctx_isp->cam_isp_ctx_state_monitor;

	if (log_rate_limit)
		CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20,
			"Dumping state information for preceding requests");
	else
		CAM_INFO(CAM_ISP,
			"Dumping state information for preceding requests");

	for (i = CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES - 1; i >= 0;
		i--) {
		index = (((state_head - i) +
			CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES) %
			CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES);

		if (log_rate_limit) {
			CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20,
			"time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]",
			ctx_monitor[index].evt_time_stamp,
			ctx_monitor[index].last_reported_id,
			ctx_monitor[index].frame_id,
			ctx_monitor[index].last_applied_req_id,
			__cam_isp_ctx_substate_val_to_type(
			ctx_monitor[index].curr_state),
			__cam_isp_ctx_substate_val_to_type(
			ctx_monitor[index].next_state),
			__cam_isp_hw_evt_val_to_type(
			ctx_monitor[index].hw_event));

		} else {
			CAM_INFO(CAM_ISP,
			"time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]",
			ctx_monitor[index].evt_time_stamp,
			ctx_monitor[index].last_reported_id,
			ctx_monitor[index].frame_id,
			ctx_monitor[index].last_applied_req_id,
			__cam_isp_ctx_substate_val_to_type(
			ctx_monitor[index].curr_state),
			__cam_isp_ctx_substate_val_to_type(
			ctx_monitor[index].next_state),
			__cam_isp_hw_evt_val_to_type(
			ctx_monitor[index].hw_event));
		}
	}
}

static void cam_isp_ctx_dump_req(struct cam_isp_ctx_req *req_isp)
{
	int i = 0, rc = 0;
@@ -820,7 +722,6 @@ static int __cam_isp_ctx_notify_sof_in_activated_state(
				ctx->ctx_id, request_id,
				ctx_isp->req_info.reported_req_id);

			__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
		}

		__cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id,
@@ -964,7 +865,6 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,
		 * The recovery is to go back to sof state
		 */
		CAM_ERR(CAM_ISP, "Ctx:%d No wait request", ctx->ctx_id);
		__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
		ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF;

		/* Send SOF event as empty frame*/
@@ -981,7 +881,6 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,

	CAM_INFO(CAM_ISP, "ctx:%d Report Bubble flag %d req id:%lld",
		ctx->ctx_id, req_isp->bubble_report, req->request_id);
	__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
	if (req_isp->bubble_report && ctx->ctx_crm_intf &&
		ctx->ctx_crm_intf->notify_err) {
		struct cam_req_mgr_error_notify notify;
@@ -1123,7 +1022,6 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
		 * Just go back to the bubble state.
		 */
		CAM_ERR(CAM_ISP, "ctx:%d No pending request.", ctx->ctx_id);
		__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
		__cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id,
			CAM_REQ_MGR_SOF_EVENT_SUCCESS);

@@ -1137,7 +1035,6 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
	req_isp->bubble_detected = true;
	CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld",
		ctx->ctx_id, req_isp->bubble_report, req->request_id);
	__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);

	if (req_isp->bubble_report && ctx->ctx_crm_intf &&
		ctx->ctx_crm_intf->notify_err) {
@@ -2048,7 +1945,6 @@ static int __cam_isp_ctx_flush_req_in_top_state(
			ctx_isp->req_info.last_reported_id_time_stamp,
			ctx_isp->req_info.last_bufdone_time_stamp);

		__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
	}
	spin_unlock_bh(&ctx->lock);

@@ -2358,7 +2254,6 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied(
	req_isp->bubble_detected = true;
	CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld",
		ctx->ctx_id, req_isp->bubble_report, req->request_id);
	__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);

	if (req_isp->bubble_report && ctx->ctx_crm_intf &&
		ctx->ctx_crm_intf->notify_err) {
@@ -3735,7 +3630,6 @@ static int __cam_isp_ctx_apply_req(struct cam_context *ctx,
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"Ctx:%d No handle function in activated substate %d",
			ctx->ctx_id, ctx_isp->substate_activated);
		__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
		rc = -EFAULT;
	}

@@ -3770,7 +3664,6 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context,
	} else {
		CAM_INFO(CAM_ISP, "Ctx:%d No handle function for substate %d",
			ctx->ctx_id, ctx_isp->substate_activated);
		__cam_isp_ctx_dump_state_monitor_array(ctx_isp, true);
	}
	if (evt_id != CAM_ISP_HW_EVENT_DONE)
		__cam_isp_ctx_update_state_monitor_array(ctx_isp, evt_id,
+1 −1
Original line number Diff line number Diff line
@@ -2533,7 +2533,7 @@ static int cam_ife_mgr_config_hw(void *hw_mgr_priv,
		if (cfg->init_packet) {
			rc = wait_for_completion_timeout(
				&ctx->config_done_complete,
				msecs_to_jiffies(30));
				msecs_to_jiffies(50));
			if (rc <= 0) {
				CAM_ERR(CAM_ISP,
					"config done completion timeout for req_id=%llu rc=%d ctx_index %d",
+2 −0
Original line number Diff line number Diff line
@@ -2808,6 +2808,8 @@ static int cam_ife_csid_reset_retain_sw_reg(
	cam_io_w_mb(1, soc_info->reg_map[0].mem_base +
		csid_reg->cmn_reg->csid_irq_cmd_addr);

	usleep_range(3000, 3010);

	cam_io_w_mb(csid_reg->cmn_reg->csid_rst_stb,
		soc_info->reg_map[0].mem_base +
		csid_reg->cmn_reg->csid_rst_strobes_addr);
+14 −3
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ struct cam_vfe_bus_ver2_wm_resource_data {
	uint32_t             en_cfg;
	uint32_t             is_dual;
	uint32_t             is_lite;
	uint32_t             is_streaming;
};

struct cam_vfe_bus_ver2_comp_grp_data {
@@ -1246,6 +1247,7 @@ static int cam_vfe_bus_start_wm(struct cam_isp_resource_node *wm_res)
	CAM_DBG(CAM_ISP, "enable WM res %d offset 0x%x val 0x%x",
		rsrc_data->index, (uint32_t) rsrc_data->hw_regs->cfg,
		rsrc_data->en_cfg);
	rsrc_data->is_streaming = CAM_ISP_RESOURCE_STATE_STREAMING;

	wm_res->res_state = CAM_ISP_RESOURCE_STATE_STREAMING;

@@ -1274,6 +1276,7 @@ static int cam_vfe_bus_stop_wm(struct cam_isp_resource_node *wm_res)
			wm_res->irq_handle);

	wm_res->res_state = CAM_ISP_RESOURCE_STATE_RESERVED;
	rsrc_data->is_streaming = CAM_ISP_RESOURCE_STATE_RESERVED;

	kfifo_reset(
	&g_addr_fifo[rsrc_data->common_data->core_index][rsrc_data->index]);
@@ -3015,9 +3018,17 @@ static int cam_vfe_bus_update_wm(void *priv, void *cmd_args,
					&output_image_buf,
					sizeof(uint32_t));

					if (wm_data->is_streaming ==
					CAM_ISP_RESOURCE_STATE_STREAMING)
						cam_io_w_mb(output_image_buf,
						bus_priv->common_data.mem_base +
						wm_data->hw_regs->image_addr);
					else
						CAM_VFE_ADD_REG_VAL_PAIR(
						reg_val_pair,
						j,
						wm_data->hw_regs->image_addr,
						output_image_buf);

					kfifo_in(
					&bus_priv->addr_fifo[wm_data->index],