Browse Source

msm: camera: cpas: Add cpas support for camera v170_200 platform

Add register information. Initial QoS settings info to program
camera static settings for chipsets having camera v170_200.
Also change the logic to get the camera and cpas versions.
Added the map table corresponding to camera and cpas versions.
For any new CPAS version support, just need to add the entries to
the map. This removes the complexity of if-else cases while
fetching the cpas hw information.

CRs-Fixed: 2571273
Change-Id: I7d54b8bc038aa90ecb39f5048e7809ac10c4476f
Signed-off-by: Gaurav Jindal <[email protected]>
Signed-off-by: Chandan Kumar Jha <[email protected]>
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Chandan Kumar Jha 5 năm trước cách đây
mục cha
commit
e03b67bb2f

+ 141 - 62
drivers/cam_cpas/cpas_top/cam_cpastop_hw.c

@@ -15,6 +15,7 @@
 #include "cam_cpas_soc.h"
 #include "cam_cpas_soc.h"
 #include "cpastop100.h"
 #include "cpastop100.h"
 #include "cpastop_v150_100.h"
 #include "cpastop_v150_100.h"
+#include "cpastop_v170_200.h"
 #include "cpastop_v170_110.h"
 #include "cpastop_v170_110.h"
 #include "cpastop_v175_100.h"
 #include "cpastop_v175_100.h"
 #include "cpastop_v175_101.h"
 #include "cpastop_v175_101.h"
@@ -38,6 +39,123 @@ static const char * const camnoc_salve_err_code[] = {
 	"Unknown Error",             /* unknown err code */
 	"Unknown Error",             /* unknown err code */
 };
 };
 
 
