Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9276c20f authored by Jigarkumar Zala's avatar Jigarkumar Zala
Browse files

msm: camera: cpas: Update logic for reading hw version at runtime



This change will read the hw version and assign the cpas hw version
at runtime. This change help to remove DT entry for every hw iteration.

Change-Id: I3c3ad3b2bab1735b308e21e6e0ffb9780cdc3270
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent 29130252
Loading
Loading
Loading
Loading
+0 −25
Original line number Original line Diff line number Diff line
@@ -1506,27 +1506,6 @@ static int cam_cpas_util_get_internal_ops(struct platform_device *pdev,
	return rc;
	return rc;
}
}


static int cam_cpas_util_get_hw_version(struct platform_device *pdev,
	struct cam_hw_soc_info *soc_info)
{
	struct device_node *of_node = pdev->dev.of_node;
	int rc;

	soc_info->hw_version = 0;

	rc = of_property_read_u32(of_node,
		"qcom,cpas-hw-ver", &soc_info->hw_version);

	CAM_DBG(CAM_CPAS, "CPAS HW VERSION %x", soc_info->hw_version);

	if (rc) {
		CAM_ERR(CAM_CPAS, "failed to get CPAS HW Version rc=%d", rc);
		return -EINVAL;
	}

	return rc;
}

int cam_cpas_hw_probe(struct platform_device *pdev,
int cam_cpas_hw_probe(struct platform_device *pdev,
	struct cam_hw_intf **hw_intf)
	struct cam_hw_intf **hw_intf)
{
{
@@ -1669,10 +1648,6 @@ int cam_cpas_hw_probe(struct platform_device *pdev,
	if (rc)
	if (rc)
		goto axi_cleanup;
		goto axi_cleanup;


	rc = cam_cpas_util_get_hw_version(pdev, &cpas_hw->soc_info);
	if (rc)
		goto axi_cleanup;

	*hw_intf = cpas_hw_intf;
	*hw_intf = cpas_hw_intf;
	return 0;
	return 0;


+0 −12
Original line number Original line Diff line number Diff line
@@ -44,18 +44,6 @@ int cam_cpas_get_custom_dt_info(struct platform_device *pdev,
		return rc;
		return rc;
	}
	}



	soc_private->hw_version = 0;
	rc = of_property_read_u32(of_node,
		"qcom,cpas-hw-ver", &soc_private->hw_version);
	if (rc) {
		CAM_ERR(CAM_CPAS, "device %s failed to read cpas-hw-ver",
			pdev->name);
		return rc;
	}

	CAM_DBG(CAM_CPAS, "CPAS HW VERSION %x", soc_private->hw_version);

	soc_private->camnoc_axi_min_ib_bw = 0;
	soc_private->camnoc_axi_min_ib_bw = 0;
	rc = of_property_read_u64(of_node,
	rc = of_property_read_u64(of_node,
		"camnoc-axi-min-ib-bw",
		"camnoc-axi-min-ib-bw",
+0 −2
Original line number Original line Diff line number Diff line
@@ -34,7 +34,6 @@ struct cam_cpas_vdd_ahb_mapping {
 * struct cam_cpas_private_soc : CPAS private DT info
 * struct cam_cpas_private_soc : CPAS private DT info
 *
 *
 * @arch_compat: ARCH compatible string
 * @arch_compat: ARCH compatible string
 * @hw_version: Camera HW version
 * @client_id_based: Whether clients are id based
 * @client_id_based: Whether clients are id based
 * @num_clients: Number of clients supported
 * @num_clients: Number of clients supported
 * @client_name: Client names
 * @client_name: Client names
@@ -52,7 +51,6 @@ struct cam_cpas_vdd_ahb_mapping {
 */
 */
struct cam_cpas_private_soc {
struct cam_cpas_private_soc {
	const char *arch_compat;
	const char *arch_compat;
	uint32_t hw_version;
	bool client_id_based;
	bool client_id_based;
	uint32_t num_clients;
	uint32_t num_clients;
	const char *client_name[CAM_CPAS_MAX_CLIENTS];
	const char *client_name[CAM_CPAS_MAX_CLIENTS];
+35 −4
Original line number Original line Diff line number Diff line
@@ -76,6 +76,38 @@ static int cam_cpastop_get_hw_info(struct cam_hw_info *cpas_hw,
		hw_caps->cpas_version.major, hw_caps->cpas_version.minor,
		hw_caps->cpas_version.major, hw_caps->cpas_version.minor,
		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;

	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;
	}

	CAM_DBG(CAM_CPAS, "CPAS HW VERSION %x", soc_info->hw_version);

	return 0;
	return 0;
}
}


@@ -522,12 +554,11 @@ static int cam_cpastop_init_hw_version(struct cam_hw_info *cpas_hw,
	struct cam_cpas_hw_caps *hw_caps)
	struct cam_cpas_hw_caps *hw_caps)
{
{
	int rc = 0;
	int rc = 0;
	struct cam_cpas_private_soc *soc_private =
	struct cam_hw_soc_info *soc_info = &cpas_hw->soc_info;
		(struct cam_cpas_private_soc *) cpas_hw->soc_info.soc_private;


	CAM_DBG(CAM_CPAS,
	CAM_DBG(CAM_CPAS,
		"hw_version=0x%x Camera Version %d.%d.%d, cpas version %d.%d.%d",
		"hw_version=0x%x Camera Version %d.%d.%d, cpas version %d.%d.%d",
		soc_private->hw_version,
		soc_info->hw_version,
		hw_caps->camera_version.major,
		hw_caps->camera_version.major,
		hw_caps->camera_version.minor,
		hw_caps->camera_version.minor,
		hw_caps->camera_version.incr,
		hw_caps->camera_version.incr,
@@ -535,7 +566,7 @@ static int cam_cpastop_init_hw_version(struct cam_hw_info *cpas_hw,
		hw_caps->cpas_version.minor,
		hw_caps->cpas_version.minor,
		hw_caps->cpas_version.incr);
		hw_caps->cpas_version.incr);


	switch (soc_private->hw_version) {
	switch (soc_info->hw_version) {
	case CAM_CPAS_TITAN_170_V100:
	case CAM_CPAS_TITAN_170_V100:
		camnoc_info = &cam170_cpas100_camnoc_info;
		camnoc_info = &cam170_cpas100_camnoc_info;
		break;
		break;