Эх сурвалжийг харах

msm: camera: core: Handle event failure reason propagation

Handle event failure reason propagation in camera kernel
driver. Individual camera kernel driver will fill reason
codes for sync failure and send it to sync driver. Sync
driver will add this as part of sync event header and
propagate to user space.

CRs-Fixed: 2750553
Change-Id: I284390fc45757ba8291a44400e2263b9be64b092
Signed-off-by: Alok Chauhan <[email protected]>
Alok Chauhan 5 жил өмнө
parent
commit
acb34abbad

+ 4 - 0
drivers/cam_fd/fd_hw_mgr/cam_fd_hw_mgr.c

@@ -7,6 +7,7 @@
 #include <linux/kernel.h>
 #include <media/cam_cpas.h>
 #include <media/cam_req_mgr.h>
+#include <media/cam_sync.h>
 
 #include "cam_io_util.h"
 #include "cam_soc_util.h"
@@ -1032,6 +1033,9 @@ notify_context:
 
 		buf_data.num_handles = frame_req->num_hw_update_entries;
 		buf_data.request_id = frame_req->request_id;
+		buf_data.evt_param = (irq_type == CAM_FD_IRQ_FRAME_DONE) ?
+			CAM_SYNC_FD_EVENT_IRQ_FRAME_DONE :
+			CAM_SYNC_FD_EVENT_IRQ_RESET_DONE;
 
 		rc = frame_req->hw_ctx->event_cb(frame_req->hw_ctx->cb_priv,
 			evt_id, &buf_data);

+ 2 - 0
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c

@@ -2103,6 +2103,7 @@ static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
 	idx = i;
 
 	if (flag == ICP_FRAME_PROCESS_FAILURE) {
+		buf_data.evt_param = CAM_SYNC_ICP_EVENT_FRAME_PROCESS_FAILURE;
 		if (ioconfig_ack->err_type == CAMERAICP_EABORTED) {
 			CAM_WARN(CAM_ICP,
 				"ctx_id %d req %llu dev %d has been aborted[flushed]",
@@ -3860,6 +3861,7 @@ static int cam_icp_mgr_handle_config_err(
 	struct cam_hw_done_event_data buf_data;
 
 	buf_data.request_id = *(uint64_t *)config_args->priv;
+	buf_data.evt_param = CAM_SYNC_ICP_EVENT_CONFIG_ERR;
 	ctx_data->ctxt_event_cb(ctx_data->context_priv, CAM_CTX_EVT_ID_SUCCESS,
 		&buf_data);
 

+ 14 - 3
drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c

@@ -14,6 +14,7 @@
 #include <linux/debugfs.h>
 #include <media/cam_defs.h>
 #include <media/cam_jpeg.h>
+#include <media/cam_sync.h>
 
 #include "cam_packet_util.h"
 #include "cam_hw.h"
@@ -43,7 +44,8 @@ static int cam_jpeg_insert_cdm_change_base(
 	struct cam_jpeg_hw_ctx_data *ctx_data,
 	struct cam_jpeg_hw_mgr *hw_mgr);
 
-static int cam_jpeg_process_next_hw_update(void *priv, void *data)
+static int cam_jpeg_process_next_hw_update(void *priv, void *data,
+	struct cam_hw_done_event_data *buf_data)
 {
 	int rc;
 	int i = 0;
@@ -68,6 +70,7 @@ static int cam_jpeg_process_next_hw_update(void *priv, void *data)
 
 	if (!hw_mgr->devices[dev_type][0]->hw_ops.reset) {
 		CAM_ERR(CAM_JPEG, "op reset null ");
+		buf_data->evt_param = CAM_SYNC_JPEG_EVENT_INVLD_CMD;
 		rc = -EFAULT;
 		goto end_error;
 	}
@@ -76,6 +79,7 @@ static int cam_jpeg_process_next_hw_update(void *priv, void *data)
 		NULL, 0);
 	if (rc) {
 		CAM_ERR(CAM_JPEG, "jpeg hw reset failed %d", rc);
+		buf_data->evt_param = CAM_SYNC_JPEG_EVENT_HW_RESET_FAILED;
 		goto end_error;
 	}
 
@@ -91,6 +95,7 @@ static int cam_jpeg_process_next_hw_update(void *priv, void *data)
 		ctx_data, hw_mgr);
 	if (rc) {
 		CAM_ERR(CAM_JPEG, "insert change base failed %d", rc);
+		buf_data->evt_param = CAM_SYNC_JPEG_EVENT_CDM_CHANGE_BASE_ERR;
 		goto end_error;
 	}
 
@@ -124,11 +129,13 @@ static int cam_jpeg_process_next_hw_update(void *priv, void *data)
 		cdm_cmd);
 	if (rc) {
 		CAM_ERR(CAM_JPEG, "Failed to apply the configs %d", rc);
+		buf_data->evt_param = CAM_SYNC_JPEG_EVENT_CDM_CONFIG_ERR;
 		goto end_error;
 	}
 
 	if (!hw_mgr->devices[dev_type][0]->hw_ops.start) {
 		CAM_ERR(CAM_JPEG, "op start null ");
+		buf_data->evt_param = CAM_SYNC_JPEG_EVENT_INVLD_CMD;
 		rc = -EINVAL;
 		goto end_error;
 	}
@@ -137,6 +144,7 @@ static int cam_jpeg_process_next_hw_update(void *priv, void *data)
 	if (rc) {
 		CAM_ERR(CAM_JPEG, "Failed to apply the configs %d",
 			rc);
+		buf_data->evt_param = CAM_SYNC_JPEG_EVENT_START_HW_ERR;
 		goto end_error;
 	}
 
@@ -199,7 +207,8 @@ static int cam_jpeg_mgr_process_irq(void *priv, void *data)
 		(p_cfg_req->num_hw_entry_processed <
 			p_cfg_req->hw_cfg_args.num_hw_update_entries - 2)) {
 		/* start processing next entry before marking device free */
-		rc  = cam_jpeg_process_next_hw_update(priv, ctx_data);
+		rc  = cam_jpeg_process_next_hw_update(priv, ctx_data,
+			&buf_data);
 		if (!rc) {
 			mutex_unlock(&g_jpeg_hw_mgr.hw_mgr_mutex);
 			return 0;
@@ -533,6 +542,7 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data)
 	irq_cb.b_set_cb = true;
 	if (!hw_mgr->devices[dev_type][0]->hw_ops.process_cmd) {
 		CAM_ERR(CAM_JPEG, "op process_cmd null ");
+		buf_data.evt_param = CAM_SYNC_JPEG_EVENT_INVLD_CMD;
 		rc = -EFAULT;
 		goto end_callcb;
 	}
@@ -542,11 +552,12 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data)
 		&irq_cb, sizeof(irq_cb));
 	if (rc) {
 		CAM_ERR(CAM_JPEG, "SET_IRQ_CB failed %d", rc);
+		buf_data.evt_param = CAM_SYNC_JPEG_EVENT_SET_IRQ_CB;
 		goto end_callcb;
 	}
 
 	/* insert one of the cdm payloads */