+static const uint32_t cam_cpas_hw_version_map
+	[CAM_CPAS_CAMERA_VERSION_ID_MAX][CAM_CPAS_VERSION_ID_MAX] = {
+	/* for camera_150 */
+	{
+		CAM_CPAS_TITAN_150_V100,
+		0,
+		0,
+		0,
+		0,
+		0,
+	},
+	/* for camera_170 */
+	{
+		CAM_CPAS_TITAN_170_V100,
+		0,
+		CAM_CPAS_TITAN_170_V110,
+		CAM_CPAS_TITAN_170_V120,
+		0,
+		CAM_CPAS_TITAN_170_V200,
+	},
+	/* for camera_175 */
+	{
+		CAM_CPAS_TITAN_175_V100,
+		CAM_CPAS_TITAN_175_V101,
+		0,
+		CAM_CPAS_TITAN_175_V120,
+		CAM_CPAS_TITAN_175_V130,
+		0,
+	},
+	/* for camera_480 */
+	{
+		CAM_CPAS_TITAN_480_V100,
+		0,
+		0,
+		0,
+		0,
+		0,
+	},
+	/* for camera_580 */
+	{
+		CAM_CPAS_TITAN_580_V100,
+		0,
+		0,
+		0,
+		0,
+		0,
+	},
+};
+
+static int cam_cpas_translate_camera_cpas_version_id(
+	uint32_t cam_version,
+	uint32_t cpas_version,
+	uint32_t *cam_version_id,
+	uint32_t *cpas_version_id)
+{
+
+	switch (cam_version) {
+
+	case CAM_CPAS_CAMERA_VERSION_150:
+		*cam_version_id = CAM_CPAS_CAMERA_VERSION_ID_150;
+		break;
+
+	case CAM_CPAS_CAMERA_VERSION_170:
+		*cam_version_id = CAM_CPAS_CAMERA_VERSION_ID_170;
+		break;
+
+	case CAM_CPAS_CAMERA_VERSION_175:
+		*cam_version_id = CAM_CPAS_CAMERA_VERSION_ID_175;
+		break;
+
+	case CAM_CPAS_CAMERA_VERSION_480:
+		*cam_version_id = CAM_CPAS_CAMERA_VERSION_ID_480;
+		break;
+
+	case CAM_CPAS_CAMERA_VERSION_580:
+		*cam_version_id = CAM_CPAS_CAMERA_VERSION_ID_580;
+		break;
+
+	default:
+		CAM_ERR(CAM_CPAS, "Invalid cam version %u",
+			cam_version);
+		return -EINVAL;
+	}
+
+	switch (cpas_version) {
+
+	case CAM_CPAS_VERSION_100:
+		*cpas_version_id = CAM_CPAS_VERSION_ID_100;
+		break;
+
+	case CAM_CPAS_VERSION_101:
+		*cpas_version_id = CAM_CPAS_VERSION_ID_101;
+		break;
+	case CAM_CPAS_VERSION_110:
+		*cpas_version_id = CAM_CPAS_VERSION_ID_110;
+		break;
+
+	case CAM_CPAS_VERSION_120:
+		*cpas_version_id = CAM_CPAS_VERSION_ID_120;
+		break;
+
+	case CAM_CPAS_VERSION_130:
+		*cpas_version_id = CAM_CPAS_VERSION_ID_130;
+		break;
+
+	case CAM_CPAS_VERSION_200:
+		*cpas_version_id = CAM_CPAS_VERSION_ID_200;
+		break;
+
+	default:
+		CAM_ERR(CAM_CPAS, "Invalid cpas version %u",
+			cpas_version);
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static int cam_cpastop_get_hw_info(struct cam_hw_info *cpas_hw,
 static int cam_cpastop_get_hw_info(struct cam_hw_info *cpas_hw,
 	struct cam_cpas_hw_caps *hw_caps)
 	struct cam_cpas_hw_caps *hw_caps)
 {
 {
@@ -45,27 +163,30 @@ static int cam_cpastop_get_hw_info(struct cam_hw_info *cpas_hw,
 	struct cam_hw_soc_info *soc_info = &cpas_hw->soc_info;
 	struct cam_hw_soc_info *soc_info = &cpas_hw->soc_info;
 	int32_t reg_indx = cpas_core->regbase_index[CAM_CPAS_REG_CPASTOP];
 	int32_t reg_indx = cpas_core->regbase_index[CAM_CPAS_REG_CPASTOP];
 	uint32_t reg_value;
 	uint32_t reg_value;
+	uint32_t cam_version, cpas_version;
+	uint32_t cam_version_id, cpas_version_id;
+	int rc;
 
 
 	if (reg_indx == -1)
 	if (reg_indx == -1)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	hw_caps->camera_family = CAM_FAMILY_CPAS_SS;
 	hw_caps->camera_family = CAM_FAMILY_CPAS_SS;
 
 
-	reg_value = cam_io_r_mb(soc_info->reg_map[reg_indx].mem_base + 0x0);
+	cam_version = cam_io_r_mb(soc_info->reg_map[reg_indx].mem_base + 0x0);
 	hw_caps->camera_version.major =
 	hw_caps->camera_version.major =
-		CAM_BITS_MASK_SHIFT(reg_value, 0xff0000, 0x10);
+		CAM_BITS_MASK_SHIFT(cam_version, 0xff0000, 0x10);
 	hw_caps->camera_version.minor =
 	hw_caps->camera_version.minor =
-		CAM_BITS_MASK_SHIFT(reg_value, 0xff00, 0x8);
+		CAM_BITS_MASK_SHIFT(cam_version, 0xff00, 0x8);
 	hw_caps->camera_version.incr =
 	hw_caps->camera_version.incr =
-		CAM_BITS_MASK_SHIFT(reg_value, 0xff, 0x0);
+		CAM_BITS_MASK_SHIFT(cam_version, 0xff, 0x0);
 
 
-	reg_value = cam_io_r_mb(soc_info->reg_map[reg_indx].mem_base + 0x4);
+	cpas_version = cam_io_r_mb(soc_info->reg_map[reg_indx].mem_base + 0x4);
 	hw_caps->cpas_version.major =
 	hw_caps->cpas_version.major =
-		CAM_BITS_MASK_SHIFT(reg_value, 0xf0000000, 0x1c);
+		CAM_BITS_MASK_SHIFT(cpas_version, 0xf0000000, 0x1c);
 	hw_caps->cpas_version.minor =
 	hw_caps->cpas_version.minor =
-		CAM_BITS_MASK_SHIFT(reg_value, 0xfff0000, 0x10);
+		CAM_BITS_MASK_SHIFT(cpas_version, 0xfff0000, 0x10);
 	hw_caps->cpas_version.incr =
 	hw_caps->cpas_version.incr =
-		CAM_BITS_MASK_SHIFT(reg_value, 0xffff, 0x0);
+		CAM_BITS_MASK_SHIFT(cpas_version, 0xffff, 0x0);
 
 
 	reg_value = cam_io_r_mb(soc_info->reg_map[reg_indx].mem_base + 0x8);
 	reg_value = cam_io_r_mb(soc_info->reg_map[reg_indx].mem_base + 0x8);
 	hw_caps->camera_capability = reg_value;
 	hw_caps->camera_capability = reg_value;
@@ -77,62 +198,16 @@ static int cam_cpastop_get_hw_info(struct cam_hw_info *cpas_hw,
 		hw_caps->cpas_version.incr, hw_caps->camera_capability);
 		hw_caps->cpas_version.incr, hw_caps->camera_capability);
 
 
 	soc_info->hw_version = CAM_CPAS_TITAN_NONE;
 	soc_info->hw_version = CAM_CPAS_TITAN_NONE;
-
-	if ((hw_caps->camera_version.major == 1) &&
-		(hw_caps->camera_version.minor == 7) &&
-		(hw_caps->camera_version.incr == 0)) {
-		if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 0) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_170_V100;
-		else if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 1) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_170_V110;
-		else if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 2) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_170_V120;
-	} else if ((hw_caps->camera_version.major == 1) &&
-		(hw_caps->camera_version.minor == 7) &&
-		(hw_caps->camera_version.incr == 5)) {
-		if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 0) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_175_V100;
-		else if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 0) &&
-			(hw_caps->cpas_version.incr == 1))
-			soc_info->hw_version = CAM_CPAS_TITAN_175_V101;
-		else if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 2) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_175_V120;
-		else if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 3) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_175_V130;
-	} else if ((hw_caps->camera_version.major == 1) &&
-		(hw_caps->camera_version.minor == 5) &&
-		(hw_caps->camera_version.incr == 0)) {
-		if ((hw_caps->cpas_version.major == 1) &&
-			(hw_caps->cpas_version.minor == 0) &&
-			(hw_caps->cpas_version.incr == 0))
-			soc_info->hw_version = CAM_CPAS_TITAN_150_V100;
-	} else if ((hw_caps->camera_version.major == 4) &&
-		(hw_caps->camera_version.minor == 8) &&
-		(hw_caps->camera_version.incr == 0)) {
-		soc_info->hw_version = CAM_CPAS_TITAN_480_V100;
-	} else if ((hw_caps->camera_version.major == 5) &&
-		(hw_caps->camera_version.minor == 8) &&
-		(hw_caps->camera_version.incr == 0)) {
-		soc_info->hw_version = CAM_CPAS_TITAN_580_V100;
-	} else if ((hw_caps->camera_version.major == 5) &&
-		(hw_caps->camera_version.minor == 4) &&
-		(hw_caps->camera_version.incr == 0)) {
-		soc_info->hw_version = CAM_CPAS_TITAN_540_V100;
+	rc  = cam_cpas_translate_camera_cpas_version_id(cam_version,
+		cpas_version, &cam_version_id, &cpas_version_id);
+	if (rc) {
+		CAM_ERR(CAM_CPAS, "Invalid Version, Camera: 0x%x CPAS: 0x%x",
+			cam_version, cpas_version);
+		return -EINVAL;
 	}
 	}
 
 
