Преглед изворни кода

Merge "msm: camera: tfe: TFE and CSID probe based on fuse" into camera-kernel.lnx.7.0

Camera Software Integration пре 1 година
родитељ
комит
b2565f210d

+ 10 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_dev.c

@@ -7,11 +7,13 @@
 #include <linux/slab.h>
 #include <linux/mod_devicetable.h>
 #include <linux/of_device.h>
+#include <dt-bindings/msm-camera.h>
 #include "cam_tfe_csid_core.h"
 #include "cam_tfe_csid_dev.h"
 #include "cam_tfe_csid_hw_intf.h"
 #include "cam_debug_util.h"
 #include "camera_main.h"
+#include "cam_cpas_api.h"
 
 static struct cam_hw_intf *cam_tfe_csid_hw_list[CAM_TFE_CSID_HW_NUM_MAX] = {
 	0, 0, 0};
@@ -31,6 +33,14 @@ static int cam_tfe_csid_component_bind(struct device *dev,
 
 	CAM_DBG(CAM_ISP, "probe called");
 
+	/* get tfe csid hw index */
+	of_property_read_u32(pdev->dev.of_node, "cell-index", &csid_dev_idx);
+
+	if (!cam_cpas_is_feature_supported(CAM_CPAS_ISP_LITE_FUSE, BIT(csid_dev_idx), NULL)) {
+		CAM_DBG(CAM_ISP, "CSID:%d is not supported", csid_dev_idx);
+		goto err;
+	}
+
 	csid_hw_intf = kzalloc(sizeof(*csid_hw_intf), GFP_KERNEL);
 	if (!csid_hw_intf) {
 		rc = -ENOMEM;
@@ -49,8 +59,6 @@ static int cam_tfe_csid_component_bind(struct device *dev,
 		goto free_hw_info;
 	}
 
-	/* get tfe csid hw index */
-	of_property_read_u32(pdev->dev.of_node, "cell-index", &csid_dev_idx);
 	/* get tfe csid hw information */
 	match_dev = of_match_device(pdev->dev.driver->of_match_table,
 		&pdev->dev);

+ 15 - 3
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_dev.c

@@ -1,16 +1,19 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/slab.h>
 #include <linux/mod_devicetable.h>
 #include <linux/of_device.h>
+#include <dt-bindings/msm-camera.h>
 #include "cam_tfe_dev.h"
 #include "cam_tfe_core.h"
 #include "cam_tfe_soc.h"
 #include "cam_debug_util.h"
 #include "camera_main.h"
+#include "cam_cpas_api.h"
 
 static struct cam_isp_hw_intf_data  cam_tfe_hw_list[CAM_TFE_HW_NUM_MAX];
 
@@ -25,17 +28,25 @@ static int cam_tfe_component_bind(struct device *dev,
 	struct cam_tfe_soc_private        *tfe_soc_priv;
 	int                                rc = 0;
 	struct platform_device *pdev = to_platform_device(dev);
+	uint32_t tfe_hw_idx = 0;
 	uint32_t  i;
 
+	CAM_DBG(CAM_ISP, "probe called");
+
+	of_property_read_u32(pdev->dev.of_node,
+		"cell-index", &tfe_hw_idx);
+
+	if (!cam_cpas_is_feature_supported(CAM_CPAS_ISP_LITE_FUSE, BIT(tfe_hw_idx), NULL)) {
+		CAM_DBG(CAM_ISP, "TFE:%d is not supported", tfe_hw_idx);
+		goto end;
+	}
+
 	tfe_hw_intf = kzalloc(sizeof(struct cam_hw_intf), GFP_KERNEL);
 	if (!tfe_hw_intf) {
 		rc = -ENOMEM;
 		goto end;
 	}
 
-	of_property_read_u32(pdev->dev.of_node,
-		"cell-index", &tfe_hw_intf->hw_idx);
-
 	tfe_hw = kzalloc(sizeof(struct cam_hw_info), GFP_KERNEL);
 	if (!tfe_hw) {
 		rc = -ENOMEM;
@@ -46,6 +57,7 @@ static int cam_tfe_component_bind(struct device *dev,
 	tfe_hw->soc_info.dev = &pdev->dev;
 	tfe_hw->soc_info.dev_name = pdev->name;
 	tfe_hw_intf->hw_priv = tfe_hw;
+	tfe_hw_intf->hw_idx = tfe_hw_idx;
 	tfe_hw_intf->hw_ops.get_hw_caps = cam_tfe_get_hw_caps;
 	tfe_hw_intf->hw_ops.init = cam_tfe_init_hw;
 	tfe_hw_intf->hw_ops.deinit = cam_tfe_deinit_hw;