msm: camera: custom: Add support for custom HW
This change provides a template to add any custom HW block. CRs-Fixed: 2515662 Change-Id: Ie707c27950a330658cdaa4b64b7e304f4d62a5b2 Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
02f7646413
commit
9c771385d3
@@ -11,3 +11,4 @@ obj-$(CONFIG_SPECTRA_CAMERA) += cam_icp/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_jpeg/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_fd/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_lrme/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_cust/
|
||||
|
19
drivers/cam_cust/Makefile
Normal file
19
drivers/cam_cust/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_core
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_req_mgr
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_smmu/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_sync
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_utils
|
||||
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_hw_mgr/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_dev.o cam_custom_context.o
|
945
drivers/cam_cust/cam_custom_context.c
Normal file
945
drivers/cam_cust/cam_custom_context.c
Normal file
@@ -0,0 +1,945 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
#include "cam_mem_mgr.h"
|
||||
#include "cam_sync_api.h"
|
||||
#include "cam_req_mgr_dev.h"
|
||||
#include "cam_trace.h"
|
||||
#include "cam_debug_util.h"
|
||||
#include "cam_packet_util.h"
|
||||
#include "cam_context_utils.h"
|
||||
#include "cam_custom_context.h"
|
||||
#include "cam_common_util.h"
|
||||
|
||||
static const char custom_dev_name[] = "custom hw";
|
||||
|
||||
static int __cam_custom_ctx_handle_irq_in_activated(
|
||||
void *context, uint32_t evt_id, void *evt_data);
|
||||
|
||||
static int __cam_custom_ctx_enqueue_request_in_order(
|
||||
struct cam_context *ctx, struct cam_ctx_request *req)
|
||||
{
|
||||
struct cam_ctx_request *req_current;
|
||||
struct cam_ctx_request *req_prev;
|
||||
struct list_head temp_list;
|
||||
|
||||
INIT_LIST_HEAD(&temp_list);
|
||||
spin_lock_bh(&ctx->lock);
|
||||
if (list_empty(&ctx->pending_req_list)) {
|
||||
list_add_tail(&req->list, &ctx->pending_req_list);
|
||||
} else {
|
||||
list_for_each_entry_safe_reverse(
|
||||
req_current, req_prev, &ctx->pending_req_list, list) {
|
||||
if (req->request_id < req_current->request_id) {
|
||||
list_del_init(&req_current->list);
|
||||
list_add(&req_current->list, &temp_list);
|
||||
continue;
|
||||
} else if (req->request_id == req_current->request_id) {
|
||||
CAM_WARN(CAM_CUSTOM,
|
||||
"Received duplicated request %lld",
|
||||
req->request_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
list_add_tail(&req->list, &ctx->pending_req_list);
|
||||
|
||||
if (!list_empty(&temp_list)) {
|
||||
list_for_each_entry_safe(
|
||||
req_current, req_prev, &temp_list, list) {
|
||||
list_del_init(&req_current->list);
|
||||
list_add_tail(&req_current->list,
|
||||
&ctx->pending_req_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_flush_req(struct cam_context *ctx,
|
||||
struct list_head *req_list, struct cam_req_mgr_flush_request *flush_req)
|
||||
{
|
||||
int i, rc;
|
||||
uint32_t cancel_req_id_found = 0;
|
||||
struct cam_ctx_request *req;
|
||||
struct cam_ctx_request *req_temp;
|
||||
struct cam_custom_dev_ctx_req *req_custom;
|
||||
struct list_head flush_list;
|
||||
|
||||
INIT_LIST_HEAD(&flush_list);
|
||||
if (list_empty(req_list)) {
|
||||
CAM_DBG(CAM_CUSTOM, "request list is empty");
|
||||
if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ) {
|
||||
CAM_ERR(CAM_CUSTOM, "no request to cancel");
|
||||
return -EINVAL;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Flush [%u] in progress for req_id %llu",
|
||||
flush_req->type, flush_req->req_id);
|
||||
list_for_each_entry_safe(req, req_temp, req_list, list) {
|
||||
if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ) {
|
||||
if (req->request_id != flush_req->req_id) {
|
||||
continue;
|
||||
} else {
|
||||
list_del_init(&req->list);
|
||||
list_add_tail(&req->list, &flush_list);
|
||||
cancel_req_id_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
list_del_init(&req->list);
|
||||
list_add_tail(&req->list, &flush_list);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(req, req_temp, &flush_list, list) {
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
for (i = 0; i < req_custom->num_fence_map_out; i++) {
|
||||
if (req_custom->fence_map_out[i].sync_id != -1) {
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"Flush req 0x%llx, fence %d",
|
||||
req->request_id,
|
||||
req_custom->fence_map_out[i].sync_id);
|
||||
rc = cam_sync_signal(
|
||||
req_custom->fence_map_out[i].sync_id,
|
||||
CAM_SYNC_STATE_SIGNALED_ERROR);
|
||||
if (rc)
|
||||
CAM_ERR_RATE_LIMIT(CAM_CUSTOM,
|
||||
"signal fence failed\n");
|
||||
req_custom->fence_map_out[i].sync_id = -1;
|
||||
}
|
||||
}
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
}
|
||||
|
||||
if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ &&
|
||||
!cancel_req_id_found)
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"Flush request id:%lld is not found in the list",
|
||||
flush_req->req_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_flush_req_in_top_state(
|
||||
struct cam_context *ctx,
|
||||
struct cam_req_mgr_flush_request *flush_req)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) {
|
||||
CAM_INFO(CAM_CUSTOM, "Last request id to flush is %lld",
|
||||
flush_req->req_id);
|
||||
ctx->last_flush_req = flush_req->req_id;
|
||||
}
|
||||
|
||||
spin_lock_bh(&ctx->lock);
|
||||
rc = __cam_custom_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_flush_req_in_ready(
|
||||
struct cam_context *ctx,
|
||||
struct cam_req_mgr_flush_request *flush_req)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "try to flush pending list");
|
||||
spin_lock_bh(&ctx->lock);
|
||||
rc = __cam_custom_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
|
||||
|
||||
/* if nothing is in pending req list, change state to acquire */
|
||||
if (list_empty(&ctx->pending_req_list))
|
||||
ctx->state = CAM_CTX_ACQUIRED;
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Flush request in ready state. next state %d",
|
||||
ctx->state);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_unlink_in_ready(struct cam_context *ctx,
|
||||
struct cam_req_mgr_core_dev_link_setup *unlink)
|
||||
{
|
||||
ctx->link_hdl = -1;
|
||||
ctx->ctx_crm_intf = NULL;
|
||||
ctx->state = CAM_CTX_ACQUIRED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_stop_dev_core(
|
||||
struct cam_context *ctx, struct cam_start_stop_dev_cmd *stop_cmd)
|
||||
{
|
||||
int rc = 0;
|
||||
uint32_t i;
|
||||
struct cam_custom_context *ctx_custom =
|
||||
(struct cam_custom_context *) ctx->ctx_priv;
|
||||
struct cam_ctx_request *req;
|
||||
struct cam_custom_dev_ctx_req *req_custom;
|
||||
struct cam_hw_stop_args stop;
|
||||
|
||||
if (ctx_custom->hw_ctx) {
|
||||
stop.ctxt_to_hw_map = ctx_custom->hw_ctx;
|
||||
|
||||
stop.args = NULL;
|
||||
if (ctx->hw_mgr_intf->hw_stop)
|
||||
ctx->hw_mgr_intf->hw_stop(ctx->hw_mgr_intf->hw_mgr_priv,
|
||||
&stop);
|
||||
}
|
||||
|
||||
while (!list_empty(&ctx->pending_req_list)) {
|
||||
req = list_first_entry(&ctx->pending_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
list_del_init(&req->list);
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"signal fence in pending list. fence num %d",
|
||||
req_custom->num_fence_map_out);
|
||||
for (i = 0; i < req_custom->num_fence_map_out; i++)
|
||||
if (req_custom->fence_map_out[i].sync_id != -1) {
|
||||
cam_sync_signal(
|
||||
req_custom->fence_map_out[i].sync_id,
|
||||
CAM_SYNC_STATE_SIGNALED_ERROR);
|
||||
}
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
}
|
||||
|
||||
while (!list_empty(&ctx->wait_req_list)) {
|
||||
req = list_first_entry(&ctx->wait_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
list_del_init(&req->list);
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
CAM_DBG(CAM_CUSTOM, "signal fence in wait list. fence num %d",
|
||||
req_custom->num_fence_map_out);
|
||||
for (i = 0; i < req_custom->num_fence_map_out; i++)
|
||||
if (req_custom->fence_map_out[i].sync_id != -1) {
|
||||
cam_sync_signal(
|
||||
req_custom->fence_map_out[i].sync_id,
|
||||
CAM_SYNC_STATE_SIGNALED_ERROR);
|
||||
}
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
}
|
||||
|
||||
while (!list_empty(&ctx->active_req_list)) {
|
||||
req = list_first_entry(&ctx->active_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
list_del_init(&req->list);
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
CAM_DBG(CAM_CUSTOM, "signal fence in active list. fence num %d",
|
||||
req_custom->num_fence_map_out);
|
||||
for (i = 0; i < req_custom->num_fence_map_out; i++)
|
||||
if (req_custom->fence_map_out[i].sync_id != -1) {
|
||||
cam_sync_signal(
|
||||
req_custom->fence_map_out[i].sync_id,
|
||||
CAM_SYNC_STATE_SIGNALED_ERROR);
|
||||
}
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
}
|
||||
ctx_custom->frame_id = 0;
|
||||
ctx_custom->active_req_cnt = 0;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Stop device success next state %d on ctx %u",
|
||||
ctx->state, ctx->ctx_id);
|
||||
|
||||
if (!stop_cmd) {
|
||||
rc = __cam_custom_ctx_unlink_in_ready(ctx, NULL);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Unlink failed rc=%d", rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_stop_dev_in_activated(struct cam_context *ctx,
|
||||
struct cam_start_stop_dev_cmd *cmd)
|
||||
{
|
||||
struct cam_custom_context *ctx_custom =
|
||||
(struct cam_custom_context *)ctx->ctx_priv;
|
||||
|
||||
__cam_custom_stop_dev_core(ctx, cmd);
|
||||
ctx_custom->init_received = false;
|
||||
ctx->state = CAM_CTX_ACQUIRED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_release_dev_in_acquired(struct cam_context *ctx,
|
||||
struct cam_release_dev_cmd *cmd)
|
||||
{
|
||||
int rc;
|
||||
struct cam_custom_context *ctx_custom =
|
||||
(struct cam_custom_context *) ctx->ctx_priv;
|
||||
struct cam_req_mgr_flush_request flush_req;
|
||||
|
||||
rc = cam_context_release_dev_to_hw(ctx, cmd);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Unable to release device");
|
||||
|
||||
ctx->ctx_crm_intf = NULL;
|
||||
ctx->last_flush_req = 0;
|
||||
ctx_custom->frame_id = 0;
|
||||
ctx_custom->active_req_cnt = 0;
|
||||
ctx_custom->init_received = false;
|
||||
|
||||
if (!list_empty(&ctx->active_req_list))
|
||||
CAM_ERR(CAM_CUSTOM, "Active list is not empty");
|
||||
|
||||
/* Flush all the pending request list */
|
||||
flush_req.type = CAM_REQ_MGR_FLUSH_TYPE_ALL;
|
||||
flush_req.link_hdl = ctx->link_hdl;
|
||||
flush_req.dev_hdl = ctx->dev_hdl;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "try to flush pending list");
|
||||
spin_lock_bh(&ctx->lock);
|
||||
rc = __cam_custom_ctx_flush_req(ctx, &ctx->pending_req_list,
|
||||
&flush_req);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
ctx->state = CAM_CTX_AVAILABLE;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Release device success[%u] next state %d",
|
||||
ctx->ctx_id, ctx->state);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_apply_req_in_activated_state(
|
||||
struct cam_context *ctx, struct cam_req_mgr_apply_request *apply)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_ctx_request *req;
|
||||
struct cam_custom_dev_ctx_req *req_custom;
|
||||
struct cam_custom_context *custom_ctx = NULL;
|
||||
struct cam_hw_config_args cfg;
|
||||
|
||||
if (list_empty(&ctx->pending_req_list)) {
|
||||
CAM_ERR(CAM_CUSTOM, "No available request for Apply id %lld",
|
||||
apply->request_id);
|
||||
rc = -EFAULT;
|
||||
goto end;
|
||||
}
|
||||
|
||||
custom_ctx = (struct cam_custom_context *) ctx->ctx_priv;
|
||||
spin_lock_bh(&ctx->lock);
|
||||
req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request,
|
||||
list);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
|
||||
/*
|
||||
* Check whether the request id is matching the tip
|
||||
*/
|
||||
if (req->request_id != apply->request_id) {
|
||||
CAM_ERR_RATE_LIMIT(CAM_CUSTOM,
|
||||
"Invalid Request Id asking %llu existing %llu",
|
||||
apply->request_id, req->request_id);
|
||||
rc = -EFAULT;
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
|
||||
cfg.ctxt_to_hw_map = custom_ctx->hw_ctx;
|
||||
cfg.request_id = req->request_id;
|
||||
cfg.hw_update_entries = req_custom->cfg;
|
||||
cfg.num_hw_update_entries = req_custom->num_cfg;
|
||||
cfg.priv = &req_custom->hw_update_data;
|
||||
cfg.init_packet = 0;
|
||||
|
||||
rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv, &cfg);
|
||||
if (rc) {
|
||||
CAM_ERR_RATE_LIMIT(CAM_CUSTOM,
|
||||
"Can not apply the configuration");
|
||||
} else {
|
||||
spin_lock_bh(&ctx->lock);
|
||||
list_del_init(&req->list);
|
||||
if (!req->num_out_map_entries) {
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
} else {
|
||||
list_add_tail(&req->list, &ctx->active_req_list);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
/*
|
||||
* for test purposes only-this should be
|
||||
* triggered based on irq
|
||||
*/
|
||||
__cam_custom_ctx_handle_irq_in_activated(ctx, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_acquire_dev_in_available(struct cam_context *ctx,
|
||||
struct cam_acquire_dev_cmd *cmd)
|
||||
{
|
||||
int rc;
|
||||
struct cam_custom_context *custom_ctx;
|
||||
|
||||
custom_ctx = (struct cam_custom_context *) ctx->ctx_priv;
|
||||
|
||||
if (cmd->num_resources > CAM_CUSTOM_DEV_CTX_RES_MAX) {
|
||||
CAM_ERR(CAM_CUSTOM, "Too much resources in the acquire");
|
||||
rc = -ENOMEM;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (cmd->handle_type != 1) {
|
||||
CAM_ERR(CAM_CUSTOM, "Only user pointer is supported");
|
||||
rc = -EINVAL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = cam_context_acquire_dev_to_hw(ctx, cmd);
|
||||
if (!rc) {
|
||||
ctx->state = CAM_CTX_ACQUIRED;
|
||||
custom_ctx->hw_ctx = ctx->ctxt_to_hw_map;
|
||||
}
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Acquire done %d", ctx->ctx_id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_enqueue_init_request(
|
||||
struct cam_context *ctx, struct cam_ctx_request *req)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_ctx_request *req_old;
|
||||
struct cam_custom_dev_ctx_req *req_custom_old;
|
||||
struct cam_custom_dev_ctx_req *req_custom_new;
|
||||
|
||||
spin_lock_bh(&ctx->lock);
|
||||
if (list_empty(&ctx->pending_req_list)) {
|
||||
list_add_tail(&req->list, &ctx->pending_req_list);
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_old = list_first_entry(&ctx->pending_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
req_custom_old = (struct cam_custom_dev_ctx_req *) req_old->req_priv;
|
||||
req_custom_new = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
if (req_custom_old->hw_update_data.packet_opcode_type ==
|
||||
CAM_CUSTOM_PACKET_INIT_DEV) {
|
||||
if ((req_custom_old->num_cfg + req_custom_new->num_cfg) >=
|
||||
CAM_CUSTOM_CTX_CFG_MAX) {
|
||||
CAM_WARN(CAM_CUSTOM, "Can not merge INIT pkt");
|
||||
rc = -ENOMEM;
|
||||
}
|
||||
|
||||
if (req_custom_old->num_fence_map_out != 0 ||
|
||||
req_custom_old->num_fence_map_in != 0) {
|
||||
CAM_WARN(CAM_CUSTOM, "Invalid INIT pkt sequence");
|
||||
rc = -EINVAL;
|
||||
}
|
||||
|
||||
if (!rc) {
|
||||
memcpy(req_custom_old->fence_map_out,
|
||||
req_custom_new->fence_map_out,
|
||||
sizeof(req_custom_new->fence_map_out[0])*
|
||||
req_custom_new->num_fence_map_out);
|
||||
req_custom_old->num_fence_map_out =
|
||||
req_custom_new->num_fence_map_out;
|
||||
|
||||
memcpy(req_custom_old->fence_map_in,
|
||||
req_custom_new->fence_map_in,
|
||||
sizeof(req_custom_new->fence_map_in[0])*
|
||||
req_custom_new->num_fence_map_in);
|
||||
req_custom_old->num_fence_map_in =
|
||||
req_custom_new->num_fence_map_in;
|
||||
|
||||
memcpy(&req_custom_old->cfg[req_custom_old->num_cfg],
|
||||
req_custom_new->cfg,
|
||||
sizeof(req_custom_new->cfg[0])*
|
||||
req_custom_new->num_cfg);
|
||||
req_custom_old->num_cfg += req_custom_new->num_cfg;
|
||||
|
||||
req_old->request_id = req->request_id;
|
||||
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
}
|
||||
} else {
|
||||
CAM_WARN(CAM_CUSTOM,
|
||||
"Received Update pkt before INIT pkt. req_id= %lld",
|
||||
req->request_id);
|
||||
rc = -EINVAL;
|
||||
}
|
||||
end:
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_config_dev(struct cam_context *ctx,
|
||||
struct cam_config_dev_cmd *cmd)
|
||||
{
|
||||
int rc = 0, i;
|
||||
struct cam_ctx_request *req = NULL;
|
||||
struct cam_custom_dev_ctx_req *req_custom;
|
||||
uintptr_t packet_addr;
|
||||
struct cam_packet *packet;
|
||||
size_t len = 0;
|
||||
struct cam_hw_prepare_update_args cfg;
|
||||
struct cam_req_mgr_add_request add_req;
|
||||
struct cam_custom_context *ctx_custom =
|
||||
(struct cam_custom_context *) ctx->ctx_priv;
|
||||
|
||||
/* get free request */
|
||||
spin_lock_bh(&ctx->lock);
|
||||
if (!list_empty(&ctx->free_req_list)) {
|
||||
req = list_first_entry(&ctx->free_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
list_del_init(&req->list);
|
||||
}
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
|
||||
if (!req) {
|
||||
CAM_ERR(CAM_CUSTOM, "No more request obj free");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
|
||||
/* for config dev, only memory handle is supported */
|
||||
/* map packet from the memhandle */
|
||||
rc = cam_mem_get_cpu_buf((int32_t) cmd->packet_handle,
|
||||
&packet_addr, &len);
|
||||
if (rc != 0) {
|
||||
CAM_ERR(CAM_CUSTOM, "Can not get packet address");
|
||||
rc = -EINVAL;
|
||||
goto free_req;
|
||||
}
|
||||
|
||||
packet = (struct cam_packet *)(packet_addr + (uint32_t)cmd->offset);
|
||||
CAM_DBG(CAM_CUSTOM, "pack_handle %llx", cmd->packet_handle);
|
||||
CAM_DBG(CAM_CUSTOM, "packet address is 0x%zx", packet_addr);
|
||||
CAM_DBG(CAM_CUSTOM, "packet with length %zu, offset 0x%llx",
|
||||
len, cmd->offset);
|
||||
CAM_DBG(CAM_CUSTOM, "Packet request id %lld",
|
||||
packet->header.request_id);
|
||||
CAM_DBG(CAM_CUSTOM, "Packet size 0x%x", packet->header.size);
|
||||
CAM_DBG(CAM_CUSTOM, "packet op %d", packet->header.op_code);
|
||||
|
||||
if ((((packet->header.op_code) & 0xF) ==
|
||||
CAM_CUSTOM_PACKET_UPDATE_DEV)
|
||||
&& (packet->header.request_id <= ctx->last_flush_req)) {
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"request %lld has been flushed, reject packet",
|
||||
packet->header.request_id);
|
||||
rc = -EINVAL;
|
||||
goto free_req;
|
||||
}
|
||||
|
||||
/* preprocess the configuration */
|
||||
memset(&cfg, 0, sizeof(cfg));
|
||||
cfg.packet = packet;
|
||||
cfg.ctxt_to_hw_map = ctx_custom->hw_ctx;
|
||||
cfg.out_map_entries = req_custom->fence_map_out;
|
||||
cfg.in_map_entries = req_custom->fence_map_in;
|
||||
cfg.priv = &req_custom->hw_update_data;
|
||||
cfg.pf_data = &(req->pf_data);
|
||||
|
||||
rc = ctx->hw_mgr_intf->hw_prepare_update(
|
||||
ctx->hw_mgr_intf->hw_mgr_priv, &cfg);
|
||||
if (rc != 0) {
|
||||
CAM_ERR(CAM_CUSTOM, "Prepare config packet failed in HW layer");
|
||||
rc = -EFAULT;
|
||||
goto free_req;
|
||||
}
|
||||
|
||||
req_custom->num_cfg = cfg.num_hw_update_entries;
|
||||
req_custom->num_fence_map_out = cfg.num_out_map_entries;
|
||||
req_custom->num_fence_map_in = cfg.num_in_map_entries;
|
||||
req_custom->num_acked = 0;
|
||||
|
||||
for (i = 0; i < req_custom->num_fence_map_out; i++) {
|
||||
rc = cam_sync_get_obj_ref(req_custom->fence_map_out[i].sync_id);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Can't get ref for fence %d",
|
||||
req_custom->fence_map_out[i].sync_id);
|
||||
goto put_ref;
|
||||
}
|
||||
}
|
||||
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"num_entry: %d, num fence out: %d, num fence in: %d",
|
||||
req_custom->num_cfg, req_custom->num_fence_map_out,
|
||||
req_custom->num_fence_map_in);
|
||||
|
||||
req->request_id = packet->header.request_id;
|
||||
req->status = 1;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Packet request id %lld packet opcode:%d",
|
||||
packet->header.request_id,
|
||||
req_custom->hw_update_data.packet_opcode_type);
|
||||
|
||||
if (req_custom->hw_update_data.packet_opcode_type ==
|
||||
CAM_CUSTOM_PACKET_INIT_DEV) {
|
||||
if (ctx->state < CAM_CTX_ACTIVATED) {
|
||||
rc = __cam_custom_ctx_enqueue_init_request(ctx, req);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Enqueue INIT pkt failed");
|
||||
ctx_custom->init_received = true;
|
||||
} else {
|
||||
rc = -EINVAL;
|
||||
CAM_ERR(CAM_CUSTOM, "Recevied INIT pkt in wrong state");
|
||||
}
|
||||
} else {
|
||||
if (ctx->state >= CAM_CTX_READY && ctx->ctx_crm_intf->add_req) {
|
||||
add_req.link_hdl = ctx->link_hdl;
|
||||
add_req.dev_hdl = ctx->dev_hdl;
|
||||
add_req.req_id = req->request_id;
|
||||
add_req.skip_before_applying = 0;
|
||||
rc = ctx->ctx_crm_intf->add_req(&add_req);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM,
|
||||
"Add req failed: req id=%llu",
|
||||
req->request_id);
|
||||
} else {
|
||||
__cam_custom_ctx_enqueue_request_in_order(
|
||||
ctx, req);
|
||||
}
|
||||
} else {
|
||||
rc = -EINVAL;
|
||||
CAM_ERR(CAM_CUSTOM, "Recevied Update in wrong state");
|
||||
}
|
||||
}
|
||||
|
||||
if (rc)
|
||||
goto put_ref;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"Preprocessing Config req_id %lld successful on ctx %u",
|
||||
req->request_id, ctx->ctx_id);
|
||||
|
||||
return rc;
|
||||
|
||||
put_ref:
|
||||
for (--i; i >= 0; i--) {
|
||||
if (cam_sync_put_obj_ref(req_custom->fence_map_out[i].sync_id))
|
||||
CAM_ERR(CAM_CUSTOM, "Failed to put ref of fence %d",
|
||||
req_custom->fence_map_out[i].sync_id);
|
||||
}
|
||||
free_req:
|
||||
spin_lock_bh(&ctx->lock);
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_config_dev_in_acquired(struct cam_context *ctx,
|
||||
struct cam_config_dev_cmd *cmd)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
rc = __cam_custom_ctx_config_dev(ctx, cmd);
|
||||
|
||||
if (!rc && (ctx->link_hdl >= 0))
|
||||
ctx->state = CAM_CTX_READY;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_link_in_acquired(struct cam_context *ctx,
|
||||
struct cam_req_mgr_core_dev_link_setup *link)
|
||||
{
|
||||
struct cam_custom_context *ctx_custom =
|
||||
(struct cam_custom_context *) ctx->ctx_priv;
|
||||
|
||||
ctx->link_hdl = link->link_hdl;
|
||||
ctx->ctx_crm_intf = link->crm_cb;
|
||||
ctx_custom->subscribe_event = link->subscribe_event;
|
||||
|
||||
/* change state only if we had the init config */
|
||||
if (ctx_custom->init_received)
|
||||
ctx->state = CAM_CTX_READY;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "next state %d", ctx->state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_unlink_in_acquired(struct cam_context *ctx,
|
||||
struct cam_req_mgr_core_dev_link_setup *unlink)
|
||||
{
|
||||
ctx->link_hdl = -1;
|
||||
ctx->ctx_crm_intf = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_get_dev_info_in_acquired(struct cam_context *ctx,
|
||||
struct cam_req_mgr_device_info *dev_info)
|
||||
{
|
||||
dev_info->dev_hdl = ctx->dev_hdl;
|
||||
strlcpy(dev_info->name, CAM_CUSTOM_DEV_NAME, sizeof(dev_info->name));
|
||||
dev_info->dev_id = CAM_REQ_MGR_DEVICE_CUSTOM_HW;
|
||||
dev_info->p_delay = 1;
|
||||
dev_info->trigger = CAM_TRIGGER_POINT_SOF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_start_dev_in_ready(struct cam_context *ctx,
|
||||
struct cam_start_stop_dev_cmd *cmd)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_hw_config_args hw_config;
|
||||
struct cam_ctx_request *req;
|
||||
struct cam_custom_dev_ctx_req *req_custom;
|
||||
struct cam_custom_context *ctx_custom =
|
||||
(struct cam_custom_context *) ctx->ctx_priv;
|
||||
|
||||
if (cmd->session_handle != ctx->session_hdl ||
|
||||
cmd->dev_handle != ctx->dev_hdl) {
|
||||
rc = -EPERM;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (list_empty(&ctx->pending_req_list)) {
|
||||
/* should never happen */
|
||||
CAM_ERR(CAM_CUSTOM, "Start device with empty configuration");
|
||||
rc = -EFAULT;
|
||||
goto end;
|
||||
} else {
|
||||
req = list_first_entry(&ctx->pending_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
}
|
||||
req_custom = (struct cam_custom_dev_ctx_req *) req->req_priv;
|
||||
|
||||
if (!ctx_custom->hw_ctx) {
|
||||
CAM_ERR(CAM_CUSTOM, "Wrong hw context pointer.");
|
||||
rc = -EFAULT;
|
||||
goto end;
|
||||
}
|
||||
|
||||
hw_config.ctxt_to_hw_map = ctx_custom->hw_ctx;
|
||||
hw_config.request_id = req->request_id;
|
||||
hw_config.hw_update_entries = req_custom->cfg;
|
||||
hw_config.num_hw_update_entries = req_custom->num_cfg;
|
||||
hw_config.priv = &req_custom->hw_update_data;
|
||||
hw_config.init_packet = 1;
|
||||
|
||||
ctx->state = CAM_CTX_ACTIVATED;
|
||||
rc = ctx->hw_mgr_intf->hw_start(ctx->hw_mgr_intf->hw_mgr_priv,
|
||||
&hw_config);
|
||||
if (rc) {
|
||||
/* HW failure. User need to clean up the resource */
|
||||
CAM_ERR(CAM_CUSTOM, "Start HW failed");
|
||||
ctx->state = CAM_CTX_READY;
|
||||
goto end;
|
||||
}
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "start device success ctx %u",
|
||||
ctx->ctx_id);
|
||||
|
||||
spin_lock_bh(&ctx->lock);
|
||||
list_del_init(&req->list);
|
||||
if (req_custom->num_fence_map_out)
|
||||
list_add_tail(&req->list, &ctx->active_req_list);
|
||||
else
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
spin_unlock_bh(&ctx->lock);
|
||||
|
||||
end:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_release_dev_in_activated(struct cam_context *ctx,
|
||||
struct cam_release_dev_cmd *cmd)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
rc = __cam_custom_stop_dev_core(ctx, NULL);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Stop device failed rc=%d", rc);
|
||||
|
||||
rc = __cam_custom_release_dev_in_acquired(ctx, cmd);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Release device failed rc=%d", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_unlink_in_activated(struct cam_context *ctx,
|
||||
struct cam_req_mgr_core_dev_link_setup *unlink)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
CAM_WARN(CAM_CUSTOM,
|
||||
"Received unlink in activated state. It's unexpected");
|
||||
|
||||
rc = __cam_custom_stop_dev_in_activated(ctx, NULL);
|
||||
if (rc)
|
||||
CAM_WARN(CAM_CUSTOM, "Stop device failed rc=%d", rc);
|
||||
|
||||
rc = __cam_custom_ctx_unlink_in_ready(ctx, unlink);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Unlink failed rc=%d", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_process_evt(struct cam_context *ctx,
|
||||
struct cam_req_mgr_link_evt_data *link_evt_data)
|
||||
{
|
||||
switch (link_evt_data->evt_type) {
|
||||
case CAM_REQ_MGR_LINK_EVT_ERR:
|
||||
/* Handle error/bubble related issues */
|
||||
break;
|
||||
default:
|
||||
CAM_WARN(CAM_CUSTOM, "Unknown event from CRM");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_custom_ctx_handle_irq_in_activated(void *context,
|
||||
uint32_t evt_id, void *evt_data)
|
||||
{
|
||||
int rc;
|
||||
struct cam_context *ctx =
|
||||
(struct cam_context *)context;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Enter %d", ctx->ctx_id);
|
||||
|
||||
/*
|
||||
* handle based on different irq's currently
|
||||
* triggering only buf done if there are fences
|
||||
*/
|
||||
rc = cam_context_buf_done_from_hw(ctx, evt_data, 0);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Failed in buf done, rc=%d", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* top state machine */
|
||||
static struct cam_ctx_ops
|
||||
cam_custom_dev_ctx_top_state_machine[CAM_CTX_STATE_MAX] = {
|
||||
/* Uninit */
|
||||
{
|
||||
.ioctl_ops = {},
|
||||
.crm_ops = {},
|
||||
.irq_ops = NULL,
|
||||
},
|
||||
/* Available */
|
||||
{
|
||||
.ioctl_ops = {
|
||||
.acquire_dev =
|
||||
__cam_custom_ctx_acquire_dev_in_available,
|
||||
},
|
||||
.crm_ops = {},
|
||||
.irq_ops = NULL,
|
||||
},
|
||||
/* Acquired */
|
||||
{
|
||||
.ioctl_ops = {
|
||||
.release_dev = __cam_custom_release_dev_in_acquired,
|
||||
.config_dev = __cam_custom_ctx_config_dev_in_acquired,
|
||||
},
|
||||
.crm_ops = {
|
||||
.link = __cam_custom_ctx_link_in_acquired,
|
||||
.unlink = __cam_custom_ctx_unlink_in_acquired,
|
||||
.get_dev_info =
|
||||
__cam_custom_ctx_get_dev_info_in_acquired,
|
||||
.flush_req = __cam_custom_ctx_flush_req_in_top_state,
|
||||
},
|
||||
.irq_ops = NULL,
|
||||
.pagefault_ops = NULL,
|
||||
},
|
||||
/* Ready */
|
||||
{
|
||||
.ioctl_ops = {
|
||||
.start_dev = __cam_custom_ctx_start_dev_in_ready,
|
||||
.release_dev = __cam_custom_release_dev_in_acquired,
|
||||
.config_dev = __cam_custom_ctx_config_dev,
|
||||
},
|
||||
.crm_ops = {
|
||||
.unlink = __cam_custom_ctx_unlink_in_ready,
|
||||
.flush_req = __cam_custom_ctx_flush_req_in_ready,
|
||||
},
|
||||
.irq_ops = NULL,
|
||||
.pagefault_ops = NULL,
|
||||
},
|
||||
/* Activated */
|
||||
{
|
||||
.ioctl_ops = {
|
||||
.stop_dev = __cam_custom_stop_dev_in_activated,
|
||||
.release_dev =
|
||||
__cam_custom_ctx_release_dev_in_activated,
|
||||
.config_dev = __cam_custom_ctx_config_dev,
|
||||
},
|
||||
.crm_ops = {
|
||||
.unlink = __cam_custom_ctx_unlink_in_activated,
|
||||
.apply_req =
|
||||
__cam_custom_ctx_apply_req_in_activated_state,
|
||||
.flush_req = __cam_custom_ctx_flush_req_in_top_state,
|
||||
.process_evt = __cam_custom_ctx_process_evt,
|
||||
},
|
||||
.irq_ops = __cam_custom_ctx_handle_irq_in_activated,
|
||||
.pagefault_ops = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
int cam_custom_dev_context_init(struct cam_custom_context *ctx,
|
||||
struct cam_context *ctx_base,
|
||||
struct cam_req_mgr_kmd_ops *crm_node_intf,
|
||||
struct cam_hw_mgr_intf *hw_intf,
|
||||
uint32_t ctx_id)
|
||||
{
|
||||
int rc = -1, i = 0;
|
||||
|
||||
if (!ctx || !ctx_base) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid Context");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Custom HW context setup */
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
|
||||
ctx->base = ctx_base;
|
||||
ctx->frame_id = 0;
|
||||
ctx->active_req_cnt = 0;
|
||||
ctx->hw_ctx = NULL;
|
||||
|
||||
for (i = 0; i < CAM_CTX_REQ_MAX; i++) {
|
||||
ctx->req_base[i].req_priv = &ctx->req_custom[i];
|
||||
ctx->req_custom[i].base = &ctx->req_base[i];
|
||||
}
|
||||
|
||||
/* camera context setup */
|
||||
rc = cam_context_init(ctx_base, custom_dev_name, CAM_CUSTOM, ctx_id,
|
||||
crm_node_intf, hw_intf, ctx->req_base, CAM_CTX_REQ_MAX);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Camera Context Base init failed");
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* link camera context with custom HW context */
|
||||
ctx_base->state_machine = cam_custom_dev_ctx_top_state_machine;
|
||||
ctx_base->ctx_priv = ctx;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_dev_context_deinit(struct cam_custom_context *ctx)
|
||||
{
|
||||
if (ctx->base)
|
||||
cam_context_deinit(ctx->base);
|
||||
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
return 0;
|
||||
}
|
115
drivers/cam_cust/cam_custom_context.h
Normal file
115
drivers/cam_cust/cam_custom_context.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_CONTEXT_H_
|
||||
#define _CAM_CUSTOM_CONTEXT_H_
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <uapi/media/cam_custom.h>
|
||||
#include <uapi/media/cam_defs.h>
|
||||
|
||||
#include "cam_context.h"
|
||||
#include "cam_custom_hw_mgr_intf.h"
|
||||
|
||||
/*
|
||||
* Maximum hw resource - This number is based on the maximum
|
||||
* output port resource. The current maximum resource number
|
||||
* is 2.
|
||||
*/
|
||||
#define CAM_CUSTOM_DEV_CTX_RES_MAX 2
|
||||
|
||||
#define CAM_CUSTOM_CTX_CFG_MAX 8
|
||||
|
||||
/* forward declaration */
|
||||
struct cam_custom_context;
|
||||
|
||||
/**
|
||||
* struct cam_custom_dev_ctx_req - Custom context request object
|
||||
*
|
||||
* @base: Common request object pointer
|
||||
* @cfg: Custom hardware configuration array
|
||||
* @num_cfg: Number of custom hardware configuration entries
|
||||
* @fence_map_out: Output fence mapping array
|
||||
* @num_fence_map_out: Number of the output fence map
|
||||
* @fence_map_in: Input fence mapping array
|
||||
* @num_fence_map_in: Number of input fence map
|
||||
* @num_acked: Count to track acked entried for output.
|
||||
* If count equals the number of fence out, it means
|
||||
* the request has been completed.
|
||||
* @hw_update_data: HW update data for this request
|
||||
*
|
||||
*/
|
||||
struct cam_custom_dev_ctx_req {
|
||||
struct cam_ctx_request *base;
|
||||
struct cam_hw_update_entry cfg
|
||||
[CAM_CUSTOM_CTX_CFG_MAX];
|
||||
uint32_t num_cfg;
|
||||
struct cam_hw_fence_map_entry fence_map_out
|
||||
[CAM_CUSTOM_DEV_CTX_RES_MAX];
|
||||
uint32_t num_fence_map_out;
|
||||
struct cam_hw_fence_map_entry fence_map_in
|
||||
[CAM_CUSTOM_DEV_CTX_RES_MAX];
|
||||
uint32_t num_fence_map_in;
|
||||
uint32_t num_acked;
|
||||
struct cam_custom_prepare_hw_update_data hw_update_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cam_custom_context - Custom device context
|
||||
* @base: custom device context object
|
||||
* @state_machine: state machine for Custom device context
|
||||
* @state: Common context state
|
||||
* @hw_ctx: HW object returned by the acquire device command
|
||||
* @init_received: Indicate whether init config packet is received
|
||||
* @subscribe_event: The irq event mask that CRM subscribes to,
|
||||
* custom HW will invoke CRM cb at those event.
|
||||
* @active_req_cnt: Counter for the active request
|
||||
* @frame_id: Frame id tracking for the custom context
|
||||
* @req_base: common request structure
|
||||
* @req_custom: custom request structure
|
||||
*
|
||||
*/
|
||||
struct cam_custom_context {
|
||||
struct cam_context *base;
|
||||
struct cam_ctx_ops *state_machine;
|
||||
uint32_t state;
|
||||
void *hw_ctx;
|
||||
bool init_received;
|
||||
uint32_t subscribe_event;
|
||||
uint32_t active_req_cnt;
|
||||
int64_t frame_id;
|
||||
struct cam_ctx_request req_base[CAM_CTX_REQ_MAX];
|
||||
struct cam_custom_dev_ctx_req req_custom[CAM_CTX_REQ_MAX];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* cam_custom_dev_context_init()
|
||||
*
|
||||
* @brief: Initialization function for the custom context
|
||||
*
|
||||
* @ctx: Custom context obj to be initialized
|
||||
* @bridge_ops: Bridge call back funciton
|
||||
* @hw_intf: Cust hw manager interface
|
||||
* @ctx_id: ID for this context
|
||||
*
|
||||
*/
|
||||
int cam_custom_dev_context_init(struct cam_custom_context *ctx,
|
||||
struct cam_context *ctx_base,
|
||||
struct cam_req_mgr_kmd_ops *bridge_ops,
|
||||
struct cam_hw_mgr_intf *hw_intf,
|
||||
uint32_t ctx_id);
|
||||
|
||||
/**
|
||||
* cam_custom_dev_context_deinit()
|
||||
*
|
||||
* @brief: Deinitialize function for the Custom context
|
||||
*
|
||||
* @ctx: Custom context obj to be deinitialized
|
||||
*
|
||||
*/
|
||||
int cam_custom_dev_context_deinit(struct cam_custom_context *ctx);
|
||||
|
||||
#endif /* _CAM_CUSTOM_CONTEXT_H_ */
|
198
drivers/cam_cust/cam_custom_dev.c
Normal file
198
drivers/cam_cust/cam_custom_dev.c
Normal file
@@ -0,0 +1,198 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/ion.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <uapi/media/cam_req_mgr.h>
|
||||
#include "cam_custom_dev.h"
|
||||
#include "cam_hw_mgr_intf.h"
|
||||
#include "cam_custom_hw_mgr_intf.h"
|
||||
#include "cam_node.h"
|
||||
#include "cam_debug_util.h"
|
||||
#include "cam_smmu_api.h"
|
||||
|
||||
static struct cam_custom_dev g_custom_dev;
|
||||
|
||||
static void cam_custom_dev_iommu_fault_handler(
|
||||
struct iommu_domain *domain, struct device *dev, unsigned long iova,
|
||||
int flags, void *token, uint32_t buf_info)
|
||||
{
|
||||
int i = 0;
|
||||
struct cam_node *node = NULL;
|
||||
|
||||
if (!token) {
|
||||
CAM_ERR(CAM_CUSTOM, "invalid token in page handler cb");
|
||||
return;
|
||||
}
|
||||
|
||||
node = (struct cam_node *)token;
|
||||
|
||||
for (i = 0; i < node->ctx_size; i++)
|
||||
cam_context_dump_pf_info(&(node->ctx_list[i]), iova,
|
||||
buf_info);
|
||||
}
|
||||
|
||||
static const struct of_device_id cam_custom_dt_match[] = {
|
||||
{
|
||||
.compatible = "qcom,cam-custom"
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static int cam_custom_subdev_open(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_fh *fh)
|
||||
{
|
||||
mutex_lock(&g_custom_dev.custom_dev_mutex);
|
||||
g_custom_dev.open_cnt++;
|
||||
mutex_unlock(&g_custom_dev.custom_dev_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cam_custom_subdev_close(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_fh *fh)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_node *node = v4l2_get_subdevdata(sd);
|
||||
|
||||
mutex_lock(&g_custom_dev.custom_dev_mutex);
|
||||
if (g_custom_dev.open_cnt <= 0) {
|
||||
CAM_DBG(CAM_CUSTOM, "Custom subdev is already closed");
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
g_custom_dev.open_cnt--;
|
||||
if (!node) {
|
||||
CAM_ERR(CAM_CUSTOM, "Node ptr is NULL");
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (g_custom_dev.open_cnt == 0)
|
||||
cam_node_shutdown(node);
|
||||
|
||||
end:
|
||||
mutex_unlock(&g_custom_dev.custom_dev_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static const struct v4l2_subdev_internal_ops cam_custom_subdev_internal_ops = {
|
||||
.close = cam_custom_subdev_close,
|
||||
.open = cam_custom_subdev_open,
|
||||
};
|
||||
|
||||
static int cam_custom_dev_remove(struct platform_device *pdev)
|
||||
{
|
||||
int rc = 0;
|
||||
int i;
|
||||
|
||||
/* clean up resources */
|
||||
for (i = 0; i < CAM_CUSTOM_HW_MAX_INSTANCES; i++) {
|
||||
rc = cam_custom_dev_context_deinit(&g_custom_dev.ctx_custom[i]);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM,
|
||||
"Custom context %d deinit failed", i);
|
||||
}
|
||||
|
||||
rc = cam_subdev_remove(&g_custom_dev.sd);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Unregister failed");
|
||||
|
||||
memset(&g_custom_dev, 0, sizeof(g_custom_dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cam_custom_dev_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc = -EINVAL;
|
||||
int i;
|
||||
struct cam_hw_mgr_intf hw_mgr_intf;
|
||||
struct cam_node *node;
|
||||
int iommu_hdl = -1;
|
||||
|
||||
g_custom_dev.sd.internal_ops = &cam_custom_subdev_internal_ops;
|
||||
|
||||
rc = cam_subdev_probe(&g_custom_dev.sd, pdev, CAM_CUSTOM_DEV_NAME,
|
||||
CAM_CUSTOM_DEVICE_TYPE);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Custom device cam_subdev_probe failed!");
|
||||
goto err;
|
||||
}
|
||||
node = (struct cam_node *) g_custom_dev.sd.token;
|
||||
|
||||
memset(&hw_mgr_intf, 0, sizeof(hw_mgr_intf));
|
||||
rc = cam_custom_hw_mgr_init(pdev->dev.of_node,
|
||||
&hw_mgr_intf, &iommu_hdl);
|
||||
if (rc != 0) {
|
||||
CAM_ERR(CAM_CUSTOM, "Can not initialized Custom HW manager!");
|
||||
goto unregister;
|
||||
}
|
||||
|
||||
for (i = 0; i < CAM_CUSTOM_HW_MAX_INSTANCES; i++) {
|
||||
rc = cam_custom_dev_context_init(&g_custom_dev.ctx_custom[i],
|
||||
&g_custom_dev.ctx[i],
|
||||
&node->crm_node_intf,
|
||||
&node->hw_mgr_intf,
|
||||
i);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Custom context init failed!");
|
||||
goto unregister;
|
||||
}
|
||||
}
|
||||
|
||||
rc = cam_node_init(node, &hw_mgr_intf, g_custom_dev.ctx,
|
||||
CAM_CUSTOM_HW_MAX_INSTANCES, CAM_CUSTOM_DEV_NAME);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Custom HW node init failed!");
|
||||
goto unregister;
|
||||
}
|
||||
|
||||
cam_smmu_set_client_page_fault_handler(iommu_hdl,
|
||||
cam_custom_dev_iommu_fault_handler, node);
|
||||
|
||||
mutex_init(&g_custom_dev.custom_dev_mutex);
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Camera custom HW probe complete");
|
||||
|
||||
return 0;
|
||||
unregister:
|
||||
rc = cam_subdev_remove(&g_custom_dev.sd);
|
||||
err:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_driver custom_driver = {
|
||||
.probe = cam_custom_dev_probe,
|
||||
.remove = cam_custom_dev_remove,
|
||||
.driver = {
|
||||
.name = "cam_custom",
|
||||
.of_match_table = cam_custom_dt_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init cam_custom_dev_init_module(void)
|
||||
{
|
||||
return platform_driver_register(&custom_driver);
|
||||
}
|
||||
|
||||
static void __exit cam_custom_dev_exit_module(void)
|
||||
{
|
||||
platform_driver_unregister(&custom_driver);
|
||||
}
|
||||
|
||||
module_init(cam_custom_dev_init_module);
|
||||
module_exit(cam_custom_dev_exit_module);
|
||||
MODULE_DESCRIPTION("MSM CUSTOM driver");
|
||||
MODULE_LICENSE("GPL v2");
|
34
drivers/cam_cust/cam_custom_dev.h
Normal file
34
drivers/cam_cust/cam_custom_dev.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_DEV_H_
|
||||
#define _CAM_CUSTOM_DEV_H_
|
||||
|
||||
#include "cam_subdev.h"
|
||||
#include "cam_hw_mgr_intf.h"
|
||||
#include "cam_custom_hw_mgr.h"
|
||||
#include "cam_context.h"
|
||||
#include "cam_custom_context.h"
|
||||
|
||||
#define CAM_CUSTOM_HW_MAX_INSTANCES 3
|
||||
|
||||
/**
|
||||
* struct cam_custom_dev - Camera Custom V4l2 device node
|
||||
*
|
||||
* @sd: Common camera subdevice node
|
||||
* @ctx: Custom base context storage
|
||||
* @ctx_custom: Custom private context storage
|
||||
* @custom_dev_mutex: Custom dev mutex
|
||||
* @open_cnt: Open device count
|
||||
*/
|
||||
struct cam_custom_dev {
|
||||
struct cam_subdev sd;
|
||||
struct cam_context ctx[CAM_CUSTOM_HW_MAX_INSTANCES];
|
||||
struct cam_custom_context ctx_custom[CAM_CUSTOM_HW_MAX_INSTANCES];
|
||||
struct mutex custom_dev_mutex;
|
||||
int32_t open_cnt;
|
||||
};
|
||||
|
||||
#endif /* _CAM_CUSTOM_DEV_H_ */
|
20
drivers/cam_cust/cam_custom_hw_mgr/Makefile
Normal file
20
drivers/cam_cust/cam_custom_hw_mgr/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_req_mgr
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_utils
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_core
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_smmu/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_sync
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cpas/include
|
||||
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_hw1/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_hw1/ cam_custom_csid/
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_hw_mgr.o
|
||||
|
16
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/Makefile
Normal file
16
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_utils
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_core
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cpas/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_smmu/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_req_mgr/
|
||||
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_csid_dev.o
|
@@ -0,0 +1,272 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_CSID_480_H_
|
||||
#define _CAM_CUSTOM_CSID_480_H_
|
||||
|
||||
#include "cam_ife_csid_core.h"
|
||||
|
||||
#define CAM_CSID_VERSION_V480 0x40080000
|
||||
|
||||
static struct cam_ife_csid_udi_reg_offset
|
||||
cam_custom_csid_480_udi_0_reg_offset = {
|
||||
.csid_udi_irq_status_addr = 0x30,
|
||||
.csid_udi_irq_mask_addr = 0x34,
|
||||
.csid_udi_irq_clear_addr = 0x38,
|
||||
.csid_udi_irq_set_addr = 0x3c,
|
||||
.csid_udi_cfg0_addr = 0x200,
|
||||
.csid_udi_cfg1_addr = 0x204,
|
||||
.csid_udi_ctrl_addr = 0x208,
|
||||
.csid_udi_frm_drop_pattern_addr = 0x20c,
|
||||
.csid_udi_frm_drop_period_addr = 0x210,
|
||||
.csid_udi_irq_subsample_pattern_addr = 0x214,
|
||||
.csid_udi_irq_subsample_period_addr = 0x218,
|
||||
.csid_udi_rpp_hcrop_addr = 0x21c,
|
||||
.csid_udi_rpp_vcrop_addr = 0x220,
|
||||
.csid_udi_rpp_pix_drop_pattern_addr = 0x224,
|
||||
.csid_udi_rpp_pix_drop_period_addr = 0x228,
|
||||
.csid_udi_rpp_line_drop_pattern_addr = 0x22c,
|
||||
.csid_udi_rpp_line_drop_period_addr = 0x230,
|
||||
.csid_udi_rst_strobes_addr = 0x240,
|
||||
.csid_udi_status_addr = 0x250,
|
||||
.csid_udi_misr_val0_addr = 0x254,
|
||||
.csid_udi_misr_val1_addr = 0x258,
|
||||
.csid_udi_misr_val2_addr = 0x25c,
|
||||
.csid_udi_misr_val3_addr = 0x260,
|
||||
.csid_udi_format_measure_cfg0_addr = 0x270,
|
||||
.csid_udi_format_measure_cfg1_addr = 0x274,
|
||||
.csid_udi_format_measure0_addr = 0x278,
|
||||
.csid_udi_format_measure1_addr = 0x27c,
|
||||
.csid_udi_format_measure2_addr = 0x280,
|
||||
.csid_udi_timestamp_curr0_sof_addr = 0x290,
|
||||
.csid_udi_timestamp_curr1_sof_addr = 0x294,
|
||||
.csid_udi_timestamp_prev0_sof_addr = 0x298,
|
||||
.csid_udi_timestamp_prev1_sof_addr = 0x29c,
|
||||
.csid_udi_timestamp_curr0_eof_addr = 0x2a0,
|
||||
.csid_udi_timestamp_curr1_eof_addr = 0x2a4,
|
||||
.csid_udi_timestamp_prev0_eof_addr = 0x2a8,
|
||||
.csid_udi_timestamp_prev1_eof_addr = 0x2ac,
|
||||
.csid_udi_err_recovery_cfg0_addr = 0x2b0,
|
||||
.csid_udi_err_recovery_cfg1_addr = 0x2b4,
|
||||
.csid_udi_err_recovery_cfg2_addr = 0x2b8,
|
||||
.csid_udi_multi_vcdt_cfg0_addr = 0x2bc,
|
||||
.csid_udi_byte_cntr_ping_addr = 0x2e0,
|
||||
.csid_udi_byte_cntr_pong_addr = 0x2e4,
|
||||
/* configurations */
|
||||
.ccif_violation_en = 1,
|
||||
.overflow_ctrl_en = 1,
|
||||
};
|
||||
|
||||
static struct cam_ife_csid_udi_reg_offset
|
||||
cam_custom_csid_480_udi_1_reg_offset = {
|
||||
.csid_udi_irq_status_addr = 0x40,
|
||||
.csid_udi_irq_mask_addr = 0x44,
|
||||
.csid_udi_irq_clear_addr = 0x48,
|
||||
.csid_udi_irq_set_addr = 0x4c,
|
||||
.csid_udi_cfg0_addr = 0x300,
|
||||
.csid_udi_cfg1_addr = 0x304,
|
||||
.csid_udi_ctrl_addr = 0x308,
|
||||
.csid_udi_frm_drop_pattern_addr = 0x30c,
|
||||
.csid_udi_frm_drop_period_addr = 0x310,
|
||||
.csid_udi_irq_subsample_pattern_addr = 0x314,
|
||||
.csid_udi_irq_subsample_period_addr = 0x318,
|
||||
.csid_udi_rpp_hcrop_addr = 0x31c,
|
||||
.csid_udi_rpp_vcrop_addr = 0x320,
|
||||
.csid_udi_rpp_pix_drop_pattern_addr = 0x324,
|
||||
.csid_udi_rpp_pix_drop_period_addr = 0x328,
|
||||
.csid_udi_rpp_line_drop_pattern_addr = 0x32c,
|
||||
.csid_udi_rpp_line_drop_period_addr = 0x330,
|
||||
.csid_udi_rst_strobes_addr = 0x340,
|
||||
.csid_udi_status_addr = 0x350,
|
||||
.csid_udi_misr_val0_addr = 0x354,
|
||||
.csid_udi_misr_val1_addr = 0x358,
|
||||
.csid_udi_misr_val2_addr = 0x35c,
|
||||
.csid_udi_misr_val3_addr = 0x360,
|
||||
.csid_udi_format_measure_cfg0_addr = 0x370,
|
||||
.csid_udi_format_measure_cfg1_addr = 0x374,
|
||||
.csid_udi_format_measure0_addr = 0x378,
|
||||
.csid_udi_format_measure1_addr = 0x37c,
|
||||
.csid_udi_format_measure2_addr = 0x380,
|
||||
.csid_udi_timestamp_curr0_sof_addr = 0x390,
|
||||
.csid_udi_timestamp_curr1_sof_addr = 0x394,
|
||||
.csid_udi_timestamp_prev0_sof_addr = 0x398,
|
||||
.csid_udi_timestamp_prev1_sof_addr = 0x39c,
|
||||
.csid_udi_timestamp_curr0_eof_addr = 0x3a0,
|
||||
.csid_udi_timestamp_curr1_eof_addr = 0x3a4,
|
||||
.csid_udi_timestamp_prev0_eof_addr = 0x3a8,
|
||||
.csid_udi_timestamp_prev1_eof_addr = 0x3ac,
|
||||
.csid_udi_err_recovery_cfg0_addr = 0x3b0,
|
||||
.csid_udi_err_recovery_cfg1_addr = 0x3b4,
|
||||
.csid_udi_err_recovery_cfg2_addr = 0x3b8,
|
||||
.csid_udi_multi_vcdt_cfg0_addr = 0x3bc,
|
||||
.csid_udi_byte_cntr_ping_addr = 0x3e0,
|
||||
.csid_udi_byte_cntr_pong_addr = 0x3e4,
|
||||
/* configurations */
|
||||
.ccif_violation_en = 1,
|
||||
.overflow_ctrl_en = 1,
|
||||
};
|
||||
|
||||
static struct cam_ife_csid_udi_reg_offset
|
||||
cam_custom_csid_480_udi_2_reg_offset = {
|
||||
.csid_udi_irq_status_addr = 0x50,
|
||||
.csid_udi_irq_mask_addr = 0x54,
|
||||
.csid_udi_irq_clear_addr = 0x58,
|
||||
.csid_udi_irq_set_addr = 0x5c,
|
||||
.csid_udi_cfg0_addr = 0x400,
|
||||
.csid_udi_cfg1_addr = 0x404,
|
||||
.csid_udi_ctrl_addr = 0x408,
|
||||
.csid_udi_frm_drop_pattern_addr = 0x40c,
|
||||
.csid_udi_frm_drop_period_addr = 0x410,
|
||||
.csid_udi_irq_subsample_pattern_addr = 0x414,
|
||||
.csid_udi_irq_subsample_period_addr = 0x418,
|
||||
.csid_udi_rpp_hcrop_addr = 0x41c,
|
||||
.csid_udi_rpp_vcrop_addr = 0x420,
|
||||
.csid_udi_rpp_pix_drop_pattern_addr = 0x424,
|
||||
.csid_udi_rpp_pix_drop_period_addr = 0x428,
|
||||
.csid_udi_rpp_line_drop_pattern_addr = 0x42c,
|
||||
.csid_udi_rpp_line_drop_period_addr = 0x430,
|
||||
.csid_udi_yuv_chroma_conversion_addr = 0x434,
|
||||
.csid_udi_rst_strobes_addr = 0x440,
|
||||
.csid_udi_status_addr = 0x450,
|
||||
.csid_udi_misr_val0_addr = 0x454,
|
||||
.csid_udi_misr_val1_addr = 0x458,
|
||||
.csid_udi_misr_val2_addr = 0x45c,
|
||||
.csid_udi_misr_val3_addr = 0x460,
|
||||
.csid_udi_format_measure_cfg0_addr = 0x470,
|
||||
.csid_udi_format_measure_cfg1_addr = 0x474,
|
||||
.csid_udi_format_measure0_addr = 0x478,
|
||||
.csid_udi_format_measure1_addr = 0x47c,
|
||||
.csid_udi_format_measure2_addr = 0x480,
|
||||
.csid_udi_timestamp_curr0_sof_addr = 0x490,
|
||||
.csid_udi_timestamp_curr1_sof_addr = 0x494,
|
||||
.csid_udi_timestamp_prev0_sof_addr = 0x498,
|
||||
.csid_udi_timestamp_prev1_sof_addr = 0x49c,
|
||||
.csid_udi_timestamp_curr0_eof_addr = 0x4a0,
|
||||
.csid_udi_timestamp_curr1_eof_addr = 0x4a4,
|
||||
.csid_udi_timestamp_prev0_eof_addr = 0x4a8,
|
||||
.csid_udi_timestamp_prev1_eof_addr = 0x4ac,
|
||||
.csid_udi_err_recovery_cfg0_addr = 0x4b0,
|
||||
.csid_udi_err_recovery_cfg1_addr = 0x4b4,
|
||||
.csid_udi_err_recovery_cfg2_addr = 0x4b8,
|
||||
.csid_udi_multi_vcdt_cfg0_addr = 0x4bc,
|
||||
.csid_udi_byte_cntr_ping_addr = 0x4e0,
|
||||
.csid_udi_byte_cntr_pong_addr = 0x4e4,
|
||||
/* configurations */
|
||||
.ccif_violation_en = 1,
|
||||
.overflow_ctrl_en = 1,
|
||||
};
|
||||
|
||||
static struct cam_ife_csid_csi2_rx_reg_offset
|
||||
cam_custom_csid_480_csi2_reg_offset = {
|
||||
.csid_csi2_rx_irq_status_addr = 0x20,
|
||||
.csid_csi2_rx_irq_mask_addr = 0x24,
|
||||
.csid_csi2_rx_irq_clear_addr = 0x28,
|
||||
.csid_csi2_rx_irq_set_addr = 0x2c,
|
||||
|
||||
/*CSI2 rx control */
|
||||
.csid_csi2_rx_cfg0_addr = 0x100,
|
||||
.csid_csi2_rx_cfg1_addr = 0x104,
|
||||
.csid_csi2_rx_capture_ctrl_addr = 0x108,
|
||||
.csid_csi2_rx_rst_strobes_addr = 0x110,
|
||||
.csid_csi2_rx_de_scramble_cfg0_addr = 0x114,
|
||||
.csid_csi2_rx_de_scramble_cfg1_addr = 0x118,
|
||||
.csid_csi2_rx_cap_unmap_long_pkt_hdr_0_addr = 0x120,
|
||||
.csid_csi2_rx_cap_unmap_long_pkt_hdr_1_addr = 0x124,
|
||||
.csid_csi2_rx_captured_short_pkt_0_addr = 0x128,
|
||||
.csid_csi2_rx_captured_short_pkt_1_addr = 0x12c,
|
||||
.csid_csi2_rx_captured_long_pkt_0_addr = 0x130,
|
||||
.csid_csi2_rx_captured_long_pkt_1_addr = 0x134,
|
||||
.csid_csi2_rx_captured_long_pkt_ftr_addr = 0x138,
|
||||
.csid_csi2_rx_captured_cphy_pkt_hdr_addr = 0x13c,
|
||||
.csid_csi2_rx_lane0_misr_addr = 0x150,
|
||||
.csid_csi2_rx_lane1_misr_addr = 0x154,
|
||||
.csid_csi2_rx_lane2_misr_addr = 0x158,
|
||||
.csid_csi2_rx_lane3_misr_addr = 0x15c,
|
||||
.csid_csi2_rx_total_pkts_rcvd_addr = 0x160,
|
||||
.csid_csi2_rx_stats_ecc_addr = 0x164,
|
||||
.csid_csi2_rx_total_crc_err_addr = 0x168,
|
||||
|
||||
.csi2_rst_srb_all = 0x3FFF,
|
||||
.csi2_rst_done_shift_val = 27,
|
||||
.csi2_irq_mask_all = 0xFFFFFFF,
|
||||
.csi2_misr_enable_shift_val = 6,
|
||||
.csi2_vc_mode_shift_val = 2,
|
||||
.csi2_capture_long_pkt_en_shift = 0,
|
||||
.csi2_capture_short_pkt_en_shift = 1,
|
||||
.csi2_capture_cphy_pkt_en_shift = 2,
|
||||
.csi2_capture_long_pkt_dt_shift = 4,
|
||||
.csi2_capture_long_pkt_vc_shift = 10,
|
||||
.csi2_capture_short_pkt_vc_shift = 15,
|
||||
.csi2_capture_cphy_pkt_dt_shift = 20,
|
||||
.csi2_capture_cphy_pkt_vc_shift = 26,
|
||||
.csi2_rx_phy_num_mask = 0x3,
|
||||
};
|
||||
|
||||
static struct cam_ife_csid_common_reg_offset
|
||||
cam_custom_csid_480_cmn_reg_offset = {
|
||||
.csid_hw_version_addr = 0x0,
|
||||
.csid_cfg0_addr = 0x4,
|
||||
.csid_ctrl_addr = 0x8,
|
||||
.csid_reset_addr = 0xc,
|
||||
.csid_rst_strobes_addr = 0x10,
|
||||
|
||||
.csid_test_bus_ctrl_addr = 0x14,
|
||||
.csid_top_irq_status_addr = 0x70,
|
||||
.csid_top_irq_mask_addr = 0x74,
|
||||
.csid_top_irq_clear_addr = 0x78,
|
||||
.csid_top_irq_set_addr = 0x7c,
|
||||
.csid_irq_cmd_addr = 0x80,
|
||||
|
||||
/*configurations */
|
||||
.major_version = 1,
|
||||
.minor_version = 7,
|
||||
.version_incr = 0,
|
||||
.num_udis = 3,
|
||||
.num_rdis = 0,
|
||||
.num_pix = 0,
|
||||
.num_ppp = 0,
|
||||
.csid_reg_rst_stb = 1,
|
||||
.csid_rst_stb = 0x1e,
|
||||
.csid_rst_stb_sw_all = 0x1f,
|
||||
.path_rst_stb_all = 0x7f,
|
||||
.path_rst_done_shift_val = 1,
|
||||
.path_en_shift_val = 31,
|
||||
.dt_id_shift_val = 27,
|
||||
.vc_shift_val = 22,
|
||||
.dt_shift_val = 16,
|
||||
.fmt_shift_val = 12,
|
||||
.plain_fmt_shit_val = 10,
|
||||
.crop_v_en_shift_val = 6,
|
||||
.crop_h_en_shift_val = 5,
|
||||
.crop_shift = 16,
|
||||
.ipp_irq_mask_all = 0,
|
||||
.rdi_irq_mask_all = 0,
|
||||
.ppp_irq_mask_all = 0,
|
||||
.udi_irq_mask_all = 0x7FFF,
|
||||
.measure_en_hbi_vbi_cnt_mask = 0xC,
|
||||
.format_measure_en_val = 1,
|
||||
.num_bytes_out_shift_val = 3,
|
||||
};
|
||||
|
||||
static struct cam_ife_csid_reg_offset cam_custom_csid_480_reg_offset = {
|
||||
.cmn_reg = &cam_custom_csid_480_cmn_reg_offset,
|
||||
.csi2_reg = &cam_custom_csid_480_csi2_reg_offset,
|
||||
.ipp_reg = NULL,
|
||||
.ppp_reg = NULL,
|
||||
.rdi_reg = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
},
|
||||
.udi_reg = {
|
||||
&cam_custom_csid_480_udi_0_reg_offset,
|
||||
&cam_custom_csid_480_udi_1_reg_offset,
|
||||
&cam_custom_csid_480_udi_2_reg_offset,
|
||||
},
|
||||
.tpg_reg = NULL,
|
||||
};
|
||||
|
||||
#endif /*_CAM_IFE_CSID_480_H_ */
|
@@ -0,0 +1,190 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include "linux/module.h"
|
||||
#include "cam_custom_csid_dev.h"
|
||||
#include "cam_ife_csid_core.h"
|
||||
#include "cam_hw.h"
|
||||
#include "cam_hw_intf.h"
|
||||
#include "cam_custom_csid480.h"
|
||||
#include "cam_debug_util.h"
|
||||
|
||||
#define CAM_CUSTOM_CSID_DRV_NAME "custom_csid"
|
||||
|
||||
static struct cam_hw_intf *cam_custom_csid_hw_list[CAM_IFE_CSID_HW_NUM_MAX] = {
|
||||
0, 0, 0, 0};
|
||||
|
||||
static char csid_dev_name[16];
|
||||
|
||||
static struct cam_ife_csid_hw_info cam_custom_csid480_hw_info = {
|
||||
.csid_reg = &cam_custom_csid_480_reg_offset,
|
||||
.hw_dts_version = CAM_CSID_VERSION_V480,
|
||||
};
|
||||
|
||||
static int cam_custom_csid_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
struct cam_hw_intf *csid_hw_intf;
|
||||
struct cam_hw_info *csid_hw_info;
|
||||
struct cam_ife_csid_hw *csid_dev = NULL;
|
||||
const struct of_device_id *match_dev = NULL;
|
||||
struct cam_ife_csid_hw_info *csid_hw_data = NULL;
|
||||
uint32_t csid_dev_idx;
|
||||
int rc = 0;
|
||||
|
||||
csid_hw_intf = kzalloc(sizeof(*csid_hw_intf), GFP_KERNEL);
|
||||
if (!csid_hw_intf) {
|
||||
rc = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
csid_hw_info = kzalloc(sizeof(struct cam_hw_info), GFP_KERNEL);
|
||||
if (!csid_hw_info) {
|
||||
rc = -ENOMEM;
|
||||
goto free_hw_intf;
|
||||
}
|
||||
|
||||
csid_dev = kzalloc(sizeof(struct cam_ife_csid_hw), GFP_KERNEL);
|
||||
if (!csid_dev) {
|
||||
rc = -ENOMEM;
|
||||
goto free_hw_info;
|
||||
}
|
||||
|
||||
/* get custom csid hw index */
|
||||
of_property_read_u32(pdev->dev.of_node, "cell-index", &csid_dev_idx);
|
||||
/* get custom csid hw information */
|
||||
match_dev = of_match_device(pdev->dev.driver->of_match_table,
|
||||
&pdev->dev);
|
||||
if (!match_dev) {
|
||||
CAM_ERR(CAM_CUSTOM,
|
||||
"No matching table for the CUSTOM CSID HW!");
|
||||
rc = -EINVAL;
|
||||
goto free_dev;
|
||||
}
|
||||
|
||||
memset(csid_dev_name, 0, sizeof(csid_dev_name));
|
||||
snprintf(csid_dev_name, sizeof(csid_dev_name),
|
||||
"csid-custom%1u", csid_dev_idx);
|
||||
|
||||
csid_hw_intf->hw_idx = csid_dev_idx;
|
||||
csid_hw_intf->hw_type = CAM_ISP_HW_TYPE_IFE_CSID;
|
||||
csid_hw_intf->hw_priv = csid_hw_info;
|
||||
|
||||
csid_hw_info->core_info = csid_dev;
|
||||
csid_hw_info->soc_info.pdev = pdev;
|
||||
csid_hw_info->soc_info.dev = &pdev->dev;
|
||||
csid_hw_info->soc_info.dev_name = csid_dev_name;
|
||||
csid_hw_info->soc_info.index = csid_dev_idx;
|
||||
|
||||
csid_hw_data = (struct cam_ife_csid_hw_info *)match_dev->data;
|
||||
csid_dev->csid_info = csid_hw_data;
|
||||
|
||||
rc = cam_ife_csid_hw_probe_init(csid_hw_intf, csid_dev_idx, true);
|
||||
if (rc)
|
||||
goto free_dev;
|
||||
|
||||
platform_set_drvdata(pdev, csid_dev);
|
||||
CAM_DBG(CAM_CUSTOM, "CSID:%d probe successful for dev %s",
|
||||
csid_hw_intf->hw_idx, csid_dev_name);
|
||||
|
||||
if (csid_hw_intf->hw_idx < CAM_IFE_CSID_HW_NUM_MAX)
|
||||
cam_custom_csid_hw_list[csid_hw_intf->hw_idx] = csid_hw_intf;
|
||||
else
|
||||
goto free_dev;
|
||||
|
||||
return 0;
|
||||
|
||||
free_dev:
|
||||
kfree(csid_dev);
|
||||
free_hw_info:
|
||||
kfree(csid_hw_info);
|
||||
free_hw_intf:
|
||||
kfree(csid_hw_intf);
|
||||
err:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int cam_custom_csid_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct cam_ife_csid_hw *csid_dev = NULL;
|
||||
struct cam_hw_intf *csid_hw_intf;
|
||||
struct cam_hw_info *csid_hw_info;
|
||||
|
||||
csid_dev = (struct cam_ife_csid_hw *)platform_get_drvdata(pdev);
|
||||
csid_hw_intf = csid_dev->hw_intf;
|
||||
csid_hw_info = csid_dev->hw_info;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "CSID:%d remove",
|
||||
csid_dev->hw_intf->hw_idx);
|
||||
|
||||
cam_ife_csid_hw_deinit(csid_dev);
|
||||
|
||||
/*release the csid device memory */
|
||||
kfree(csid_dev);
|
||||
kfree(csid_hw_info);
|
||||
kfree(csid_hw_intf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id cam_custom_csid_dt_match[] = {
|
||||
{
|
||||
.compatible = "qcom,csid-custom480",
|
||||
.data = &cam_custom_csid480_hw_info
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, cam_custom_csid_dt_match);
|
||||
|
||||
static struct platform_driver cam_custom_csid_driver = {
|
||||
.probe = cam_custom_csid_probe,
|
||||
.driver = {
|
||||
.name = "qcom,custom-csid",
|
||||
.of_match_table = cam_custom_csid_dt_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
.remove = cam_custom_csid_remove,
|
||||
};
|
||||
|
||||
static int __init cam_custom_csid_driver_init(void)
|
||||
{
|
||||
int32_t rc = 0;
|
||||
|
||||
rc = platform_driver_register(&cam_custom_csid_driver);
|
||||
if (rc < 0)
|
||||
CAM_ERR(CAM_CUSTOM, "platform_driver_register Failed: rc = %d",
|
||||
rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_csid_hw_init(struct cam_hw_intf **custom_csid_hw,
|
||||
uint32_t hw_idx)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (cam_custom_csid_hw_list[hw_idx]) {
|
||||
*custom_csid_hw = cam_custom_csid_hw_list[hw_idx];
|
||||
} else {
|
||||
*custom_csid_hw = NULL;
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void __exit cam_custom_csid_driver_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&cam_custom_csid_driver);
|
||||
}
|
||||
|
||||
module_init(cam_custom_csid_driver_init);
|
||||
module_exit(cam_custom_csid_driver_exit);
|
||||
MODULE_DESCRIPTION("cam_custom_csid_driver");
|
||||
MODULE_LICENSE("GPL v2");
|
@@ -0,0 +1,12 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_IFE_CSID_DEV_H_
|
||||
#define _CAM_IFE_CSID_DEV_H_
|
||||
|
||||
#include "cam_debug_util.h"
|
||||
#include "cam_custom_hw_mgr_intf.h"
|
||||
|
||||
#endif /*_CAM_IFE_CSID_DEV_H_ */
|
10
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/Makefile
Normal file
10
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_utils
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_core
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cpas/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/include
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/
|
||||
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1
|
||||
|
||||
obj-$(CONFIG_SPECTRA_CAMERA) += cam_custom_sub_mod_soc.o cam_custom_sub_mod_dev.o cam_custom_sub_mod_core.o
|
@@ -0,0 +1,337 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include "cam_custom_sub_mod_core.h"
|
||||
|
||||
int cam_custom_hw_sub_mod_get_hw_caps(void *hw_priv,
|
||||
void *get_hw_cap_args, uint32_t arg_size)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Add HW Capabilities to be published */
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_init_hw(void *hw_priv,
|
||||
void *init_hw_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_hw = hw_priv;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
struct cam_custom_resource_node *custom_res = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&custom_hw->hw_mutex);
|
||||
custom_hw->open_count++;
|
||||
if (custom_hw->open_count > 1) {
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"Cam Custom has already been initialized cnt %d",
|
||||
custom_hw->open_count);
|
||||
return 0;
|
||||
}
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
|
||||
soc_info = &custom_hw->soc_info;
|
||||
|
||||
/* Turn ON Regulators, Clocks and other SOC resources */
|
||||
rc = cam_custom_hw_sub_mod_enable_soc_resources(soc_info);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Enable SOC failed");
|
||||
rc = -EFAULT;
|
||||
goto decrement_open_cnt;
|
||||
}
|
||||
|
||||
custom_res = (struct cam_custom_resource_node *)init_hw_args;
|
||||
if (custom_res && custom_res->init) {
|
||||
rc = custom_res->init(custom_res, NULL, 0);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "init Failed rc=%d", rc);
|
||||
goto decrement_open_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
rc = cam_custom_hw_sub_mod_reset(hw_priv, NULL, 0);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_CUSTOM, "Custom HW reset failed : %d", rc);
|
||||
goto decrement_open_cnt;
|
||||
}
|
||||
/* Initialize all resources here */
|
||||
custom_hw->hw_state = CAM_HW_STATE_POWER_UP;
|
||||
return rc;
|
||||
|
||||
decrement_open_cnt:
|
||||
mutex_lock(&custom_hw->hw_mutex);
|
||||
custom_hw->open_count--;
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_deinit_hw(void *hw_priv,
|
||||
void *deinit_hw_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_hw = hw_priv;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
struct cam_custom_resource_node *custom_res = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&custom_hw->hw_mutex);
|
||||
if (!custom_hw->open_count) {
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
CAM_ERR(CAM_CUSTOM, "Error! Unbalanced deinit");
|
||||
return -EFAULT;
|
||||
}
|
||||
custom_hw->open_count--;
|
||||
if (custom_hw->open_count) {
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
CAM_DBG(CAM_CUSTOM,
|
||||
"open_cnt non-zero =%d", custom_hw->open_count);
|
||||
return 0;
|
||||
}
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
|
||||
soc_info = &custom_hw->soc_info;
|
||||
|
||||
custom_res = (struct cam_custom_resource_node *)deinit_hw_args;
|
||||
if (custom_res && custom_res->deinit) {
|
||||
rc = custom_res->deinit(custom_res, NULL, 0);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "deinit failed");
|
||||
}
|
||||
|
||||
rc = cam_custom_hw_sub_mod_reset(hw_priv, NULL, 0);
|
||||
|
||||
/* Turn OFF Regulators, Clocks and other SOC resources */
|
||||
CAM_DBG(CAM_CUSTOM, "Disable SOC resource");
|
||||
rc = cam_custom_hw_sub_mod_disable_soc_resources(soc_info);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "Disable SOC failed");
|
||||
|
||||
custom_hw->hw_state = CAM_HW_STATE_POWER_DOWN;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_reset(void *hw_priv,
|
||||
void *reserve_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_hw = hw_priv;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid input arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
soc_info = &custom_hw->soc_info;
|
||||
/* Do Reset of HW */
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_reserve(void *hw_priv,
|
||||
void *reserve_args, uint32_t arg_size)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv || !reserve_args) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid input arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*Reserve Args */
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int cam_custom_hw_sub_mod_release(void *hw_priv,
|
||||
void *release_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_hw = hw_priv;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv || !release_args) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid input arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&custom_hw->hw_mutex);
|
||||
/* Release Resources */
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int cam_custom_hw_sub_mod_start(void *hw_priv,
|
||||
void *start_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_hw = hw_priv;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv || !start_args) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid input arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&custom_hw->hw_mutex);
|
||||
/* Start HW -- Stream On*/
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_stop(void *hw_priv,
|
||||
void *stop_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_hw = hw_priv;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv || !stop_args) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid input arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&custom_hw->hw_mutex);
|
||||
/* Stop HW */
|
||||
mutex_unlock(&custom_hw->hw_mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_read(void *hw_priv,
|
||||
void *read_args, uint32_t arg_size)
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_write(void *hw_priv,
|
||||
void *write_args, uint32_t arg_size)
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
int cam_custom_hw_submit_req(void *hw_priv, void *hw_submit_args,
|
||||
uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *custom_dev = hw_priv;
|
||||
struct cam_custom_sub_mod_req_to_dev *submit_req =
|
||||
(struct cam_custom_sub_mod_req_to_dev *)hw_submit_args;
|
||||
struct cam_custom_sub_mod_core_info *core_info = NULL;
|
||||
|
||||
core_info =
|
||||
(struct cam_custom_sub_mod_core_info *)custom_dev->core_info;
|
||||
|
||||
spin_lock(&custom_dev->hw_lock);
|
||||
if (core_info->curr_req) {
|
||||
CAM_WARN(CAM_CUSTOM, "Req %lld still processed by %s",
|
||||
core_info->curr_req->req_id,
|
||||
custom_dev->soc_info.dev_name);
|
||||
spin_unlock(&custom_dev->hw_lock);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
core_info->curr_req = submit_req;
|
||||
spin_unlock(&custom_dev->hw_lock);
|
||||
|
||||
/* Do other submit procedures */
|
||||
return 0;
|
||||
}
|
||||
|
||||
irqreturn_t cam_custom_hw_sub_mod_irq(int irq_num, void *data)
|
||||
{
|
||||
struct cam_hw_info *custom_dev = data;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
struct cam_custom_hw_cb_args cb_args;
|
||||
struct cam_custom_sub_mod_core_info *core_info = NULL;
|
||||
uint32_t irq_status = 0;
|
||||
|
||||
if (!data) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid custom_dev_info");
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
soc_info = &custom_dev->soc_info;
|
||||
core_info =
|
||||
(struct cam_custom_sub_mod_core_info *)custom_dev->core_info;
|
||||
|
||||
irq_status = cam_io_r_mb(soc_info->reg_map[0].mem_base +
|
||||
core_info->device_hw_info->irq_status);
|
||||
|
||||
cam_io_w_mb(irq_status,
|
||||
soc_info->reg_map[0].mem_base +
|
||||
core_info->device_hw_info->irq_clear);
|
||||
|
||||
spin_lock(&custom_dev->hw_lock);
|
||||
cb_args.irq_status = irq_status;
|
||||
cb_args.req_info = core_info->curr_req;
|
||||
core_info->curr_req = NULL;
|
||||
if (core_info->irq_cb.custom_hw_mgr_cb)
|
||||
core_info->irq_cb.custom_hw_mgr_cb(
|
||||
core_info->irq_cb.data, &cb_args);
|
||||
spin_unlock(&custom_dev->hw_lock);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_process_cmd(void *hw_priv, uint32_t cmd_type,
|
||||
void *cmd_args, uint32_t arg_size)
|
||||
{
|
||||
struct cam_hw_info *hw = hw_priv;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
struct cam_custom_sub_mod_core_info *core_info = NULL;
|
||||
unsigned long flag = 0;
|
||||
int rc = 0;
|
||||
|
||||
if (!hw_priv || !cmd_args) {
|
||||
CAM_ERR(CAM_CUSTOM, "Invalid arguments");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
soc_info = &hw->soc_info;
|
||||
core_info = hw->core_info;
|
||||
/* Handle any custom process cmds */
|
||||
|
||||
switch (cmd_type) {
|
||||
case CAM_CUSTOM_SET_IRQ_CB: {
|
||||
struct cam_custom_sub_mod_set_irq_cb *irq_cb = cmd_args;
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Setting irq cb");
|
||||
spin_lock_irqsave(&hw->hw_lock, flag);
|
||||
core_info->irq_cb.custom_hw_mgr_cb = irq_cb->custom_hw_mgr_cb;
|
||||
core_info->irq_cb.data = irq_cb->data;
|
||||
spin_unlock_irqrestore(&hw->hw_lock, flag);
|
||||
break;
|
||||
}
|
||||
case CAM_CUSTOM_SUBMIT_REQ: {
|
||||
rc = cam_custom_hw_submit_req(hw_priv, cmd_args, arg_size);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,79 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_SUB_MOD_CORE_H_
|
||||
#define _CAM_CUSTOM_SUB_MOD_CORE_H_
|
||||
|
||||
#include "cam_debug_util.h"
|
||||
#include "cam_custom_hw.h"
|
||||
#include "cam_custom_sub_mod_soc.h"
|
||||
#include "cam_custom_hw_mgr_intf.h"
|
||||
|
||||
struct cam_custom_sub_mod_set_irq_cb {
|
||||
int32_t (*custom_hw_mgr_cb)(void *data,
|
||||
struct cam_custom_hw_cb_args *cb_args);
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct cam_custom_sub_mod_req_to_dev {
|
||||
uint64_t req_id;
|
||||
uint32_t ctx_idx;
|
||||
uint32_t dev_idx;
|
||||
};
|
||||
|
||||
struct cam_custom_device_hw_info {
|
||||
uint32_t hw_ver;
|
||||
uint32_t irq_status;
|
||||
uint32_t irq_mask;
|
||||
uint32_t irq_clear;
|
||||
};
|
||||
|
||||
struct cam_custom_sub_mod_core_info {
|
||||
uint32_t cpas_handle;
|
||||
bool cpas_start;
|
||||
bool clk_enable;
|
||||
struct cam_custom_sub_mod_set_irq_cb irq_cb;
|
||||
struct cam_custom_sub_mod_req_to_dev *curr_req;
|
||||
struct cam_custom_device_hw_info *device_hw_info;
|
||||
struct cam_hw_info *custom_hw_info;
|
||||
};
|
||||
|
||||
enum cam_custom_hw_resource_type {
|
||||
CAM_CUSTOM_HW_RESOURCE_UNINT,
|
||||
CAM_CUSTOM_HW_RESOURCE_SRC,
|
||||
CAM_CUSTOM_HW_RESOURCE_MAX,
|
||||
};
|
||||
|
||||
struct cam_custom_sub_mod_acq {
|
||||
enum cam_custom_hw_resource_type rsrc_type;
|
||||
int32_t acq;
|
||||
struct cam_custom_resource_node *rsrc_node;
|
||||
};
|
||||
|
||||
int cam_custom_hw_sub_mod_get_hw_caps(void *hw_priv,
|
||||
void *get_hw_cap_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_init_hw(void *hw_priv,
|
||||
void *init_hw_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_deinit_hw(void *hw_priv,
|
||||
void *deinit_hw_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_reset(void *hw_priv,
|
||||
void *deinit_hw_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_reserve(void *hw_priv,
|
||||
void *reserve_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_release(void *hw_priv,
|
||||
void *release_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_start(void *hw_priv,
|
||||
void *start_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_stop(void *hw_priv,
|
||||
void *stop_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_read(void *hw_priv,
|
||||
void *read_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_write(void *hw_priv,
|
||||
void *write_args, uint32_t arg_size);
|
||||
int cam_custom_hw_sub_mod_process_cmd(void *hw_priv, uint32_t cmd_type,
|
||||
void *cmd_args, uint32_t arg_size);
|
||||
irqreturn_t cam_custom_hw_sub_mod_irq(int irq_num, void *data);
|
||||
|
||||
#endif /* _CAM_CUSTOM_SUB_MOD_CORE_H_ */
|
@@ -0,0 +1,162 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include "cam_custom_sub_mod_dev.h"
|
||||
#include "cam_custom_sub_mod_core.h"
|
||||
#include "cam_custom_sub_mod_soc.h"
|
||||
#include "cam_debug_util.h"
|
||||
|
||||
static struct cam_hw_intf *cam_custom_hw_sub_mod_list
|
||||
[CAM_CUSTOM_SUB_MOD_MAX_INSTANCES] = {0, 0};
|
||||
|
||||
static char cam_custom_hw_sub_mod_name[8];
|
||||
|
||||
struct cam_custom_device_hw_info cam_custom_hw_info = {
|
||||
.hw_ver = 0x0,
|
||||
.irq_status = 0x0,
|
||||
.irq_mask = 0x0,
|
||||
.irq_clear = 0x0,
|
||||
};
|
||||
EXPORT_SYMBOL(cam_custom_hw_info);
|
||||
|
||||
int cam_custom_hw_sub_mod_init(struct cam_hw_intf **custom_hw, uint32_t hw_idx)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (cam_custom_hw_sub_mod_list[hw_idx]) {
|
||||
*custom_hw = cam_custom_hw_sub_mod_list[hw_idx];
|
||||
rc = 0;
|
||||
} else {
|
||||
*custom_hw = NULL;
|
||||
rc = -ENODEV;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct cam_hw_info *hw = NULL;
|
||||
struct cam_hw_intf *hw_intf = NULL;
|
||||
struct cam_custom_sub_mod_core_info *core_info = NULL;
|
||||
int rc = 0;
|
||||
|
||||
hw_intf = kzalloc(sizeof(struct cam_hw_intf), GFP_KERNEL);
|
||||
if (!hw_intf)
|
||||
return -ENOMEM;
|
||||
|
||||
of_property_read_u32(pdev->dev.of_node,
|
||||
"cell-index", &hw_intf->hw_idx);
|
||||
|
||||
hw = kzalloc(sizeof(struct cam_hw_info), GFP_KERNEL);
|
||||
if (!hw) {
|
||||
rc = -ENOMEM;
|
||||
goto free_hw_intf;
|
||||
}
|
||||
|
||||
memset(cam_custom_hw_sub_mod_name, 0,
|
||||
sizeof(cam_custom_hw_sub_mod_name));
|
||||
snprintf(cam_custom_hw_sub_mod_name, sizeof(cam_custom_hw_sub_mod_name),
|
||||
"custom_hw%1u", hw_intf->hw_idx);
|
||||
|
||||
hw->soc_info.pdev = pdev;
|
||||
hw->soc_info.dev = &pdev->dev;
|
||||
hw->soc_info.dev_name = cam_custom_hw_sub_mod_name;
|
||||
hw_intf->hw_priv = hw;
|
||||
hw_intf->hw_ops.get_hw_caps = cam_custom_hw_sub_mod_get_hw_caps;
|
||||
hw_intf->hw_ops.init = cam_custom_hw_sub_mod_init_hw;
|
||||
hw_intf->hw_ops.deinit = cam_custom_hw_sub_mod_deinit_hw;
|
||||
hw_intf->hw_ops.reset = cam_custom_hw_sub_mod_reset;
|
||||
hw_intf->hw_ops.reserve = cam_custom_hw_sub_mod_reserve;
|
||||
hw_intf->hw_ops.release = cam_custom_hw_sub_mod_release;
|
||||
hw_intf->hw_ops.start = cam_custom_hw_sub_mod_start;
|
||||
hw_intf->hw_ops.stop = cam_custom_hw_sub_mod_stop;
|
||||
hw_intf->hw_ops.read = cam_custom_hw_sub_mod_read;
|
||||
hw_intf->hw_ops.write = cam_custom_hw_sub_mod_write;
|
||||
hw_intf->hw_ops.process_cmd = cam_custom_hw_sub_mod_process_cmd;
|
||||
hw_intf->hw_type = CAM_CUSTOM_HW_TYPE_1;
|
||||
|
||||
platform_set_drvdata(pdev, hw_intf);
|
||||
|
||||
hw->core_info = kzalloc(sizeof(struct cam_custom_sub_mod_core_info),
|
||||
GFP_KERNEL);
|
||||
if (!hw->core_info) {
|
||||
CAM_DBG(CAM_CUSTOM, "Failed to alloc for core");
|
||||
rc = -ENOMEM;
|
||||
goto free_hw;
|
||||
}
|
||||
core_info = (struct cam_custom_sub_mod_core_info *)hw->core_info;
|
||||
|
||||
core_info->custom_hw_info = hw;
|
||||
|
||||
rc = cam_custom_hw_sub_mod_init_soc_resources(&hw->soc_info,
|
||||
cam_custom_hw_sub_mod_irq, hw);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_CUSTOM, "Failed to init soc rc=%d", rc);
|
||||
goto free_core_info;
|
||||
}
|
||||
|
||||
/* Initialize HW */
|
||||
|
||||
hw->hw_state = CAM_HW_STATE_POWER_DOWN;
|
||||
mutex_init(&hw->hw_mutex);
|
||||
spin_lock_init(&hw->hw_lock);
|
||||
init_completion(&hw->hw_complete);
|
||||
|
||||
if (hw_intf->hw_idx < CAM_CUSTOM_HW_SUB_MOD_MAX)
|
||||
cam_custom_hw_sub_mod_list[hw_intf->hw_idx] = hw_intf;
|
||||
|
||||
/* needs to be invoked when custom hw is in place */
|
||||
//cam_custom_hw_sub_mod_init_hw(hw, NULL, 0);
|
||||
|
||||
CAM_DBG(CAM_CUSTOM, "Custom hw_idx[%d] probe successful",
|
||||
hw_intf->hw_idx);
|
||||
return rc;
|
||||
|
||||
free_core_info:
|
||||
kfree(hw->core_info);
|
||||
free_hw:
|
||||
kfree(hw);
|
||||
free_hw_intf:
|
||||
kfree(hw_intf);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static const struct of_device_id cam_custom_hw_sub_mod_dt_match[] = {
|
||||
{
|
||||
.compatible = "qcom,cam_custom_hw_sub_mod",
|
||||
.data = &cam_custom_hw_info,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, cam_custom_hw_sub_mod_dt_match);
|
||||
|
||||
static struct platform_driver cam_custom_hw_sub_mod_driver = {
|
||||
.probe = cam_custom_hw_sub_mod_probe,
|
||||
.driver = {
|
||||
.name = CAM_CUSTOM_SUB_MOD_NAME,
|
||||
.of_match_table = cam_custom_hw_sub_mod_dt_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init cam_custom_hw_sub_module_init(void)
|
||||
{
|
||||
return platform_driver_register(&cam_custom_hw_sub_mod_driver);
|
||||
}
|
||||
|
||||
static void __exit cam_custom_hw_sub_module_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&cam_custom_hw_sub_mod_driver);
|
||||
}
|
||||
|
||||
module_init(cam_custom_hw_sub_module_init);
|
||||
module_exit(cam_custom_hw_sub_module_exit);
|
||||
MODULE_DESCRIPTION("CAM CUSTOM HW SUB MODULE driver");
|
||||
MODULE_LICENSE("GPL v2");
|
@@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_SUB_MOD_DEV_H_
|
||||
#define _CAM_CUSTOM_SUB_MOD_DEV_H_
|
||||
|
||||
#include "cam_custom_hw_mgr_intf.h"
|
||||
|
||||
#define CAM_CUSTOM_SUB_MOD_NAME "cam_custom_sub_mod"
|
||||
|
||||
#define CAM_CUSTOM_SUB_MOD_MAX_INSTANCES 2
|
||||
|
||||
#endif /* _CAM_CUSTOM_SUB_MOD_DEV_H_ */
|
@@ -0,0 +1,160 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include "cam_cpas_api.h"
|
||||
#include "cam_custom_sub_mod_soc.h"
|
||||
#include "cam_debug_util.h"
|
||||
|
||||
int cam_custom_hw_sub_mod_init_soc_resources(struct cam_hw_soc_info *soc_info,
|
||||
irq_handler_t irq_handler, void *irq_data)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_custom_hw_soc_private *soc_private = NULL;
|
||||
struct cam_cpas_register_params cpas_register_param;
|
||||
|
||||
rc = cam_soc_util_get_dt_properties(soc_info);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_CUSTOM,
|
||||
"Error! Get DT properties failed rc=%d", rc);
|
||||
/* For Test Purposes */
|
||||
return 0;
|
||||
}
|
||||
|
||||
soc_private = kzalloc(sizeof(struct cam_custom_hw_soc_private),
|
||||
GFP_KERNEL);
|
||||
if (!soc_private) {
|
||||
CAM_DBG(CAM_CUSTOM, "Error! soc_private Alloc Failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
soc_info->soc_private = soc_private;
|
||||
|
||||
rc = cam_soc_util_request_platform_resource(soc_info, irq_handler,
|
||||
irq_data);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_CUSTOM,
|
||||
"Error! Request platform resources failed rc=%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
memset(&cpas_register_param, 0, sizeof(cpas_register_param));
|
||||
|
||||
cpas_register_param.cell_index = soc_info->index;
|
||||
cpas_register_param.dev = soc_info->dev;
|
||||
cpas_register_param.cam_cpas_client_cb = NULL;
|
||||
cpas_register_param.userdata = soc_info;
|
||||
soc_private->cpas_handle =
|
||||
cpas_register_param.client_handle;
|
||||
|
||||
rc = cam_cpas_register_client(&cpas_register_param);
|
||||
if (rc < 0)
|
||||
goto release_soc;
|
||||
|
||||
return rc;
|
||||
|
||||
release_soc:
|
||||
cam_soc_util_release_platform_resource(soc_info);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_deinit_soc_resources(struct cam_hw_soc_info *soc_info)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_custom_hw_soc_private *soc_private = NULL;
|
||||
|
||||
if (!soc_info) {
|
||||
CAM_ERR(CAM_CUSTOM, "Error! soc_info NULL");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
soc_private = soc_info->soc_private;
|
||||
if (!soc_private) {
|
||||
CAM_ERR(CAM_CUSTOM, "Error! soc_private NULL");
|
||||
return -ENODEV;
|
||||
}
|
||||
rc = cam_cpas_unregister_client(soc_private->cpas_handle);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CUSTOM, "CPAS0 unregistration failed rc=%d", rc);
|
||||
|
||||
rc = cam_soc_util_release_platform_resource(soc_info);
|
||||
if (rc < 0)
|
||||
CAM_ERR(CAM_CUSTOM,
|
||||
"Error! Release platform resources failed rc=%d", rc);
|
||||
|
||||
kfree(soc_private);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_enable_soc_resources(struct cam_hw_soc_info *soc_info)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_custom_hw_soc_private *soc_private = soc_info->soc_private;
|
||||
struct cam_ahb_vote ahb_vote;
|
||||
struct cam_axi_vote axi_vote = {0};
|
||||
|
||||
ahb_vote.type = CAM_VOTE_ABSOLUTE;
|
||||
ahb_vote.vote.level = CAM_LOWSVS_VOTE;
|
||||
axi_vote.num_paths = 2;
|
||||
axi_vote.axi_path[0].path_data_type = CAM_AXI_PATH_DATA_ALL;
|
||||
axi_vote.axi_path[0].transac_type = CAM_AXI_TRANSACTION_READ;
|
||||
axi_vote.axi_path[0].camnoc_bw = 7200000;
|
||||
axi_vote.axi_path[0].mnoc_ab_bw = 7200000;
|
||||
axi_vote.axi_path[0].mnoc_ib_bw = 7200000;
|
||||
axi_vote.axi_path[1].path_data_type = CAM_AXI_PATH_DATA_ALL;
|
||||
axi_vote.axi_path[1].transac_type = CAM_AXI_TRANSACTION_WRITE;
|
||||
axi_vote.axi_path[1].camnoc_bw = 512000000;
|
||||
axi_vote.axi_path[1].mnoc_ab_bw = 512000000;
|
||||
axi_vote.axi_path[1].mnoc_ib_bw = 512000000;
|
||||
|
||||
rc = cam_cpas_start(soc_private->cpas_handle, &ahb_vote, &axi_vote);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Error! CPAS0 start failed rc=%d", rc);
|
||||
rc = -EFAULT;
|
||||
goto end;
|
||||
}
|
||||
|
||||
rc = cam_soc_util_enable_platform_resource(soc_info, true,
|
||||
CAM_TURBO_VOTE, true);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Error! enable platform failed rc=%d", rc);
|
||||
goto stop_cpas;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
stop_cpas:
|
||||
cam_cpas_stop(soc_private->cpas_handle);
|
||||
end:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cam_custom_hw_sub_mod_disable_soc_resources(
|
||||
struct cam_hw_soc_info *soc_info)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cam_custom_hw_soc_private *soc_private;
|
||||
|
||||
if (!soc_info) {
|
||||
CAM_ERR(CAM_CUSTOM, "Error! Invalid params");
|
||||
rc = -EINVAL;
|
||||
return rc;
|
||||
}
|
||||
soc_private = soc_info->soc_private;
|
||||
|
||||
rc = cam_soc_util_disable_platform_resource(soc_info, true, true);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Disable platform failed rc=%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = cam_cpas_stop(soc_private->cpas_handle);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CUSTOM, "Error! CPAS stop failed rc=%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_HW_SUB_MOD_SOC_H_
|
||||
#define _CAM_CUSTOM_HW_SUB_MOD_SOC_H_
|
||||
|
||||
#include "cam_soc_util.h"
|
||||
/*
|
||||
* struct cam_custom_hw_soc_private:
|
||||
*
|
||||
* @Brief: Private SOC data specific to Custom HW Driver
|
||||
*
|
||||
* @cpas_handle: Handle returned on registering with CPAS driver.
|
||||
* This handle is used for all further interface
|
||||
* with CPAS.
|
||||
*/
|
||||
struct cam_custom_hw_soc_private {
|
||||
uint32_t cpas_handle;
|
||||
};
|
||||
|
||||
int cam_custom_hw_sub_mod_init_soc_resources(struct cam_hw_soc_info *soc_info,
|
||||
irq_handler_t irq_handler, void *irq_data);
|
||||
|
||||
int cam_custom_hw_sub_mod_deinit_soc_resources(
|
||||
struct cam_hw_soc_info *soc_info);
|
||||
|
||||
int cam_custom_hw_sub_mod_enable_soc_resources(
|
||||
struct cam_hw_soc_info *soc_info);
|
||||
|
||||
int cam_custom_hw_sub_mod_disable_soc_resources(
|
||||
struct cam_hw_soc_info *soc_info);
|
||||
|
||||
#endif /* _CAM_CUSTOM_HW_SUB_MOD_SOC_H_ */
|
1329
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.c
Normal file
1329
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.c
Normal file
File diff suppressed because it is too large
Load Diff
180
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.h
Normal file
180
drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_HW_MGR_H_
|
||||
#define _CAM_CUSTOM_HW_MGR_H_
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include "cam_custom_hw_mgr_intf.h"
|
||||
#include "cam_custom_sub_mod_core.h"
|
||||
#include "cam_ife_csid_hw_intf.h"
|
||||
#include "cam_isp_hw.h"
|
||||
#include "cam_custom_hw.h"
|
||||
#include <uapi/media/cam_defs.h>
|
||||
#include <uapi/media/cam_custom.h>
|
||||
|
||||
enum cam_custom_hw_mgr_res_type {
|
||||
CAM_CUSTOM_HW_SUB_MODULE,
|
||||
CAM_CUSTOM_CID_HW,
|
||||
CAM_CUSTOM_CSID_HW,
|
||||
CAM_CUSTOM_HW_MAX,
|
||||
};
|
||||
|
||||
/* Needs to be suitably defined */
|
||||
#define CAM_CUSTOM_HW_OUT_RES_MAX 1
|
||||
|
||||
/**
|
||||
* struct cam_custom_hw_mgr_res - HW resources for the Custom manager
|
||||
*
|
||||
* @list: used by the resource list
|
||||
* @res_type: Custom 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 Custom HW
|
||||
* layer
|
||||
* @rsrc_node: isp hw layer resource for csid/cid
|
||||
* @hw_res: hw layer resource array.
|
||||
*/
|
||||
struct cam_custom_hw_mgr_res {
|
||||
struct list_head list;
|
||||
enum cam_custom_hw_mgr_res_type res_type;
|
||||
uint32_t res_id;
|
||||
void *rsrc_node;
|
||||
struct cam_custom_resource_node *hw_res;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* struct ctx_base_info - Base hardware information for the context
|
||||
*
|
||||
* @idx: Base resource index
|
||||
*
|
||||
*/
|
||||
struct ctx_base_info {
|
||||
uint32_t idx;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* struct cam_custom_hw_mgr_ctx - Custom HW manager ctx object
|
||||
*
|
||||
* @list: used by the ctx list.
|
||||
* @ctx_index: acquired context id.
|
||||
* @hw_mgr: Custom hw mgr which owns this context
|
||||
* @ctx_in_use: flag to tell whether context is active
|
||||
* @res_list_custom_csid: custom csid modules for this context
|
||||
* @res_list_custom_cid: custom cid modules for this context
|
||||
* @sub_hw_list: HW submodules for this context
|
||||
* @free_res_list: Free resources list for the branch node
|
||||
* @res_pool: memory storage for the free resource list
|
||||
* @base: device base index array contain the all
|
||||
* Custom HW instance associated with this ctx.
|
||||
* @num_base: number of valid base data in the base array
|
||||
* @init_done: indicate whether init hw is done
|
||||
* @event_cb: event_cb to ctx
|
||||
* @cb_priv: data sent back with event_cb
|
||||
*
|
||||
*/
|
||||
struct cam_custom_hw_mgr_ctx {
|
||||
struct list_head list;
|
||||
|
||||
uint32_t ctx_index;
|
||||
struct cam_custom_hw_mgr *hw_mgr;
|
||||
uint32_t ctx_in_use;
|
||||
|
||||
struct list_head res_list_custom_csid;
|
||||
struct list_head res_list_custom_cid;
|
||||
struct cam_custom_hw_mgr_res sub_hw_list[
|
||||
CAM_CUSTOM_HW_RES_MAX];
|
||||
|
||||
struct list_head free_res_list;
|
||||
struct cam_custom_hw_mgr_res res_pool[CAM_CUSTOM_HW_RES_MAX];
|
||||
struct ctx_base_info base[CAM_CUSTOM_HW_SUB_MOD_MAX];
|
||||
uint32_t num_base;
|
||||
bool init_done;
|
||||
cam_hw_event_cb_func event_cb;
|
||||
void *cb_priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cam_custom_hw_mgr - Custom HW Manager
|
||||
*
|
||||
* @img_iommu_hdl: iommu handle
|
||||
* @custom_hw: Custom device instances array. This will be filled by
|
||||
* HW layer during initialization
|
||||
* @csid_devices: Custom csid device instance array
|
||||
* @ctx_mutex: mutex for the hw context pool
|
||||
* @free_ctx_list: free hw context list
|
||||
* @used_ctx_list: used hw context list
|
||||
* @ctx_pool: context storage
|
||||
*
|
||||
*/
|
||||
struct cam_custom_hw_mgr {
|
||||
int img_iommu_hdl;
|
||||
struct cam_hw_intf *custom_hw[CAM_CUSTOM_HW_SUB_MOD_MAX];
|
||||
struct cam_hw_intf *csid_devices[CAM_CUSTOM_CSID_HW_MAX];
|
||||
struct mutex ctx_mutex;
|
||||
struct list_head free_ctx_list;
|
||||
struct list_head used_ctx_list;
|
||||
struct cam_custom_hw_mgr_ctx ctx_pool[CAM_CTX_MAX];
|
||||
};
|
||||
|
||||
/**
|
||||
* cam_custom_hw_mgr_init()
|
||||
*
|
||||
* @brief: Initialize the Custom hardware manger. This is the
|
||||
* etnry functinon for the Cust HW manager.
|
||||
*
|
||||
* @of_node: Device node
|
||||
* @hw_mgr_intf: Custom hardware manager object returned
|
||||
* @iommu_hdl: Iommu handle to be returned
|
||||
*
|
||||
*/
|
||||
int cam_custom_hw_mgr_init(struct device_node *of_node,
|
||||
struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl);
|
||||
|
||||
|
||||
/* Utility APIs */
|
||||
|
||||
/**
|
||||
* cam_custom_hw_mgr_get_custom_res_state()
|
||||
*
|
||||
* @brief: Obtain equivalent custom rsrc state
|
||||
* from isp rsrc state
|
||||
*
|
||||
* @in_rsrc_state: isp rsrc state
|
||||
*
|
||||
*/
|
||||
enum cam_custom_hw_resource_state
|
||||
cam_custom_hw_mgr_get_custom_res_state(
|
||||
uint32_t in_rsrc_state);
|
||||
|
||||
/**
|
||||
* cam_custom_hw_mgr_get_isp_res_state()
|
||||
*
|
||||
* @brief: Obtain equivalent isp rsrc state
|
||||
* from custom rsrc state
|
||||
*
|
||||
* @in_rsrc_state: custom rsrc state
|
||||
*
|
||||
*/
|
||||
enum cam_isp_resource_state
|
||||
cam_custom_hw_mgr_get_isp_res_state(
|
||||
uint32_t in_rsrc_state);
|
||||
|
||||
/**
|
||||
* cam_custom_hw_mgr_get_isp_res_type()
|
||||
*
|
||||
* @brief: Obtain equivalent isp rsrc type
|
||||
* from custom rsrc type
|
||||
*
|
||||
* @res_type: custom rsrc type
|
||||
*
|
||||
*/
|
||||
enum cam_isp_resource_type
|
||||
cam_custom_hw_mgr_get_isp_res_type(
|
||||
enum cam_custom_hw_mgr_res_type res_type);
|
||||
|
||||
#endif /* _CAM_CUSTOM_HW_MGR_H_ */
|
57
drivers/cam_cust/cam_custom_hw_mgr/include/cam_custom_hw.h
Normal file
57
drivers/cam_cust/cam_custom_hw_mgr/include/cam_custom_hw.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_HW_H_
|
||||
#define _CAM_CUSTOM_HW_H_
|
||||
|
||||
#include <linux/of.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/list.h>
|
||||
#include <uapi/media/cam_custom.h>
|
||||
|
||||
enum cam_custom_hw_resource_state {
|
||||
CAM_CUSTOM_HW_RESOURCE_STATE_UNAVAILABLE = 0,
|
||||
CAM_CUSTOM_HW_RESOURCE_STATE_AVAILABLE = 1,
|
||||
CAM_CUSTOM_HW_RESOURCE_STATE_RESERVED = 2,
|
||||
CAM_CUSTOM_HW_RESOURCE_STATE_INIT_HW = 3,
|
||||
CAM_CUSTOM_HW_RESOURCE_STATE_STREAMING = 4,
|
||||
};
|
||||
|
||||
/*
|
||||
* struct cam_custom_resource_node:
|
||||
*
|
||||
* @Brief: Structure representing HW resource object
|
||||
*
|
||||
* @res_id: Unique resource ID within res_type objects
|
||||
* for a particular HW
|
||||
* @res_state: State of the resource
|
||||
* @hw_intf: HW Interface of HW to which this resource
|
||||
* belongs
|
||||
* @res_priv: Private data of the resource
|
||||
* @irq_handle: handle returned on subscribing for IRQ event
|
||||
* @init: function pointer to init the HW resource
|
||||
* @deinit: function pointer to deinit the HW resource
|
||||
* @start: function pointer to start the HW resource
|
||||
* @stop: function pointer to stop the HW resource
|
||||
* @process_cmd: function pointer for processing commands
|
||||
* specific to the resource
|
||||
*/
|
||||
struct cam_custom_resource_node {
|
||||
uint32_t res_id;
|
||||
enum cam_custom_hw_resource_state res_state;
|
||||
struct cam_hw_intf *hw_intf;
|
||||
void *res_priv;
|
||||
int irq_handle;
|
||||
|
||||
int (*init)(struct cam_custom_resource_node *rsrc_node,
|
||||
void *init_args, uint32_t arg_size);
|
||||
int (*deinit)(struct cam_custom_resource_node *rsrc_node,
|
||||
void *deinit_args, uint32_t arg_size);
|
||||
int (*start)(struct cam_custom_resource_node *rsrc_node);
|
||||
int (*stop)(struct cam_custom_resource_node *rsrc_node);
|
||||
int (*process_cmd)(struct cam_custom_resource_node *rsrc_node,
|
||||
uint32_t cmd_type, void *cmd_args, uint32_t arg_size);
|
||||
};
|
||||
#endif /* _CAM_CUSTOM_HW_H_ */
|
@@ -0,0 +1,104 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CUSTOM_HW_MGR_INTF_H_
|
||||
#define _CAM_CUSTOM_HW_MGR_INTF_H_
|
||||
|
||||
#include <linux/of.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/list.h>
|
||||
#include <uapi/media/cam_custom.h>
|
||||
#include "cam_hw.h"
|
||||
#include "cam_hw_mgr_intf.h"
|
||||
#include "cam_hw_intf.h"
|
||||
|
||||
#define CAM_CUSTOM_HW_TYPE_1 1
|
||||
|
||||
#define CAM_CUSTOM_HW_RES_MAX 32
|
||||
|
||||
#define CAM_CUSTOM_HW_SUB_MOD_MAX 1
|
||||
#define CAM_CUSTOM_CSID_HW_MAX 1
|
||||
|
||||
enum cam_custom_hw_event_type {
|
||||
CAM_CUSTOM_EVENT_TYPE_ERROR,
|
||||
CAM_CUSTOM_EVENT_BUF_DONE,
|
||||
};
|
||||
|
||||
enum cam_custom_cmd_types {
|
||||
CAM_CUSTOM_CMD_NONE,
|
||||
CAM_CUSTOM_SET_IRQ_CB,
|
||||
CAM_CUSTOM_SUBMIT_REQ,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cam_custom_stop_args - hardware stop arguments
|
||||
*
|
||||
* @stop_only Send stop only to hw drivers. No Deinit to be
|
||||
* done.
|
||||
*/
|
||||
struct cam_custom_stop_args {
|
||||
bool stop_only;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cam_custom_start_args - custom hardware start arguments
|
||||
*
|
||||
* @hw_config: Hardware configuration commands.
|
||||
* @start_only Send start only to hw drivers. No init to
|
||||
* be done.
|
||||
*
|
||||
*/
|
||||
struct cam_custom_start_args {
|
||||
struct cam_hw_config_args hw_config;
|
||||
bool start_only;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cam_custom_prepare_hw_update_data - hw prepare data
|
||||
*
|
||||
* @packet_opcode_type: Packet header opcode in the packet header
|
||||
* this opcode defines, packet is init packet or
|
||||
* update packet
|
||||
*
|
||||
*/
|
||||
struct cam_custom_prepare_hw_update_data {
|
||||
uint32_t packet_opcode_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cam_custom_hw_cb_args : HW manager callback args
|
||||
*
|
||||
* @irq_status : irq status
|
||||
* @req_info : Pointer to the request info associated with the cb
|
||||
*/
|
||||
struct cam_custom_hw_cb_args {
|
||||
uint32_t irq_status;
|
||||
struct cam_custom_sub_mod_req_to_dev *req_info;
|
||||
};
|
||||
|
||||
/**
|
||||
* cam_custom_hw_sub_mod_init()
|
||||
*
|
||||
* @Brief: Initialize Custom HW device
|
||||
*
|
||||
* @custom_hw: cust_hw interface to fill in and return on
|
||||
* successful initialization
|
||||
* @hw_idx: Index of Custom HW
|
||||
*/
|
||||
int cam_custom_hw_sub_mod_init(struct cam_hw_intf **custom_hw, uint32_t hw_idx);
|
||||
|
||||
/**
|
||||
* cam_custom_csid_hw_init()
|
||||
*
|
||||
* @Brief: Initialize Custom HW device
|
||||
*
|
||||
* @custom_hw: cust_hw interface to fill in and return on
|
||||
* successful initialization
|
||||
* @hw_idx: Index of Custom HW
|
||||
*/
|
||||
int cam_custom_csid_hw_init(
|
||||
struct cam_hw_intf **custom_hw, uint32_t hw_idx);
|
||||
|
||||
#endif /* _CAM_CUSTOM_HW_MGR_INTF_H_ */
|
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_REQ_MGR_INTERFACE_H
|
||||
@@ -151,6 +151,7 @@ enum cam_req_mgr_device_error {
|
||||
* @FLASH : LED flash or dual LED device
|
||||
* @ACTUATOR : lens mover
|
||||
* @IFE : Image processing device
|
||||
* @CUSTOM : Custom HW block
|
||||
* @EXTERNAL_1 : third party device
|
||||
* @EXTERNAL_2 : third party device
|
||||
* @EXTERNAL_3 : third party device
|
||||
@@ -162,6 +163,7 @@ enum cam_req_mgr_device_id {
|
||||
CAM_REQ_MGR_DEVICE_FLASH,
|
||||
CAM_REQ_MGR_DEVICE_ACTUATOR,
|
||||
CAM_REQ_MGR_DEVICE_IFE,
|
||||
CAM_REQ_MGR_DEVICE_CUSTOM_HW,
|
||||
CAM_REQ_MGR_DEVICE_EXTERNAL_1,
|
||||
CAM_REQ_MGR_DEVICE_EXTERNAL_2,
|
||||
CAM_REQ_MGR_DEVICE_EXTERNAL_3,
|
||||
|
@@ -91,6 +91,9 @@ const char *cam_get_module_name(unsigned int module_id)
|
||||
case CAM_REQ:
|
||||
name = "CAM-REQ";
|
||||
break;
|
||||
case CAM_CUSTOM:
|
||||
name = "CAM-CUSTOM";
|
||||
break;
|
||||
default:
|
||||
name = "CAM";
|
||||
break;
|
||||
|
@@ -38,6 +38,7 @@
|
||||
|
||||
/* CAM_PERF: Used for performance (clock, BW etc) logs */
|
||||
#define CAM_PERF (1 << 25)
|
||||
#define CAM_CUSTOM (1 << 26)
|
||||
|
||||
#define STR_BUFFER_MAX_LENGTH 1024
|
||||
|
||||
|
Reference in New Issue
Block a user