+	soc_info->hw_version =
+		cam_cpas_hw_version_map[cam_version_id][cpas_version_id];
 	CAM_DBG(CAM_CPAS, "CPAS HW VERSION %x", soc_info->hw_version);
 	CAM_DBG(CAM_CPAS, "CPAS HW VERSION %x", soc_info->hw_version);
 
 
 	return 0;
 	return 0;
@@ -614,6 +689,9 @@ static int cam_cpastop_init_hw_version(struct cam_hw_info *cpas_hw,
 	case CAM_CPAS_TITAN_170_V110:
 	case CAM_CPAS_TITAN_170_V110:
 		camnoc_info = &cam170_cpas110_camnoc_info;
 		camnoc_info = &cam170_cpas110_camnoc_info;
 		break;
 		break;
+	case CAM_CPAS_TITAN_170_V200:
+		camnoc_info = &cam170_cpas200_camnoc_info;
+		break;
 	case CAM_CPAS_TITAN_175_V100:
 	case CAM_CPAS_TITAN_175_V100:
 		camnoc_info = &cam175_cpas100_camnoc_info;
 		camnoc_info = &cam175_cpas100_camnoc_info;
 		break;
 		break;
@@ -634,6 +712,7 @@ static int cam_cpastop_init_hw_version(struct cam_hw_info *cpas_hw,
 		break;
 		break;
 	case CAM_CPAS_TITAN_580_V100:
 	case CAM_CPAS_TITAN_580_V100:
 		camnoc_info = &cam580_cpas100_camnoc_info;
 		camnoc_info = &cam580_cpas100_camnoc_info;
+		break;
 	case CAM_CPAS_TITAN_540_V100:
 	case CAM_CPAS_TITAN_540_V100:
 		camnoc_info = &cam540_cpas100_camnoc_info;
 		camnoc_info = &cam540_cpas100_camnoc_info;
 		break;
 		break;

+ 538 - 0
drivers/cam_cpas/cpas_top/cpastop_v170_200.h

@@ -0,0 +1,538 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _CPASTOP_V170_200_H_
+#define _CPASTOP_V170_200_H_
+
+#define TEST_IRQ_ENABLE 0
+#define TCSR_CONN_RESET 0x0
+#define TCSR_CONN_SET  0x3
+
+static struct cam_camnoc_irq_sbm cam_cpas_v170_200_irq_sbm = {
+	.sbm_enable = {
+		.access_type = CAM_REG_TYPE_READ_WRITE,
+		.enable = true,
+		.offset = 0x2040, /* SBM_FAULTINEN0_LOW */
+		.value = 0x1 | /* SBM_FAULTINEN0_LOW_PORT0_MASK*/
+			0x2 | /* SBM_FAULTINEN0_LOW_PORT1_MASK */
+			0x4 | /* SBM_FAULTINEN0_LOW_PORT2_MASK */
+			0x8 | /* SBM_FAULTINEN0_LOW_PORT3_MASK */
+			0x10 | /* SBM_FAULTINEN0_LOW_PORT4_MASK */
+			0x20 | /* SBM_FAULTINEN0_LOW_PORT5_MASK */
+			(TEST_IRQ_ENABLE ?
+			0x100 : /* SBM_FAULTINEN0_LOW_PORT8_MASK */
+			0x0),
+	},
+	.sbm_status = {
+		.access_type = CAM_REG_TYPE_READ,
+		.enable = true,
+		.offset = 0x2048, /* SBM_FAULTINSTATUS0_LOW */
+	},
+	.sbm_clear = {
+		.access_type = CAM_REG_TYPE_WRITE,
+		.enable = true,
+		.offset = 0x2080, /* SBM_FLAGOUTCLR0_LOW */
+		.value = TEST_IRQ_ENABLE ? 0x6 : 0x2,
+	}
+};
+
+static struct cam_camnoc_irq_err
+	cam_cpas_v170_200_irq_err[] = {
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_SLAVE_ERROR,
+		.enable = true,
+		.sbm_port = 0x1, /* SBM_FAULTINSTATUS0_LOW_PORT0_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0x2708, /* ERRLOGGER_MAINCTL_LOW */
+			.value = 1,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0x2710, /* ERRLOGGER_ERRVLD_LOW */
+		},
+		.err_clear = {
+			.access_type = CAM_REG_TYPE_WRITE,
+			.enable = true,
+			.offset = 0x2718, /* ERRLOGGER_ERRCLR_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_IFE02_UBWC_ENCODE_ERROR,
+		.enable = true,
+		.sbm_port = 0x2, /* SBM_FAULTINSTATUS0_LOW_PORT1_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0x5a0, /* SPECIFIC_IFE02_ENCERREN_LOW */
+			.value = 1,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0x590, /* SPECIFIC_IFE02_ENCERRSTATUS_LOW */
+		},
+		.err_clear = {
+			.access_type = CAM_REG_TYPE_WRITE,
+			.enable = true,
+			.offset = 0x598, /* SPECIFIC_IFE02_ENCERRCLR_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_IFE13_UBWC_ENCODE_ERROR,
+		.enable = true,
+		.sbm_port = 0x4, /* SBM_FAULTINSTATUS0_LOW_PORT2_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0x9a0, /* SPECIFIC_IFE13_ENCERREN_LOW */
+			.value = 1,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0x990, /* SPECIFIC_IFE13_ENCERRSTATUS_LOW */
+		},
+		.err_clear = {
+			.access_type = CAM_REG_TYPE_WRITE,
+			.enable = true,
+			.offset = 0x998, /* SPECIFIC_IFE13_ENCERRCLR_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_IPE_BPS_UBWC_DECODE_ERROR,
+		.enable = true,
+		.sbm_port = 0x8, /* SBM_FAULTINSTATUS0_LOW_PORT3_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0xd20, /* SPECIFIC_IBL_RD_DECERREN_LOW */
+			.value = 1,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0xd10, /* SPECIFIC_IBL_RD_DECERRSTATUS_LOW */
+		},
+		.err_clear = {
+			.access_type = CAM_REG_TYPE_WRITE,
+			.enable = true,
+			.offset = 0xd18, /* SPECIFIC_IBL_RD_DECERRCLR_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_IPE_BPS_UBWC_ENCODE_ERROR,
+		.enable = true,
+		.sbm_port = 0x10, /* SBM_FAULTINSTATUS0_LOW_PORT4_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0x11a0, /* SPECIFIC_IBL_WR_ENCERREN_LOW */
+			.value = 1,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0x1190,
+			/* SPECIFIC_IBL_WR_ENCERRSTATUS_LOW */
+		},
+		.err_clear = {
+			.access_type = CAM_REG_TYPE_WRITE,
+			.enable = true,
+			.offset = 0x1198, /* SPECIFIC_IBL_WR_ENCERRCLR_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_AHB_TIMEOUT,
+		.enable = true,
+		.sbm_port = 0x20, /* SBM_FAULTINSTATUS0_LOW_PORT5_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0x2088, /* SBM_FLAGOUTSET0_LOW */
+			.value = 0x1,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0x2090, /* SBM_FLAGOUTSTATUS0_LOW */
+		},
+		.err_clear = {
+			.enable = false,
+		},
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_RESERVED1,
+		.enable = false,
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_RESERVED2,
+		.enable = false,
+	},
+	{
+		.irq_type = CAM_CAMNOC_HW_IRQ_CAMNOC_TEST,
+		.enable = TEST_IRQ_ENABLE ? true : false,
+		.sbm_port = 0x100, /* SBM_FAULTINSTATUS0_LOW_PORT8_MASK */
+		.err_enable = {
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.enable = true,
+			.offset = 0x2088, /* SBM_FLAGOUTSET0_LOW */
+			.value = 0x5,
+		},
+		.err_status = {
+			.access_type = CAM_REG_TYPE_READ,
+			.enable = true,
+			.offset = 0x2090, /* SBM_FLAGOUTSTATUS0_LOW */
+		},
+		.err_clear = {
+			.enable = false,
+		},
+	},
+};
+
+static struct cam_camnoc_specific
+	cam_cpas_v170_200_camnoc_specific[] = {
+	{
+		.port_type = CAM_CAMNOC_CDM,
+		.enable = true,
+		.priority_lut_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x30, /* SPECIFIC_CDM_PRIORITYLUT_LOW */
+			.value = 0x22222222,
+		},
+		.priority_lut_high = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x34, /* SPECIFIC_CDM_PRIORITYLUT_HIGH */
+			.value = 0x22222222,
+		},
+		.urgency = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 1,
+			.offset = 0x38, /* SPECIFIC_CDM_URGENCY_LOW */
+			.mask = 0x7, /* SPECIFIC_CDM_URGENCY_LOW_READ_MASK */
+			.shift = 0x0, /* SPECIFIC_CDM_URGENCY_LOW_READ_SHIFT */
+			.value = 0x2,
+		},
+		.danger_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x40, /* SPECIFIC_CDM_DANGERLUT_LOW */
+			.value = 0x0,
+		},
+		.safe_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x48, /* SPECIFIC_CDM_SAFELUT_LOW */
+			.value = 0x0,
+		},
+		.ubwc_ctl = {
+			.enable = false,
+		},
+	},
+	{
+		.port_type = CAM_CAMNOC_IFE02,
+		.enable = true,
+		.priority_lut_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x430, /* SPECIFIC_IFE02_PRIORITYLUT_LOW */
+			.value = 0x66666543,
+		},
+		.priority_lut_high = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x434, /* SPECIFIC_IFE02_PRIORITYLUT_HIGH */
+			.value = 0x66666666,
+		},
+		.urgency = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 1,
+			.offset = 0x438, /* SPECIFIC_IFE02_URGENCY_LOW */
+			/* SPECIFIC_IFE02_URGENCY_LOW_WRITE_MASK */
+			.mask = 0x70,
+			/* SPECIFIC_IFE02_URGENCY_LOW_WRITE_SHIFT */
+			.shift = 0x4,
+			.value = 3,
+		},
+		.danger_lut = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.offset = 0x440, /* SPECIFIC_IFE02_DANGERLUT_LOW */
+			.value = 0xFFFFFF00,
+		},
+		.safe_lut = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.offset = 0x448, /* SPECIFIC_IFE02_SAFELUT_LOW */
+			.value = 0x1,
+		},
+		.ubwc_ctl = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x588, /* SPECIFIC_IFE02_ENCCTL_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.port_type = CAM_CAMNOC_IFE13,
+		.enable = true,
+		.priority_lut_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x830, /* SPECIFIC_IFE13_PRIORITYLUT_LOW */
+			.value = 0x66666543,
+		},
+		.priority_lut_high = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x834, /* SPECIFIC_IFE13_PRIORITYLUT_HIGH */
+			.value = 0x66666666,
+		},
+		.urgency = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 1,
+			.offset = 0x838, /* SPECIFIC_IFE13_URGENCY_LOW */
+			/* SPECIFIC_IFE13_URGENCY_LOW_WRITE_MASK */
+			.mask = 0x70,
+			/* SPECIFIC_IFE13_URGENCY_LOW_WRITE_SHIFT */
+			.shift = 0x4,
+			.value = 3,
+		},
+		.danger_lut = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.offset = 0x840, /* SPECIFIC_IFE13_DANGERLUT_LOW */
+			.value = 0xFFFFFF00,
+		},
+		.safe_lut = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.offset = 0x848, /* SPECIFIC_IFE13_SAFELUT_LOW */
+			.value = 0x1,
+		},
+		.ubwc_ctl = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x988, /* SPECIFIC_IFE13_ENCCTL_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.port_type = CAM_CAMNOC_IPE_BPS_LRME_READ,
+		.enable = true,
+		.priority_lut_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0xc30, /* SPECIFIC_IBL_RD_PRIORITYLUT_LOW */
+			.value = 0x33333333,
+		},
+		.priority_lut_high = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0xc34, /* SPECIFIC_IBL_RD_PRIORITYLUT_HIGH */
+			.value = 0x33333333,
+		},
+		.urgency = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 1,
+			.offset = 0xc38, /* SPECIFIC_IBL_RD_URGENCY_LOW */
+			/* SPECIFIC_IBL_RD_URGENCY_LOW_READ_MASK */
+			.mask = 0x7,
+			/* SPECIFIC_IBL_RD_URGENCY_LOW_READ_SHIFT */
+			.shift = 0x0,
+			.value = 3,
+		},
+		.danger_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0xc40, /* SPECIFIC_IBL_RD_DANGERLUT_LOW */
+			.value = 0x0,
+		},
+		.safe_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0xc48, /* SPECIFIC_IBL_RD_SAFELUT_LOW */
+			.value = 0x0,
+		},
+		.ubwc_ctl = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0xd08, /* SPECIFIC_IBL_RD_DECCTL_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.port_type = CAM_CAMNOC_IPE_BPS_LRME_WRITE,
+		.enable = true,
+		.priority_lut_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1030, /* SPECIFIC_IBL_WR_PRIORITYLUT_LOW */
+			.value = 0x33333333,
+		},
+		.priority_lut_high = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1034, /* SPECIFIC_IBL_WR_PRIORITYLUT_HIGH */
+			.value = 0x33333333,
+		},
+		.urgency = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 1,
+			.offset = 0x1038, /* SPECIFIC_IBL_WR_URGENCY_LOW */
+			/* SPECIFIC_IBL_WR_URGENCY_LOW_WRITE_MASK */
+			.mask = 0x70,
+			/* SPECIFIC_IBL_WR_URGENCY_LOW_WRITE_SHIFT */
+			.shift = 0x4,
+			.value = 3,
+		},
+		.danger_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1040, /* SPECIFIC_IBL_WR_DANGERLUT_LOW */
+			.value = 0x0,
+		},
+		.safe_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1048, /* SPECIFIC_IBL_WR_SAFELUT_LOW */
+			.value = 0x0,
+		},
+		.ubwc_ctl = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1188, /* SPECIFIC_IBL_WR_ENCCTL_LOW */
+			.value = 1,
+		},
+	},
+	{
+		.port_type = CAM_CAMNOC_JPEG,
+		.enable = true,
+		.priority_lut_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1430, /* SPECIFIC_JPEG_PRIORITYLUT_LOW */
+			.value = 0x22222222,
+		},
+		.priority_lut_high = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1434, /* SPECIFIC_JPEG_PRIORITYLUT_HIGH */
+			.value = 0x22222222,
+		},
+		.urgency = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1438, /* SPECIFIC_JPEG_URGENCY_LOW */
+			.value = 0x22,
+		},
+		.danger_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1440, /* SPECIFIC_JPEG_DANGERLUT_LOW */
+			.value = 0x0,
+		},
+		.safe_lut = {
+			.enable = false,
+			.access_type = CAM_REG_TYPE_READ_WRITE,
+			.masked_value = 0,
+			.offset = 0x1448, /* SPECIFIC_JPEG_SAFELUT_LOW */
+			.value = 0x0,
+		},
+		.ubwc_ctl = {
+			.enable = false,
+		},
+	},
+	{
+		.port_type = CAM_CAMNOC_FD,
+		.enable = false,
+	},
+	{
+		.port_type = CAM_CAMNOC_ICP,
+		.enable = true,
+		.flag_out_set0_low = {
+			.enable = true,
+			.access_type = CAM_REG_TYPE_WRITE,
+			.masked_value = 0,
+			.offset = 0x2088,
+			.value = 0x100000,
+		},
+	},
+};
+
+static struct cam_camnoc_err_logger_info cam170_cpas200_err_logger_offsets = {
+	.mainctrl     =  0x2708, /* ERRLOGGER_MAINCTL_LOW */
+	.errvld       =  0x2710, /* ERRLOGGER_ERRVLD_LOW */
+	.errlog0_low  =  0x2720, /* ERRLOGGER_ERRLOG0_LOW */
+	.errlog0_high =  0x2724, /* ERRLOGGER_ERRLOG0_HIGH */
+	.errlog1_low  =  0x2728, /* ERRLOGGER_ERRLOG1_LOW */
+	.errlog1_high =  0x272c, /* ERRLOGGER_ERRLOG1_HIGH */
+	.errlog2_low  =  0x2730, /* ERRLOGGER_ERRLOG2_LOW */
+	.errlog2_high =  0x2734, /* ERRLOGGER_ERRLOG2_HIGH */
+	.errlog3_low  =  0x2738, /* ERRLOGGER_ERRLOG3_LOW */
+	.errlog3_high =  0x273c, /* ERRLOGGER_ERRLOG3_HIGH */
+};
+
+static struct cam_cpas_hw_errata_wa_list cam170_cpas200_errata_wa_list = {
+	.camnoc_flush_slave_pending_trans = {
+		.enable = false,
+		.data.reg_info = {
+			.access_type = CAM_REG_TYPE_READ,
+			.offset = 0x2100, /* SidebandManager_SenseIn0_Low */
+			.mask = 0xE0000, /* Bits 17, 18, 19 */
+			.value = 0, /* expected to be 0 */
+		},
+	},
+};
+
+static struct cam_camnoc_info cam170_cpas200_camnoc_info = {
+	.specific = &cam_cpas_v170_200_camnoc_specific[0],
+	.specific_size = ARRAY_SIZE(cam_cpas_v170_200_camnoc_specific),
+	.irq_sbm = &cam_cpas_v170_200_irq_sbm,
+	.irq_err = &cam_cpas_v170_200_irq_err[0],
+	.irq_err_size = ARRAY_SIZE(cam_cpas_v170_200_irq_err),
+	.err_logger = &cam170_cpas200_err_logger_offsets,
+	.errata_wa_list = &cam170_cpas200_errata_wa_list,
+};
+
+#endif /* _CPASTOP_V170_200_H_ */

