From eef5866053570d15413c95f4da9fcba6358e3173 Mon Sep 17 00:00:00 2001 From: Mukund Madhusudan Atre Date: Sun, 5 Jan 2020 16:54:50 -0800 Subject: [PATCH] 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 Signed-off-by: Vishalsingh Hajeri --- .../icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c | 5 ++-- .../isp_hw/ife_csid_hw/cam_ife_csid17x.c | 6 ++++- .../isp_hw/ife_csid_hw/cam_ife_csid_core.c | 24 ++++++++++++------- .../isp_hw/ife_csid_hw/cam_ife_csid_lite17x.c | 6 ++++- .../isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c | 4 +++- .../isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.c | 3 ++- .../vfe_hw/vfe_top/cam_vfe_camif_ver3.c | 3 ++- 7 files changed, 36 insertions(+), 15 deletions(-) diff --git a/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c b/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c index 8bc550bc188d..67cb42aa1661 100644 --- a/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c +++ b/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 @@ -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) diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid17x.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid17x.c index 8e34447f3634..98155a08c036 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid17x.c +++ b/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, + }, {} }; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index 2e57cd1f1155..3682823a496b 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/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 @@ -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); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_lite17x.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_lite17x.c index 2bc6e8ce6284..421218a0ee06 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_lite17x.c +++ b/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 @@ -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); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c index a640353b6b5e..ae5713f455dd 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c +++ b/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 @@ -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; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.c index 77e2a059af57..c0b555d37090 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.c +++ b/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 @@ -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"); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c index 12cdcb19f2c0..ef161d2b20b9 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c +++ b/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 @@ -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