Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d5af3d2 authored by Ravikishore Pampana's avatar Ravikishore Pampana Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: isp: Move the ife hw manager resource to isp hw manager



Hardware manager resource is generic. Move the resource definition
to isp hw manager so that it can be used by other hw manager.
Remove the parent and child graph in the hardware manager resource
as it is not used. Use the common isp resource type everywhere.

CRs-Fixed: 2545590
Change-Id: I41d49af0855f3bd3768450d850b1284ff1e3fea9
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent fefda431
Loading
Loading
Loading
Loading
+137 −173

File changed.

Preview size limit exceeded, changes collapsed.

+20 −61
Original line number Diff line number Diff line
@@ -13,68 +13,11 @@
#include "cam_ife_csid_hw_intf.h"
#include "cam_tasklet_util.h"

/* enum cam_ife_hw_mgr_res_type - manager resource node type */
enum cam_ife_hw_mgr_res_type {
	CAM_IFE_HW_MGR_RES_UNINIT,
	CAM_IFE_HW_MGR_RES_ROOT,
	CAM_IFE_HW_MGR_RES_CID,
	CAM_IFE_HW_MGR_RES_CSID,
	CAM_IFE_HW_MGR_RES_IFE_SRC,
	CAM_IFE_HW_MGR_RES_IFE_IN_RD,
	CAM_IFE_HW_MGR_RES_IFE_OUT,
};

/* IFE resource constants */
#define CAM_IFE_HW_IN_RES_MAX            (CAM_ISP_IFE_IN_RES_MAX & 0xFF)
#define CAM_IFE_HW_OUT_RES_MAX           (CAM_ISP_IFE_OUT_RES_MAX & 0xFF)
#define CAM_IFE_HW_RES_POOL_MAX          64

/**
 * struct cam_vfe_hw_mgr_res- HW resources for the VFE manager
 *
 * @list:                used by the resource list
 * @res_type:            IFE manager resource type
 * @res_id:              resource id based on the resource type for root or
 *                       leaf resource, it matches the KMD interface port id.
 *                       For branch resrouce, it is defined by the ISP HW
 *                       layer
 * @hw_res:              hw layer resource array. For single VFE, only one VFE
 *                       hw resrouce will be acquired. For dual VFE, two hw
 *                       resources from different VFE HW device will be
 *                       acquired
 * @parent:              point to the parent resource node.
 * @children:            point to the children resource nodes
 * @child_num:           numbe of the child resource node.
 * @is_secure            informs whether the resource is in secure mode or not
 *
 */
struct cam_ife_hw_mgr_res {
	struct list_head                 list;
	enum cam_ife_hw_mgr_res_type     res_type;
	uint32_t                         res_id;
	uint32_t                         is_dual_vfe;
	struct cam_isp_resource_node    *hw_res[CAM_ISP_HW_SPLIT_MAX];

	/* graph */
	struct cam_ife_hw_mgr_res       *parent;
	struct cam_ife_hw_mgr_res       *child[CAM_IFE_HW_OUT_RES_MAX];
	uint32_t                         num_children;
	uint32_t                         is_secure;
};


/**
 * struct ctx_base_info - Base hardware information for the context
 *
 * @idx:                 Base resource index
 * @split_id:            Split info for the base resource
 *
 */
struct ctx_base_info {
	uint32_t                       idx;
	enum cam_isp_hw_split_id       split_id;
};

/**
 * struct cam_ife_hw_mgr_debug - contain the debug information
 *
@@ -147,20 +90,20 @@ struct cam_ife_hw_mgr_ctx {
	struct cam_ife_hw_mgr          *hw_mgr;
	uint32_t                        ctx_in_use;

	struct cam_ife_hw_mgr_res       res_list_ife_in;
	struct cam_isp_hw_mgr_res       res_list_ife_in;
	struct list_head                res_list_ife_cid;
	struct list_head                res_list_ife_csid;
	struct list_head                res_list_ife_src;
	struct list_head                res_list_ife_in_rd;
	struct cam_ife_hw_mgr_res       res_list_ife_out[
	struct cam_isp_hw_mgr_res       res_list_ife_out[
						CAM_IFE_HW_OUT_RES_MAX];

	struct list_head                free_res_list;
	struct cam_ife_hw_mgr_res       res_pool[CAM_IFE_HW_RES_POOL_MAX];
	struct cam_isp_hw_mgr_res       res_pool[CAM_IFE_HW_RES_POOL_MAX];

	uint32_t                        irq_status0_mask[CAM_IFE_HW_NUM_MAX];
	uint32_t                        irq_status1_mask[CAM_IFE_HW_NUM_MAX];
	struct ctx_base_info            base[CAM_IFE_HW_NUM_MAX];
	struct cam_isp_ctx_base_info    base[CAM_IFE_HW_NUM_MAX];
	uint32_t                        num_base;
	uint32_t                        cdm_handle;
	struct cam_cdm_utils_ops       *cdm_ops;
@@ -221,6 +164,22 @@ struct cam_ife_hw_mgr {
	struct cam_ife_hw_mgr_debug    debug_cfg;
};

/**
 * struct cam_ife_hw_event_recovery_data - Payload for the recovery procedure
 *
 * @error_type:               Error type that causes the recovery
 * @affected_core:            Array of the hardware cores that are affected
 * @affected_ctx:             Array of the hardware contexts that are affected
 * @no_of_context:            Actual number of the affected context
 *
 */
