瀏覽代碼

msm: camera: icp: Add new HFI property for ram dumps

Add new property to configure FW ram dump level.
It is disabled by default.

CRs-Fixed: 3261717
Change-Id: I58db96929d9887a130ce5d7edb9bb13383a342f8
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 2 年之前
父節點
當前提交
fe0a275903

+ 4 - 3
drivers/cam_icp/fw_inc/hfi_intf.h

@@ -137,10 +137,11 @@ void cam_hfi_deinit(void);
 int hfi_set_debug_level(u64 icp_dbg_type, uint32_t lvl);
 
 /**
- * hfi_set_fw_dump_level() - set firmware dump level
- * @lvl: level of firmware dump level
+ * hfi_set_fw_dump_levels() - set firmware hang dump/ramdump levels
+ * @hang_dump_lvl : level of firmware hang dump
+ * @ram_dump_lvl  : level of firmware ram dump
  */
-int hfi_set_fw_dump_level(uint32_t lvl);
+int hfi_set_fw_dump_levels(uint32_t hang_dump_lvl, uint32_t ram_dump_lvl);
 
 /**
  * hfi_send_freq_info() - set firmware dump level

+ 8 - 0
drivers/cam_icp/fw_inc/hfi_sys_defs.h

@@ -178,6 +178,7 @@
 #define HFI_PROP_SYS_FW_DUMP_CFG           (HFI_PROPERTY_ICP_COMMON_START + 0x8)
 #define HFI_PROPERTY_SYS_UBWC_CONFIG_EX    (HFI_PROPERTY_ICP_COMMON_START + 0x9)
 #define HFI_PROPERTY_SYS_ICP_HW_FREQUENCY  (HFI_PROPERTY_ICP_COMMON_START + 0xa)
+#define HFI_PROPERTY_SYS_RAMDUMP_MODE      (HFI_PROPERTY_ICP_COMMON_START + 0xb)
 
 /* Capabilities reported at sys init */
 #define HFI_CAPS_PLACEHOLDER_1         (HFI_COMMON_BASE + 0x1)
@@ -210,6 +211,13 @@
 /* Number of available dump levels. */
 #define NUM_HFI_DUMP_LVL        0x00000003
 
+/* Number of available ramdump levels. */
+#define HFI_FW_RAMDUMP_DISABLED 0x00000000
+#define HFI_FW_RAMDUMP_ENABLED  0x00000001
+
+/* Number of available ramdump levels. */
+#define NUM_HFI_RAMDUMP_LVLS    0x00000002
+
 /* Debug Msg Communication types:
  * Section describes different modes (HFI_DEBUG_MODE_X)
  * available to communicate the debug messages

+ 17 - 13
drivers/cam_icp/hfi.c

@@ -490,7 +490,8 @@ int hfi_set_debug_level(u64 icp_dbg_type, uint32_t lvl)
 	return 0;
 }
 
-int hfi_set_fw_dump_level(uint32_t lvl)
+int hfi_set_fw_dump_levels(uint32_t hang_dump_lvl,
+	uint32_t ram_dump_lvl)
 {
 	uint8_t *prop = NULL;
 	struct hfi_cmd_prop *fw_dump_level_switch_prop = NULL;
@@ -498,7 +499,7 @@ int hfi_set_fw_dump_level(uint32_t lvl)
 
 	CAM_DBG(CAM_HFI, "fw dump ENTER");
 
-	size = sizeof(struct hfi_cmd_prop) + sizeof(lvl);
+	size = sizeof(struct hfi_cmd_prop) + sizeof(uint32_t);
 	prop = kzalloc(size, GFP_KERNEL);
 	if (!prop)
 		return -ENOMEM;
@@ -508,20 +509,23 @@ int hfi_set_fw_dump_level(uint32_t lvl)
 	fw_dump_level_switch_prop->pkt_type = HFI_CMD_SYS_SET_PROPERTY;
 	fw_dump_level_switch_prop->num_prop = 1;
 	fw_dump_level_switch_prop->prop_data[0] = HFI_PROP_SYS_FW_DUMP_CFG;
-	fw_dump_level_switch_prop->prop_data[1] = lvl;
+	fw_dump_level_switch_prop->prop_data[1] = hang_dump_lvl;
 
-	CAM_DBG(CAM_HFI, "prop->size = %d\n"
-			 "prop->pkt_type = %d\n"
-			 "prop->num_prop = %d\n"
-			 "prop->prop_data[0] = %d\n"
-			 "prop->prop_data[1] = %d\n",
-			 fw_dump_level_switch_prop->size,
-			 fw_dump_level_switch_prop->pkt_type,
-			 fw_dump_level_switch_prop->num_prop,
-			 fw_dump_level_switch_prop->prop_data[0],
-			 fw_dump_level_switch_prop->prop_data[1]);
+	/* Write hang dump level */
+	hfi_write_cmd(prop);
+
+	/* Update and write ramdump level */
+	fw_dump_level_switch_prop->prop_data[0] = HFI_PROPERTY_SYS_RAMDUMP_MODE;
+	fw_dump_level_switch_prop->prop_data[1] = ram_dump_lvl;
 
 	hfi_write_cmd(prop);