+ 55 - 0
drivers/cam_cpas/include/cam_cpas_api.h

@@ -32,6 +32,60 @@ enum cam_cpas_reg_base {
 	CAM_CPAS_REG_MAX
 	CAM_CPAS_REG_MAX
 };
 };
 
 
+/**
+ * enum cam_cpas_camera_version Enum for Titan Camera Versions
+ */
+enum cam_cpas_camera_version {
+	CAM_CPAS_CAMERA_VERSION_NONE = 0,
+	CAM_CPAS_CAMERA_VERSION_150  = 0x00010500,
+	CAM_CPAS_CAMERA_VERSION_170  = 0x00010700,
+	CAM_CPAS_CAMERA_VERSION_175  = 0x00010705,
+	CAM_CPAS_CAMERA_VERSION_480  = 0x00040800,
+	CAM_CPAS_CAMERA_VERSION_580  = 0x00050800,
+	CAM_CPAS_CAMERA_VERSION_MAX
+};
+
+/**
+ * enum cam_cpas_version Enum for Titan CPAS Versions
+ */
+enum cam_cpas_version {
+	CAM_CPAS_VERSION_NONE = 0,
+	CAM_CPAS_VERSION_100  = 0x10000000,
+	CAM_CPAS_VERSION_101  = 0x10000001,
+	CAM_CPAS_VERSION_110  = 0x10010000,
+	CAM_CPAS_VERSION_120  = 0x10020000,
+	CAM_CPAS_VERSION_130  = 0x10030000,
+	CAM_CPAS_VERSION_200  = 0x20000000,
+	CAM_CPAS_VERSION_MAX
+};
+
+/**
+ * enum cam_cpas_camera_version_map_id Enum for camera version map id
+ * This enum is mapped with cam_cpas_camera_version
+ */
+enum cam_cpas_camera_version_map_id {
+	CAM_CPAS_CAMERA_VERSION_ID_150  = 0x0,
+	CAM_CPAS_CAMERA_VERSION_ID_170  = 0x1,
+	CAM_CPAS_CAMERA_VERSION_ID_175  = 0x2,
+	CAM_CPAS_CAMERA_VERSION_ID_480  = 0x3,
+	CAM_CPAS_CAMERA_VERSION_ID_580  = 0x4,
+	CAM_CPAS_CAMERA_VERSION_ID_MAX
+};
+
+/**
+ * enum cam_cpas_version_map_id Enum for cpas version map id
+ * This enum is mapped with cam_cpas_version
+ */
+enum cam_cpas_version_map_id {
+	CAM_CPAS_VERSION_ID_100  = 0x0,
+	CAM_CPAS_VERSION_ID_101  = 0x1,
+	CAM_CPAS_VERSION_ID_110  = 0x2,
+	CAM_CPAS_VERSION_ID_120  = 0x3,
+	CAM_CPAS_VERSION_ID_130  = 0x4,
+	CAM_CPAS_VERSION_ID_200  = 0x5,
+	CAM_CPAS_VERSION_ID_MAX
+};
+
 /**
 /**
  * enum cam_cpas_hw_version - Enum for Titan CPAS HW Versions
  * enum cam_cpas_hw_version - Enum for Titan CPAS HW Versions
  */
  */
@@ -41,6 +95,7 @@ enum cam_cpas_hw_version {
 	CAM_CPAS_TITAN_170_V100 = 0x170100,
 	CAM_CPAS_TITAN_170_V100 = 0x170100,
 	CAM_CPAS_TITAN_170_V110 = 0x170110,
 	CAM_CPAS_TITAN_170_V110 = 0x170110,
 	CAM_CPAS_TITAN_170_V120 = 0x170120,
 	CAM_CPAS_TITAN_170_V120 = 0x170120,
+	CAM_CPAS_TITAN_170_V200 = 0x170200,
 	CAM_CPAS_TITAN_175_V100 = 0x175100,
 	CAM_CPAS_TITAN_175_V100 = 0x175100,
 	CAM_CPAS_TITAN_175_V101 = 0x175101,
 	CAM_CPAS_TITAN_175_V101 = 0x175101,
 	CAM_CPAS_TITAN_175_V120 = 0x175120,
 	CAM_CPAS_TITAN_175_V120 = 0x175120,