struct cam_ife_hw_event_recovery_data {
	uint32_t                   error_type;
	uint32_t                   affected_core[CAM_ISP_HW_NUM_MAX];
	struct cam_ife_hw_mgr_ctx *affected_ctx[CAM_CTX_MAX];
	uint32_t                   no_of_context;
};

/**
 * cam_ife_hw_mgr_init()
 *
+38 −10
Original line number Diff line number Diff line
@@ -6,8 +6,11 @@
#ifndef _CAM_ISP_HW_MGR_H_
#define _CAM_ISP_HW_MGR_H_

#include <uapi/media/cam_defs.h>
#include "cam_isp_hw_mgr_intf.h"
#include "cam_tasklet_util.h"
#include "cam_isp_hw.h"


#define CAM_ISP_HW_NUM_MAX                       7

@@ -50,18 +53,43 @@ struct cam_isp_hw_mgr {
};

/**
 * struct cam_hw_event_recovery_data - Payload for the recovery procedure
 * struct cam_isp_hw_mgr_res- HW resources for the ISP hw manager
 *
 * @list:                used by the resource list
 * @res_type:            ISP manager resource type
 * @res_id:              resource id based on the resource type for root or
 *                       leaf resource, it matches the KMD interface port id.
 *                       For branch resrouce, it is defined by the ISP HW
 *                       layer
 * @is_dual_isp          is dual isp hw resource
 * @hw_res:              hw layer resource array. For single ISP, only one ISP
 *                       hw resrouce will be acquired. For dual ISP, two hw
 *                       resources from different ISP HW device will be
 *                       acquired
 * @is_secure            informs whether the resource is in secure mode or not
 * @num_children:        number of the child resource node.
 *
 */
struct cam_isp_hw_mgr_res {
	struct list_head                 list;
	enum cam_isp_resource_type       res_type;
	uint32_t                         res_id;
	uint32_t                         is_dual_isp;
	struct cam_isp_resource_node    *hw_res[CAM_ISP_HW_SPLIT_MAX];
	uint32_t                         is_secure;
	uint32_t                         num_children;
};


/**
 * struct cam_isp_ctx_base_info - Base hardware information for the context
 *
 * @error_type:               Error type that causes the recovery
 * @affected_core:            Array of the hardware cores that are affected
 * @affected_ctx:             Array of the hardware contexts that are affected
 * @no_of_context:            Actual number of the affected context
 * @idx:                 Base resource index
 * @split_id:            Split info for the base resource
 *
 */
struct cam_hw_event_recovery_data {
	uint32_t                   error_type;
	uint32_t                   affected_core[CAM_ISP_HW_NUM_MAX];
	struct cam_ife_hw_mgr_ctx *affected_ctx[CAM_CTX_MAX];
	uint32_t                   no_of_context;
struct cam_isp_ctx_base_info {
	uint32_t                       idx;
	enum cam_isp_hw_split_id       split_id;
};
#endif /* _CAM_ISP_HW_MGR_H_ */
+29 −22
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ int cam_isp_add_change_base(
	struct cam_kmd_buf_info                *kmd_buf_info)
{
	int rc = -EINVAL;
	struct cam_ife_hw_mgr_res       *hw_mgr_res;
	struct cam_isp_hw_mgr_res       *hw_mgr_res;
	struct cam_isp_resource_node    *res;
	struct cam_isp_hw_get_cmd_update get_base;
	struct cam_hw_update_entry      *hw_entry;
@@ -35,7 +35,7 @@ int cam_isp_add_change_base(
	}

