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

msm: camera: isp: Add SOF Retiming Disable Support

For Spectra 780, SOF Retiming disable can be used for master slave
cases.
This needs to be disabled for below cases:
- RDIs which are part of SHDR data.
- In case of LCR , RDI0 needs to be disabled, also disable for PPP if
there is PD data on PPP.
This commit adds support to disable SOF Retiming.

Change-Id: I253490ba1dee2006d6d7c9d1e9085e6bdb45ba65
CRs-Fixed: 2948116
Signed-off-by: Gaurav Jindal <[email protected]>
Gaurav Jindal 3 жил өмнө
parent
commit
bca20811dd

+ 17 - 3
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid780.h

@@ -420,10 +420,12 @@ static struct cam_ife_csid_ver2_path_reg_info
 		/* configurations */
 		.resume_frame_boundary            = 1,
 		.binning_supported                = 0x7,
+		.capabilities                     = CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.start_mode_internal              = 0x0,
 		.start_mode_global                = 0x1,
 		.start_mode_master                = 0x2,
 		.start_mode_slave                 = 0x3,
+		.sof_retiming_dis_shift           = 5,
 		.start_mode_shift                 = 2,
 		.start_master_sel_val             = 0,
 		.start_master_sel_shift           = 4,
@@ -525,6 +527,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.epoch0_cfg_batch_id5_addr        = 0xBF4,
 		.epoch1_cfg_batch_id5_addr        = 0xBF8,
 		/* configurations */
+		.capabilities                     = CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.resume_frame_boundary            = 1,
 		.start_mode_shift                 = 2,
 		.start_mode_internal              = 0x0,
@@ -554,6 +557,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.top_irq_mask                     = 0x10,
 		.epoch0_shift_val                 = 16,
 		.epoch1_shift_val                 = 0,
+		.sof_retiming_dis_shift           = 5,
 };
 
 static struct cam_ife_csid_ver2_path_reg_info
@@ -629,7 +633,8 @@ static struct cam_ife_csid_ver2_path_reg_info
 							CAM_IFE_CSID_CAP_MIPI10_UNPACK |
 							CAM_IFE_CSID_CAP_MIPI12_UNPACK |
 							CAM_IFE_CSID_CAP_MIPI14_UNPACK |
-							CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI,
+							CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI |
+							CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.overflow_ctrl_mode_val           = 0x8,
 		.offline_mode_supported           = 1,
 		.mipi_pack_supported              = 1,
@@ -654,6 +659,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.epoch0_shift_val                 = 16,
 		.epoch1_shift_val                 = 0,
 		.pix_store_en_shift_val           = 10,
+		.sof_retiming_dis_shift           = 5,
 };
 
 static struct cam_ife_csid_ver2_path_reg_info
@@ -729,7 +735,8 @@ static struct cam_ife_csid_ver2_path_reg_info
 							CAM_IFE_CSID_CAP_MIPI10_UNPACK |
 							CAM_IFE_CSID_CAP_MIPI12_UNPACK |
 							CAM_IFE_CSID_CAP_MIPI14_UNPACK |
-							CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI,
+							CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI |
+							CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.overflow_ctrl_mode_val           = 0x8,
 		.mipi_pack_supported              = 1,
 		.offline_mode_supported           = 1,
@@ -754,6 +761,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.epoch0_shift_val                 = 16,
 		.epoch1_shift_val                 = 0,
 		.pix_store_en_shift_val           = 10,
+		.sof_retiming_dis_shift           = 5,
 };
 
 static struct cam_ife_csid_ver2_path_reg_info
@@ -829,7 +837,8 @@ static struct cam_ife_csid_ver2_path_reg_info
 							CAM_IFE_CSID_CAP_MIPI10_UNPACK |
 							CAM_IFE_CSID_CAP_MIPI12_UNPACK |
 							CAM_IFE_CSID_CAP_MIPI14_UNPACK |
-							CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI,
+							CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI |
+							CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.overflow_ctrl_mode_val           = 0x8,
 		.mipi_pack_supported              = 1,
 		.offline_mode_supported           = 1,
@@ -854,6 +863,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.epoch0_shift_val                 = 16,
 		.epoch1_shift_val                 = 0,
 		.pix_store_en_shift_val           = 10,
+		.sof_retiming_dis_shift           = 5,
 };
 
 static struct cam_ife_csid_ver2_path_reg_info
@@ -923,6 +933,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.epoch0_cfg_batch_id5_addr        = 0x8EC,
 		.epoch1_cfg_batch_id5_addr        = 0x8F0,
 		/* configurations */
+		.capabilities                     = CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.resume_frame_boundary            = 1,
 		.overflow_ctrl_en                 = 1,
 		.capabilities                     = 0,
@@ -949,6 +960,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.top_irq_mask                     = 0x800,
 		.epoch0_shift_val                 = 16,
 		.epoch1_shift_val                 = 0,
+		.sof_retiming_dis_shift           = 5,
 };
 
 static struct cam_ife_csid_ver2_path_reg_info
@@ -1018,6 +1030,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.epoch0_cfg_batch_id5_addr       = 0x9EC,
 		.epoch1_cfg_batch_id5_addr       = 0x9F0,
 		/* configurations */
+		.capabilities                    = CAM_IFE_CSID_CAP_SOF_RETIME_DIS,
 		.resume_frame_boundary           = 1,
 		.overflow_ctrl_en                = 1,
 		.capabilities                    = 0,
