Explorar o código

msm: camera: isp: Add hw version checks and dt match string

The platform register requires dt match string for csid to probe
and correct cpas hw version is required for vfe to function. Add
dt match strings and hw version checks in csid and vfe.

CRs-Fixed: 2584631
Change-Id: Ieb2766fa6243bf4133b43f657a18aed7f04447be
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Signed-off-by: Vishalsingh Hajeri <[email protected]>
Mukund Madhusudan Atre %!s(int64=5) %!d(string=hai) anos
pai
achega
eef5866053

+ 3 - 2
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_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/uaccess.h>
@@ -5626,7 +5626,8 @@ int cam_icp_hw_mgr_init(struct device_node *of_node, uint64_t *hw_mgr_hdl,
 		&query.camera_version, &query.cpas_version, &cam_caps);
 	cam_cpas_get_cpas_hw_version(&camera_hw_version);
 
-	if (camera_hw_version == CAM_CPAS_TITAN_480_V100) {
+	if ((camera_hw_version == CAM_CPAS_TITAN_480_V100) ||
+		(camera_hw_version == CAM_CPAS_TITAN_580_V100)) {
 		if (cam_caps & CPAS_TITAN_480_IPE0_BIT)
 			icp_hw_mgr.ipe0_enable = true;
 		if (cam_caps & CPAS_BPS_BIT)

+ 5 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid17x.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.
  */
 
 
@@ -54,6 +54,10 @@ static const struct of_device_id cam_ife_csid17x_dt_match[] = {
 		.compatible = "qcom,csid480",
 		.data = &cam_ife_csid480_hw_info,
 	},
+	{
+		.compatible = "qcom,csid580",
+		.data = &cam_ife_csid480_hw_info,
+	},
 	{}
 };
 

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

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/iopoll.h>
@@ -339,7 +339,8 @@ static int cam_ife_match_vc_dt_pair(int32_t *vc, uint32_t *dt,
 		return -EINVAL;
 	}
 
-	if (camera_hw_version != CAM_CPAS_TITAN_480_V100)
+	if ((camera_hw_version != CAM_CPAS_TITAN_480_V100) &&
+		(camera_hw_version != CAM_CPAS_TITAN_580_V100))
 		num_valid_vc_dt = 1;
 
 	switch (num_valid_vc_dt) {
@@ -771,6 +772,7 @@ int cam_ife_csid_cid_reserve(struct cam_ife_csid_hw *csid_hw,
 		}
 		break;
 	case CAM_CPAS_TITAN_480_V100:
+	case CAM_CPAS_TITAN_580_V100:
 		if (cid_reserv->in_port->cust_node == 1) {
 			if (cid_reserv->in_port->usage_type == 1) {
 				CAM_ERR(CAM_ISP, "Dual IFE is not supported");
@@ -1716,7 +1718,8 @@ static int cam_ife_csid_init_config_pxl_path(
 	}
 	CAM_DBG(CAM_ISP, "HW version: %x", camera_hw_version);
 
-	if (camera_hw_version == CAM_CPAS_TITAN_480_V100)
+	if ((camera_hw_version == CAM_CPAS_TITAN_480_V100) ||
+		(camera_hw_version == CAM_CPAS_TITAN_580_V100))
 		val |= (path_data->drop_enable <<
 			csid_reg->cmn_reg->drop_h_en_shift_val) |
 			(path_data->drop_enable <<
@@ -1737,7 +1740,8 @@ static int cam_ife_csid_init_config_pxl_path(
 		pxl_reg->csid_pxl_cfg0_addr);
 
 	if (path_data->is_valid_vc1_dt1 &&
-		camera_hw_version == CAM_CPAS_TITAN_480_V100) {
+		((camera_hw_version == CAM_CPAS_TITAN_480_V100) ||
+		(camera_hw_version == CAM_CPAS_TITAN_580_V100))) {
 		val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
 			pxl_reg->csid_pxl_multi_vcdt_cfg0_addr);
 		val |= ((path_data->vc1 << 2) |
@@ -1773,7 +1777,8 @@ static int cam_ife_csid_init_config_pxl_path(
 		 * Skip for version 480 HW due to HW limitation.
 		 */
 		if (!(csid_hw->csid_debug & CSID_DEBUG_DISABLE_EARLY_EOF) &&
-			(camera_hw_version != CAM_CPAS_TITAN_480_V100)) {
+			(camera_hw_version != CAM_CPAS_TITAN_480_V100) &&
+			(camera_hw_version != CAM_CPAS_TITAN_580_V100)) {
 			val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
 				pxl_reg->csid_pxl_cfg0_addr);
 			val |= (1 << pxl_reg->early_eof_en_shift_val);
@@ -2167,7 +2172,8 @@ static int cam_ife_csid_init_config_rdi_path(
 	CAM_DBG(CAM_ISP, "HW version: %x", camera_hw_version);
 
 	if (camera_hw_version == CAM_CPAS_TITAN_480_V100 ||
-		camera_hw_version == CAM_CPAS_TITAN_175_V130) {
+		camera_hw_version == CAM_CPAS_TITAN_175_V130 ||
+		camera_hw_version == CAM_CPAS_TITAN_580_V100) {
 		val |= (path_data->drop_enable <<
 			csid_reg->cmn_reg->drop_h_en_shift_val) |
 			(path_data->drop_enable <<
@@ -2180,7 +2186,8 @@ static int cam_ife_csid_init_config_rdi_path(
 			csid_reg->rdi_reg[id]->csid_rdi_cfg0_addr);
 
 	if (path_data->is_valid_vc1_dt1 &&
-		camera_hw_version == CAM_CPAS_TITAN_480_V100) {
+		((camera_hw_version == CAM_CPAS_TITAN_480_V100) ||
+		(camera_hw_version == CAM_CPAS_TITAN_580_V100))) {
 		val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
 			csid_reg->rdi_reg[id]->csid_rdi_multi_vcdt_cfg0_addr);
 		val |= ((path_data->vc1 << 2) |
@@ -2236,7 +2243,8 @@ static int cam_ife_csid_init_config_rdi_path(
 		csid_reg->rdi_reg[id]->csid_rdi_rpp_pix_drop_pattern_addr);
 
 	/* Write max value to pixel drop period due to a bug in ver 480 HW */
-	if (camera_hw_version == CAM_CPAS_TITAN_480_V100 &&
+	if (((camera_hw_version == CAM_CPAS_TITAN_480_V100) ||
+		(camera_hw_version == CAM_CPAS_TITAN_580_V100)) &&
 		path_data->drop_enable)
 		cam_io_w_mb(0x1F, soc_info->reg_map[0].mem_base +
 		csid_reg->rdi_reg[id]->csid_rdi_rpp_pix_drop_period_addr);

+ 5 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_lite17x.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/module.h>
@@ -32,6 +32,10 @@ static const struct of_device_id cam_ife_csid_lite_dt_match[] = {
 		.compatible = "qcom,csid-lite480",
 		.data = &cam_ife_csid_lite_480_hw_info,
 	},
+	{
+		.compatible = "qcom,csid-lite580",
+		.data = &cam_ife_csid_lite_480_hw_info,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, cam_ife_csid_lite_dt_match);

+ 3 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.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/delay.h>
@@ -90,6 +90,7 @@ int cam_vfe_reset_irq_top_half(uint32_t    evt_id,
 
 	switch (soc_info->hw_version) {
 	case CAM_CPAS_TITAN_480_V100:
+	case CAM_CPAS_TITAN_580_V100:
 		if (!soc_private->is_ife_lite) {
 			if (th_payload->evt_status_arr[0] & 0x1) {
 				cam_io_w(0xFFFFFFFF, mem_base +
@@ -330,6 +331,7 @@ int cam_vfe_reset(void *hw_priv, void *reset_core_args, uint32_t arg_size)
 
 	switch (soc_info->hw_version) {
 	case CAM_CPAS_TITAN_480_V100:
+	case CAM_CPAS_TITAN_580_V100:
 		if (!soc_private->is_ife_lite)
 			top_reset_irq_reg_mask[CAM_IFE_IRQ_CAMIF_REG_STATUS0]
 				= CAM_VFE_48X_TOP_RESET_MASK;

+ 2 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.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>
@@ -60,6 +60,7 @@ static int cam_vfe_get_dt_properties(struct cam_hw_soc_info *soc_info)
 
 	switch (soc_info->hw_version) {
 	case CAM_CPAS_TITAN_480_V100:
+	case CAM_CPAS_TITAN_580_V100:
 		num_ubwc_cfg = of_property_count_u32_elems(of_node,
 			"ubwc-static-cfg");
 

+ 2 - 1
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>
@@ -425,6 +425,7 @@ static int cam_vfe_camif_ver3_resource_start(
 	/* epoch config */
 	switch (soc_private->cpas_version) {
 	case CAM_CPAS_TITAN_480_V100:
+	case CAM_CPAS_TITAN_580_V100:
 		epoch0_line_cfg = (rsrc_data->last_line -
 			rsrc_data->first_line) / 4;
 	/* epoch line cfg will still be configured at midpoint of the