	list_for_each_entry(hw_mgr_res, res_list_isp_src, list) {
		if (hw_mgr_res->res_type == CAM_IFE_HW_MGR_RES_UNINIT)
		if (hw_mgr_res->res_type == CAM_ISP_RESOURCE_UNINT)
			continue;

		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
@@ -91,12 +91,12 @@ static int cam_isp_update_dual_config(
	struct cam_cmd_buf_desc            *cmd_desc,
	uint32_t                            split_id,
	uint32_t                            base_idx,
	struct cam_ife_hw_mgr_res          *res_list_isp_out,
	struct cam_isp_hw_mgr_res          *res_list_isp_out,
	uint32_t                            size_isp_out)
{
	int rc = -EINVAL;
	struct cam_isp_dual_config                 *dual_config;
	struct cam_ife_hw_mgr_res                  *hw_mgr_res;
	struct cam_isp_hw_mgr_res                  *hw_mgr_res;
	struct cam_isp_resource_node               *res;
	struct cam_isp_hw_dual_isp_update_args      dual_isp_update_args;
	uint32_t                                    outport_id;
@@ -180,7 +180,7 @@ static int cam_isp_update_dual_config(
}

int cam_isp_add_cmd_buf_update(
	struct cam_ife_hw_mgr_res            *hw_mgr_res,
	struct cam_isp_hw_mgr_res            *hw_mgr_res,
	uint32_t                              cmd_type,
	uint32_t                              hw_cmd_type,
	uint32_t                              base_idx,
@@ -195,7 +195,7 @@ int cam_isp_add_cmd_buf_update(
	uint32_t                            i;
	uint32_t                            total_used_bytes = 0;

	if (hw_mgr_res->res_type == CAM_IFE_HW_MGR_RES_UNINIT) {
	if (hw_mgr_res->res_type == CAM_ISP_RESOURCE_UNINT) {
		CAM_ERR(CAM_ISP, "io res id:%d not valid",
			hw_mgr_res->res_type);
		return -EINVAL;
@@ -243,9 +243,9 @@ int cam_isp_add_cmd_buf_update(
int cam_isp_add_command_buffers(
	struct cam_hw_prepare_update_args  *prepare,
	struct cam_kmd_buf_info            *kmd_buf_info,
	struct ctx_base_info               *base_info,
	struct cam_isp_ctx_base_info       *base_info,
	cam_packet_generic_blob_handler     blob_handler_cb,
	struct cam_ife_hw_mgr_res          *res_list_isp_out,
	struct cam_isp_hw_mgr_res          *res_list_isp_out,
	uint32_t                            size_isp_out)
{
	int rc = 0;
@@ -460,7 +460,7 @@ int cam_isp_add_io_buffers(
	struct cam_hw_prepare_update_args    *prepare,
	uint32_t                              base_idx,
	struct cam_kmd_buf_info              *kmd_buf_info,
	struct cam_ife_hw_mgr_res            *res_list_isp_out,
	struct cam_isp_hw_mgr_res            *res_list_isp_out,
	struct list_head                     *res_list_ife_in_rd,
	uint32_t                              size_isp_out,
	bool                                  fill_fence)
@@ -469,7 +469,7 @@ int cam_isp_add_io_buffers(
	dma_addr_t                          io_addr[CAM_PACKET_MAX_PLANES];
	struct cam_buf_io_cfg              *io_cfg;
	struct cam_isp_resource_node       *res;
	struct cam_ife_hw_mgr_res          *hw_mgr_res;
	struct cam_isp_hw_mgr_res          *hw_mgr_res;
	struct cam_isp_hw_get_cmd_update    update_buf;
	struct cam_isp_hw_get_wm_update     wm_update;
	struct cam_isp_hw_get_wm_update     bus_rd_update;
@@ -540,7 +540,7 @@ int cam_isp_add_io_buffers(
			}

			hw_mgr_res = &res_list_isp_out[res_id_out];
			if (hw_mgr_res->res_type == CAM_IFE_HW_MGR_RES_UNINIT) {
			if (hw_mgr_res->res_type == CAM_ISP_RESOURCE_UNINT) {
				CAM_ERR(CAM_ISP, "io res id:%d not valid",
					io_cfg[i].resource_type);
				return -EINVAL;
@@ -550,10 +550,15 @@ int cam_isp_add_io_buffers(
			CAM_DBG(CAM_ISP,
				"configure input io with fill fence %d",
				fill_fence);
			if (!res_list_ife_in_rd) {
				CAM_ERR(CAM_ISP,
					"No ISP in Read supported");
				return -EINVAL;
			}
			if (!list_empty(res_list_ife_in_rd)) {
				hw_mgr_res =
					list_first_entry(res_list_ife_in_rd,
					struct cam_ife_hw_mgr_res, list);
					struct cam_isp_hw_mgr_res, list);
			} else {
				CAM_ERR(CAM_ISP,
					"No IFE in Read resource");
@@ -606,10 +611,11 @@ int cam_isp_add_io_buffers(
					break;

				hdl = io_cfg[i].mem_handle[plane_id];
				if (res->process_cmd(res,
				rc = res->hw_intf->hw_ops.process_cmd(
					res->hw_intf->hw_priv,
					CAM_ISP_HW_CMD_GET_SECURE_MODE,
						&mode,
						sizeof(bool)))
					&mode, sizeof(bool));
				if (rc)
					return -EINVAL;

				is_buf_secure = cam_mem_is_secure_buf(hdl);
@@ -716,10 +722,11 @@ int cam_isp_add_io_buffers(
					break;

				hdl = io_cfg[i].mem_handle[plane_id];
				if (res->process_cmd(res,
				rc = res->hw_intf->hw_ops.process_cmd(
					res->hw_intf->hw_priv,
					CAM_ISP_HW_CMD_GET_SECURE_MODE,
						&mode,
						sizeof(bool)))
					&mode, sizeof(bool));
				if (rc)
					return -EINVAL;

				is_buf_secure = cam_mem_is_secure_buf(hdl);
@@ -852,7 +859,7 @@ int cam_isp_add_reg_update(
{
	int rc = -EINVAL;
	struct cam_isp_resource_node         *res;
	struct cam_ife_hw_mgr_res            *hw_mgr_res;
	struct cam_isp_hw_mgr_res            *hw_mgr_res;
	struct cam_hw_update_entry           *hw_entry;
	struct cam_isp_hw_get_cmd_update      get_regup;
	uint32_t kmd_buf_remain_size, num_ent, i, reg_update_size;
@@ -869,7 +876,7 @@ int cam_isp_add_reg_update(

	reg_update_size = 0;
	list_for_each_entry(hw_mgr_res, res_list_isp_src, list) {
		if (hw_mgr_res->res_type == CAM_IFE_HW_MGR_RES_UNINIT)
		if (hw_mgr_res->res_type == CAM_ISP_RESOURCE_UNINT)
			continue;

		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
+7 −7
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
#include <linux/types.h>
#include <media/cam_isp.h>
#include "cam_isp_hw_mgr_intf.h"
#include "cam_ife_hw_mgr.h"
#include "cam_isp_hw_mgr.h"
#include "cam_hw_intf.h"
#include "cam_packet_util.h"

@@ -25,12 +25,12 @@ enum cam_isp_cdm_bl_type {
 * struct cam_isp_generic_blob_info
 *
 * @prepare:            Payload for prepare command
 * @ctx_base_info:      Base hardware information for the context
 * @base_info:          Base hardware information for the context
 * @kmd_buf_info:       Kmd buffer to store the custom cmd data
 */
struct cam_isp_generic_blob_info {
	struct cam_hw_prepare_update_args     *prepare;
	struct ctx_base_info                  *base_info;
	struct cam_isp_ctx_base_info          *base_info;
	struct cam_kmd_buf_info               *kmd_buf_info;
};

@@ -77,7 +77,7 @@ int cam_isp_add_change_base(
 *                         otherwise returns bytes used
 */
int cam_isp_add_cmd_buf_update(
	struct cam_ife_hw_mgr_res            *hw_mgr_res,
	struct cam_isp_hw_mgr_res            *hw_mgr_res,
	uint32_t                              cmd_type,
	uint32_t                              hw_cmd_type,
	uint32_t                              base_idx,
@@ -105,9 +105,9 @@ int cam_isp_add_cmd_buf_update(
int cam_isp_add_command_buffers(
	struct cam_hw_prepare_update_args  *prepare,
	struct cam_kmd_buf_info            *kmd_buf_info,
	struct ctx_base_info               *base_info,
	struct cam_isp_ctx_base_info       *base_info,
	cam_packet_generic_blob_handler     blob_handler_cb,
	struct cam_ife_hw_mgr_res          *res_list_isp_out,
	struct cam_isp_hw_mgr_res          *res_list_isp_out,
	uint32_t                            size_isp_out);

/*
@@ -137,7 +137,7 @@ int cam_isp_add_io_buffers(
	struct cam_hw_prepare_update_args    *prepare,
	uint32_t                              base_idx,
	struct cam_kmd_buf_info              *kmd_buf_info,
	struct cam_ife_hw_mgr_res            *res_list_isp_out,
	struct cam_isp_hw_mgr_res            *res_list_isp_out,
	struct list_head                     *res_list_ife_in_rd,
	uint32_t                              size_isp_out,
	bool                                  fill_fence);
Loading