@@ -1044,6 +1057,7 @@ static struct cam_ife_csid_ver2_path_reg_info
 		.top_irq_mask                    = 0x1000,
 		.epoch0_shift_val                = 16,
 		.epoch1_shift_val                = 0,
+		.sof_retiming_dis_shift          = 5,
 };
 
 static struct cam_ife_csid_csi2_rx_reg_info

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_common.h

@@ -41,6 +41,7 @@
 #define CAM_IFE_CSID_CAP_MIPI16_UNPACK                    0x20
 #define CAM_IFE_CSID_CAP_MIPI20_UNPACK                    0x40
 #define CAM_IFE_CSID_CAP_LINE_SMOOTHING_IN_RDI            0x80
+#define CAM_IFE_CSID_CAP_SOF_RETIME_DIS                   0x100
 
 /*
  * Debug values enable the corresponding interrupts and debug logs provide

+ 32 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -55,6 +55,28 @@ static void cam_ife_csid_ver2_print_debug_reg_status(
 	struct cam_ife_csid_ver2_hw *csid_hw,
 	struct cam_isp_resource_node    *res);
 
+static bool cam_ife_csid_ver2_disable_sof_retime(
+	struct cam_ife_csid_ver2_hw     *csid_hw,
+	struct cam_isp_resource_node    *res)
+{
+	struct cam_ife_csid_ver2_reg_info  *csid_reg = (struct cam_ife_csid_ver2_reg_info *)
+							    csid_hw->core_info->csid_reg;
+	struct cam_ife_csid_ver2_path_cfg  *path_cfg = (struct cam_ife_csid_ver2_path_cfg *)
+							    res->res_priv;
+	const struct cam_ife_csid_ver2_path_reg_info *path_reg = csid_reg->path_reg[res->res_id];
+
+	if (!(path_reg->capabilities & CAM_IFE_CSID_CAP_SOF_RETIME_DIS))
+		return false;
+
+	if (path_cfg->sfe_shdr || path_cfg->lcr_en)
+		return true;
+
+	if (csid_hw->flags.rdi_lcr_en && res->res_id == CAM_IFE_PIX_PATH_RES_PPP)
+		return true;
+
+	return false;
+}
+
 static int cam_ife_csid_ver2_set_debug(
 	struct cam_ife_csid_ver2_hw *csid_hw,
 	uint32_t debug_val)
@@ -2778,8 +2800,14 @@ static int cam_ife_csid_ver2_init_config_rdi_path(
 			(cmn_reg->timestamp_strobe_val <<
 				cmn_reg->timestamp_stb_sel_shift_val);
 
+	if (cam_ife_csid_ver2_disable_sof_retime(csid_hw, res))
+		cfg0 |= 1 << path_reg->sof_retiming_dis_shift;
+
 	cam_io_w_mb(cfg0, mem_base + path_reg->cfg0_addr);
 
+	CAM_DBG(CAM_ISP, "CSID[%d] %s cfg0_addr 0x%x",
+		csid_hw->hw_intf->hw_idx, res->res_name, cfg0);
+
 	/*Configure Multi VC DT combo */
 	if (cid_data->vc_dt[CAM_IFE_CSID_MULTI_VC_DT_GRP_1].valid) {
 		val = (cid_data->vc_dt[CAM_IFE_CSID_MULTI_VC_DT_GRP_1].vc <<
@@ -2938,6 +2966,9 @@ static int cam_ife_csid_ver2_init_config_pxl_path(
 			(cmn_reg->timestamp_strobe_val <<
 				cmn_reg->timestamp_stb_sel_shift_val);
 
+	if (cam_ife_csid_ver2_disable_sof_retime(csid_hw, res))
+		cfg0 |= 1 << path_reg->sof_retiming_dis_shift;
+
 	CAM_DBG(CAM_ISP, "CSID[%d] res:%d cfg0_addr 0x%x",
 		csid_hw->hw_intf->hw_idx, res->res_id, cfg0);
 
@@ -5015,6 +5046,7 @@ static int cam_ife_csid_ver2_rdi_lcr_cfg(
 			csid_reg->top_reg->rdi_lcr_shift_val;
 
 	csid_hw->flags.rdi_lcr_en = true;
+	path_cfg->lcr_en = true;
 
 	CAM_DBG(CAM_ISP, "CSID[%u] %s top_cfg %u",
 		csid_hw->hw_intf->hw_idx, res->res_name, csid_hw->top_cfg.rdi_lcr);

+ 3 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.h

@@ -168,6 +168,7 @@ struct cam_ife_csid_ver2_camif_data {
  *                          for before processing discard config we can skip it for
  *                          the corresponding paths
  * @sfe_shdr:               flag to indicate if sfe is inline shdr
+ * @lcr_en:                 Flag to indicate if path is part can be input to LCR
  *
  */
 struct cam_ife_csid_ver2_path_cfg {
@@ -206,6 +207,7 @@ struct cam_ife_csid_ver2_path_cfg {
 	bool                                 discard_init_frames;
 	bool                                 skip_discard_frame_cfg;
 	bool                                 sfe_shdr;
+	bool                                 lcr_en;
 };
 
 struct cam_ife_csid_ver2_top_reg_info {
@@ -351,6 +353,7 @@ struct cam_ife_csid_ver2_path_reg_info {
 	uint32_t epoch1_cfg_val;
 	uint32_t epoch0_shift_val;
 	uint32_t epoch1_shift_val;
+	uint32_t sof_retiming_dis_shift;
 	uint32_t capabilities;
 };