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

msm: camera: isp: Add CSID binning

Add support to configure CSID binning

Change-Id: I09b76b287c243149c89cba958a786f7476c8addb
Signed-off-by: Vishalsingh Hajeri <[email protected]>
Vishalsingh Hajeri 6 жил өмнө
parent
commit
c952930533

+ 4 - 0
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -2147,6 +2147,8 @@ static int cam_ife_mgr_acquire_get_unified_structure_v0(
 	port_info->dsp_mode        =  in->dsp_mode;
 	port_info->dsp_mode        =  in->dsp_mode;
 	port_info->hbi_cnt         =  in->hbi_cnt;
 	port_info->hbi_cnt         =  in->hbi_cnt;
 	port_info->cust_node       =  0;
 	port_info->cust_node       =  0;
+	port_info->horizontal_bin  =  0;
+	port_info->qcfa_bin        =  0;
 	port_info->num_out_res     =  in->num_out_res;
 	port_info->num_out_res     =  in->num_out_res;
 
 
 	port_info->data = kcalloc(in->num_out_res,
 	port_info->data = kcalloc(in->num_out_res,
@@ -2246,6 +2248,8 @@ static int cam_ife_mgr_acquire_get_unified_structure_v2(
 	port_info->dsp_mode       =  in->dsp_mode;
 	port_info->dsp_mode       =  in->dsp_mode;
 	port_info->hbi_cnt        =  in->hbi_cnt;
 	port_info->hbi_cnt        =  in->hbi_cnt;
 	port_info->cust_node      =  in->cust_node;
 	port_info->cust_node      =  in->cust_node;
+	port_info->horizontal_bin =  in->horizontal_bin;
+	port_info->qcfa_bin       =  in->qcfa_bin;
 	port_info->num_out_res    =  in->num_out_res;
 	port_info->num_out_res    =  in->num_out_res;
 
 
 	port_info->data = kcalloc(in->num_out_res,
 	port_info->data = kcalloc(in->num_out_res,

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid480.h

@@ -50,6 +50,8 @@ static struct cam_ife_csid_pxl_reg_offset  cam_ife_csid_480_ipp_reg_offset = {
 	/* configurations */
 	/* configurations */
 	.pix_store_en_shift_val              = 7,
 	.pix_store_en_shift_val              = 7,
 	.early_eof_en_shift_val              = 29,
 	.early_eof_en_shift_val              = 29,
+	.horizontal_bin_en_shift_val         = 2,
+	.quad_cfa_bin_en_shift_val           = 30,
 	.ccif_violation_en                   = 1,
 	.ccif_violation_en                   = 1,
 	.overflow_ctrl_en                    = 1,
 	.overflow_ctrl_en                    = 1,
 };
 };

+ 8 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c

@@ -1016,6 +1016,8 @@ static int cam_ife_csid_path_reserve(struct cam_ife_csid_hw *csid_hw,
 	path_data->end_line = reserve->in_port->line_stop;
 	path_data->end_line = reserve->in_port->line_stop;
 	path_data->crop_enable = reserve->crop_enable;
 	path_data->crop_enable = reserve->crop_enable;
 	path_data->drop_enable = reserve->drop_enable;
 	path_data->drop_enable = reserve->drop_enable;
+	path_data->horizontal_bin = reserve->in_port->horizontal_bin;
+	path_data->qcfa_bin = reserve->in_port->qcfa_bin;
 
 
 	CAM_DBG(CAM_ISP,
 	CAM_DBG(CAM_ISP,
 		"Res id: %d height:%d line_start %d line_stop %d crop_en %d",
 		"Res id: %d height:%d line_start %d line_stop %d crop_en %d",
@@ -1603,6 +1605,12 @@ static int cam_ife_csid_init_config_pxl_path(
 			(path_data->drop_enable <<
 			(path_data->drop_enable <<
 			csid_reg->cmn_reg->drop_v_en_shift_val);
 			csid_reg->cmn_reg->drop_v_en_shift_val);
 
 
+	if (path_data->horizontal_bin || path_data->qcfa_bin) {
+		val |= (1 << pxl_reg->horizontal_bin_en_shift_val);
+		if (path_data->qcfa_bin)
+			val |= (1 << pxl_reg->quad_cfa_bin_en_shift_val);
+	}
+
 	val |= (1 << pxl_reg->pix_store_en_shift_val);
 	val |= (1 << pxl_reg->pix_store_en_shift_val);
 	cam_io_w_mb(val, soc_info->reg_map[0].mem_base +
 	cam_io_w_mb(val, soc_info->reg_map[0].mem_base +
 		pxl_reg->csid_pxl_cfg0_addr);
 		pxl_reg->csid_pxl_cfg0_addr);

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

@@ -133,6 +133,7 @@ struct cam_ife_csid_pxl_reg_offset {
 	/* configuration */
 	/* configuration */
 	uint32_t pix_store_en_shift_val;
 	uint32_t pix_store_en_shift_val;
 	uint32_t early_eof_en_shift_val;
 	uint32_t early_eof_en_shift_val;
+	uint32_t horizontal_bin_en_shift_val;
 	uint32_t quad_cfa_bin_en_shift_val;
 	uint32_t quad_cfa_bin_en_shift_val;
 	uint32_t ccif_violation_en;
 	uint32_t ccif_violation_en;
 	uint32_t overflow_ctrl_en;
 	uint32_t overflow_ctrl_en;
@@ -448,6 +449,8 @@ struct cam_ife_csid_path_cfg {
 	enum cam_isp_hw_sync_mode       sync_mode;
 	enum cam_isp_hw_sync_mode       sync_mode;
 	uint32_t                        master_idx;
 	uint32_t                        master_idx;
 	uint64_t                        clk_rate;
 	uint64_t                        clk_rate;
+	uint32_t                        horizontal_bin;
+	uint32_t                        qcfa_bin;
 };
 };
 
 
 /**
 /**

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h

@@ -95,6 +95,8 @@ struct cam_isp_in_port_generic_info {
 	uint32_t                        hbi_cnt;
 	uint32_t                        hbi_cnt;
 	uint32_t                        cust_node;
 	uint32_t                        cust_node;
 	uint32_t                        num_out_res;
 	uint32_t                        num_out_res;
+	uint32_t                        horizontal_bin;
+	uint32_t                        qcfa_bin;
 	struct cam_isp_out_port_generic_info    *data;
 	struct cam_isp_out_port_generic_info    *data;
 };
 };
 
 

+ 8 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c

@@ -49,6 +49,8 @@ struct cam_vfe_mux_camif_ver3_data {
 	bool                               enable_sof_irq_debug;
 	bool                               enable_sof_irq_debug;
 	uint32_t                           irq_debug_cnt;
 	uint32_t                           irq_debug_cnt;
 	uint32_t                           camif_debug;
 	uint32_t                           camif_debug;
+	uint32_t                           horizontal_bin;
+	uint32_t                           qcfa_bin;
 };
 };
 
 
 static int cam_vfe_camif_ver3_get_evt_payload(
 static int cam_vfe_camif_ver3_get_evt_payload(
@@ -250,6 +252,9 @@ int cam_vfe_camif_ver3_acquire_resource(
 	camif_data->last_pixel  = acquire_data->vfe_in.in_port->left_stop;
 	camif_data->last_pixel  = acquire_data->vfe_in.in_port->left_stop;
 	camif_data->first_line  = acquire_data->vfe_in.in_port->line_start;
 	camif_data->first_line  = acquire_data->vfe_in.in_port->line_start;
 	camif_data->last_line   = acquire_data->vfe_in.in_port->line_stop;
 	camif_data->last_line   = acquire_data->vfe_in.in_port->line_stop;
+	camif_data->horizontal_bin =
+		acquire_data->vfe_in.in_port->horizontal_bin;
+	camif_data->qcfa_bin    = acquire_data->vfe_in.in_port->qcfa_bin;
 	camif_data->event_cb    = acquire_data->event_cb;
 	camif_data->event_cb    = acquire_data->event_cb;
 	camif_data->priv        = acquire_data->priv;
 	camif_data->priv        = acquire_data->priv;
 
 
@@ -441,6 +446,9 @@ static int cam_vfe_camif_ver3_resource_start(
 	 * frame width. We use '/ 4' instead of '/ 2'
 	 * frame width. We use '/ 4' instead of '/ 2'
 	 * cause it is multipixel path
 	 * cause it is multipixel path
 	 */
 	 */
+		if (rsrc_data->horizontal_bin || rsrc_data->qcfa_bin)
+			epoch0_line_cfg >>= 1;
+
 		epoch1_line_cfg = rsrc_data->reg_data->epoch_line_cfg &
 		epoch1_line_cfg = rsrc_data->reg_data->epoch_line_cfg &
 			0xFFFF;
 			0xFFFF;
 		computed_epoch_line_cfg = (epoch1_line_cfg << 16) |
 		computed_epoch_line_cfg = (epoch1_line_cfg << 16) |