+	CAM_DBG(CAM_HFI,
+		"prop->size = %d prop->pkt_type = %d prop->num_prop = %d hang_dump_lvl = %u ram_dump_lvl = %u",
+		fw_dump_level_switch_prop->size,
+		fw_dump_level_switch_prop->pkt_type,
+		fw_dump_level_switch_prop->num_prop,
+		hang_dump_lvl, ram_dump_lvl);
+
 	kfree(prop);
 	return 0;
 }

+ 26 - 6
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c

@@ -1904,21 +1904,37 @@ static int cam_icp_get_icp_dbg_type(void *data, u64 *val)
 DEFINE_SIMPLE_ATTRIBUTE(cam_icp_debug_type_fs, cam_icp_get_icp_dbg_type,
 	cam_icp_set_icp_dbg_type, "%08llu");
 
-static int cam_icp_set_icp_fw_dump_lvl(void *data, u64 val)
+static int cam_icp_set_icp_fw_hang_dump_lvl(void *data, u64 val)
 {
 	if (val < NUM_HFI_DUMP_LVL)
 		icp_hw_mgr.icp_fw_dump_lvl = val;
 	return 0;
 }
 
-static int cam_icp_get_icp_fw_dump_lvl(void *data, u64 *val)
+static int cam_icp_get_icp_fw_hang_dump_lvl(void *data, u64 *val)
 {
 	*val = icp_hw_mgr.icp_fw_dump_lvl;
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(cam_icp_debug_fw_dump, cam_icp_get_icp_fw_dump_lvl,
-	cam_icp_set_icp_fw_dump_lvl, "%08llu");
+DEFINE_DEBUGFS_ATTRIBUTE(cam_icp_debug_fw_dump, cam_icp_get_icp_fw_hang_dump_lvl,
+	cam_icp_set_icp_fw_hang_dump_lvl, "%08llu");
+
+static int cam_icp_set_icp_fw_ramdump_lvl(void *data, u64 val)
+{
+	if (val < NUM_HFI_RAMDUMP_LVLS)
+		icp_hw_mgr.icp_fw_ramdump_lvl = (uint32_t)val;
+	return 0;
+}
+
+static int cam_icp_get_icp_fw_ramdump_lvl(void *data, u64 *val)
+{
+	*val = icp_hw_mgr.icp_fw_ramdump_lvl;
+	return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(cam_icp_debug_fw_ramdump, cam_icp_get_icp_fw_ramdump_lvl,
+	cam_icp_set_icp_fw_ramdump_lvl, "%08llu");
 
 #ifdef CONFIG_CAM_TEST_ICP_FW_DOWNLOAD
 static ssize_t cam_icp_hw_mgr_fw_load_unload(
@@ -2050,6 +2066,9 @@ static int cam_icp_hw_mgr_create_debugfs_entry(void)
 	debugfs_create_file("icp_fw_dump_lvl", 0644,
 		icp_hw_mgr.dentry, NULL, &cam_icp_debug_fw_dump);
 
+	debugfs_create_file("icp_fw_ramdump_lvl", 0644,
+		icp_hw_mgr.dentry, NULL, &cam_icp_debug_fw_ramdump);
+
 	debugfs_create_bool("disable_ubwc_comp", 0644,
 		icp_hw_mgr.dentry, &icp_hw_mgr.disable_ubwc_comp);
 
@@ -2061,7 +2080,7 @@ static int cam_icp_hw_mgr_create_debugfs_entry(void)
 		icp_hw_mgr.dentry, NULL, &cam_icp_irq_line_test);
 
 end:
-	/* Set default hang dump lvl */
+	/* Set default dump lvls */
 	icp_hw_mgr.icp_fw_dump_lvl = HFI_FW_DUMP_ON_FAILURE;
 	return rc;
 }
@@ -6419,7 +6438,8 @@ static int cam_icp_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 			hfi_set_debug_level(icp_hw_mgr.icp_debug_type,
 				icp_hw_mgr.icp_dbg_lvl);
 
-		hfi_set_fw_dump_level(icp_hw_mgr.icp_fw_dump_lvl);
+		hfi_set_fw_dump_levels(icp_hw_mgr.icp_fw_dump_lvl,
+			icp_hw_mgr.icp_fw_ramdump_lvl);
 
 		rc = cam_icp_send_ubwc_cfg(hw_mgr);
 		if (rc)

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

@@ -391,6 +391,7 @@ struct cam_icp_clk_info {
  * @icp_debug_type : entry to enable FW debug message/qdss
  * @icp_dbg_lvl : debug level set to FW.
  * @icp_fw_dump_lvl : level set for dumping the FW data
+ * @icp_fw_ramdump_lvl : level set for FW ram dumps
  * @ipe0_enable: Flag for IPE0
  * @ipe1_enable: Flag for IPE1
  * @bps_enable: Flag for BPS
@@ -445,6 +446,7 @@ struct cam_icp_hw_mgr {
 	u64 icp_debug_type;
 	u64 icp_dbg_lvl;
 	u64 icp_fw_dump_lvl;
+	u32 icp_fw_ramdump_lvl;
 	bool ipe0_enable;
 	bool ipe1_enable;
 	bool bps_enable;