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

Commit 0b94dfcb authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: icp: Dump hfi queues in case of FW timeout" into dev/msm-4.9-camx

parents 39560caa 6fe599d9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -153,4 +153,10 @@ int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg);
int cam_hfi_resume(struct hfi_mem_info *hfi_mem,
	void __iomem *icp_base, bool debug);

/**
 * cam_hfi_queue_dump() - utility function to dump hfi queues
 */
void cam_hfi_queue_dump(void);


#endif /* _HFI_INTF_H_ */
+43 −0
Original line number Diff line number Diff line
@@ -47,6 +47,49 @@ unsigned int g_icp_mmu_hdl;
static DEFINE_MUTEX(hfi_cmd_q_mutex);
static DEFINE_MUTEX(hfi_msg_q_mutex);

void cam_hfi_queue_dump(void)
{
	struct hfi_qtbl *qtbl;
	struct hfi_qtbl_hdr *qtbl_hdr;
	struct hfi_q_hdr *cmd_q_hdr, *msg_q_hdr;
	struct hfi_mem_info *hfi_mem = NULL;
	uint32_t *read_q, *read_ptr;
	int i;

	hfi_mem = &g_hfi->map;
	if (!hfi_mem) {
		CAM_ERR(CAM_HFI, "Unable to dump queues hfi memory is NULL");
		return;
	}

	qtbl = (struct hfi_qtbl *)hfi_mem->qtbl.kva;
	qtbl_hdr = &qtbl->q_tbl_hdr;
	CAM_INFO(CAM_HFI,
		"qtbl: version = %x size = %u num q = %u qhdr_size = %u",
		qtbl_hdr->qtbl_version, qtbl_hdr->qtbl_size,
		qtbl_hdr->qtbl_num_q, qtbl_hdr->qtbl_qhdr_size);

	cmd_q_hdr = &qtbl->q_hdr[Q_CMD];
	CAM_INFO(CAM_HFI, "cmd: size = %u r_idx = %u w_idx = %u addr = %x",
		cmd_q_hdr->qhdr_q_size, cmd_q_hdr->qhdr_read_idx,
		cmd_q_hdr->qhdr_write_idx, hfi_mem->cmd_q.iova);
	read_q = (uint32_t *)g_hfi->map.cmd_q.kva;
	read_ptr = (uint32_t *)(read_q + 0);
	CAM_INFO(CAM_HFI, "CMD Q START");
	for (i = 0; i < ICP_CMD_Q_SIZE_IN_BYTES >> BYTE_WORD_SHIFT; i++)
		CAM_INFO(CAM_HFI, "Word: %d Data: 0x%08x ", i, read_ptr[i]);

	msg_q_hdr = &qtbl->q_hdr[Q_MSG];
	CAM_INFO(CAM_HFI, "msg: size = %u r_idx = %u w_idx = %u addr = %x",
		msg_q_hdr->qhdr_q_size, msg_q_hdr->qhdr_read_idx,
		msg_q_hdr->qhdr_write_idx, hfi_mem->msg_q.iova);
	read_q = (uint32_t *)g_hfi->map.msg_q.kva;
	read_ptr = (uint32_t *)(read_q + 0);
	CAM_INFO(CAM_HFI, "MSG Q START");
	for (i = 0; i < ICP_MSG_Q_SIZE_IN_BYTES >> BYTE_WORD_SHIFT; i++)
		CAM_INFO(CAM_HFI, "Word: %d Data: 0x%08x ", i, read_ptr[i]);
}

int hfi_write_cmd(void *cmd_ptr)
{
	uint32_t size_in_words, empty_space, new_write_idx, read_idx, temp;
+6 −0
Original line number Diff line number Diff line
@@ -2323,6 +2323,7 @@ static int cam_icp_mgr_abort_handle(
	if (!rem_jiffies) {
		rc = -ETIMEDOUT;
		CAM_ERR(CAM_ICP, "FW timeout/err in abort handle command");
		cam_hfi_queue_dump();
	}

	kfree(abort_cmd);
@@ -2379,6 +2380,7 @@ static int cam_icp_mgr_destroy_handle(
		if (icp_hw_mgr.a5_debug_type ==
			HFI_DEBUG_MODE_QUEUE)
			cam_icp_mgr_process_dbg_buf();
		cam_hfi_queue_dump();
	}
	kfree(destroy_cmd);
	return rc;
@@ -2680,6 +2682,7 @@ static int cam_icp_mgr_send_fw_init(struct cam_icp_hw_mgr *hw_mgr)
	if (!rem_jiffies) {
		rc = -ETIMEDOUT;
		CAM_ERR(CAM_ICP, "FW response timed out %d", rc);
		cam_hfi_queue_dump();
	}
	CAM_DBG(CAM_ICP, "Done Waiting for INIT DONE Message");

@@ -2929,6 +2932,7 @@ static int cam_icp_mgr_send_config_io(struct cam_icp_hw_ctx_data *ctx_data,
	if (!rem_jiffies) {
		rc = -ETIMEDOUT;
		CAM_ERR(CAM_ICP, "FW response timed out %d", rc);
		cam_hfi_queue_dump();
	}

	return rc;
@@ -3769,6 +3773,7 @@ static int cam_icp_mgr_create_handle(uint32_t dev_type,
	if (!rem_jiffies) {
		rc = -ETIMEDOUT;
		CAM_ERR(CAM_ICP, "FW response timed out %d", rc);
		cam_hfi_queue_dump();
	}

	if (ctx_data->fw_handle == 0) {
@@ -3814,6 +3819,7 @@ static int cam_icp_mgr_send_ping(struct cam_icp_hw_ctx_data *ctx_data)
	if (!rem_jiffies) {
		rc = -ETIMEDOUT;
		CAM_ERR(CAM_ICP, "FW response timed out %d", rc);
		cam_hfi_queue_dump();
	}

	return rc;