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: 2594541
Change-Id: I41d49af0855f3bd3768450d850b1284ff1e3fea9
Signed-off-by: Ravikishore Pampana <rpampana@codeaurora.org>
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
This commit is contained in:
Trishansh Bhardwaj 2019-12-20 14:59:27 +05:30
commit 2c76e695e3
10 changed files with 254 additions and 302 deletions

View file

@ -63,8 +63,8 @@ static int cam_ife_mgr_regspace_data_cb(uint32_t reg_base_type,
uint32_t *reg_base_idx)
{
int rc = 0;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_ife_hw_mgr_res *hw_mgr_res_temp;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res_temp;
struct cam_hw_soc_info *soc_info = NULL;
struct cam_ife_hw_mgr_ctx *ctx =
(struct cam_ife_hw_mgr_ctx *) hw_mgr_ctx;
@ -229,7 +229,7 @@ static int cam_ife_hw_mgr_is_rdi_res(uint32_t res_id)
}
static int cam_ife_hw_mgr_reset_csid_res(
struct cam_ife_hw_mgr_res *isp_hw_res)
struct cam_isp_hw_mgr_res *isp_hw_res)
{
int i;
int rc = 0;
@ -262,7 +262,7 @@ err:
}
static int cam_ife_hw_mgr_init_hw_res(
struct cam_ife_hw_mgr_res *isp_hw_res)
struct cam_isp_hw_mgr_res *isp_hw_res)
{
int i;
int rc = -1;
@ -291,7 +291,7 @@ err:
}
static int cam_ife_hw_mgr_start_hw_res(
struct cam_ife_hw_mgr_res *isp_hw_res,
struct cam_isp_hw_mgr_res *isp_hw_res,
struct cam_ife_hw_mgr_ctx *ctx)
{
int i;
@ -327,7 +327,7 @@ err:
}
static void cam_ife_hw_mgr_stop_hw_res(
struct cam_ife_hw_mgr_res *isp_hw_res)
struct cam_isp_hw_mgr_res *isp_hw_res)
{
int i;
struct cam_hw_intf *hw_intf;
@ -349,7 +349,7 @@ static void cam_ife_hw_mgr_stop_hw_res(
else
CAM_ERR(CAM_ISP, "stop null");
if (hw_intf->hw_ops.process_cmd &&
isp_hw_res->res_type == CAM_IFE_HW_MGR_RES_IFE_OUT) {
isp_hw_res->res_type == CAM_ISP_RESOURCE_VFE_OUT) {
hw_intf->hw_ops.process_cmd(hw_intf->hw_priv,
CAM_ISP_HW_CMD_STOP_BUS_ERR_IRQ,
&dummy_args, sizeof(dummy_args));
@ -358,7 +358,7 @@ static void cam_ife_hw_mgr_stop_hw_res(
}
static void cam_ife_hw_mgr_deinit_hw_res(
struct cam_ife_hw_mgr_res *isp_hw_res)
struct cam_isp_hw_mgr_res *isp_hw_res)
{
int i;
struct cam_hw_intf *hw_intf;
@ -377,7 +377,7 @@ static void cam_ife_hw_mgr_deinit_hw_res(
static void cam_ife_hw_mgr_deinit_hw(
struct cam_ife_hw_mgr_ctx *ctx)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
int i = 0;
if (!ctx->init_done) {
@ -417,7 +417,7 @@ static void cam_ife_hw_mgr_deinit_hw(
static int cam_ife_hw_mgr_init_hw(
struct cam_ife_hw_mgr_ctx *ctx)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
int rc = 0, i;
CAM_DBG(CAM_ISP, "INIT IFE CID ... in ctx id:%d",
@ -491,10 +491,10 @@ deinit:
static int cam_ife_hw_mgr_put_res(
struct list_head *src_list,
struct cam_ife_hw_mgr_res **res)
struct cam_isp_hw_mgr_res **res)
{
int rc = 0;
struct cam_ife_hw_mgr_res *res_ptr = NULL;
struct cam_isp_hw_mgr_res *res_ptr = NULL;
res_ptr = *res;
if (res_ptr)
@ -505,14 +505,14 @@ static int cam_ife_hw_mgr_put_res(
static int cam_ife_hw_mgr_get_res(
struct list_head *src_list,
struct cam_ife_hw_mgr_res **res)
struct cam_isp_hw_mgr_res **res)
{
int rc = 0;
struct cam_ife_hw_mgr_res *res_ptr = NULL;
struct cam_isp_hw_mgr_res *res_ptr = NULL;
if (!list_empty(src_list)) {
res_ptr = list_first_entry(src_list,
struct cam_ife_hw_mgr_res, list);
struct cam_isp_hw_mgr_res, list);
list_del_init(&res_ptr->list);
} else {
CAM_ERR(CAM_ISP, "No more free ife hw mgr ctx");
@ -524,7 +524,7 @@ static int cam_ife_hw_mgr_get_res(
}
static int cam_ife_hw_mgr_free_hw_res(
struct cam_ife_hw_mgr_res *isp_hw_res)
struct cam_isp_hw_mgr_res *isp_hw_res)
{
int rc = 0;
int i;
@ -625,8 +625,8 @@ static void cam_ife_hw_mgr_dump_src_acq_info(
struct cam_ife_hw_mgr_ctx *hwr_mgr_ctx,
uint32_t num_pix_port, uint32_t num_rdi_port)
{
struct cam_ife_hw_mgr_res *hw_mgr_res = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res_temp = NULL;
struct cam_isp_hw_mgr_res *hw_mgr_res = NULL;
struct cam_isp_hw_mgr_res *hw_mgr_res_temp = NULL;
struct cam_isp_resource_node *hw_res = NULL;
int i = 0;
@ -653,8 +653,8 @@ static void cam_ife_hw_mgr_dump_src_acq_info(
static void cam_ife_hw_mgr_dump_acq_data(
struct cam_ife_hw_mgr_ctx *hwr_mgr_ctx)
{
struct cam_ife_hw_mgr_res *hw_mgr_res = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res_temp = NULL;
struct cam_isp_hw_mgr_res *hw_mgr_res = NULL;
struct cam_isp_hw_mgr_res *hw_mgr_res_temp = NULL;
struct cam_isp_resource_node *hw_res = NULL;
struct timespec64 *ts = NULL;
uint64_t ms, tmp, hrs, min, sec;
@ -761,7 +761,7 @@ static int cam_ife_mgr_csid_stop_hw(
struct cam_ife_hw_mgr_ctx *ctx, struct list_head *stop_list,
uint32_t base_idx, uint32_t stop_cmd)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_isp_resource_node *isp_res;
struct cam_isp_resource_node *stop_res[CAM_IFE_PIX_PATH_RES_MAX - 1];
struct cam_csid_hw_stop_args stop;
@ -801,8 +801,8 @@ static int cam_ife_hw_mgr_release_hw_for_ctx(
struct cam_ife_hw_mgr_ctx *ife_ctx)
{
uint32_t i;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_ife_hw_mgr_res *hw_mgr_res_temp;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res_temp;
/* ife leaf resource */
for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
@ -837,7 +837,7 @@ static int cam_ife_hw_mgr_release_hw_for_ctx(
}
/* ife root node */
if (ife_ctx->res_list_ife_in.res_type != CAM_IFE_HW_MGR_RES_UNINIT)
if (ife_ctx->res_list_ife_in.res_type != CAM_ISP_RESOURCE_UNINT)
cam_ife_hw_mgr_free_hw_res(&ife_ctx->res_list_ife_in);
/* clean up the callback function */
@ -930,7 +930,7 @@ static void cam_ife_mgr_add_base_info(
static int cam_ife_mgr_process_base_info(
struct cam_ife_hw_mgr_ctx *ctx)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_isp_resource_node *res = NULL;
uint32_t i;
@ -941,7 +941,7 @@ static int cam_ife_mgr_process_base_info(
/* IFE mux in resources */
list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_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++) {
@ -966,9 +966,9 @@ static int cam_ife_hw_mgr_acquire_res_bus_rd(
{
int rc = -EINVAL;
struct cam_vfe_acquire_args vfe_acquire;
struct cam_ife_hw_mgr_res *ife_in_rd_res;
struct cam_isp_hw_mgr_res *ife_in_rd_res;
struct cam_hw_intf *hw_intf;
struct cam_ife_hw_mgr_res *ife_src_res;
struct cam_isp_hw_mgr_res *ife_src_res;
int i;
CAM_DBG(CAM_ISP, "Enter");
@ -991,7 +991,7 @@ static int cam_ife_hw_mgr_acquire_res_bus_rd(
vfe_acquire.vfe_out.cdm_ops = ife_ctx->cdm_ops;
vfe_acquire.priv = ife_ctx;
vfe_acquire.vfe_out.unique_id = ife_ctx->ctx_index;
vfe_acquire.vfe_out.is_dual = ife_src_res->is_dual_vfe;
vfe_acquire.vfe_out.is_dual = ife_src_res->is_dual_isp;
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
if (!ife_src_res->hw_res[i])
continue;
@ -1000,7 +1000,7 @@ static int cam_ife_hw_mgr_acquire_res_bus_rd(
if (i == CAM_ISP_HW_SPLIT_LEFT) {
vfe_acquire.vfe_out.split_id =
CAM_ISP_HW_SPLIT_LEFT;
if (ife_src_res->is_dual_vfe) {
if (ife_src_res->is_dual_isp) {
/*TBD */
vfe_acquire.vfe_out.is_master = 1;
vfe_acquire.vfe_out.dual_slave_core =
@ -1034,9 +1034,8 @@ static int cam_ife_hw_mgr_acquire_res_bus_rd(
ife_in_rd_res->hw_res[i]->res_id);
}
ife_in_rd_res->is_dual_vfe = in_port->usage_type;
ife_in_rd_res->res_type = (enum cam_ife_hw_mgr_res_type)
CAM_ISP_RESOURCE_VFE_BUS_RD;
ife_in_rd_res->is_dual_isp = in_port->usage_type;
ife_in_rd_res->res_type = CAM_ISP_RESOURCE_VFE_BUS_RD;
}
return 0;
@ -1047,13 +1046,13 @@ err:
static int cam_ife_hw_mgr_acquire_res_ife_out_rdi(
struct cam_ife_hw_mgr_ctx *ife_ctx,
struct cam_ife_hw_mgr_res *ife_src_res,
struct cam_isp_in_port_generic_info *in_port)
struct cam_isp_hw_mgr_res *ife_src_res,
struct cam_isp_in_port_generic_info *in_port)
{
int rc = -EINVAL;
struct cam_vfe_acquire_args vfe_acquire;
struct cam_isp_out_port_generic_info *out_port = NULL;
struct cam_ife_hw_mgr_res *ife_out_res;
struct cam_isp_hw_mgr_res *ife_out_res;
struct cam_hw_intf *hw_intf;
uint32_t i, vfe_out_res_id, vfe_in_res_id;
@ -1120,13 +1119,10 @@ static int cam_ife_hw_mgr_acquire_res_ife_out_rdi(
}
ife_out_res->hw_res[0] = vfe_acquire.vfe_out.rsrc_node;
ife_out_res->is_dual_vfe = 0;
ife_out_res->is_dual_isp = 0;
ife_out_res->res_id = vfe_out_res_id;
ife_out_res->res_type = (enum cam_ife_hw_mgr_res_type)
CAM_ISP_RESOURCE_VFE_OUT;
ife_src_res->child[ife_src_res->num_children++] = ife_out_res;
CAM_DBG(CAM_ISP, "IFE SRC num_children = %d",
ife_src_res->num_children);
ife_out_res->res_type = CAM_ISP_RESOURCE_VFE_OUT;
ife_src_res->num_children++;
return 0;
err:
@ -1134,16 +1130,16 @@ err:
}
static int cam_ife_hw_mgr_acquire_res_ife_out_pixel(
struct cam_ife_hw_mgr_ctx *ife_ctx,
struct cam_ife_hw_mgr_res *ife_src_res,
struct cam_ife_hw_mgr_ctx *ife_ctx,
struct cam_isp_hw_mgr_res *ife_src_res,
struct cam_isp_in_port_generic_info *in_port,
bool acquire_lcr)
bool acquire_lcr)
{
int rc = -1;
uint32_t i, j, k;
struct cam_vfe_acquire_args vfe_acquire;
struct cam_isp_out_port_generic_info *out_port;
struct cam_ife_hw_mgr_res *ife_out_res;
struct cam_isp_hw_mgr_res *ife_out_res;
struct cam_hw_intf *hw_intf;
for (i = 0; i < in_port->num_out_res; i++) {
@ -1173,14 +1169,14 @@ static int cam_ife_hw_mgr_acquire_res_ife_out_pixel(
CAM_DBG(CAM_ISP, "res_type 0x%x", out_port->res_type);
ife_out_res = &ife_ctx->res_list_ife_out[k];
ife_out_res->is_dual_vfe = in_port->usage_type;
ife_out_res->is_dual_isp = in_port->usage_type;
vfe_acquire.rsrc_type = CAM_ISP_RESOURCE_VFE_OUT;
vfe_acquire.tasklet = ife_ctx->common.tasklet_info;
vfe_acquire.vfe_out.cdm_ops = ife_ctx->cdm_ops;
vfe_acquire.priv = ife_ctx;
vfe_acquire.vfe_out.out_port_info = out_port;
vfe_acquire.vfe_out.is_dual = ife_src_res->is_dual_vfe;
vfe_acquire.vfe_out.is_dual = ife_src_res->is_dual_isp;
vfe_acquire.vfe_out.unique_id = ife_ctx->ctx_index;
vfe_acquire.event_cb = cam_ife_hw_mgr_event_handler;
@ -1193,7 +1189,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_out_pixel(
if (j == CAM_ISP_HW_SPLIT_LEFT) {
vfe_acquire.vfe_out.split_id =
CAM_ISP_HW_SPLIT_LEFT;
if (ife_src_res->is_dual_vfe) {
if (ife_src_res->is_dual_isp) {
/*TBD */
vfe_acquire.vfe_out.is_master = 1;
vfe_acquire.vfe_out.dual_slave_core =
@ -1227,13 +1223,9 @@ static int cam_ife_hw_mgr_acquire_res_ife_out_pixel(
ife_out_res->hw_res[j]->res_id);
}
ife_out_res->res_type =
(enum cam_ife_hw_mgr_res_type)CAM_ISP_RESOURCE_VFE_OUT;
ife_out_res->res_type = CAM_ISP_RESOURCE_VFE_OUT;
ife_out_res->res_id = out_port->res_type;
ife_out_res->parent = ife_src_res;
ife_src_res->child[ife_src_res->num_children++] = ife_out_res;
CAM_DBG(CAM_ISP, "IFE SRC num_children = %d",
ife_src_res->num_children);
ife_src_res->num_children++;
}
return 0;
@ -1247,7 +1239,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_out(
struct cam_isp_in_port_generic_info *in_port)
{
int rc = -EINVAL;
struct cam_ife_hw_mgr_res *ife_src_res;
struct cam_isp_hw_mgr_res *ife_src_res;
list_for_each_entry(ife_src_res, &ife_ctx->res_list_ife_src, list) {
if (ife_src_res->num_children)
@ -1291,8 +1283,8 @@ static int cam_ife_hw_mgr_acquire_res_ife_rd_src(
struct cam_isp_in_port_generic_info *in_port)
{
int rc = -1;
struct cam_ife_hw_mgr_res *csid_res;
struct cam_ife_hw_mgr_res *ife_src_res;
struct cam_isp_hw_mgr_res *csid_res;
struct cam_isp_hw_mgr_res *ife_src_res;
struct cam_vfe_acquire_args vfe_acquire;
struct cam_hw_intf *hw_intf;
struct cam_ife_hw_mgr *ife_hw_mgr;
@ -1324,10 +1316,9 @@ static int cam_ife_hw_mgr_acquire_res_ife_rd_src(
vfe_acquire.vfe_in.res_id = CAM_ISP_HW_VFE_IN_RD;
vfe_acquire.vfe_in.sync_mode = CAM_ISP_HW_SYNC_NONE;
ife_src_res->res_type =
(enum cam_ife_hw_mgr_res_type)vfe_acquire.rsrc_type;
ife_src_res->res_type = vfe_acquire.rsrc_type;
ife_src_res->res_id = vfe_acquire.vfe_in.res_id;
ife_src_res->is_dual_vfe = csid_res->is_dual_vfe;
ife_src_res->is_dual_isp = csid_res->is_dual_isp;
hw_intf =
ife_hw_mgr->ife_devices[csid_res->hw_res[
@ -1339,7 +1330,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_rd_src(
/*
* fill in more acquire information as needed
*/
if (ife_src_res->is_dual_vfe)
if (ife_src_res->is_dual_isp)
vfe_acquire.vfe_in.sync_mode = CAM_ISP_HW_SYNC_MASTER;
rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv,
@ -1359,7 +1350,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_rd_src(
ife_src_res->hw_res[CAM_ISP_HW_SPLIT_LEFT]->res_type,
ife_src_res->hw_res[CAM_ISP_HW_SPLIT_LEFT]->res_id);
if (!ife_src_res->is_dual_vfe)
if (!ife_src_res->is_dual_isp)
goto acq;
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
@ -1397,13 +1388,7 @@ acq:
* It should be one to one mapping between
* csid resource and ife source resource
*/
csid_res->child[0] = ife_src_res;
ife_src_res->parent = csid_res;
csid_res->child[csid_res->num_children++] = ife_src_res;
CAM_DBG(CAM_ISP,
"csid_res=%d CSID num_children=%d ife_src_res=%d",
csid_res->res_id, csid_res->num_children,
ife_src_res->res_id);
csid_res->num_children++;
}
err:
@ -1505,8 +1490,8 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
{
int rc = -1;
int i;
struct cam_ife_hw_mgr_res *csid_res;
struct cam_ife_hw_mgr_res *ife_src_res;
struct cam_isp_hw_mgr_res *csid_res;
struct cam_isp_hw_mgr_res *ife_src_res;
struct cam_vfe_acquire_args vfe_acquire;
struct cam_hw_intf *hw_intf;
struct cam_ife_hw_mgr *ife_hw_mgr;
@ -1544,13 +1529,13 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
else
vfe_acquire.vfe_in.res_id =
CAM_ISP_HW_VFE_IN_LCR;
if (csid_res->is_dual_vfe)
if (csid_res->is_dual_isp)
vfe_acquire.vfe_in.sync_mode =
CAM_ISP_HW_SYNC_MASTER;
else
vfe_acquire.vfe_in.sync_mode =
CAM_ISP_HW_SYNC_NONE;
vfe_acquire.vfe_in.is_dual = csid_res->is_dual_vfe;
vfe_acquire.vfe_in.is_dual = csid_res->is_dual_isp;
break;
case CAM_IFE_PIX_PATH_RES_PPP:
@ -1579,10 +1564,9 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
CAM_ERR(CAM_ISP, "Wrong IFE CSID Resource Node");
goto err;
}
ife_src_res->res_type =
(enum cam_ife_hw_mgr_res_type)vfe_acquire.rsrc_type;
ife_src_res->res_type = vfe_acquire.rsrc_type;
ife_src_res->res_id = vfe_acquire.vfe_in.res_id;
ife_src_res->is_dual_vfe = csid_res->is_dual_vfe;
ife_src_res->is_dual_isp = csid_res->is_dual_isp;
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
if (!csid_res->hw_res[i])
@ -1592,7 +1576,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
csid_res->hw_res[i]->hw_intf->hw_idx];
if (i == CAM_ISP_HW_SPLIT_LEFT &&
ife_src_res->is_dual_vfe) {
ife_src_res->is_dual_isp) {
vfe_acquire.vfe_in.dual_hw_idx =
ife_ctx->slave_hw_idx;
}
@ -1600,7 +1584,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
/* fill in more acquire information as needed */
/* slave Camif resource, */
if (i == CAM_ISP_HW_SPLIT_RIGHT &&
ife_src_res->is_dual_vfe) {
ife_src_res->is_dual_isp) {
vfe_acquire.vfe_in.sync_mode =
CAM_ISP_HW_SYNC_SLAVE;
vfe_acquire.vfe_in.dual_hw_idx =
@ -1637,13 +1621,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_src(
ife_src_res->hw_res[i]->res_id);
}
ife_src_res->parent = csid_res;
csid_res->child[csid_res->num_children++] = ife_src_res;
CAM_DBG(CAM_ISP,
"csid_res=%d CSID num_children=%d ife_src_res=%d",
csid_res->res_id, csid_res->num_children,
ife_src_res->res_id);
csid_res->num_children++;
}
return 0;
@ -1701,16 +1679,16 @@ static int cam_ife_hw_mgr_acquire_csid_hw(
}
static int cam_ife_mgr_acquire_cid_res(
struct cam_ife_hw_mgr_ctx *ife_ctx,
struct cam_ife_hw_mgr_ctx *ife_ctx,
struct cam_isp_in_port_generic_info *in_port,
struct cam_ife_hw_mgr_res **cid_res,
enum cam_ife_pix_path_res_id path_res_id)
struct cam_isp_hw_mgr_res **cid_res,
enum cam_ife_pix_path_res_id path_res_id)
{
int rc = -1;
int i, j;
struct cam_ife_hw_mgr *ife_hw_mgr;
struct cam_hw_intf *hw_intf;
struct cam_ife_hw_mgr_res *cid_res_temp, *cid_res_iterator;
struct cam_ife_hw_mgr *ife_hw_mgr;
struct cam_hw_intf *hw_intf;
struct cam_isp_hw_mgr_res *cid_res_temp, *cid_res_iterator;
struct cam_csid_hw_reserve_resource_args csid_acquire;
uint32_t acquired_cnt = 0;
struct cam_isp_out_port_generic_info *out_port = NULL;
@ -1812,10 +1790,10 @@ acquire_successful:
CAM_DBG(CAM_ISP, "CID left acquired success is_dual %d",
in_port->usage_type);
cid_res_temp->res_type = CAM_IFE_HW_MGR_RES_CID;
cid_res_temp->res_type = CAM_ISP_RESOURCE_CID;
/* CID(DT_ID) value of acquire device, require for path */
cid_res_temp->res_id = csid_acquire.node_res->res_id;
cid_res_temp->is_dual_vfe = in_port->usage_type;
cid_res_temp->is_dual_isp = in_port->usage_type;
ife_ctx->is_dual = (bool)in_port->usage_type;
if (ife_ctx->is_dual)
ife_ctx->master_hw_idx =
@ -1829,7 +1807,7 @@ acquire_successful:
* Acquire Right if not already acquired.
* Dual IFE for RDI and PPP is not currently supported.
*/
if (cid_res_temp->is_dual_vfe && path_res_id
if (cid_res_temp->is_dual_isp && path_res_id
== CAM_IFE_PIX_PATH_RES_IPP && acquired_cnt == 1) {
csid_acquire.node_res = NULL;
csid_acquire.res_type = CAM_ISP_RESOURCE_CID;
@ -1861,11 +1839,6 @@ acquire_successful:
CAM_DBG(CAM_ISP, "CID right acquired success is_dual %d",
in_port->usage_type);
}
cid_res_temp->parent = &ife_ctx->res_list_ife_in;
ife_ctx->res_list_ife_in.child[
ife_ctx->res_list_ife_in.num_children++] = cid_res_temp;
CAM_DBG(CAM_ISP, "IFE IN num_children = %d",
ife_ctx->res_list_ife_in.num_children);
return 0;
put_res:
@ -1886,8 +1859,8 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
int master_idx = -1;
struct cam_ife_hw_mgr *ife_hw_mgr;
struct cam_ife_hw_mgr_res *csid_res;
struct cam_ife_hw_mgr_res *cid_res;
struct cam_isp_hw_mgr_res *csid_res;
struct cam_isp_hw_mgr_res *cid_res;
struct cam_hw_intf *hw_intf;
struct cam_csid_hw_reserve_resource_args csid_acquire;
enum cam_ife_pix_path_res_id path_res_id;
@ -1913,22 +1886,21 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
goto end;
}
csid_res->res_type =
(enum cam_ife_hw_mgr_res_type)CAM_ISP_RESOURCE_PIX_PATH;
csid_res->res_type = CAM_ISP_RESOURCE_PIX_PATH;
csid_res->res_id = path_res_id;
if (in_port->usage_type && is_ipp)
csid_res->is_dual_vfe = 1;
csid_res->is_dual_isp = 1;
else {
csid_res->is_dual_vfe = 0;
csid_res->is_dual_isp = 0;
csid_acquire.sync_mode = CAM_ISP_HW_SYNC_NONE;
}
CAM_DBG(CAM_ISP, "CSID Acq: E");
/* IPP resource needs to be from same HW as CID resource */
for (i = 0; i <= csid_res->is_dual_vfe; i++) {
CAM_DBG(CAM_ISP, "i %d is_dual %d", i, csid_res->is_dual_vfe);
for (i = 0; i <= csid_res->is_dual_isp; i++) {
CAM_DBG(CAM_ISP, "i %d is_dual %d", i, csid_res->is_dual_isp);
csid_acquire.res_type = CAM_ISP_RESOURCE_PIX_PATH;
csid_acquire.res_id = path_res_id;
@ -1941,7 +1913,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
hw_intf = cid_res->hw_res[i]->hw_intf;
if (csid_res->is_dual_vfe) {
if (csid_res->is_dual_isp) {
if (i == CAM_ISP_HW_SPLIT_LEFT) {
master_idx = hw_intf->hw_idx;
csid_acquire.sync_mode =
@ -1974,12 +1946,11 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
(is_ipp) ? "IPP" : "PPP");
}
cam_ife_hw_mgr_put_res(&ife_ctx->res_list_ife_csid, &csid_res);
csid_res->parent = cid_res;
cid_res->child[cid_res->num_children++] = csid_res;
cid_res->num_children++;
CAM_DBG(CAM_ISP, "acquire res %d CID children = %d",
csid_acquire.res_id, cid_res->num_children);
return 0;
put_res:
cam_ife_hw_mgr_put_res(&ife_ctx->free_res_list, &csid_res);
@ -2025,11 +1996,11 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_rdi(
int rc = -EINVAL;
int i;
struct cam_ife_hw_mgr *ife_hw_mgr;
struct cam_ife_hw_mgr_res *csid_res;
struct cam_ife_hw_mgr_res *cid_res;
struct cam_hw_intf *hw_intf;
struct cam_isp_out_port_generic_info *out_port;
struct cam_ife_hw_mgr *ife_hw_mgr;
struct cam_isp_hw_mgr_res *csid_res;
struct cam_isp_hw_mgr_res *cid_res;
struct cam_hw_intf *hw_intf;
struct cam_isp_out_port_generic_info *out_port;
struct cam_csid_hw_reserve_resource_args csid_acquire;
enum cam_ife_pix_path_res_id path_res_id;
@ -2096,19 +2067,13 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_rdi(
goto put_res;
}
csid_res->res_type = (enum cam_ife_hw_mgr_res_type)
CAM_ISP_RESOURCE_PIX_PATH;
csid_res->res_type = CAM_ISP_RESOURCE_PIX_PATH;
csid_res->res_id = csid_acquire.res_id;
csid_res->is_dual_vfe = 0;
csid_res->is_dual_isp = 0;
csid_res->hw_res[0] = csid_acquire.node_res;
csid_res->hw_res[1] = NULL;
csid_res->parent = cid_res;
cid_res->child[cid_res->num_children++] =
csid_res;
CAM_DBG(CAM_ISP, "acquire res %d CID children = %d",
csid_acquire.res_id, cid_res->num_children);
cam_ife_hw_mgr_put_res(&ife_ctx->res_list_ife_csid, &csid_res);
cid_res->num_children++;
}
return 0;
@ -2124,11 +2089,11 @@ static int cam_ife_hw_mgr_acquire_res_root(
{
int rc = -1;
if (ife_ctx->res_list_ife_in.res_type == CAM_IFE_HW_MGR_RES_UNINIT) {
if (ife_ctx->res_list_ife_in.res_type == CAM_ISP_RESOURCE_UNINT) {
/* first acquire */
ife_ctx->res_list_ife_in.res_type = CAM_IFE_HW_MGR_RES_ROOT;
ife_ctx->res_list_ife_in.res_type = CAM_ISP_RESOURCE_SRC;
ife_ctx->res_list_ife_in.res_id = in_port->res_type;
ife_ctx->res_list_ife_in.is_dual_vfe = in_port->usage_type;
ife_ctx->res_list_ife_in.is_dual_isp = in_port->usage_type;
} else if ((ife_ctx->res_list_ife_in.res_id !=
in_port->res_type) && (!ife_ctx->is_fe_enable)) {
CAM_ERR(CAM_ISP, "No Free resource for this context");
@ -2318,7 +2283,7 @@ static int cam_ife_mgr_acquire_hw_for_ctx(
uint32_t *acquired_hw_id, uint32_t *acquired_hw_path)
{
int rc = -1;
int is_dual_vfe = 0;
int is_dual_isp = 0;
int ipp_count = 0;
int rdi_count = 0;
int ppp_count = 0;
@ -2326,12 +2291,11 @@ static int cam_ife_mgr_acquire_hw_for_ctx(
int lcr_count = 0;
bool crop_enable = true;
is_dual_vfe = in_port->usage_type;
is_dual_isp = in_port->usage_type;
/* get root node resource */
rc = cam_ife_hw_mgr_acquire_res_root(ife_ctx, in_port);
if (rc) {
CAM_ERR(CAM_ISP, "Can not acquire csid rx resource");
CAM_ERR(CAM_ISP, "Can not acquire root resource");
goto err;
}
@ -2444,7 +2408,7 @@ void cam_ife_cam_cdm_callback(uint32_t handle, void *userdata,
}
hw_update_data = (struct cam_isp_prepare_hw_update_data *)userdata;
ctx = (struct cam_ife_hw_mgr_ctx *)hw_update_data->ife_mgr_ctx;
ctx = (struct cam_ife_hw_mgr_ctx *)hw_update_data->isp_mgr_ctx;
if (status == CAM_CDM_CB_STATUS_BL_SUCCESS) {
complete_all(&ctx->config_done_complete);
@ -3104,7 +3068,7 @@ static const char *cam_isp_util_usage_data_to_string(
}
static int cam_isp_classify_vote_info(
struct cam_ife_hw_mgr_res *hw_mgr_res,
struct cam_isp_hw_mgr_res *hw_mgr_res,
struct cam_isp_bw_config_v2 *bw_config,
struct cam_axi_vote *isp_vote,
uint32_t split_idx,
@ -3201,7 +3165,7 @@ static int cam_isp_blob_bw_update_v2(
struct cam_isp_bw_config_v2 *bw_config,
struct cam_ife_hw_mgr_ctx *ctx)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_vfe_bw_update_args_v2 bw_upd_args;
int rc = -EINVAL;
@ -3268,7 +3232,7 @@ static int cam_isp_blob_bw_update(
struct cam_isp_bw_config *bw_config,
struct cam_ife_hw_mgr_ctx *ctx)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_vfe_bw_update_args bw_upd_args;
uint64_t cam_bw_bps = 0;
@ -3401,7 +3365,7 @@ static int cam_ife_mgr_config_hw(void *hw_mgr_priv,
}
hw_update_data = (struct cam_isp_prepare_hw_update_data *) cfg->priv;
hw_update_data->ife_mgr_ctx = ctx;
hw_update_data->isp_mgr_ctx = ctx;
CAM_DBG(CAM_ISP, "Ctx[%pK][%d] : Applying Req %lld, init_packet=%d",
ctx, ctx->ctx_index, cfg->request_id, cfg->init_packet);
@ -3511,7 +3475,7 @@ static int cam_ife_mgr_stop_hw_in_overflow(void *stop_hw_args)
{
int rc = 0;
struct cam_hw_stop_args *stop_args = stop_hw_args;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_ife_hw_mgr_ctx *ctx;
uint32_t i, master_base_idx = 0;
@ -3596,7 +3560,7 @@ static int cam_ife_mgr_stop_hw_in_overflow(void *stop_hw_args)
static int cam_ife_mgr_bw_control(struct cam_ife_hw_mgr_ctx *ctx,
enum cam_vfe_bw_control_action action)
{
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_vfe_bw_control_args bw_ctrl_args;
int rc = -EINVAL;
@ -3641,7 +3605,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
int rc = 0;
struct cam_hw_stop_args *stop_args = stop_hw_args;
struct cam_isp_stop_args *stop_isp;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_ife_hw_mgr_ctx *ctx;
enum cam_ife_csid_halt_cmd csid_halt_type;
uint32_t i, master_base_idx = 0;
@ -3804,7 +3768,7 @@ static int cam_ife_mgr_restart_hw(void *start_hw_args)
int rc = -1;
struct cam_hw_start_args *start_args = start_hw_args;
struct cam_ife_hw_mgr_ctx *ctx;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
uint32_t i;
if (!start_hw_args) {
@ -3883,7 +3847,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
struct cam_hw_stop_args stop_args;
struct cam_isp_stop_args stop_isp;
struct cam_ife_hw_mgr_ctx *ctx;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_isp_resource_node *rsrc_node = NULL;
uint32_t i, camif_debug;
bool res_rdi_context_set = false;
@ -4122,7 +4086,7 @@ static int cam_ife_mgr_reset(void *hw_mgr_priv, void *hw_reset_args)
struct cam_ife_hw_mgr *hw_mgr = hw_mgr_priv;
struct cam_hw_reset_args *reset_args = hw_reset_args;
struct cam_ife_hw_mgr_ctx *ctx;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
int rc = 0, i = 0;
if (!hw_mgr_priv || !hw_reset_args) {
@ -4223,7 +4187,7 @@ static int cam_isp_blob_fe_update(
struct cam_hw_prepare_update_args *prepare)
{
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
int rc = -EINVAL;
uint32_t i;
@ -4297,7 +4261,7 @@ static int cam_isp_blob_ubwc_update(
struct cam_ubwc_plane_cfg_v1 *ubwc_plane_cfg;
struct cam_kmd_buf_info *kmd_buf_info;
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
uint32_t res_id_out, i;
uint32_t total_used_bytes = 0;
uint32_t kmd_buf_remain_size;
@ -4468,7 +4432,7 @@ static int cam_isp_blob_ubwc_update_v2(
struct cam_ubwc_plane_cfg_v2 *ubwc_plane_cfg;
struct cam_kmd_buf_info *kmd_buf_info;
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
uint32_t res_id_out, i;
uint32_t total_used_bytes = 0;
uint32_t kmd_buf_remain_size;
@ -4586,7 +4550,7 @@ static int cam_isp_blob_hfr_update(
struct cam_isp_port_hfr_config *port_hfr_config;
struct cam_kmd_buf_info *kmd_buf_info;
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
uint32_t res_id_out, i;
uint32_t total_used_bytes = 0;
uint32_t kmd_buf_remain_size;
@ -4682,7 +4646,7 @@ static int cam_isp_blob_csid_clock_update(
struct cam_hw_prepare_update_args *prepare)
{
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_ife_csid_clock_update_args csid_clock_upd_args;
uint64_t clk_rate = 0;
@ -4729,7 +4693,7 @@ static int cam_isp_blob_csid_qcfa_update(
struct cam_hw_prepare_update_args *prepare)
{
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_ife_csid_qcfa_update_args csid_qcfa_upd_args;
int rc = -EINVAL;
@ -4777,7 +4741,7 @@ static int cam_isp_blob_core_cfg_update(
struct cam_hw_prepare_update_args *prepare)
{
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
uint64_t clk_rate = 0;
int rc = 0, i;
@ -4825,7 +4789,7 @@ static int cam_isp_blob_clock_update(
struct cam_hw_prepare_update_args *prepare)
{
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_vfe_clock_update_args clock_upd_args;
uint64_t clk_rate = 0;
@ -4937,7 +4901,7 @@ static int cam_isp_blob_vfe_out_update(
struct cam_isp_vfe_wm_config *wm_config;
struct cam_kmd_buf_info *kmd_buf_info;
struct cam_ife_hw_mgr_ctx *ctx = NULL;
struct cam_ife_hw_mgr_res *ife_out_res;
struct cam_isp_hw_mgr_res *ife_out_res;
uint32_t res_id_out, i;
uint32_t total_used_bytes = 0;
uint32_t kmd_buf_remain_size;
@ -5677,7 +5641,7 @@ static int cam_ife_mgr_sof_irq_debug(
{
int rc = 0;
uint32_t i = 0;
struct cam_ife_hw_mgr_res *hw_mgr_res = NULL;
struct cam_isp_hw_mgr_res *hw_mgr_res = NULL;
struct cam_hw_intf *hw_intf = NULL;
struct cam_isp_resource_node *rsrc_node = NULL;
@ -5913,12 +5877,12 @@ static int cam_ife_mgr_cmd_get_sof_timestamp(
{
int rc = -EINVAL;
uint32_t i;
struct cam_ife_hw_mgr_res *hw_mgr_res;
struct cam_isp_hw_mgr_res *hw_mgr_res;
struct cam_hw_intf *hw_intf;
struct cam_csid_get_time_stamp_args csid_get_time;
hw_mgr_res = list_first_entry(&ife_ctx->res_list_ife_csid,
struct cam_ife_hw_mgr_res, list);
struct cam_isp_hw_mgr_res, list);
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
if (!hw_mgr_res->hw_res[i])
@ -5966,12 +5930,12 @@ static int cam_ife_mgr_cmd_get_sof_timestamp(
static int cam_ife_mgr_process_recovery_cb(void *priv, void *data)
{
int32_t rc = 0;
struct cam_hw_event_recovery_data *recovery_data = data;
struct cam_hw_start_args start_args;
struct cam_hw_stop_args stop_args;
struct cam_ife_hw_mgr *ife_hw_mgr = priv;
struct cam_ife_hw_mgr_res *hw_mgr_res;
uint32_t i = 0;
struct cam_ife_hw_event_recovery_data *recovery_data = data;
struct cam_hw_start_args start_args;
struct cam_hw_stop_args stop_args;
struct cam_ife_hw_mgr *ife_hw_mgr = priv;
struct cam_isp_hw_mgr_res *hw_mgr_res;
uint32_t i = 0;
uint32_t error_type = recovery_data->error_type;
struct cam_ife_hw_mgr_ctx *ctx = NULL;
@ -6058,20 +6022,17 @@ static int cam_ife_mgr_process_recovery_cb(void *priv, void *data)
}
static int cam_ife_hw_mgr_do_error_recovery(
struct cam_hw_event_recovery_data *ife_mgr_recovery_data)
struct cam_ife_hw_event_recovery_data *ife_mgr_recovery_data)
{
int32_t rc = 0;
struct crm_workq_task *task = NULL;
struct cam_hw_event_recovery_data *recovery_data = NULL;
int32_t rc = 0;
struct crm_workq_task *task = NULL;
struct cam_ife_hw_event_recovery_data *recovery_data = NULL;
recovery_data = kzalloc(sizeof(struct cam_hw_event_recovery_data),
GFP_ATOMIC);
recovery_data = kmemdup(ife_mgr_recovery_data,
sizeof(struct cam_ife_hw_event_recovery_data), GFP_ATOMIC);
if (!recovery_data)
return -ENOMEM;
memcpy(recovery_data, ife_mgr_recovery_data,
sizeof(struct cam_hw_event_recovery_data));
CAM_DBG(CAM_ISP, "Enter: error_type (%d)", recovery_data->error_type);
task = cam_req_mgr_workq_get_task(g_ife_hw_mgr.workq);
@ -6143,9 +6104,9 @@ static bool cam_ife_hw_mgr_is_ctx_affected(
* b. Notify CTX with fatal error
*/
static int cam_ife_hw_mgr_find_affected_ctx(
struct cam_isp_hw_error_event_data *error_event_data,
uint32_t curr_core_idx,
struct cam_hw_event_recovery_data *recovery_data)
struct cam_isp_hw_error_event_data *error_event_data,
uint32_t curr_core_idx,
struct cam_ife_hw_event_recovery_data *recovery_data)
{
uint32_t affected_core[CAM_IFE_HW_NUM_MAX] = {0};
struct cam_ife_hw_mgr_ctx *ife_hwr_mgr_ctx = NULL;
@ -6205,11 +6166,11 @@ static int cam_ife_hw_mgr_find_affected_ctx(
static int cam_ife_hw_mgr_handle_hw_err(
void *evt_info)
{
struct cam_isp_hw_event_info *event_info = evt_info;
struct cam_isp_hw_event_info *event_info = evt_info;
uint32_t core_idx;
struct cam_isp_hw_error_event_data error_event_data = {0};
struct cam_hw_event_recovery_data recovery_data = {0};
int rc = -EINVAL;
struct cam_isp_hw_error_event_data error_event_data = {0};
struct cam_ife_hw_event_recovery_data recovery_data = {0};
int rc = -EINVAL;
if (event_info->err_type == CAM_VFE_IRQ_STATUS_VIOLATION)
error_event_data.error_type = CAM_ISP_HW_ERROR_VIOLATION;
@ -6731,7 +6692,7 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
int i, j;
struct cam_iommu_handle cdm_handles;
struct cam_ife_hw_mgr_ctx *ctx_pool;
struct cam_ife_hw_mgr_res *res_list_ife_out;
struct cam_isp_hw_mgr_res *res_list_ife_out;
CAM_DBG(CAM_ISP, "Enter");

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_IFE_HW_MGR_H_
@ -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
*
@ -151,20 +94,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;
@ -225,6 +168,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()
*

View file

@ -1,13 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_ISP_HW_MGR_H_
#define _CAM_ISP_HW_MGR_H_
#include <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
*
* @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
* @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 resource, 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 resource 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_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_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
*
* @idx: Base resource index
* @split_id: Split info for the base resource
*
*/
struct cam_isp_ctx_base_info {
uint32_t idx;
enum cam_isp_hw_split_id split_id;
};
#endif /* _CAM_ISP_HW_MGR_H_ */

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#include <media/cam_defs.h>
@ -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 @@ end:
}
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,
CAM_ISP_HW_CMD_GET_SECURE_MODE,
&mode,
sizeof(bool)))
rc = res->hw_intf->hw_ops.process_cmd(
res->hw_intf->hw_priv,
CAM_ISP_HW_CMD_GET_SECURE_MODE,
&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,
CAM_ISP_HW_CMD_GET_SECURE_MODE,
&mode,
sizeof(bool)))
rc = res->hw_intf->hw_ops.process_cmd(
res->hw_intf->hw_priv,
CAM_ISP_HW_CMD_GET_SECURE_MODE,
&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++) {

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_ISP_HW_PARSER_H_
@ -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);

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_ISP_HW_MGR_INTF_H_
@ -115,7 +115,7 @@ struct cam_isp_bw_config_internal {
/**
* struct cam_isp_prepare_hw_update_data - hw prepare data
*
* @ife_mgr_ctx: IFE HW manager Context for current request
* @isp_mgr_ctx: ISP HW manager Context for current request
* @packet_opcode_type: Packet header opcode in the packet header
* this opcode defines, packet is init packet or
* update packet
@ -129,7 +129,7 @@ struct cam_isp_bw_config_internal {
*
*/
struct cam_isp_prepare_hw_update_data {
struct cam_ife_hw_mgr_ctx *ife_mgr_ctx;
void *isp_mgr_ctx;
uint32_t packet_opcode_type;
uint32_t bw_config_version;
struct cam_isp_bw_config_internal bw_config[CAM_IFE_HW_NUM_MAX];

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_ISP_HW_H_
@ -224,13 +224,6 @@ struct cam_isp_hw_get_cmd_update {
void *data;
struct cam_isp_hw_get_wm_update *wm_update;
struct cam_isp_hw_get_wm_update *rm_update;
struct cam_isp_port_hfr_config *hfr_update;
struct cam_isp_clock_config *clock_update;
struct cam_isp_bw_config *bw_update;
struct cam_ubwc_plane_cfg_v1 *ubwc_update;
struct cam_fe_config *fe_update;
struct cam_vfe_generic_ubwc_config *ubwc_config;
struct cam_isp_vfe_wm_config *wm_config;
};
};

View file

@ -606,6 +606,7 @@ int cam_vfe_process_cmd(void *hw_priv, uint32_t cmd_type,
case CAM_ISP_HW_CMD_UBWC_UPDATE:
case CAM_ISP_HW_CMD_UBWC_UPDATE_V2:
case CAM_ISP_HW_CMD_WM_CONFIG_UPDATE:
case CAM_ISP_HW_CMD_GET_SECURE_MODE:
rc = core_info->vfe_bus->hw_ops.process_cmd(
core_info->vfe_bus->bus_priv, cmd_type, cmd_args,
arg_size);

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/ratelimit.h>
@ -3004,7 +3004,7 @@ static int cam_vfe_bus_update_hfr(void *priv, void *cmd_args,
}
reg_val_pair = &vfe_out_data->common_data->io_buf_update[0];
hfr_cfg = update_hfr->hfr_update;
hfr_cfg = (struct cam_isp_port_hfr_config *)update_hfr->data;
for (i = 0, j = 0; i < vfe_out_data->num_wm; i++) {
if (j >= (MAX_REG_VAL_PAIR_SIZE - MAX_BUF_UPDATE_REG_NUM * 2)) {
@ -3116,7 +3116,7 @@ static int cam_vfe_bus_update_ubwc_config(void *cmd_args)
goto end;
}
ubwc_plane_cfg = update_ubwc->ubwc_update;
ubwc_plane_cfg = (struct cam_ubwc_plane_cfg_v1 *)update_ubwc->data;
for (i = 0; i < vfe_out_data->num_wm; i++) {
@ -3226,7 +3226,8 @@ static int cam_vfe_bus_update_ubwc_config_v2(void *cmd_args)
goto end;
}
ubwc_generic_cfg = update_ubwc->ubwc_config;
ubwc_generic_cfg = (struct cam_vfe_generic_ubwc_config *)
update_ubwc->data;
for (i = 0; i < vfe_out_data->num_wm; i++) {

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*/
@ -3202,7 +3202,7 @@ static int cam_vfe_bus_ver3_update_hfr(void *priv, void *cmd_args,
}
reg_val_pair = &vfe_out_data->common_data->io_buf_update[0];
hfr_cfg = update_hfr->hfr_update;
hfr_cfg = (struct cam_isp_port_hfr_config *)update_hfr->data;
for (i = 0, j = 0; i < vfe_out_data->num_wm; i++) {
if (j >= (MAX_REG_VAL_PAIR_SIZE - MAX_BUF_UPDATE_REG_NUM * 2)) {
@ -3317,7 +3317,8 @@ static int cam_vfe_bus_ver3_update_ubwc_config_v2(void *cmd_args)
goto end;
}
ubwc_generic_cfg = update_ubwc->ubwc_config;
ubwc_generic_cfg = (struct cam_vfe_generic_ubwc_config *)
update_ubwc->data;
for (i = 0; i < vfe_out_data->num_wm; i++) {
@ -3485,7 +3486,8 @@ static int cam_vfe_bus_ver3_update_wm_config(
wm_config_update = cmd_args;
vfe_out_data = wm_config_update->res->res_priv;
wm_config = wm_config_update->wm_config;
wm_config = (struct cam_isp_vfe_wm_config *)
wm_config_update->data;
if (!vfe_out_data || !vfe_out_data->cdm_util_ops || !wm_config) {
CAM_ERR(CAM_ISP, "Invalid data");