Loading drivers/cam_core/cam_context.c +28 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,34 @@ int cam_context_handle_crm_apply_req(struct cam_context *ctx, return rc; } int cam_context_handle_crm_apply_default_req( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply) { int rc = 0; if (!ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } if (!apply) { CAM_ERR(CAM_CORE, "Invalid apply request payload"); return -EINVAL; } mutex_lock(&ctx->ctx_mutex); if (ctx->state_machine[ctx->state].crm_ops.apply_default) rc = ctx->state_machine[ctx->state].crm_ops.apply_default(ctx, apply); else CAM_DBG(CAM_CORE, "No crm apply_default in dev %d, state %d", ctx->dev_hdl, ctx->state); mutex_unlock(&ctx->ctx_mutex); return rc; } int cam_context_handle_crm_flush_req(struct cam_context *ctx, struct cam_req_mgr_flush_request *flush) { Loading drivers/cam_core/cam_context.h +15 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ struct cam_ctx_ioctl_ops { * @link: Link the context * @unlink: Unlink the context * @apply_req: Apply setting for the context * @apply_default: Apply default settings for the context * @flush_req: Flush request to remove request ids * @process_evt: Handle event notification from CRM.(optional) * @dump_req: Dump information for the issue request Loading @@ -135,6 +136,8 @@ struct cam_ctx_crm_ops { struct cam_req_mgr_core_dev_link_setup *unlink); int (*apply_req)(struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); int (*apply_default)(struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); int (*flush_req)(struct cam_context *ctx, struct cam_req_mgr_flush_request *flush); int (*process_evt)(struct cam_context *ctx, Loading Loading @@ -302,6 +305,18 @@ int cam_context_handle_crm_unlink(struct cam_context *ctx, int cam_context_handle_crm_apply_req(struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); /** * cam_context_handle_crm_apply_default_req() * * @brief: Handle apply default request command * * @ctx: Object pointer for cam_context * @apply: Apply default request command payload * */ int cam_context_handle_crm_apply_default_req( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); /** * cam_context_handle_crm_flush_req() * Loading drivers/cam_core/cam_node.c +21 −0 Original line number Diff line number Diff line Loading @@ -570,6 +570,26 @@ static int __cam_node_crm_apply_req(struct cam_req_mgr_apply_request *apply) return cam_context_handle_crm_apply_req(ctx, apply); } static int __cam_node_crm_apply_default_req( struct cam_req_mgr_apply_request *apply) { struct cam_context *ctx = NULL; if (!apply) return -EINVAL; ctx = (struct cam_context *) cam_get_device_priv(apply->dev_hdl); if (!ctx) { CAM_ERR(CAM_CORE, "Can not get context for handle %d", apply->dev_hdl); return -EINVAL; } trace_cam_apply_req("Node", apply->request_id); return cam_context_handle_crm_apply_default_req(ctx, apply); } static int __cam_node_crm_flush_req(struct cam_req_mgr_flush_request *flush) { struct cam_context *ctx = NULL; Loading Loading @@ -683,6 +703,7 @@ int cam_node_init(struct cam_node *node, struct cam_hw_mgr_intf *hw_mgr_intf, node->crm_node_intf.flush_req = __cam_node_crm_flush_req; node->crm_node_intf.process_evt = __cam_node_crm_process_evt; node->crm_node_intf.dump_req = __cam_node_crm_dump_req; node->crm_node_intf.apply_default = __cam_node_crm_apply_default_req; mutex_init(&node->list_mutex); INIT_LIST_HEAD(&node->free_ctx_list); Loading drivers/cam_cust/cam_custom_context.c +29 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ static int __cam_custom_ctx_get_dev_info_in_acquired(struct cam_context *ctx, dev_info->dev_id = CAM_REQ_MGR_DEVICE_CUSTOM_HW; dev_info->p_delay = 1; dev_info->trigger = CAM_TRIGGER_POINT_SOF; dev_info->enable_apply_default = true; return 0; } Loading Loading @@ -456,6 +457,32 @@ static int __cam_custom_release_dev_in_acquired(struct cam_context *ctx, return rc; } static int __cam_custom_ctx_apply_default_settings( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply) { int rc = 0; struct cam_custom_context *custom_ctx = (struct cam_custom_context *) ctx->ctx_priv; struct cam_hw_cmd_args hw_cmd_args; struct cam_custom_hw_cmd_args custom_hw_cmd_args; hw_cmd_args.ctxt_to_hw_map = custom_ctx->hw_ctx; hw_cmd_args.cmd_type = CAM_HW_MGR_CMD_INTERNAL; custom_hw_cmd_args.cmd_type = CAM_CUSTOM_HW_MGR_PROG_DEFAULT_CONFIG; hw_cmd_args.u.internal_args = (void *)&custom_hw_cmd_args; rc = ctx->hw_mgr_intf->hw_cmd(ctx->hw_mgr_intf->hw_mgr_priv, &hw_cmd_args); if (rc) CAM_ERR(CAM_CUSTOM, "Failed to apply default settings rc %d", rc); else CAM_DBG(CAM_CUSTOM, "Applied default settings rc %d", rc); return rc; } static int __cam_custom_ctx_apply_req_in_activated_state( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply) { Loading Loading @@ -1194,6 +1221,8 @@ static struct cam_ctx_ops .unlink = __cam_custom_ctx_unlink_in_activated, .apply_req = __cam_custom_ctx_apply_req_in_activated_state, .apply_default = __cam_custom_ctx_apply_default_settings, .flush_req = __cam_custom_ctx_flush_req_in_top_state, .process_evt = __cam_custom_ctx_process_evt, }, Loading drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.c +52 −0 Original line number Diff line number Diff line Loading @@ -1281,6 +1281,57 @@ static int cam_custom_hw_mgr_irq_cb(void *data, return 0; } static int cam_custom_mgr_cmd(void *hw_mgr_priv, void *cmd_args) { int rc = 0; struct cam_hw_cmd_args *hw_cmd_args = cmd_args; struct cam_custom_hw_cmd_args *custom_hw_cmd_args; struct cam_custom_hw_mgr_ctx *custom_ctx = NULL; if (!hw_mgr_priv || !cmd_args) { CAM_ERR(CAM_CUSTOM, "Invalid arguments"); return -EINVAL; } custom_ctx = (struct cam_custom_hw_mgr_ctx *) hw_cmd_args->ctxt_to_hw_map; if (!custom_ctx || !custom_ctx->ctx_in_use) { CAM_ERR(CAM_CUSTOM, "Fatal: Invalid context is used"); return -EPERM; } switch (hw_cmd_args->cmd_type) { case CAM_HW_MGR_CMD_INTERNAL: if (!hw_cmd_args->u.internal_args) { CAM_ERR(CAM_CUSTOM, "Invalid cmd arguments"); return -EINVAL; } custom_hw_cmd_args = (struct cam_custom_hw_cmd_args *) hw_cmd_args->u.internal_args; switch (custom_hw_cmd_args->cmd_type) { case CAM_CUSTOM_HW_MGR_PROG_DEFAULT_CONFIG: CAM_DBG(CAM_CUSTOM, "configure RUP and scratch buffer"); /* Handle event accordingly */ break; default: CAM_ERR(CAM_CUSTOM, "Invalid HW mgr command:0x%x", hw_cmd_args->cmd_type); rc = -EINVAL; break; } break; default: rc = -EINVAL; break; } return rc; } int cam_custom_hw_mgr_init(struct device_node *of_node, struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) { Loading Loading @@ -1376,6 +1427,7 @@ int cam_custom_hw_mgr_init(struct device_node *of_node, hw_mgr_intf->hw_prepare_update = cam_custom_mgr_prepare_hw_update; hw_mgr_intf->hw_config = cam_custom_mgr_config_hw; hw_mgr_intf->hw_reset = cam_custom_hw_mgr_reset; hw_mgr_intf->hw_cmd = cam_custom_mgr_cmd; if (iommu_hdl) *iommu_hdl = g_custom_hw_mgr.img_iommu_hdl; Loading Loading
drivers/cam_core/cam_context.c +28 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,34 @@ int cam_context_handle_crm_apply_req(struct cam_context *ctx, return rc; } int cam_context_handle_crm_apply_default_req( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply) { int rc = 0; if (!ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } if (!apply) { CAM_ERR(CAM_CORE, "Invalid apply request payload"); return -EINVAL; } mutex_lock(&ctx->ctx_mutex); if (ctx->state_machine[ctx->state].crm_ops.apply_default) rc = ctx->state_machine[ctx->state].crm_ops.apply_default(ctx, apply); else CAM_DBG(CAM_CORE, "No crm apply_default in dev %d, state %d", ctx->dev_hdl, ctx->state); mutex_unlock(&ctx->ctx_mutex); return rc; } int cam_context_handle_crm_flush_req(struct cam_context *ctx, struct cam_req_mgr_flush_request *flush) { Loading
drivers/cam_core/cam_context.h +15 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ struct cam_ctx_ioctl_ops { * @link: Link the context * @unlink: Unlink the context * @apply_req: Apply setting for the context * @apply_default: Apply default settings for the context * @flush_req: Flush request to remove request ids * @process_evt: Handle event notification from CRM.(optional) * @dump_req: Dump information for the issue request Loading @@ -135,6 +136,8 @@ struct cam_ctx_crm_ops { struct cam_req_mgr_core_dev_link_setup *unlink); int (*apply_req)(struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); int (*apply_default)(struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); int (*flush_req)(struct cam_context *ctx, struct cam_req_mgr_flush_request *flush); int (*process_evt)(struct cam_context *ctx, Loading Loading @@ -302,6 +305,18 @@ int cam_context_handle_crm_unlink(struct cam_context *ctx, int cam_context_handle_crm_apply_req(struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); /** * cam_context_handle_crm_apply_default_req() * * @brief: Handle apply default request command * * @ctx: Object pointer for cam_context * @apply: Apply default request command payload * */ int cam_context_handle_crm_apply_default_req( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply); /** * cam_context_handle_crm_flush_req() * Loading
drivers/cam_core/cam_node.c +21 −0 Original line number Diff line number Diff line Loading @@ -570,6 +570,26 @@ static int __cam_node_crm_apply_req(struct cam_req_mgr_apply_request *apply) return cam_context_handle_crm_apply_req(ctx, apply); } static int __cam_node_crm_apply_default_req( struct cam_req_mgr_apply_request *apply) { struct cam_context *ctx = NULL; if (!apply) return -EINVAL; ctx = (struct cam_context *) cam_get_device_priv(apply->dev_hdl); if (!ctx) { CAM_ERR(CAM_CORE, "Can not get context for handle %d", apply->dev_hdl); return -EINVAL; } trace_cam_apply_req("Node", apply->request_id); return cam_context_handle_crm_apply_default_req(ctx, apply); } static int __cam_node_crm_flush_req(struct cam_req_mgr_flush_request *flush) { struct cam_context *ctx = NULL; Loading Loading @@ -683,6 +703,7 @@ int cam_node_init(struct cam_node *node, struct cam_hw_mgr_intf *hw_mgr_intf, node->crm_node_intf.flush_req = __cam_node_crm_flush_req; node->crm_node_intf.process_evt = __cam_node_crm_process_evt; node->crm_node_intf.dump_req = __cam_node_crm_dump_req; node->crm_node_intf.apply_default = __cam_node_crm_apply_default_req; mutex_init(&node->list_mutex); INIT_LIST_HEAD(&node->free_ctx_list); Loading
drivers/cam_cust/cam_custom_context.c +29 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ static int __cam_custom_ctx_get_dev_info_in_acquired(struct cam_context *ctx, dev_info->dev_id = CAM_REQ_MGR_DEVICE_CUSTOM_HW; dev_info->p_delay = 1; dev_info->trigger = CAM_TRIGGER_POINT_SOF; dev_info->enable_apply_default = true; return 0; } Loading Loading @@ -456,6 +457,32 @@ static int __cam_custom_release_dev_in_acquired(struct cam_context *ctx, return rc; } static int __cam_custom_ctx_apply_default_settings( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply) { int rc = 0; struct cam_custom_context *custom_ctx = (struct cam_custom_context *) ctx->ctx_priv; struct cam_hw_cmd_args hw_cmd_args; struct cam_custom_hw_cmd_args custom_hw_cmd_args; hw_cmd_args.ctxt_to_hw_map = custom_ctx->hw_ctx; hw_cmd_args.cmd_type = CAM_HW_MGR_CMD_INTERNAL; custom_hw_cmd_args.cmd_type = CAM_CUSTOM_HW_MGR_PROG_DEFAULT_CONFIG; hw_cmd_args.u.internal_args = (void *)&custom_hw_cmd_args; rc = ctx->hw_mgr_intf->hw_cmd(ctx->hw_mgr_intf->hw_mgr_priv, &hw_cmd_args); if (rc) CAM_ERR(CAM_CUSTOM, "Failed to apply default settings rc %d", rc); else CAM_DBG(CAM_CUSTOM, "Applied default settings rc %d", rc); return rc; } static int __cam_custom_ctx_apply_req_in_activated_state( struct cam_context *ctx, struct cam_req_mgr_apply_request *apply) { Loading Loading @@ -1194,6 +1221,8 @@ static struct cam_ctx_ops .unlink = __cam_custom_ctx_unlink_in_activated, .apply_req = __cam_custom_ctx_apply_req_in_activated_state, .apply_default = __cam_custom_ctx_apply_default_settings, .flush_req = __cam_custom_ctx_flush_req_in_top_state, .process_evt = __cam_custom_ctx_process_evt, }, Loading
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.c +52 −0 Original line number Diff line number Diff line Loading @@ -1281,6 +1281,57 @@ static int cam_custom_hw_mgr_irq_cb(void *data, return 0; } static int cam_custom_mgr_cmd(void *hw_mgr_priv, void *cmd_args) { int rc = 0; struct cam_hw_cmd_args *hw_cmd_args = cmd_args; struct cam_custom_hw_cmd_args *custom_hw_cmd_args; struct cam_custom_hw_mgr_ctx *custom_ctx = NULL; if (!hw_mgr_priv || !cmd_args) { CAM_ERR(CAM_CUSTOM, "Invalid arguments"); return -EINVAL; } custom_ctx = (struct cam_custom_hw_mgr_ctx *) hw_cmd_args->ctxt_to_hw_map; if (!custom_ctx || !custom_ctx->ctx_in_use) { CAM_ERR(CAM_CUSTOM, "Fatal: Invalid context is used"); return -EPERM; } switch (hw_cmd_args->cmd_type) { case CAM_HW_MGR_CMD_INTERNAL: if (!hw_cmd_args->u.internal_args) { CAM_ERR(CAM_CUSTOM, "Invalid cmd arguments"); return -EINVAL; } custom_hw_cmd_args = (struct cam_custom_hw_cmd_args *) hw_cmd_args->u.internal_args; switch (custom_hw_cmd_args->cmd_type) { case CAM_CUSTOM_HW_MGR_PROG_DEFAULT_CONFIG: CAM_DBG(CAM_CUSTOM, "configure RUP and scratch buffer"); /* Handle event accordingly */ break; default: CAM_ERR(CAM_CUSTOM, "Invalid HW mgr command:0x%x", hw_cmd_args->cmd_type); rc = -EINVAL; break; } break; default: rc = -EINVAL; break; } return rc; } int cam_custom_hw_mgr_init(struct device_node *of_node, struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) { Loading Loading @@ -1376,6 +1427,7 @@ int cam_custom_hw_mgr_init(struct device_node *of_node, hw_mgr_intf->hw_prepare_update = cam_custom_mgr_prepare_hw_update; hw_mgr_intf->hw_config = cam_custom_mgr_config_hw; hw_mgr_intf->hw_reset = cam_custom_hw_mgr_reset; hw_mgr_intf->hw_cmd = cam_custom_mgr_cmd; if (iommu_hdl) *iommu_hdl = g_custom_hw_mgr.img_iommu_hdl; Loading