Loading drivers/cam_core/cam_node.c +3 −2 Original line number Diff line number Diff line Loading @@ -96,8 +96,9 @@ static int __cam_node_handle_acquire_dev(struct cam_node *node, ctx = cam_node_get_ctxt_from_free_list(node); if (!ctx) { CAM_ERR(CAM_CORE, "No free ctx in free list node %s", node->name); CAM_ERR(CAM_CORE, "No free ctx in free list node %s with size:%d", node->name, node->ctx_size); cam_node_print_ctx_state(node); rc = -ENOMEM; Loading drivers/cam_isp/cam_isp_dev.c +46 −14 Original line number Diff line number Diff line // 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 <linux/delay.h> Loading Loading @@ -95,13 +95,17 @@ static int cam_isp_dev_remove(struct platform_device *pdev) int rc = 0; int i; /* clean up resources */ for (i = 0; i < CAM_CTX_MAX; i++) { /* clean up ife/tfe resources */ for (i = 0; i < g_isp_dev.max_context; i++) { rc = cam_isp_context_deinit(&g_isp_dev.ctx_isp[i]); if (rc) CAM_ERR(CAM_ISP, "ISP context %d deinit failed", i); } kfree(g_isp_dev.ctx); g_isp_dev.ctx = NULL; kfree(g_isp_dev.ctx_isp); g_isp_dev.ctx_isp = NULL; rc = cam_subdev_remove(&g_isp_dev.sd); if (rc) Loading @@ -118,7 +122,6 @@ static int cam_isp_dev_probe(struct platform_device *pdev) struct cam_hw_mgr_intf hw_mgr_intf; struct cam_node *node; const char *compat_str = NULL; uint32_t isp_device_type; int iommu_hdl = -1; Loading @@ -130,11 +133,13 @@ static int cam_isp_dev_probe(struct platform_device *pdev) if (strnstr(compat_str, "ife", strlen(compat_str))) { rc = cam_subdev_probe(&g_isp_dev.sd, pdev, CAM_ISP_DEV_NAME, CAM_IFE_DEVICE_TYPE); isp_device_type = CAM_IFE_DEVICE_TYPE; g_isp_dev.isp_device_type = CAM_IFE_DEVICE_TYPE; g_isp_dev.max_context = CAM_IFE_CTX_MAX; } else if (strnstr(compat_str, "tfe", strlen(compat_str))) { rc = cam_subdev_probe(&g_isp_dev.sd, pdev, CAM_ISP_DEV_NAME, CAM_TFE_DEVICE_TYPE); isp_device_type = CAM_TFE_DEVICE_TYPE; g_isp_dev.isp_device_type = CAM_TFE_DEVICE_TYPE; g_isp_dev.max_context = CAM_TFE_CTX_MAX; } else { CAM_ERR(CAM_ISP, "Invalid ISP hw type %s", compat_str); rc = -EINVAL; Loading @@ -148,30 +153,50 @@ static int cam_isp_dev_probe(struct platform_device *pdev) node = (struct cam_node *) g_isp_dev.sd.token; memset(&hw_mgr_intf, 0, sizeof(hw_mgr_intf)); g_isp_dev.ctx = kcalloc(g_isp_dev.max_context, sizeof(struct cam_context), GFP_KERNEL); if (!g_isp_dev.ctx) { CAM_ERR(CAM_ISP, "Mem Allocation failed for ISP base context"); goto unregister; } g_isp_dev.ctx_isp = kcalloc(g_isp_dev.max_context, sizeof(struct cam_isp_context), GFP_KERNEL); if (!g_isp_dev.ctx_isp) { CAM_ERR(CAM_ISP, "Mem Allocation failed for Isp private context"); kfree(g_isp_dev.ctx); g_isp_dev.ctx = NULL; goto unregister; } rc = cam_isp_hw_mgr_init(compat_str, &hw_mgr_intf, &iommu_hdl); if (rc != 0) { CAM_ERR(CAM_ISP, "Can not initialized ISP HW manager!"); goto unregister; goto kfree; } for (i = 0; i < CAM_CTX_MAX; i++) { for (i = 0; i < g_isp_dev.max_context; i++) { rc = cam_isp_context_init(&g_isp_dev.ctx_isp[i], &g_isp_dev.ctx[i], &node->crm_node_intf, &node->hw_mgr_intf, i, isp_device_type); g_isp_dev.isp_device_type); if (rc) { CAM_ERR(CAM_ISP, "ISP context init failed!"); goto unregister; goto kfree; } } rc = cam_node_init(node, &hw_mgr_intf, g_isp_dev.ctx, g_isp_dev.max_context, CAM_ISP_DEV_NAME); rc = cam_node_init(node, &hw_mgr_intf, g_isp_dev.ctx, CAM_CTX_MAX, CAM_ISP_DEV_NAME); if (rc) { CAM_ERR(CAM_ISP, "ISP node init failed!"); goto unregister; goto kfree; } cam_smmu_set_client_page_fault_handler(iommu_hdl, Loading @@ -182,6 +207,13 @@ static int cam_isp_dev_probe(struct platform_device *pdev) CAM_INFO(CAM_ISP, "Camera ISP probe complete"); return 0; kfree: kfree(g_isp_dev.ctx); g_isp_dev.ctx = NULL; kfree(g_isp_dev.ctx_isp); g_isp_dev.ctx_isp = NULL; unregister: rc = cam_subdev_remove(&g_isp_dev.sd); err: Loading drivers/cam_isp/cam_isp_dev.h +7 −3 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #ifndef _CAM_ISP_DEV_H_ Loading @@ -19,13 +19,17 @@ * @ctx_isp: Isp private context storage * @isp_mutex: ISP dev mutex * @open_cnt: Open device count * @isp_device_type ISP device type * @max_context maximum contexts for TFE is 4 and for IFE is 8 */ struct cam_isp_dev { struct cam_subdev sd; struct cam_context ctx[CAM_CTX_MAX]; struct cam_isp_context ctx_isp[CAM_CTX_MAX]; struct cam_context *ctx; struct cam_isp_context *ctx_isp; struct mutex isp_mutex; int32_t open_cnt; uint32_t isp_device_type; int32_t max_context; }; #endif /* __CAM_ISP_DEV_H__ */ drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +3 −3 Original line number Diff line number Diff line Loading @@ -6369,7 +6369,7 @@ static int cam_ife_hw_mgr_find_affected_ctx( /* Add affected_context in list of recovery data */ CAM_DBG(CAM_ISP, "Add affected ctx %d to list", ife_hwr_mgr_ctx->ctx_index); if (recovery_data->no_of_context < CAM_CTX_MAX) if (recovery_data->no_of_context < CAM_IFE_CTX_MAX) recovery_data->affected_ctx[ recovery_data->no_of_context++] = ife_hwr_mgr_ctx; Loading Loading @@ -7004,7 +7004,7 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) } atomic_set(&g_ife_hw_mgr.active_ctx_cnt, 0); for (i = 0; i < CAM_CTX_MAX; i++) { for (i = 0; i < CAM_IFE_CTX_MAX; i++) { memset(&g_ife_hw_mgr.ctx_pool[i], 0, sizeof(g_ife_hw_mgr.ctx_pool[i])); INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].list); Loading Loading @@ -7086,7 +7086,7 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) return 0; end: if (rc) { for (i = 0; i < CAM_CTX_MAX; i++) { for (i = 0; i < CAM_IFE_CTX_MAX; i++) { cam_tasklet_deinit( &g_ife_hw_mgr.mgr_common.tasklet_pool[i]); kfree(g_ife_hw_mgr.ctx_pool[i].cdm_cmd); Loading drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h +2 −2 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ struct cam_ife_hw_mgr { atomic_t active_ctx_cnt; struct list_head free_ctx_list; struct list_head used_ctx_list; struct cam_ife_hw_mgr_ctx ctx_pool[CAM_CTX_MAX]; struct cam_ife_hw_mgr_ctx ctx_pool[CAM_IFE_CTX_MAX]; struct cam_ife_csid_hw_caps ife_csid_dev_caps[ CAM_IFE_CSID_HW_NUM_MAX]; Loading @@ -180,7 +180,7 @@ struct cam_ife_hw_mgr { 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]; struct cam_ife_hw_mgr_ctx *affected_ctx[CAM_IFE_CTX_MAX]; uint32_t no_of_context; }; Loading Loading
drivers/cam_core/cam_node.c +3 −2 Original line number Diff line number Diff line Loading @@ -96,8 +96,9 @@ static int __cam_node_handle_acquire_dev(struct cam_node *node, ctx = cam_node_get_ctxt_from_free_list(node); if (!ctx) { CAM_ERR(CAM_CORE, "No free ctx in free list node %s", node->name); CAM_ERR(CAM_CORE, "No free ctx in free list node %s with size:%d", node->name, node->ctx_size); cam_node_print_ctx_state(node); rc = -ENOMEM; Loading
drivers/cam_isp/cam_isp_dev.c +46 −14 Original line number Diff line number Diff line // 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 <linux/delay.h> Loading Loading @@ -95,13 +95,17 @@ static int cam_isp_dev_remove(struct platform_device *pdev) int rc = 0; int i; /* clean up resources */ for (i = 0; i < CAM_CTX_MAX; i++) { /* clean up ife/tfe resources */ for (i = 0; i < g_isp_dev.max_context; i++) { rc = cam_isp_context_deinit(&g_isp_dev.ctx_isp[i]); if (rc) CAM_ERR(CAM_ISP, "ISP context %d deinit failed", i); } kfree(g_isp_dev.ctx); g_isp_dev.ctx = NULL; kfree(g_isp_dev.ctx_isp); g_isp_dev.ctx_isp = NULL; rc = cam_subdev_remove(&g_isp_dev.sd); if (rc) Loading @@ -118,7 +122,6 @@ static int cam_isp_dev_probe(struct platform_device *pdev) struct cam_hw_mgr_intf hw_mgr_intf; struct cam_node *node; const char *compat_str = NULL; uint32_t isp_device_type; int iommu_hdl = -1; Loading @@ -130,11 +133,13 @@ static int cam_isp_dev_probe(struct platform_device *pdev) if (strnstr(compat_str, "ife", strlen(compat_str))) { rc = cam_subdev_probe(&g_isp_dev.sd, pdev, CAM_ISP_DEV_NAME, CAM_IFE_DEVICE_TYPE); isp_device_type = CAM_IFE_DEVICE_TYPE; g_isp_dev.isp_device_type = CAM_IFE_DEVICE_TYPE; g_isp_dev.max_context = CAM_IFE_CTX_MAX; } else if (strnstr(compat_str, "tfe", strlen(compat_str))) { rc = cam_subdev_probe(&g_isp_dev.sd, pdev, CAM_ISP_DEV_NAME, CAM_TFE_DEVICE_TYPE); isp_device_type = CAM_TFE_DEVICE_TYPE; g_isp_dev.isp_device_type = CAM_TFE_DEVICE_TYPE; g_isp_dev.max_context = CAM_TFE_CTX_MAX; } else { CAM_ERR(CAM_ISP, "Invalid ISP hw type %s", compat_str); rc = -EINVAL; Loading @@ -148,30 +153,50 @@ static int cam_isp_dev_probe(struct platform_device *pdev) node = (struct cam_node *) g_isp_dev.sd.token; memset(&hw_mgr_intf, 0, sizeof(hw_mgr_intf)); g_isp_dev.ctx = kcalloc(g_isp_dev.max_context, sizeof(struct cam_context), GFP_KERNEL); if (!g_isp_dev.ctx) { CAM_ERR(CAM_ISP, "Mem Allocation failed for ISP base context"); goto unregister; } g_isp_dev.ctx_isp = kcalloc(g_isp_dev.max_context, sizeof(struct cam_isp_context), GFP_KERNEL); if (!g_isp_dev.ctx_isp) { CAM_ERR(CAM_ISP, "Mem Allocation failed for Isp private context"); kfree(g_isp_dev.ctx); g_isp_dev.ctx = NULL; goto unregister; } rc = cam_isp_hw_mgr_init(compat_str, &hw_mgr_intf, &iommu_hdl); if (rc != 0) { CAM_ERR(CAM_ISP, "Can not initialized ISP HW manager!"); goto unregister; goto kfree; } for (i = 0; i < CAM_CTX_MAX; i++) { for (i = 0; i < g_isp_dev.max_context; i++) { rc = cam_isp_context_init(&g_isp_dev.ctx_isp[i], &g_isp_dev.ctx[i], &node->crm_node_intf, &node->hw_mgr_intf, i, isp_device_type); g_isp_dev.isp_device_type); if (rc) { CAM_ERR(CAM_ISP, "ISP context init failed!"); goto unregister; goto kfree; } } rc = cam_node_init(node, &hw_mgr_intf, g_isp_dev.ctx, g_isp_dev.max_context, CAM_ISP_DEV_NAME); rc = cam_node_init(node, &hw_mgr_intf, g_isp_dev.ctx, CAM_CTX_MAX, CAM_ISP_DEV_NAME); if (rc) { CAM_ERR(CAM_ISP, "ISP node init failed!"); goto unregister; goto kfree; } cam_smmu_set_client_page_fault_handler(iommu_hdl, Loading @@ -182,6 +207,13 @@ static int cam_isp_dev_probe(struct platform_device *pdev) CAM_INFO(CAM_ISP, "Camera ISP probe complete"); return 0; kfree: kfree(g_isp_dev.ctx); g_isp_dev.ctx = NULL; kfree(g_isp_dev.ctx_isp); g_isp_dev.ctx_isp = NULL; unregister: rc = cam_subdev_remove(&g_isp_dev.sd); err: Loading
drivers/cam_isp/cam_isp_dev.h +7 −3 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #ifndef _CAM_ISP_DEV_H_ Loading @@ -19,13 +19,17 @@ * @ctx_isp: Isp private context storage * @isp_mutex: ISP dev mutex * @open_cnt: Open device count * @isp_device_type ISP device type * @max_context maximum contexts for TFE is 4 and for IFE is 8 */ struct cam_isp_dev { struct cam_subdev sd; struct cam_context ctx[CAM_CTX_MAX]; struct cam_isp_context ctx_isp[CAM_CTX_MAX]; struct cam_context *ctx; struct cam_isp_context *ctx_isp; struct mutex isp_mutex; int32_t open_cnt; uint32_t isp_device_type; int32_t max_context; }; #endif /* __CAM_ISP_DEV_H__ */
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +3 −3 Original line number Diff line number Diff line Loading @@ -6369,7 +6369,7 @@ static int cam_ife_hw_mgr_find_affected_ctx( /* Add affected_context in list of recovery data */ CAM_DBG(CAM_ISP, "Add affected ctx %d to list", ife_hwr_mgr_ctx->ctx_index); if (recovery_data->no_of_context < CAM_CTX_MAX) if (recovery_data->no_of_context < CAM_IFE_CTX_MAX) recovery_data->affected_ctx[ recovery_data->no_of_context++] = ife_hwr_mgr_ctx; Loading Loading @@ -7004,7 +7004,7 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) } atomic_set(&g_ife_hw_mgr.active_ctx_cnt, 0); for (i = 0; i < CAM_CTX_MAX; i++) { for (i = 0; i < CAM_IFE_CTX_MAX; i++) { memset(&g_ife_hw_mgr.ctx_pool[i], 0, sizeof(g_ife_hw_mgr.ctx_pool[i])); INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].list); Loading Loading @@ -7086,7 +7086,7 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) return 0; end: if (rc) { for (i = 0; i < CAM_CTX_MAX; i++) { for (i = 0; i < CAM_IFE_CTX_MAX; i++) { cam_tasklet_deinit( &g_ife_hw_mgr.mgr_common.tasklet_pool[i]); kfree(g_ife_hw_mgr.ctx_pool[i].cdm_cmd); Loading
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h +2 −2 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ struct cam_ife_hw_mgr { atomic_t active_ctx_cnt; struct list_head free_ctx_list; struct list_head used_ctx_list; struct cam_ife_hw_mgr_ctx ctx_pool[CAM_CTX_MAX]; struct cam_ife_hw_mgr_ctx ctx_pool[CAM_IFE_CTX_MAX]; struct cam_ife_csid_hw_caps ife_csid_dev_caps[ CAM_IFE_CSID_HW_NUM_MAX]; Loading @@ -180,7 +180,7 @@ struct cam_ife_hw_mgr { 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]; struct cam_ife_hw_mgr_ctx *affected_ctx[CAM_IFE_CTX_MAX]; uint32_t no_of_context; }; Loading