-	rc = cam_jpeg_process_next_hw_update(priv, ctx_data);
+	rc = cam_jpeg_process_next_hw_update(priv, ctx_data, &buf_data);
 	if (rc) {
 		CAM_ERR(CAM_JPEG, "next hw update failed %d", rc);
 		goto end_callcb;

+ 4 - 0
drivers/cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.c

@@ -7,6 +7,7 @@
 #include <linux/kernel.h>
 #include <media/cam_cpas.h>
 #include <media/cam_req_mgr.h>
+#include <media/cam_sync.h>
 
 #include "cam_io_util.h"
 #include "cam_soc_util.h"
@@ -544,6 +545,9 @@ static int cam_lrme_mgr_cb(void *data,
 		struct cam_hw_done_event_data buf_data;
 
 		buf_data.request_id = frame_req->req_id;
+		buf_data.evt_param = (cb_args->cb_type & CAM_LRME_CB_ERROR) ?
+			CAM_SYNC_LRME_EVENT_CB_ERROR :
+			CAM_SYNC_EVENT_SUCCESS;
 		CAM_DBG(CAM_LRME, "frame req %llu, evt_id %d",
 			frame_req->req_id, evt_id);
 		rc = hw_mgr->event_cb(frame_req->ctxt_to_hw_map,

+ 14 - 0
drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c

@@ -1567,8 +1567,10 @@ static void cam_ope_ctx_cdm_callback(uint32_t handle, void *userdata,
 			ope_req->request_id, ctx->ctx_id);
 		cam_ope_req_timer_reset(ctx);
 		cam_ope_device_timer_reset(ope_hw_mgr);
+		buf_data.evt_param = CAM_SYNC_EVENT_SUCCESS;
 	} else if (status == CAM_CDM_CB_STATUS_HW_RESUBMIT) {
 		CAM_INFO(CAM_OPE, "After reset of CDM and OPE, reapply req");
+		buf_data.evt_param = CAM_SYNC_OPE_EVENT_HW_RESUBMIT;
 		rc = cam_ope_mgr_reapply_config(ope_hw_mgr, ctx, ope_req);
 		if (!rc)
 			goto end;
@@ -1583,6 +1585,17 @@ static void cam_ope_ctx_cdm_callback(uint32_t handle, void *userdata,
 			cam_ope_dump_req_data(ope_req);
 		rc = cam_ope_mgr_reset_hw();
 		evt_id = CAM_CTX_EVT_ID_ERROR;
+
+		if (status == CAM_CDM_CB_STATUS_PAGEFAULT)
+			buf_data.evt_param = CAM_SYNC_OPE_EVENT_PAGE_FAULT;
+		else if (status == CAM_CDM_CB_STATUS_HW_FLUSH)
+			buf_data.evt_param = CAM_SYNC_OPE_EVENT_HW_FLUSH;
+		else if (status == CAM_CDM_CB_STATUS_HW_RESET_DONE)
+			buf_data.evt_param = CAM_SYNC_OPE_EVENT_HW_RESET_DONE;
+		else if (status == CAM_CDM_CB_STATUS_HW_ERROR)
+			buf_data.evt_param = CAM_SYNC_OPE_EVENT_HW_ERROR;
+		else
+			buf_data.evt_param = CAM_SYNC_OPE_EVENT_UNKNOWN;
 	}
 
 	ctx->req_cnt--;
@@ -3201,6 +3214,7 @@ static int cam_ope_mgr_handle_config_err(
 	ope_req = config_args->priv;
 
 	buf_data.request_id = ope_req->request_id;
+	buf_data.evt_param = CAM_SYNC_OPE_EVENT_CONFIG_ERR;
 	ctx_data->ctxt_event_cb(ctx_data->context_priv, CAM_CTX_EVT_ID_ERROR,
 		&buf_data);