Bladeren bron

Merge "msm: camera: isp: Enhance SFE debug capability" into camera-kernel.lnx.5.0

Haritha Chintalapati 4 jaren geleden
bovenliggende
commit
7f8d05ddb7

+ 100 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/cam_sfe680.h

@@ -10,6 +10,105 @@
 #include "cam_sfe_bus_rd.h"
 #include "cam_sfe_bus_wr.h"
 
+static struct cam_sfe_top_module_desc sfe_mod_desc[] = {
+	{
+		.id = 0,
+		.desc = "CRC_ZSL",
+	},
+	{
+		.id = 1,
+		.desc = "COMP",
+	},
+	{
+		.id = 2,
+		.desc = "CRC_PREV",
+	},
+	{
+		.id = 3,
+		.desc = "HDRC",
+	},
+	{
+		.id = 4,
+		.desc = "DECOMP",
+	},
+	{
+		.id = 5,
+		.desc = "BPC_PDPC",
+	},
+	{
+		.id = 6,
+		.desc = "BHIST_CH0",
+	},
+	{
+		.id = 7,
+		.desc = "BG_CH0",
+	},
+	{
+		.id = 8,
+		.desc = "LSC_CH0",
+	},
+	{
+		.id = 9,
+		.desc = "CRC_CH0",
+	},
+	{
+		.id = 10,
+		.desc = "CCIF_2x2_2x1",
+	},
+	{
+		.id = 11,
+		.desc = "GAIN_CH0",
+	},
+	{
+		.id = 12,
+		.desc = "BHIST_CH1",
+	},
+	{
+		.id = 13,
+		.desc = "BG_CH1",
+	},
+	{
+		.id = 14,
+		.desc = "LSC_CH1",
+	},
+	{
+		.id = 15,
+		.desc = "CRC_CH1",
+	},
+	{
+		.id = 16,
+		.desc = "GAIN_CH1",
+	},
+	{
+		.id = 17,
+		.desc = "BHIST_CH2",
+	},
+	{
+		.id = 18,
+		.desc = "BG_CH2",
+	},
+	{
+		.id = 19,
+		.desc = "LSC_CH2",
+	},
+	{
+		.id = 20,
+		.desc = "CRC_CH2",
+	},
+	{
+		.id = 21,
+		.desc = "GAIN_CH2",
+	},
+	{
+		.id = 22,
+		.desc = "LCR",
+	},
+	{
+		.id = 23,
+		.desc = "QCFA_DEMUX",
+	},
+};
+
 static struct cam_sfe_top_common_reg_offset  sfe680_top_commong_reg  = {
 	.hw_version                    = 0x00000000,
 	.hw_capability                 = 0x00000004,
@@ -101,6 +200,7 @@ static struct cam_sfe_top_hw_info sfe680_top_hw_info = {
 	.common_reg = &sfe680_top_commong_reg,
 	.modules_hw_info = &sfe680_modules_common_reg,
 	.common_reg_data = &sfe_680_top_common_reg_data,
+	.module_desc = sfe_mod_desc,
 	.pix_reg_data = &sfe_680_pix_reg_data,
 	.rdi_reg_data[0] = &sfe_680_rdi0_reg_data,
 	.rdi_reg_data[1] = &sfe_680_rdi1_reg_data,

+ 57 - 14
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_bus/cam_sfe_bus_wr.c

@@ -118,7 +118,6 @@ struct cam_sfe_bus_wr_wm_resource_data {
 	enum cam_sfe_bus_wr_packer_format pack_fmt;
 	enum cam_sfe_bus_wr_wm_mode wm_mode;
 
-	uint32_t             packer_cfg;
 	uint32_t             h_init;
 
 	uint32_t             irq_subsample_period;
@@ -534,7 +533,10 @@ static int cam_sfe_bus_acquire_wm(
 
 	rsrc_data->width = out_port_info->width;
 	rsrc_data->height = out_port_info->height;
+	rsrc_data->acquired_width = out_port_info->width;
+	rsrc_data->acquired_height = out_port_info->height;
 	rsrc_data->is_dual = is_dual;
+
 	/* RDI0-2 line based mode by default */
 	if (sfe_out_res_id == CAM_SFE_BUS_SFE_OUT_RDI0 ||
 		sfe_out_res_id == CAM_SFE_BUS_SFE_OUT_RDI1 ||
@@ -622,7 +624,6 @@ static int cam_sfe_bus_release_wm(void   *bus_priv,
 	rsrc_data->irq_subsample_pattern = 0;
 	rsrc_data->framedrop_period = 0;
 	rsrc_data->framedrop_pattern = 0;
-	rsrc_data->packer_cfg = 0;
 	rsrc_data->h_init = 0;
 	rsrc_data->init_cfg_done = false;
 	rsrc_data->hfr_cfg_done = false;
@@ -1688,6 +1689,7 @@ static int cam_sfe_bus_init_sfe_out_resource(
 		return -ENOMEM;
 	}
 
+	/* All SFE clients have 1 WM hence i = 0 always */
 	rc = cam_sfe_bus_init_wm_resource(
 			hw_info->sfe_out_hw_info[index].wm_idx,
 			bus_priv, hw_info,
@@ -1752,11 +1754,24 @@ static int cam_sfe_bus_deinit_sfe_out_resource(
 	return 0;
 }
 
+static inline void __cam_sfe_bus_wr_print_wm_info(
+	struct cam_sfe_bus_wr_wm_resource_data  *wm_data)
+{
+	CAM_INFO(CAM_SFE,
+		"SFE:%d WM:%d width:%u height:%u stride:%u x_init:%u en_cfg:%u acquired width:%u height:%u pack_cfg: 0x%x",
+		wm_data->common_data->core_index, wm_data->index,
+		wm_data->width, wm_data->height,
+		wm_data->stride, wm_data->h_init,
+		wm_data->en_cfg, wm_data->acquired_width,
+		wm_data->acquired_height, wm_data->pack_fmt);
+}
+
 static int cam_sfe_bus_wr_print_dimensions(
 	enum cam_sfe_bus_sfe_out_type        sfe_out_res_id,
 	struct cam_sfe_bus_wr_priv          *bus_priv)
 {
 	struct cam_isp_resource_node            *rsrc_node = NULL;
+	struct cam_isp_resource_node            *wm_res = NULL;
 	struct cam_sfe_bus_wr_out_data          *rsrc_data = NULL;
 	struct cam_sfe_bus_wr_wm_resource_data  *wm_data   = NULL;
 	int                                      i, wm_idx;
@@ -1764,8 +1779,9 @@ static int cam_sfe_bus_wr_print_dimensions(
 	rsrc_node = &bus_priv->sfe_out[sfe_out_res_id];
 	rsrc_data = rsrc_node->res_priv;
 	for (i = 0; i < rsrc_data->num_wm; i++) {
+		wm_res = &rsrc_data->wm_res[i];
 		wm_data = (struct cam_sfe_bus_wr_wm_resource_data  *)
-			&rsrc_data->wm_res[i].res_priv;
+			wm_res->res_priv;
 		wm_idx = wm_data->index;
 		if (wm_idx < 0 || wm_idx >= bus_priv->num_client) {
 			CAM_ERR(CAM_SFE, "Unsupported SFE out %d",
@@ -1773,15 +1789,7 @@ static int cam_sfe_bus_wr_print_dimensions(
 			return -EINVAL;
 		}
 
-		CAM_INFO(CAM_SFE,
-			"SFE:%d WM:%d width:%u height:%u stride:%u x_init:%u en_cfg:%u acquired width:%u height:%u",
-			wm_data->common_data->core_index, wm_idx,
-			wm_data->width,
-			wm_data->height,
-			wm_data->stride, wm_data->h_init,
-			wm_data->en_cfg,
-			wm_data->acquired_width,
-			wm_data->acquired_height);
+		__cam_sfe_bus_wr_print_wm_info(wm_data);
 	}
 	return 0;
 }
@@ -1842,6 +1850,37 @@ static int cam_sfe_bus_wr_err_irq_top_half(uint32_t evt_id,
 	return rc;
 }
 
+static void cam_sfe_bus_wr_print_violation_info(
+	uint32_t status, struct cam_sfe_bus_wr_priv *bus_priv)
+{
+	int i, j, wm_idx;
+	struct cam_isp_resource_node           *sfe_out = NULL;
+	struct cam_isp_resource_node           *wm_res = NULL;
+	struct cam_sfe_bus_wr_out_data         *rsrc_data = NULL;
+	struct cam_sfe_bus_wr_wm_resource_data *wm_data = NULL;
+
+	for (i = 0; i < bus_priv->num_client; i++) {
+		sfe_out = &bus_priv->sfe_out[i];
+		rsrc_data = (struct cam_sfe_bus_wr_out_data *)
+			sfe_out->res_priv;
+
+		for (j = 0; j < rsrc_data->num_wm; j++) {
+			wm_res = &rsrc_data->wm_res[j];
+			wm_data = (struct cam_sfe_bus_wr_wm_resource_data  *)
+				wm_res->res_priv;
+			wm_idx = wm_data->index;
+			if (wm_idx < 0 || wm_idx >= bus_priv->num_client) {
+				CAM_ERR(CAM_SFE, "Unsupported SFE out %d",
+					wm_idx);
+				return;
+			}
+
+			if (status & (1 << wm_idx))
+				__cam_sfe_bus_wr_print_wm_info(wm_data);
+		}
+	}
+}
+
 static int cam_sfe_bus_wr_irq_bottom_half(
 	void *handler_priv, void *evt_payload_priv)
 {
@@ -1864,6 +1903,11 @@ static int cam_sfe_bus_wr_irq_bottom_half(
 		evt_payload->image_size_violation_status,
 		evt_payload->ccif_violation_status);
 
+	if (evt_payload->image_size_violation_status)
+		cam_sfe_bus_wr_print_violation_info(
+			evt_payload->image_size_violation_status,
+			bus_priv);
+
 	cam_sfe_bus_wr_put_evt_payload(common_data, &evt_payload);
 
 	evt_info.hw_idx = common_data->core_index;
@@ -2458,8 +2502,7 @@ static int cam_sfe_bus_wr_process_cmd(
 			cmd_args, arg_size);
 		break;
 	case CAM_ISP_HW_CMD_STOP_BUS_ERR_IRQ:
-		bus_priv = (struct cam_sfe_bus_wr_priv  *) priv;
-		/* Handle bus err IRQ */
+		rc = 0;
 		break;
 	case CAM_ISP_HW_CMD_DUMP_BUS_INFO: {
 		struct cam_isp_hw_event_info  *event_info;

+ 10 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_top/cam_sfe_top.c

@@ -48,6 +48,7 @@ struct cam_sfe_top_priv {
 	uint32_t                        sfe_debug_cfg;
 	uint32_t                        sensor_sel_diag_cfg;
 	spinlock_t                      spin_lock;
+	struct cam_sfe_top_module_desc *module_desc;
 };
 
 struct cam_sfe_path_data {
@@ -928,7 +929,7 @@ static int cam_sfe_top_handle_irq_bottom_half(
 	void *handler_priv, void *evt_payload_priv)
 {
 	int i;
-	uint32_t val0, val1, frame_cnt, offset0, offset1;
+	uint32_t val0, val1, frame_cnt, offset0, offset1, viol_sts;
 	uint32_t irq_status[CAM_SFE_IRQ_REGISTERS_MAX] = {0};
 	enum cam_sfe_hw_irq_status          ret = CAM_SFE_IRQ_STATUS_MAX;
 	struct cam_isp_hw_event_info        evt_info;
@@ -956,8 +957,14 @@ static int cam_sfe_top_handle_irq_bottom_half(
 		if (irq_status[0] & 0x10000)
 			CAM_ERR(CAM_SFE, "LINE SMOOTH VIOLATION");
 
+		viol_sts = payload->violation_status;
 		CAM_INFO(CAM_SFE, "Violation status 0x%x",
-			payload->violation_status);
+			viol_sts);
+		if (top_priv->module_desc)
+			CAM_ERR(CAM_ISP, "SFE:%u Violating Module [ID: %d name: %s]",
+				evt_info.hw_idx,
+				top_priv->module_desc[viol_sts].id,
+				top_priv->module_desc[viol_sts].desc);
 
 		evt_info.err_type = CAM_SFE_IRQ_STATUS_VIOLATION;
 		cam_sfe_top_print_debug_reg_info(path_data);
@@ -1340,6 +1347,7 @@ int cam_sfe_top_init(
 	top_priv->common_data.hw_intf = hw_intf;
 	top_priv->common_data.common_reg =
 		sfe_top_hw_info->common_reg;
+	top_priv->module_desc = sfe_top_hw_info->module_desc;
 	top_priv->sfe_debug_cfg = 0;
 
 	/* Remove after driver stabilizes */

+ 6 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_top/cam_sfe_top.h

@@ -20,6 +20,11 @@
 #define CAM_SHIFT_TOP_CORE_CFG_OPS_MODE_CFG    1
 #define CAM_SHIFT_TOP_CORE_CFG_FS_MODE_CFG     0
 
+struct cam_sfe_top_module_desc {
+	uint32_t id;
+	uint8_t *desc;
+};
+
 struct cam_sfe_top {
 	void                   *top_priv;
 	struct cam_hw_ops       hw_ops;
@@ -86,6 +91,7 @@ struct cam_sfe_top_hw_info {
 	struct cam_sfe_top_common_reg_offset     *common_reg;
 	struct cam_sfe_modules_common_reg_offset *modules_hw_info;
 	struct cam_sfe_top_common_reg_data       *common_reg_data;
+	struct cam_sfe_top_module_desc           *module_desc;
 	struct cam_sfe_path_common_reg_data      *pix_reg_data;
 	struct cam_sfe_path_common_reg_data      *rdi_reg_data[CAM_SFE_RDI_MAX];
 	uint32_t                                  num_inputs;