From 26182c7d5866547403310c56092789cbafef5c63 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_core.c | 11 +++++++++++ .../isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_dev.c | 7 +++++-- .../cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c | 11 +++++++++++ .../cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_dev.c | 4 +++- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/cam_cpas/cam_cpas_intf.c b/drivers/cam_cpas/cam_cpas_intf.c index 94c0101433ee..7d007f4b3c29 100644 --- a/drivers/cam_cpas/cam_cpas_intf.c +++ b/drivers/cam_cpas/cam_cpas_intf.c @@ -161,19 +161,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_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index b807a9a5ab48..22f2c0ca37f5 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 @@ -21,6 +21,7 @@ #include "cam_cpas_api.h" #include "cam_subdev.h" #include "cam_tasklet_util.h" +#include "dt-bindings/msm/msm-camera.h" /* Timeout value in msec */ #define IFE_CSID_TIMEOUT 1000 @@ -5556,6 +5557,16 @@ int cam_ife_csid_hw_probe_init(struct cam_hw_intf *csid_hw_intf, ife_csid_hw->device_enabled = 0; ife_csid_hw->is_resetting = false; ife_csid_hw->hw_info->hw_state = CAM_HW_STATE_POWER_DOWN; + + if (!cam_cpas_is_feature_supported(CAM_CPAS_ISP_FUSE, + (1 << ife_csid_hw->hw_intf->hw_idx), 0) || + !cam_cpas_is_feature_supported(CAM_CPAS_ISP_LITE_FUSE, + (1 << ife_csid_hw->hw_intf->hw_idx), 0)) { + CAM_DBG(CAM_ISP, "IFE:%d is not supported", + ife_csid_hw->hw_intf->hw_idx); + return -ENODEV; + } + mutex_init(&ife_csid_hw->hw_info->hw_mutex); spin_lock_init(&ife_csid_hw->hw_info->hw_lock); spin_lock_init(&ife_csid_hw->lock_state); 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 55c8cd4274df..f8fc0f651481 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 @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include @@ -79,8 +79,11 @@ static int cam_ife_csid_component_bind(struct device *dev, csid_dev->csid_info = csid_hw_data; rc = cam_ife_csid_hw_probe_init(csid_hw_intf, csid_dev_idx, false); - if (rc) + if (rc) { + if (rc == -ENODEV) + rc = 0; goto free_dev; + } platform_set_drvdata(pdev, csid_dev); CAM_DBG(CAM_ISP, "CSID:%d component bound successfully", 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 17580dca5079..dc763c481855 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 @@ -17,6 +17,8 @@ #include "cam_ife_hw_mgr.h" #include "cam_debug_util.h" #include "cam_cpas_api.h" +#include + static const char drv_name[] = "vfe"; @@ -682,6 +684,15 @@ int cam_vfe_core_init(struct cam_vfe_hw_core_info *core_info, return -ENODEV; } + if (!cam_cpas_is_feature_supported(CAM_CPAS_ISP_FUSE, + (1 << hw_intf->hw_idx), 0) || + !cam_cpas_is_feature_supported(CAM_CPAS_ISP_LITE_FUSE, + (1 << hw_intf->hw_idx), 0)) { + CAM_DBG(CAM_ISP, "IFE:%d is not supported", + hw_intf->hw_idx); + return -ENXIO; + } + rc = cam_irq_controller_init(drv_name, CAM_SOC_GET_REG_MAP_START(soc_info, VFE_CORE_BASE_IDX), vfe_hw_info->irq_reg_info, &core_info->vfe_irq_controller, 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 4be7e8e8de13..4183e59c319f 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 @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -100,6 +100,8 @@ static int cam_vfe_component_bind(struct device *dev, rc = cam_vfe_core_init(core_info, &vfe_hw->soc_info, vfe_hw_intf, hw_info); if (rc < 0) { + if (rc == -ENXIO) + rc = 0; CAM_ERR(CAM_ISP, "Failed to init core rc=%d", rc); goto deinit_soc; }