Bläddra i källkod

Merge "msm: camera: ife: Sync master and slave IFE" into camera-kernel.lnx.4.0

Camera Software Integration 5 år sedan
förälder
incheckning
4fe0b90fd0

+ 12 - 2
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/slab.h>
@@ -1550,6 +1550,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
 			else
 				vfe_acquire.vfe_in.sync_mode =
 				CAM_ISP_HW_SYNC_NONE;
+			vfe_acquire.vfe_in.is_dual = csid_res->is_dual_vfe;
 
 			break;
 		case CAM_IFE_PIX_PATH_RES_PPP:
@@ -1590,12 +1591,21 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
 			hw_intf = ife_hw_mgr->ife_devices[
 				csid_res->hw_res[i]->hw_intf->hw_idx];
 
+			if (i == CAM_ISP_HW_SPLIT_LEFT &&
+				ife_src_res->is_dual_vfe) {
+				vfe_acquire.vfe_in.dual_hw_idx =
+					ife_ctx->slave_hw_idx;
+			}
+
 			/* fill in more acquire information as needed */
 			/* slave Camif resource, */
 			if (i == CAM_ISP_HW_SPLIT_RIGHT &&
-				ife_src_res->is_dual_vfe)
+				ife_src_res->is_dual_vfe) {
 				vfe_acquire.vfe_in.sync_mode =
 				CAM_ISP_HW_SYNC_SLAVE;
+				vfe_acquire.vfe_in.dual_hw_idx =
+					ife_ctx->master_hw_idx;
+			}
 
 			rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv,
 					&vfe_acquire,

+ 5 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_vfe_hw_intf.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _CAM_VFE_HW_INTF_H_
@@ -137,6 +137,8 @@ struct cam_vfe_hw_vfe_out_acquire_args {
  *                           is successful
  * @res_id:                  Resource ID of resource to acquire if specific,
  *                           else CAM_ISP_HW_VFE_IN_MAX
+ * @dual_hw_idx:             Slave core for this master core if dual vfe case
+ * @is_dual:                 flag to indicate if dual vfe case
  * @cdm_ops:                 CDM operations
  * @sync_mode:               In case of Dual VFE, this is Master or Slave.
  *                           (Default is Master in case of Single VFE)
@@ -145,6 +147,8 @@ struct cam_vfe_hw_vfe_out_acquire_args {
 struct cam_vfe_hw_vfe_in_acquire_args {
 	struct cam_isp_resource_node         *rsrc_node;
 	uint32_t                              res_id;
+	uint32_t                              dual_hw_idx;
+	uint32_t                              is_dual;
 	void                                 *cdm_ops;
 	enum cam_isp_hw_sync_mode             sync_mode;
 	struct cam_isp_in_port_generic_info  *in_port;

+ 2 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe580.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  */
 
 
@@ -37,6 +37,7 @@ static struct cam_vfe_camif_ver3_reg_data vfe_580_camif_reg_data = {
 	.pp_camif_cfg_en_shift           = 0,
 	.pp_camif_cfg_ife_out_en_shift   = 8,
 	.top_debug_cfg_en                = 1,
+	.dual_vfe_sync_mask              = 0x3,
 };
 
 static struct cam_vfe_camif_lite_ver3_reg_data vfe580_camif_rdi1_reg_data = {

+ 23 - 5
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/slab.h>
@@ -52,6 +52,8 @@ struct cam_vfe_mux_camif_ver3_data {
 	uint32_t                           camif_debug;
 	uint32_t                           horizontal_bin;
 	uint32_t                           qcfa_bin;
+	uint32_t                           dual_hw_idx;
+	uint32_t                           is_dual;
 };
 
 static int cam_vfe_camif_ver3_get_evt_payload(
@@ -258,6 +260,10 @@ int cam_vfe_camif_ver3_acquire_resource(
 	camif_data->qcfa_bin    = acquire_data->vfe_in.in_port->qcfa_bin;
 	camif_data->event_cb    = acquire_data->event_cb;
 	camif_data->priv        = acquire_data->priv;
+	camif_data->is_dual     = acquire_data->vfe_in.is_dual;
+
+	if (acquire_data->vfe_in.is_dual)
+		camif_data->dual_hw_idx = acquire_data->vfe_in.dual_hw_idx;
 
 	CAM_DBG(CAM_ISP, "VFE:%d CAMIF pix_pattern:%d dsp_mode=%d",
 		camif_res->hw_intf->hw_idx,
@@ -387,10 +393,16 @@ static int cam_vfe_camif_ver3_resource_start(
 	if ((rsrc_data->dsp_mode >= CAM_ISP_DSP_MODE_ONE_WAY) &&
 		(rsrc_data->dsp_mode <= CAM_ISP_DSP_MODE_ROUND)) {
 		/* DSP mode reg val is CAM_ISP_DSP_MODE - 1 */
-		val |= (((rsrc_data->dsp_mode - 1) &
-			rsrc_data->reg_data->dsp_mode_mask) <<
-			rsrc_data->reg_data->dsp_mode_shift);
-		val |= (0x1 << rsrc_data->reg_data->dsp_en_shift);
+		if (camif_res->hw_intf->hw_idx != CAM_ISP_HW_VFE_CORE_2) {
+			val |= (((rsrc_data->dsp_mode - 1) &
+				rsrc_data->reg_data->dsp_mode_mask) <<
+				rsrc_data->reg_data->dsp_mode_shift);
+			val |= (0x1 << rsrc_data->reg_data->dsp_en_shift);
+		} else {
+			CAM_ERR(CAM_ISP, "Error, HVX not available for IFE_%d",
+				camif_res->hw_intf->hw_idx);
+			return -EINVAL;
+		}
 	}
 
 	if (rsrc_data->sync_mode == CAM_ISP_HW_SYNC_SLAVE)
@@ -419,6 +431,12 @@ static int cam_vfe_camif_ver3_resource_start(
 	val |= (rsrc_data->cam_common_cfg.input_mux_sel_pp & 0x3) <<
 		CAM_SHIFT_TOP_CORE_CFG_INPUTMUX_PP;
 
+	if (rsrc_data->is_dual && rsrc_data->reg_data->dual_vfe_sync_mask) {
+		val |= (((rsrc_data->dual_hw_idx &
+				rsrc_data->reg_data->dual_vfe_sync_mask) + 1) <<
+				rsrc_data->reg_data->dual_ife_sync_sel_shift);
+	}
+
 	cam_io_w_mb(val, rsrc_data->mem_base +
 		rsrc_data->common_reg->core_cfg_0);
 

+ 2 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _CAM_VFE_CAMIF_VER3_H_
@@ -58,6 +58,7 @@ struct cam_vfe_camif_ver3_reg_data {
 	uint32_t     pp_camif_cfg_en_shift;
 	uint32_t     pp_camif_cfg_ife_out_en_shift;
 	uint32_t     top_debug_cfg_en;
+	uint32_t     dual_vfe_sync_mask;
 };
 
 struct cam_vfe_camif_ver3_hw_info {