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

Commit 29a45d8a authored by Sridhar Gujje's avatar Sridhar Gujje
Browse files

Merge remote-tracking branch 'dev/msm-4.14-camx' into msm-4.14 11/07



* commit '916a5f56':
  msm: camera: ife: calculate boot timestamp at csid SOF
  msm: camera: reqmgr: reset the slot on buf_done
  msm: camera: isp: Disable the PPI hw during PPI overflow case
  msm: camera: icp: dump page fault in ready state
  msm: camera: isp: Move CSID error propagation workq create code

Change-Id: I789bd6b9449bb2092f9cee2b261f4c6fa56705f9
Signed-off-by: default avatarSridhar Gujje <sgujje@codeaurora.org>
parents b58c05e9 916a5f56
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ static int cam_icp_context_dump_active_request(void *data, unsigned long iova,
		return -EINVAL;
		return -EINVAL;
	}
	}


	if (ctx->state < CAM_CTX_ACQUIRED || ctx->state > CAM_CTX_ACTIVATED) {
	if (ctx->state < CAM_CTX_READY || ctx->state > CAM_CTX_ACTIVATED) {
		CAM_ERR(CAM_ICP, "Invalid state icp ctx %d state %d",
		CAM_ERR(CAM_ICP, "Invalid state icp ctx %d state %d",
			ctx->ctx_id, ctx->state);
			ctx->ctx_id, ctx->state);
		return -EINVAL;
		return -EINVAL;
+9 −23
Original line number Original line Diff line number Diff line
@@ -740,23 +740,21 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state(


static void __cam_isp_ctx_send_sof_boot_timestamp(
static void __cam_isp_ctx_send_sof_boot_timestamp(
	struct cam_isp_context *ctx_isp, uint64_t request_id,
	struct cam_isp_context *ctx_isp, uint64_t request_id,
	uint32_t sof_event_status, uint64_t delta_ts)
	uint32_t sof_event_status)
{
{
	struct cam_req_mgr_message   req_msg;
	struct cam_req_mgr_message   req_msg;


	req_msg.session_hdl = ctx_isp->base->session_hdl;
	req_msg.session_hdl = ctx_isp->base->session_hdl;
	req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
	req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
	req_msg.u.frame_msg.request_id = request_id;
	req_msg.u.frame_msg.request_id = request_id;
	req_msg.u.frame_msg.timestamp = ctx_isp->boot_timestamp;
	req_msg.u.frame_msg.link_hdl = ctx_isp->base->link_hdl;
	req_msg.u.frame_msg.link_hdl = ctx_isp->base->link_hdl;
	req_msg.u.frame_msg.sof_status = sof_event_status;
	req_msg.u.frame_msg.sof_status = sof_event_status;


	req_msg.u.frame_msg.timestamp = ctx_isp->prev_boot_timestamp + delta_ts;

	CAM_DBG(CAM_ISP,
	CAM_DBG(CAM_ISP,
		"req id:%lld frame num:%lld bt_ts:0x%llx pre_bt_ts:0x%llx diff:0x%llx",
		"request id:%lld frame number:%lld boot time stamp:0x%llx",
		request_id, ctx_isp->frame_id,
		request_id, ctx_isp->frame_id,
		ctx_isp->boot_timestamp, ctx_isp->prev_boot_timestamp,
		ctx_isp->boot_timestamp);
		delta_ts);




	if (cam_req_mgr_notify_message(&req_msg,
	if (cam_req_mgr_notify_message(&req_msg,
@@ -766,7 +764,6 @@ static void __cam_isp_ctx_send_sof_boot_timestamp(
			"Error in notifying the boot time for req id:%lld",
			"Error in notifying the boot time for req id:%lld",
			request_id);
			request_id);


	ctx_isp->prev_boot_timestamp = req_msg.u.frame_msg.timestamp;
}
}




@@ -775,7 +772,6 @@ static void __cam_isp_ctx_send_sof_timestamp(
	uint32_t sof_event_status)
	uint32_t sof_event_status)
{
{
	struct cam_req_mgr_message   req_msg;
	struct cam_req_mgr_message   req_msg;
	uint64_t delta_ts;


	req_msg.session_hdl = ctx_isp->base->session_hdl;
	req_msg.session_hdl = ctx_isp->base->session_hdl;
	req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
	req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
@@ -785,9 +781,9 @@ static void __cam_isp_ctx_send_sof_timestamp(
	req_msg.u.frame_msg.sof_status = sof_event_status;
	req_msg.u.frame_msg.sof_status = sof_event_status;


	CAM_DBG(CAM_ISP,
	CAM_DBG(CAM_ISP,
		"request id:%lld frame number:%lld SOF time stamp:0x%llx, Prev SOF time:0x%llx",
		"request id:%lld frame number:%lld SOF time stamp:0x%llx",
		request_id, ctx_isp->frame_id,
		request_id, ctx_isp->frame_id,
		ctx_isp->sof_timestamp_val, ctx_isp->prev_sof_timestamp_val);
		ctx_isp->sof_timestamp_val);
	CAM_DBG(CAM_ISP, "sof status:%d", sof_event_status);
	CAM_DBG(CAM_ISP, "sof status:%d", sof_event_status);


	if (cam_req_mgr_notify_message(&req_msg,
	if (cam_req_mgr_notify_message(&req_msg,
@@ -795,18 +791,9 @@ static void __cam_isp_ctx_send_sof_timestamp(
		CAM_ERR(CAM_ISP,
		CAM_ERR(CAM_ISP,
			"Error in notifying the sof time for req id:%lld",
			"Error in notifying the sof time for req id:%lld",
			request_id);
			request_id);
	delta_ts = ctx_isp->sof_timestamp_val -
			ctx_isp->prev_sof_timestamp_val;


	__cam_isp_ctx_send_sof_boot_timestamp(ctx_isp,
	__cam_isp_ctx_send_sof_boot_timestamp(ctx_isp,
		request_id, sof_event_status,
		request_id, sof_event_status);
		(ctx_isp->prev_sof_timestamp_val == 0) ?
			ctx_isp->boot_timestamp :
			delta_ts);

	ctx_isp->prev_sof_timestamp_val =
			ctx_isp->sof_timestamp_val;

}
}


static int __cam_isp_ctx_reg_upd_in_epoch_state(
static int __cam_isp_ctx_reg_upd_in_epoch_state(
@@ -935,6 +922,7 @@ static int __cam_isp_ctx_notify_sof_in_activated_state(
			notify.dev_hdl = ctx->dev_hdl;
			notify.dev_hdl = ctx->dev_hdl;
			notify.frame_id = ctx_isp->frame_id;
			notify.frame_id = ctx_isp->frame_id;
			notify.trigger = CAM_TRIGGER_POINT_SOF;
			notify.trigger = CAM_TRIGGER_POINT_SOF;
			notify.req_id = ctx_isp->req_info.last_bufdone_req_id;
			notify.sof_timestamp_val = ctx_isp->sof_timestamp_val;
			notify.sof_timestamp_val = ctx_isp->sof_timestamp_val;


			ctx->ctx_crm_intf->notify_trigger(&notify);
			ctx->ctx_crm_intf->notify_trigger(&notify);
@@ -3913,8 +3901,6 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
	ctx_isp->req_info.last_applied_time_stamp = 0;
	ctx_isp->req_info.last_applied_time_stamp = 0;
	ctx_isp->req_info.last_bufdone_time_stamp = 0;
	ctx_isp->req_info.last_bufdone_time_stamp = 0;
	ctx_isp->req_info.last_reported_id_time_stamp = 0;
	ctx_isp->req_info.last_reported_id_time_stamp = 0;
	ctx_isp->prev_sof_timestamp_val = 0;
	ctx_isp->prev_boot_timestamp = 0;


	atomic_set(&ctx_isp->process_bubble, 0);
	atomic_set(&ctx_isp->process_bubble, 0);


+0 −4
Original line number Original line Diff line number Diff line
@@ -219,9 +219,7 @@ struct cam_isp_context_event_record {
 * @req_isp:                   ISP private request object storage
 * @req_isp:                   ISP private request object storage
 * @hw_ctx:                    HW object returned by the acquire device command
 * @hw_ctx:                    HW object returned by the acquire device command
 * @sof_timestamp_val:         Captured time stamp value at sof hw event
 * @sof_timestamp_val:         Captured time stamp value at sof hw event
 * @prev_sof_timestamp_val     Holds last notified sof time stamp
 * @boot_timestamp:            Boot time stamp for a given req_id
 * @boot_timestamp:            Boot time stamp for a given req_id
 * @prev_boot_timestamp        Holds last notified boot time stamp
 * @active_req_cnt:            Counter for the active request
 * @active_req_cnt:            Counter for the active request
 * @subscribe_event:           The irq event mask that CRM subscribes to, IFE
 * @subscribe_event:           The irq event mask that CRM subscribes to, IFE
 *                             will invoke CRM cb at those event.
 *                             will invoke CRM cb at those event.
@@ -255,9 +253,7 @@ struct cam_isp_context {


	void                            *hw_ctx;
	void                            *hw_ctx;
	uint64_t                         sof_timestamp_val;
	uint64_t                         sof_timestamp_val;
	uint64_t                         prev_sof_timestamp_val;
	uint64_t                         boot_timestamp;
	uint64_t                         boot_timestamp;
	uint64_t                         prev_boot_timestamp;
	int32_t                          active_req_cnt;
	int32_t                          active_req_cnt;
	uint32_t                         subscribe_event;
	uint32_t                         subscribe_event;
	atomic64_t                       state_monitor_head;
	atomic64_t                       state_monitor_head;
+6 −5
Original line number Original line Diff line number Diff line
@@ -323,7 +323,6 @@ int cam_csid_ppi_init_soc_resources(struct cam_hw_soc_info *soc_info,
irqreturn_t cam_csid_ppi_irq(int irq_num, void *data)
irqreturn_t cam_csid_ppi_irq(int irq_num, void *data)
{
{
	uint32_t      irq_status = 0;
	uint32_t      irq_status = 0;
	uint32_t      i, ppi_cfg_val = 0;
	bool          fatal_err_detected = false;
	bool          fatal_err_detected = false;


	struct cam_csid_ppi_hw                *ppi_hw;
	struct cam_csid_ppi_hw                *ppi_hw;
@@ -370,11 +369,13 @@ irqreturn_t cam_csid_ppi_irq(int irq_num, void *data)
	if (fatal_err_detected) {
	if (fatal_err_detected) {
		CAM_ERR(CAM_ISP, "PPI: %d irq_status:0x%x",
		CAM_ERR(CAM_ISP, "PPI: %d irq_status:0x%x",
			ppi_hw->hw_intf->hw_idx, irq_status);
			ppi_hw->hw_intf->hw_idx, irq_status);
		/* disable lanes */
		for (i = 0; i < CAM_CSID_PPI_LANES_MAX; i++)
			ppi_cfg_val &= ~PPI_CFG_CPHY_DLX_EN(i);


		cam_io_w_mb(ppi_cfg_val, soc_info->reg_map[0].mem_base +
		/* disable the interrupt */
		cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
			ppi_reg->ppi_irq_mask_addr);

		/* disable lanes */
		cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
			ppi_reg->ppi_module_cfg_addr);
			ppi_reg->ppi_module_cfg_addr);
	}
	}
ret:
ret:
+39 −22
Original line number Original line Diff line number Diff line
@@ -477,7 +477,7 @@ static int cam_ife_csid_global_reset(struct cam_ife_csid_hw *csid_hw)
		CAM_ERR(CAM_ISP, "CSID:%d IRQ value after reset rc = %d",
		CAM_ERR(CAM_ISP, "CSID:%d IRQ value after reset rc = %d",
			csid_hw->hw_intf->hw_idx, val);
			csid_hw->hw_intf->hw_idx, val);
	csid_hw->error_irq_count = 0;
	csid_hw->error_irq_count = 0;
	csid_hw->first_sof_ts = 0;
	csid_hw->prev_boot_timestamp = 0;


	for (i = 0 ; i < CAM_IFE_PIX_PATH_RES_MAX; i++)
	for (i = 0 ; i < CAM_IFE_PIX_PATH_RES_MAX; i++)
		csid_hw->res_sof_cnt[i] = 0;
		csid_hw->res_sof_cnt[i] = 0;
@@ -1178,8 +1178,8 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)


	csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN;
	csid_hw->error_irq_count = 0;
	csid_hw->error_irq_count = 0;
	csid_hw->first_sof_ts = 0;
	csid_hw->fatal_err_detected = false;
	csid_hw->fatal_err_detected = false;
	csid_hw->prev_boot_timestamp = 0;


	return rc;
	return rc;
}
}
@@ -2510,6 +2510,7 @@ static int cam_ife_csid_get_time_stamp(
	const struct cam_ife_csid_rdi_reg_offset   *rdi_reg;
	const struct cam_ife_csid_rdi_reg_offset   *rdi_reg;
	struct timespec64 ts;
	struct timespec64 ts;
	uint32_t  time_32, id;
	uint32_t  time_32, id;
	uint64_t  time_delta;


	time_stamp = (struct cam_csid_get_time_stamp_args  *)cmd_args;
	time_stamp = (struct cam_csid_get_time_stamp_args  *)cmd_args;
	res = time_stamp->node_res;
	res = time_stamp->node_res;
@@ -2563,16 +2564,31 @@ static int cam_ife_csid_get_time_stamp(
		CAM_IFE_CSID_QTIMER_MUL_FACTOR,
		CAM_IFE_CSID_QTIMER_MUL_FACTOR,
		CAM_IFE_CSID_QTIMER_DIV_FACTOR);
		CAM_IFE_CSID_QTIMER_DIV_FACTOR);


	if (!csid_hw->first_sof_ts) {
	if (!csid_hw->prev_boot_timestamp) {
		get_monotonic_boottime64(&ts);
		get_monotonic_boottime64(&ts);
		time_stamp->boot_timestamp =
		time_stamp->boot_timestamp =
			(uint64_t)((ts.tv_sec * 1000000000) +
			(uint64_t)((ts.tv_sec * 1000000000) +
			ts.tv_nsec);
			ts.tv_nsec);
		csid_hw->prev_qtimer_ts = 0;
		CAM_DBG(CAM_ISP, "timestamp:%lld",
		CAM_DBG(CAM_ISP, "timestamp:%lld",
			time_stamp->boot_timestamp);
			time_stamp->boot_timestamp);
		csid_hw->first_sof_ts = 1;
	} else {
	} else
		time_delta = time_stamp->time_stamp_val -
		time_stamp->boot_timestamp = 0;
			csid_hw->prev_qtimer_ts;

		if (csid_hw->prev_boot_timestamp >
			U64_MAX - time_delta) {
			CAM_WARN(CAM_ISP, "boottimestamp reached maximum");
			return -EINVAL;
		}

		time_stamp->boot_timestamp =
			csid_hw->prev_boot_timestamp + time_delta;
	}

	csid_hw->prev_qtimer_ts = time_stamp->time_stamp_val;
	csid_hw->prev_boot_timestamp = time_stamp->boot_timestamp;



	return 0;
	return 0;
}
}
@@ -4187,12 +4203,28 @@ int cam_ife_csid_hw_probe_init(struct cam_hw_intf *csid_hw_intf,


	ife_csid_hw->csid_debug = 0;
	ife_csid_hw->csid_debug = 0;
	ife_csid_hw->error_irq_count = 0;
	ife_csid_hw->error_irq_count = 0;
	ife_csid_hw->first_sof_ts = 0;
	ife_csid_hw->prev_boot_timestamp = 0;
	ife_csid_hw->ipp_path_config.measure_enabled = 0;
	ife_csid_hw->ipp_path_config.measure_enabled = 0;
	ife_csid_hw->ppp_path_config.measure_enabled = 0;
	ife_csid_hw->ppp_path_config.measure_enabled = 0;
	for (i = 0; i <= CAM_IFE_PIX_PATH_RES_RDI_3; i++)
	for (i = 0; i <= CAM_IFE_PIX_PATH_RES_RDI_3; i++)
		ife_csid_hw->rdi_path_config[i].measure_enabled = 0;
		ife_csid_hw->rdi_path_config[i].measure_enabled = 0;


	scnprintf(worker_name, sizeof(worker_name),
		"csid%u_worker", ife_csid_hw->hw_intf->hw_idx);
	CAM_DBG(CAM_ISP, "Create CSID worker %s", worker_name);
	rc = cam_req_mgr_workq_create(worker_name,
		CAM_CSID_WORKQ_NUM_TASK,
		&ife_csid_hw->work, CRM_WORKQ_USAGE_IRQ, 0);

	if (rc) {
		CAM_ERR(CAM_ISP, "Unable to create a workq, rc=%d", rc);
		goto err;
	}

	for (i = 0; i < CAM_CSID_WORKQ_NUM_TASK; i++)
		ife_csid_hw->work->task.pool[i].payload =
			&ife_csid_hw->work_data[i];

	/* Check if ppi bridge is present or not? */
	/* Check if ppi bridge is present or not? */
	ife_csid_hw->ppi_enable = of_property_read_bool(
	ife_csid_hw->ppi_enable = of_property_read_bool(
		csid_hw_info->soc_info.pdev->dev.of_node,
		csid_hw_info->soc_info.pdev->dev.of_node,
@@ -4209,21 +4241,6 @@ int cam_ife_csid_hw_probe_init(struct cam_hw_intf *csid_hw_intf,
			break;
			break;
		}
		}
	}
	}
	snprintf(worker_name, sizeof(worker_name),
		"csid%u_worker", ife_csid_hw->hw_intf->hw_idx);
	CAM_DBG(CAM_ISP, "Create CSID worker %s", worker_name);
	rc = cam_req_mgr_workq_create(worker_name,
		CAM_CSID_WORKQ_NUM_TASK,
		&ife_csid_hw->work, CRM_WORKQ_USAGE_IRQ, 0);
	if (rc) {
		CAM_ERR(CAM_ISP, "Unable to create a workq, rc=%d", rc);
		goto err;
	}
	for (i = 0; i < CAM_CSID_WORKQ_NUM_TASK; i++)
		ife_csid_hw->work->task.pool[i].payload =
			&ife_csid_hw->work_data[i];

	return 0;
err:
err:
	if (rc) {
	if (rc) {
		kfree(ife_csid_hw->ipp_res.res_priv);
		kfree(ife_csid_hw->ipp_res.res_priv);
Loading