msm: camera: common: Partial Camera Support

This change creates a sysfs entry(subparts_info) which
has info about number of IFEs, IFE-LITEs, SFEs & CUSTOM,
whose values are populated in their respective drivers.
Also, validates whether a particular IFE, SFE and CUSTOM
is supported or not. Based on this, probe of IFE, SFE and
CUSTOM drivers will happen accordingly.

CRs-Fixed: 3482745
Change-Id: Iff6e79a7793b14b1f368f215020617f10dbd4bb5
Signed-off-by: Karthik Dillibabu <quic_kard@quicinc.com>
This commit is contained in:
Karthik Dillibabu
2023-03-13 11:00:08 +05:30
committed by Camera Software Integration
부모 0aa784b1d9
커밋 f910aa0b4f
20개의 변경된 파일580개의 추가작업 그리고 56개의 파일을 삭제

파일 보기

@@ -1,6 +1,7 @@
// 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/delay.h>
@@ -10,6 +11,7 @@
#include <linux/iommu.h>
#include <linux/timer.h>
#include <linux/kernel.h>
#include <dt-bindings/msm-camera.h>
#include <media/cam_req_mgr.h>
@@ -23,6 +25,7 @@
#include "camera_main.h"
static struct cam_custom_dev g_custom_dev;
static uint32_t g_num_custom_hws;
static void cam_custom_dev_iommu_fault_handler(
struct cam_smmu_pf_info *pf_info)
@@ -117,6 +120,11 @@ static int cam_custom_component_bind(struct device *dev,
g_custom_dev.sd.internal_ops = &cam_custom_subdev_internal_ops;
g_custom_dev.sd.close_seq_prior = CAM_SD_CLOSE_HIGH_PRIORITY;
if (!cam_cpas_is_feature_supported(CAM_CPAS_CUSTOM_FUSE, BIT(0), NULL)) {
CAM_DBG(CAM_CUSTOM, "CUSTOM:0 is not supported");
goto err;
}
rc = cam_subdev_probe(&g_custom_dev.sd, pdev, CAM_CUSTOM_DEV_NAME,
CAM_CUSTOM_DEVICE_TYPE);
if (rc) {
@@ -167,6 +175,14 @@ err:
return rc;
}
void cam_custom_get_num_hws(uint32_t *custom_num)
{
if (custom_num)
*custom_num = g_num_custom_hws;
else
CAM_ERR(CAM_CUSTOM, "Invalid argument, g_num_custom_hws: %u", g_num_custom_hws);
}
static void cam_custom_component_unbind(struct device *dev,
struct device *master_dev, void *data)
{
@@ -204,6 +220,8 @@ static int cam_custom_dev_probe(struct platform_device *pdev)
int rc = 0;
CAM_DBG(CAM_CUSTOM, "Adding Custom HW component");
g_num_custom_hws++;
rc = component_add(&pdev->dev, &cam_custom_component_ops);
if (rc)
CAM_ERR(CAM_CUSTOM, "failed to add component rc: %d", rc);

파일 보기

@@ -150,6 +150,16 @@ enum cam_isp_resource_type
}
}
static void cam_custom_mgr_count_functional_hws(uint32_t num_custom_functional)
{
int i;
for (i = 0; i < CAM_CUSTOM_CSID_HW_MAX; i++) {
if (g_custom_hw_mgr.custom_hw[i])
num_custom_functional++;
}
}
static int cam_custom_hw_mgr_deinit_hw_res(
struct cam_custom_hw_mgr_res *hw_mgr_res)
{
@@ -1467,6 +1477,7 @@ int cam_custom_hw_mgr_init(struct device_node *of_node,
{
int rc = 0;
int i, j;
uint32_t num_custom_available, num_custom_functional = 0;
memset(&g_custom_hw_mgr, 0, sizeof(g_custom_hw_mgr));
mutex_init(&g_custom_hw_mgr.ctx_mutex);
@@ -1545,6 +1556,13 @@ int cam_custom_hw_mgr_init(struct device_node *of_node,
if (iommu_hdl)
*iommu_hdl = g_custom_hw_mgr.img_iommu_hdl;
cam_custom_get_num_hws(&num_custom_available);
cam_custom_mgr_count_functional_hws(&num_custom_functional);
rc = cam_cpas_prepare_subpart_info(CAM_CUSTOM_HW_IDX, num_custom_available,
num_custom_functional);
if (rc)
CAM_ERR(CAM_CUSTOM, "Failed to populate num_custom, rc: %d", rc);
CAM_DBG(CAM_CUSTOM, "HW manager initialized");
return 0;
}

파일 보기

@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _CAM_CUSTOM_HW_MGR_H_
@@ -126,6 +127,16 @@ struct cam_custom_hw_mgr {
struct cam_custom_hw_mgr_ctx ctx_pool[CAM_CTX_MAX];
};
/**
* cam_custom_get_num_hws()
*
* @brief : Populates number of custom.
*
* @num_custom : Fills number of custom hws in the address passed.
*
*/
void cam_custom_get_num_hws(uint32_t *num_custom);
/**
* cam_custom_hw_mgr_init()
*