From 5f7956594d75cf494990e3c75cdc4c4782975861 Mon Sep 17 00:00:00 2001 From: Wyes Karny Date: Thu, 11 Feb 2021 14:24:39 +0530 Subject: [PATCH] msm: camera: isp: IFE and CSID probe based on fuse Some ISP hardware id instances are disabled on some target skus. Cpas driver has fuse information based on the dtsi entries. ISP hw driver queries the cpas driver whether hw instance is supported or not. If ISP hardware is supported on the target then continue the isp hardware probe. Fix for get HW feature: When feature is enable or disable type and HW mask is not indicating the HW index, do not update the supported. By default it is supported. CRs-Fixed: 2825675 Change-Id: I777e5790060388458562e7a53fea8a7324ffa9d3 Signed-off-by: Wyes Karny --- drivers/cam_cpas/cam_cpas_intf.c | 7 +------ .../isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c | 10 ++++++++++ drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_dev.c | 10 ++++++++++ dt-bindings/msm-camera.h | 3 ++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/cam_cpas/cam_cpas_intf.c b/drivers/cam_cpas/cam_cpas_intf.c index 3053d2dd99..2ce5b4ffc1 100644 --- a/drivers/cam_cpas/cam_cpas_intf.c +++ b/drivers/cam_cpas/cam_cpas_intf.c @@ -188,19 +188,14 @@ bool cam_cpas_is_feature_supported(uint32_t flag, uint32_t hw_map, if (soc_private->feature_info[i].feature == flag) break; - if (i == soc_private->num_feature_info) { - CAM_INFO(CAM_CPAS, "Feature not found, no of featues: %d", - soc_private->num_feature_info); + if (i == soc_private->num_feature_info) goto end; - } if (soc_private->feature_info[i].type == CAM_CPAS_FEATURE_TYPE_DISABLE || (soc_private->feature_info[i].type == CAM_CPAS_FEATURE_TYPE_ENABLE)) { if ((soc_private->feature_info[i].hw_map & hw_map) == hw_map) supported = soc_private->feature_info[i].enable; - else - supported = !soc_private->feature_info[i].enable; } else { if (!fuse_val) { CAM_ERR(CAM_CPAS, diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c index 7e16d051dc..46ab23bb63 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c @@ -11,6 +11,8 @@ #include "cam_ife_csid_hw_intf.h" #include "cam_debug_util.h" #include "camera_main.h" +#include "cam_cpas_api.h" +#include static struct cam_hw_intf *cam_ife_csid_hw_list[CAM_IFE_CSID_HW_NUM_MAX] = { 0, 0, 0, 0}; @@ -62,6 +64,14 @@ static int cam_ife_csid_component_bind(struct device *dev, csid_core_info = (struct cam_ife_csid_core_info *)match_dev->data; + if (!cam_cpas_is_feature_supported(CAM_CPAS_ISP_FUSE, + (1 << hw_intf->hw_idx), NULL) || + !cam_cpas_is_feature_supported(CAM_CPAS_ISP_LITE_FUSE, + (1 << hw_intf->hw_idx), NULL)) { + CAM_DBG(CAM_ISP, "CSID[%d] not supported based on fuse", + csid_dev_idx); + goto free_hw_info; + } /* call the driver init and fill csid_hw_info->core_info */ rc = cam_ife_csid_hw_probe_init(hw_intf, csid_core_info, false); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_dev.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_dev.c index 11f833add1..4831fe6791 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_dev.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_dev.c @@ -13,6 +13,7 @@ #include "cam_vfe_core.h" #include "cam_vfe_soc.h" #include "cam_debug_util.h" +#include static struct cam_isp_hw_intf_data cam_vfe_hw_list[CAM_VFE_HW_NUM_MAX]; @@ -38,6 +39,15 @@ static int cam_vfe_component_bind(struct device *dev, of_property_read_u32(pdev->dev.of_node, "cell-index", &vfe_hw_intf->hw_idx); + if (!cam_cpas_is_feature_supported(CAM_CPAS_ISP_FUSE, + (1 << vfe_hw_intf->hw_idx), 0) || + !cam_cpas_is_feature_supported(CAM_CPAS_ISP_LITE_FUSE, + (1 << vfe_hw_intf->hw_idx), 0)) { + CAM_DBG(CAM_ISP, "IFE:%d is not supported", + vfe_hw_intf->hw_idx); + goto free_vfe_hw_intf; + } + vfe_hw = kzalloc(sizeof(struct cam_hw_info), GFP_KERNEL); if (!vfe_hw) { rc = -ENOMEM; diff --git a/dt-bindings/msm-camera.h b/dt-bindings/msm-camera.h index 10634892b3..7fdee4e923 100644 --- a/dt-bindings/msm-camera.h +++ b/dt-bindings/msm-camera.h @@ -88,7 +88,8 @@ #define CAM_CPAS_MP_LIMIT_FUSE 3 #define CAM_CPAS_ISP_FUSE 4 #define CAM_CPAS_ISP_PIX_FUSE 5 -#define CAM_CPAS_FUSE_FEATURE_MAX 6 +#define CAM_CPAS_ISP_LITE_FUSE 6 +#define CAM_CPAS_FUSE_FEATURE_MAX 7 #define CCI_MASTER_0 0 #define CCI_MASTER_1 1