Loading drivers/media/platform/msm/camera/cam_core/cam_context_utils.c +28 −46 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "CTXT-UTILS %s:%d " fmt, __func__, __LINE__ #include <linux/debugfs.h> #include <linux/videodev2.h> #include <linux/slab.h> Loading @@ -25,6 +23,7 @@ #include "cam_req_mgr_util.h" #include "cam_sync_api.h" #include "cam_trace.h" #include "cam_debug_util.h" int cam_context_buf_done_from_hw(struct cam_context *ctx, void *done_event_data, uint32_t bubble_state) Loading @@ -36,7 +35,7 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx, (struct cam_hw_done_event_data *)done_event_data; if (list_empty(&ctx->active_req_list)) { pr_err("Buf done with no active request\n"); CAM_ERR(CAM_CTXT, "no active request"); return -EIO; } Loading @@ -46,13 +45,13 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx, trace_cam_buf_done("UTILS", ctx, req); if (done->request_id != req->request_id) { pr_err("mismatch: done request [%lld], active request [%lld]\n", CAM_ERR(CAM_CTXT, "mismatch: done req[%lld], active req[%lld]", done->request_id, req->request_id); return -EIO; } if (!req->num_out_map_entries) { pr_err("active request with no output fence objects to signal\n"); CAM_ERR(CAM_CTXT, "no output fence to signal"); return -EIO; } Loading Loading @@ -80,13 +79,13 @@ int cam_context_apply_req_to_hw(struct cam_context *ctx, struct cam_hw_config_args cfg; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } if (list_empty(&ctx->pending_req_list)) { pr_err("No available request for Apply id %lld\n", CAM_ERR(CAM_CTXT, "No available request for Apply id %lld", apply->request_id); rc = -EFAULT; goto end; Loading Loading @@ -127,7 +126,7 @@ static void cam_context_sync_callback(int32_t sync_obj, int status, void *data) spin_unlock(&ctx->lock); if (!req) { pr_err("No more request obj free\n"); CAM_ERR(CAM_CTXT, "No more request obj free"); return; } Loading @@ -146,7 +145,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx, struct cam_ctx_request *req; if ((!ctx->hw_mgr_intf) || (!ctx->hw_mgr_intf->hw_release)) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); return -EINVAL; } Loading @@ -168,7 +167,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx, req = list_first_entry(&ctx->active_req_list, struct cam_ctx_request, list); list_del_init(&req->list); pr_debug("signal fence in active list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in active list, num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) { if (req->out_map_entries[i].sync_id > 0) Loading @@ -187,7 +186,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx, cam_sync_deregister_callback( cam_context_sync_callback, ctx, req->in_map_entries[i].sync_id); pr_debug("signal out fence in pending list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in pending list, num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) if (req->out_map_entries[i].sync_id > 0) Loading @@ -211,7 +210,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, int32_t i = 0; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } Loading @@ -225,7 +224,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, spin_unlock(&ctx->lock); if (!req) { pr_err("No more request obj free\n"); CAM_ERR(CAM_CTXT, "No more request obj free"); rc = -ENOMEM; goto end; } Loading @@ -239,20 +238,12 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, (uint64_t *) &packet_addr, &len); if (rc != 0) { pr_err("Can not get packet address\n"); CAM_ERR(CAM_CTXT, "Can not get packet address"); rc = -EINVAL; goto free_req; } packet = (struct cam_packet *) (packet_addr + cmd->offset); pr_debug("pack_handle %llx\n", cmd->packet_handle); pr_debug("packet address is 0x%llx\n", packet_addr); pr_debug("packet with length %zu, offset 0x%llx\n", len, cmd->offset); pr_debug("Packet request id 0x%llx\n", packet->header.request_id); pr_debug("Packet size 0x%x\n", packet->header.size); pr_debug("packet op %d\n", packet->header.op_code); /* preprocess the configuration */ memset(&cfg, 0, sizeof(cfg)); Loading @@ -269,7 +260,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, rc = ctx->hw_mgr_intf->hw_prepare_update( ctx->hw_mgr_intf->hw_mgr_priv, &cfg); if (rc != 0) { pr_err("Prepare config packet failed in HW layer\n"); CAM_ERR(CAM_CTXT, "Prepare config packet failed in HW layer"); rc = -EFAULT; goto free_req; } Loading @@ -289,7 +280,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, cam_context_sync_callback, (void *)ctx, req->in_map_entries[i].sync_id); pr_debug("register in fence callback: %d ret = %d\n", CAM_DBG(CAM_CTXT, "register in fence cb: %d ret = %d", req->in_map_entries[i].sync_id, rc); } goto end; Loading @@ -302,7 +293,6 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, list_add_tail(&req->list, &ctx->free_req_list); spin_unlock(&ctx->lock); end: pr_debug("Config dev successful\n"); return rc; } Loading @@ -315,25 +305,24 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, struct cam_hw_release_args release; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } pr_debug("acquire cmd: session_hdl 0x%x, num_resources %d\n", cmd->session_handle, cmd->num_resources); pr_debug(" handle type %d, res %lld\n", cmd->handle_type, CAM_DBG(CAM_CTXT, "ses hdl: %x, num_res: %d, type: %d, res: %lld", cmd->session_handle, cmd->num_resources, cmd->handle_type, cmd->resource_hdl); if (cmd->num_resources > CAM_CTX_RES_MAX) { pr_err("Too much resources in the acquire\n"); CAM_ERR(CAM_CTXT, "resource limit exceeded"); rc = -ENOMEM; goto end; } /* for now we only support user pointer */ if (cmd->handle_type != 1) { pr_err("Only user pointer is supported"); CAM_ERR(CAM_CTXT, "Only user pointer is supported"); rc = -EINVAL; goto end; } Loading @@ -344,15 +333,11 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, param.num_acq = cmd->num_resources; param.acquire_info = cmd->resource_hdl; pr_debug("ctx %pK: acquire hw resource: hw_intf: 0x%pK, priv 0x%pK", ctx, ctx->hw_mgr_intf, ctx->hw_mgr_intf->hw_mgr_priv); pr_debug("acquire_hw_func 0x%pK\n", ctx->hw_mgr_intf->hw_acquire); /* call HW manager to reserve the resource */ rc = ctx->hw_mgr_intf->hw_acquire(ctx->hw_mgr_intf->hw_mgr_priv, ¶m); if (rc != 0) { pr_err("Acquire device failed\n"); CAM_ERR(CAM_CTXT, "Acquire device failed"); goto end; } Loading @@ -365,11 +350,10 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, req_hdl_param.media_entity_flag = 0; req_hdl_param.priv = ctx; pr_debug("get device handle from bridge\n"); ctx->dev_hdl = cam_create_device_hdl(&req_hdl_param); if (ctx->dev_hdl <= 0) { rc = -EFAULT; pr_err("Can not create device handle\n"); CAM_ERR(CAM_CTXT, "Can not create device handle"); goto free_hw; } cmd->dev_handle = ctx->dev_hdl; Loading @@ -377,7 +361,6 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, /* store session information */ ctx->session_hdl = cmd->session_handle; pr_err("dev_handle = %x\n", cmd->dev_handle); return rc; free_hw: Loading @@ -395,14 +378,14 @@ int32_t cam_context_start_dev_to_hw(struct cam_context *ctx, struct cam_hw_start_args arg; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } if ((cmd->session_handle != ctx->session_hdl) || (cmd->dev_handle != ctx->dev_hdl)) { pr_err("Invalid session hdl[%d], dev_handle[%d]\n", CAM_ERR(CAM_CTXT, "Invalid session hdl[%d], dev_handle[%d]", cmd->session_handle, cmd->dev_handle); rc = -EPERM; goto end; Loading @@ -413,12 +396,11 @@ int32_t cam_context_start_dev_to_hw(struct cam_context *ctx, &arg); if (rc) { /* HW failure. user need to clean up the resource */ pr_err("Start HW failed\n"); CAM_ERR(CAM_CTXT, "Start HW failed"); goto end; } } pr_debug("start device success\n"); end: return rc; } Loading @@ -431,7 +413,7 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) struct cam_ctx_request *req; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } Loading @@ -449,7 +431,7 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request, list); list_del_init(&req->list); pr_debug("signal fence in pending list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in pending list. fence num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) if (req->out_map_entries[i].sync_id != -1) Loading @@ -462,7 +444,7 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) req = list_first_entry(&ctx->active_req_list, struct cam_ctx_request, list); list_del_init(&req->list); pr_debug("signal fence in active list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in active list. fence num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) if (req->out_map_entries[i].sync_id != -1) Loading drivers/media/platform/msm/camera/cam_icp/cam_icp_context.c +9 −10 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "CAM-ICP-CTXT %s:%d " fmt, __func__, __LINE__ #include <linux/debugfs.h> #include <linux/videodev2.h> #include <linux/slab.h> Loading @@ -26,6 +24,7 @@ #include "cam_req_mgr_util.h" #include "cam_mem_mgr.h" #include "cam_trace.h" #include "cam_debug_util.h" static int __cam_icp_acquire_dev_in_available(struct cam_context *ctx, struct cam_acquire_dev_cmd *cmd) Loading @@ -48,7 +47,7 @@ static int __cam_icp_release_dev_in_acquired(struct cam_context *ctx, rc = cam_context_release_dev_to_hw(ctx, cmd); if (rc) pr_err("Unable to release device\n"); CAM_ERR(CAM_ICP, "Unable to release device"); ctx->state = CAM_CTX_AVAILABLE; trace_cam_context_state("ICP", ctx); Loading Loading @@ -76,7 +75,7 @@ static int __cam_icp_config_dev_in_ready(struct cam_context *ctx, rc = cam_context_prepare_dev_to_hw(ctx, cmd); if (rc) pr_err("Unable to prepare device\n"); CAM_ERR(CAM_ICP, "Failed to prepare device"); return rc; } Loading @@ -88,7 +87,7 @@ static int __cam_icp_stop_dev_in_ready(struct cam_context *ctx, rc = cam_context_stop_dev_to_hw(ctx); if (rc) pr_err("Unable to stop device\n"); CAM_ERR(CAM_ICP, "Failed to stop device"); ctx->state = CAM_CTX_ACQUIRED; trace_cam_context_state("ICP", ctx); Loading @@ -102,11 +101,11 @@ static int __cam_icp_release_dev_in_ready(struct cam_context *ctx, rc = __cam_icp_stop_dev_in_ready(ctx, NULL); if (rc) pr_err("Unable to stop device\n"); CAM_ERR(CAM_ICP, "Failed to stop device"); rc = __cam_icp_release_dev_in_acquired(ctx, cmd); if (rc) pr_err("Unable to stop device\n"); CAM_ERR(CAM_ICP, "Failed to release device"); return rc; } Loading Loading @@ -167,7 +166,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, int rc; if ((!ctx) || (!ctx->base) || (!hw_intf)) { pr_err("Invalid params: %pK %pK\n", ctx, hw_intf); CAM_ERR(CAM_ICP, "Invalid params: %pK %pK", ctx, hw_intf); rc = -EINVAL; goto err; } Loading @@ -175,7 +174,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, rc = cam_context_init(ctx->base, NULL, hw_intf, ctx->req_base, CAM_CTX_REQ_MAX); if (rc) { pr_err("Camera Context Base init failed!\n"); CAM_ERR(CAM_ICP, "Camera Context Base init failed"); goto err; } Loading @@ -190,7 +189,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, int cam_icp_context_deinit(struct cam_icp_context *ctx) { if ((!ctx) || (!ctx->base)) { pr_err("Invalid params: %pK\n", ctx); CAM_ERR(CAM_ICP, "Invalid params: %pK", ctx); return -EINVAL; } Loading drivers/media/platform/msm/camera/cam_icp/cam_icp_subdev.c +19 −22 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "CAM-ICP %s:%d " fmt, __func__, __LINE__ #include <linux/delay.h> #include <linux/io.h> #include <linux/of.h> Loading @@ -36,6 +34,7 @@ #include "cam_icp_context.h" #include "cam_hw_mgr_intf.h" #include "cam_icp_hw_mgr_intf.h" #include "cam_debug_util.h" #define CAM_ICP_DEV_NAME "cam-icp" Loading Loading @@ -65,13 +64,13 @@ static int cam_icp_subdev_open(struct v4l2_subdev *sd, mutex_lock(&g_icp_dev.icp_lock); if (g_icp_dev.open_cnt >= 1) { pr_err("ICP subdev is already opened\n"); CAM_ERR(CAM_ICP, "ICP subdev is already opened"); rc = -EALREADY; goto end; } if (!node) { pr_err("Invalid args\n"); CAM_ERR(CAM_ICP, "Invalid args"); rc = -EINVAL; goto end; } Loading @@ -79,7 +78,7 @@ static int cam_icp_subdev_open(struct v4l2_subdev *sd, hw_mgr_intf = &node->hw_mgr_intf; rc = hw_mgr_intf->download_fw(hw_mgr_intf->hw_mgr_priv, NULL); if (rc < 0) { pr_err("FW download failed\n"); CAM_ERR(CAM_ICP, "FW download failed"); goto end; } g_icp_dev.open_cnt++; Loading @@ -97,27 +96,27 @@ static int cam_icp_subdev_close(struct v4l2_subdev *sd, mutex_lock(&g_icp_dev.icp_lock); if (g_icp_dev.open_cnt <= 0) { pr_err("ICP subdev is already closed\n"); CAM_ERR(CAM_ICP, "ICP subdev is already closed"); rc = -EINVAL; goto end; } g_icp_dev.open_cnt--; if (!node) { pr_err("Invalid args\n"); CAM_ERR(CAM_ICP, "Invalid args"); rc = -EINVAL; goto end; } hw_mgr_intf = &node->hw_mgr_intf; if (!hw_mgr_intf) { pr_err("hw_mgr_intf is not initialized\n"); CAM_ERR(CAM_ICP, "hw_mgr_intf is not initialized"); rc = -EINVAL; goto end; } rc = hw_mgr_intf->hw_close(hw_mgr_intf->hw_mgr_priv, NULL); if (rc < 0) { pr_err("HW close failed\n"); CAM_ERR(CAM_ICP, "HW close failed"); goto end; } Loading @@ -138,7 +137,7 @@ static int cam_icp_probe(struct platform_device *pdev) struct cam_hw_mgr_intf *hw_mgr_intf; if (!pdev) { pr_err("pdev is NULL\n"); CAM_ERR(CAM_ICP, "pdev is NULL"); return -EINVAL; } Loading @@ -147,7 +146,7 @@ static int cam_icp_probe(struct platform_device *pdev) rc = cam_subdev_probe(&g_icp_dev.sd, pdev, CAM_ICP_DEV_NAME, CAM_ICP_DEVICE_TYPE); if (rc) { pr_err("ICP cam_subdev_probe failed!\n"); CAM_ERR(CAM_ICP, "ICP cam_subdev_probe failed"); goto probe_fail; } Loading @@ -161,26 +160,24 @@ static int cam_icp_probe(struct platform_device *pdev) rc = cam_icp_hw_mgr_init(pdev->dev.of_node, (uint64_t *)hw_mgr_intf); if (rc) { pr_err("ICP HW manager init failed: %d\n", rc); CAM_ERR(CAM_ICP, "ICP HW manager init failed: %d", rc); goto hw_init_fail; } pr_debug("Initializing the ICP contexts\n"); for (i = 0; i < CAM_CTX_MAX; i++) { g_icp_dev.ctx_icp[i].base = &g_icp_dev.ctx[i]; rc = cam_icp_context_init(&g_icp_dev.ctx_icp[i], hw_mgr_intf); if (rc) { pr_err("ICP context init failed!\n"); CAM_ERR(CAM_ICP, "ICP context init failed"); goto ctx_fail; } } pr_debug("Initializing the ICP Node\n"); rc = cam_node_init(node, hw_mgr_intf, g_icp_dev.ctx, CAM_CTX_MAX, CAM_ICP_DEV_NAME); if (rc) { pr_err("ICP node init failed!\n"); CAM_ERR(CAM_ICP, "ICP node init failed"); goto ctx_fail; } Loading @@ -207,20 +204,20 @@ static int cam_icp_remove(struct platform_device *pdev) struct cam_subdev *subdev; if (!pdev) { pr_err("pdev is NULL\n"); return -EINVAL; CAM_ERR(CAM_ICP, "pdev is NULL"); return -ENODEV; } sd = platform_get_drvdata(pdev); if (!sd) { pr_err("V4l2 subdev is NULL\n"); return -EINVAL; CAM_ERR(CAM_ICP, "V4l2 subdev is NULL"); return -ENODEV; } subdev = v4l2_get_subdevdata(sd); if (!subdev) { pr_err("cam subdev is NULL\n"); return -EINVAL; CAM_ERR(CAM_ICP, "cam subdev is NULL"); return -ENODEV; } for (i = 0; i < CAM_CTX_MAX; i++) Loading drivers/media/platform/msm/camera/cam_icp/hfi.c +20 −44 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "HFI-FW %s:%d " fmt, __func__, __LINE__ #include <linux/io.h> #include <linux/delay.h> #include <linux/slab.h> Loading @@ -27,6 +25,7 @@ #include "hfi_session_defs.h" #include "hfi_intf.h" #include "cam_icp_hw_mgr_intf.h" #include "cam_debug_util.h" #define HFI_VERSION_INFO_MAJOR_VAL 1 #define HFI_VERSION_INFO_MINOR_VAL 1 Loading @@ -39,9 +38,6 @@ #define HFI_VERSION_INFO_STEP_BMSK 0xFF #define HFI_VERSION_INFO_STEP_SHFT 0 #undef HFI_DBG #define HFI_DBG(fmt, args...) pr_debug(fmt, ##args) static struct hfi_info *g_hfi; unsigned int g_icp_mmu_hdl; Loading @@ -52,21 +48,20 @@ int hfi_write_cmd(void *cmd_ptr) struct hfi_qtbl *q_tbl; struct hfi_q_hdr *q; int rc = 0; int i = 0; if (!cmd_ptr) { pr_err("Invalid args\n"); CAM_ERR(CAM_HFI, "Invalid args"); return -EINVAL; } if (!g_hfi || (g_hfi->hfi_state != HFI_READY)) { pr_err("HFI interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI interface not ready yet"); return -EIO; } mutex_lock(&g_hfi->cmd_q_lock); if (!g_hfi->cmd_q_state) { pr_err("HFI command interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI command interface not ready yet"); mutex_unlock(&g_hfi->cmd_q_lock); return -EIO; } Loading @@ -78,24 +73,20 @@ int hfi_write_cmd(void *cmd_ptr) size_in_words = (*(uint32_t *)cmd_ptr) >> BYTE_WORD_SHIFT; if (!size_in_words) { pr_debug("failed"); CAM_DBG(CAM_HFI, "failed"); rc = -EINVAL; goto err; } HFI_DBG("size_in_words : %u, q->qhdr_write_idx %x\n", size_in_words, q->qhdr_write_idx); read_idx = q->qhdr_read_idx; empty_space = (q->qhdr_write_idx >= read_idx) ? (q->qhdr_q_size - (q->qhdr_write_idx - read_idx)) : (read_idx - q->qhdr_write_idx); if (empty_space <= size_in_words) { pr_err("failed"); CAM_ERR(CAM_HFI, "failed"); rc = -EIO; goto err; } HFI_DBG("empty_space : %u\n", empty_space); new_write_idx = q->qhdr_write_idx + size_in_words; write_ptr = (uint32_t *)(write_q + q->qhdr_write_idx); Loading @@ -110,11 +101,8 @@ int hfi_write_cmd(void *cmd_ptr) memcpy(write_q, (uint8_t *)cmd_ptr + temp, new_write_idx << BYTE_WORD_SHIFT); } for (i = 0; i < size_in_words; i++) pr_debug("%x\n", write_ptr[i]); q->qhdr_write_idx = new_write_idx; HFI_DBG("q->qhdr_write_idx %x\n", q->qhdr_write_idx); cam_io_w((uint32_t)INTR_ENABLE, g_hfi->csr_base + HFI_REG_A5_CSR_HOST2ICPINT); err: Loading @@ -129,15 +117,14 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) uint32_t new_read_idx, size_in_words, temp; uint32_t *read_q, *read_ptr; int rc = 0; int i = 0; if (!pmsg || q_id > Q_DBG) { pr_err("Inavlid args\n"); CAM_ERR(CAM_HFI, "Inavlid args"); return -EINVAL; } if (!g_hfi || (g_hfi->hfi_state != HFI_READY)) { pr_err("HFI interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI interface not ready yet"); return -EIO; } Loading @@ -145,14 +132,14 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) q = &q_tbl_ptr->q_hdr[q_id]; if (q->qhdr_read_idx == q->qhdr_write_idx) { pr_debug("FW or Q not ready, hfi state : %u, r idx : %u, w idx : %u\n", CAM_DBG(CAM_HFI, "Q not ready, state:%u, r idx:%u, w idx:%u", g_hfi->hfi_state, q->qhdr_read_idx, q->qhdr_write_idx); return -EIO; } mutex_lock(&g_hfi->msg_q_lock); if (!g_hfi->msg_q_state) { pr_err("HFI message interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI message interface not ready yet"); mutex_unlock(&g_hfi->msg_q_lock); return -EIO; } Loading @@ -165,12 +152,9 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) read_ptr = (uint32_t *)(read_q + q->qhdr_read_idx); size_in_words = (*read_ptr) >> BYTE_WORD_SHIFT; HFI_DBG("size_in_words : %u, read_ptr : %pK\n", size_in_words, (void *)read_ptr); if ((size_in_words == 0) || (size_in_words > ICP_HFI_MAX_MSG_SIZE_IN_WORDS)) { pr_err("invalid HFI message packet size - 0x%08x\n", CAM_ERR(CAM_HFI, "invalid HFI message packet size - 0x%08x", size_in_words << BYTE_WORD_SHIFT); q->qhdr_read_idx = q->qhdr_write_idx; rc = -EIO; Loading @@ -178,7 +162,6 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) } new_read_idx = q->qhdr_read_idx + size_in_words; HFI_DBG("new_read_idx : %u\n", new_read_idx); if (new_read_idx < q->qhdr_q_size) { memcpy(pmsg, read_ptr, size_in_words << BYTE_WORD_SHIFT); Loading @@ -190,9 +173,6 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) new_read_idx << BYTE_WORD_SHIFT); } for (i = 0; i < size_in_words; i++) HFI_DBG("%x\n", read_ptr[i]); q->qhdr_read_idx = new_read_idx; err: mutex_unlock(&g_hfi->msg_q_lock); Loading Loading @@ -265,7 +245,7 @@ void hfi_send_system_cmd(uint32_t type, uint64_t data, uint32_t size) case HFI_CMD_IPEBPS_ASYNC_COMMAND_INDIRECT: break; default: pr_err("command not supported :%d\n", type); CAM_ERR(CAM_HFI, "command not supported :%d", type); break; } } Loading @@ -277,7 +257,7 @@ int hfi_get_hw_caps(void *query_buf) struct cam_icp_query_cap_cmd *query_cmd = NULL; if (!query_buf) { pr_err("%s: query buf is NULL\n", __func__); CAM_ERR(CAM_HFI, "query buf is NULL"); return -EINVAL; } Loading Loading @@ -340,9 +320,8 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, } } HFI_DBG("g_hfi: %pK\n", (void *)g_hfi); if (g_hfi->hfi_state != HFI_DEINIT) { pr_err("hfi_init: invalid state\n"); CAM_ERR(CAM_HFI, "hfi_init: invalid state"); return -EINVAL; } Loading Loading @@ -373,7 +352,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, qtbl_hdr->qtbl_num_active_q = ICP_HFI_NUMBER_OF_QS; /* setup host-to-firmware command queue */ pr_debug("updating the command queue info\n"); cmd_q_hdr = &qtbl->q_hdr[Q_CMD]; cmd_q_hdr->qhdr_status = QHDR_ACTIVE; cmd_q_hdr->qhdr_start_addr = hfi_mem->cmd_q.iova; Loading @@ -384,7 +362,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, cmd_q_hdr->qhdr_write_idx = RESET; /* setup firmware-to-Host message queue */ pr_debug("updating the message queue info\n"); msg_q_hdr = &qtbl->q_hdr[Q_MSG]; msg_q_hdr->qhdr_status = QHDR_ACTIVE; msg_q_hdr->qhdr_start_addr = hfi_mem->msg_q.iova; Loading @@ -395,7 +372,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, msg_q_hdr->qhdr_write_idx = RESET; /* setup firmware-to-Host message queue */ pr_debug("updating the debug queue info\n"); dbg_q_hdr = &qtbl->q_hdr[Q_DBG]; dbg_q_hdr->qhdr_status = QHDR_ACTIVE; dbg_q_hdr->qhdr_start_addr = hfi_mem->dbg_q.iova; Loading @@ -404,7 +380,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, dbg_q_hdr->qhdr_pkt_drop_cnt = RESET; dbg_q_hdr->qhdr_read_idx = RESET; dbg_q_hdr->qhdr_write_idx = RESET; pr_debug("Done updating the debug queue info\n"); switch (event_driven_mode) { case INTR_MODE: Loading Loading @@ -473,7 +448,8 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, break; default: pr_err("Invalid event driven mode :%u", event_driven_mode); CAM_ERR(CAM_HFI, "Invalid event driven mode :%u", event_driven_mode); break; } Loading @@ -490,17 +466,17 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, icp_base + HFI_REG_HOST_ICP_INIT_REQUEST); hw_version = cam_io_r(icp_base + HFI_REG_A5_HW_VERSION); HFI_DBG("hw version : [%x]\n", hw_version); rc = readw_poll_timeout((icp_base + HFI_REG_ICP_HOST_INIT_RESPONSE), status, status != ICP_INIT_RESP_SUCCESS, 15, 200); if (rc) { pr_err("timed out , status = %u\n", status); CAM_ERR(CAM_HFI, "timed out , status = %u", status); goto regions_fail; } fw_version = cam_io_r(icp_base + HFI_REG_FW_VERSION); HFI_DBG("fw version : %u[%x]\n", fw_version, fw_version); CAM_DBG(CAM_HFI, "hw version : : [%x], fw version : [%x]", hw_version, fw_version); g_hfi->csr_base = icp_base; g_hfi->hfi_state = HFI_READY; Loading @@ -521,7 +497,7 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, void cam_hfi_deinit(void) { if (!g_hfi) { pr_err("hfi path not established yet\n"); CAM_ERR(CAM_HFI, "hfi path not established yet"); return; } cam_io_w((uint32_t)INTR_DISABLE, Loading drivers/media/platform/msm/camera/cam_icp/icp_hw/a5_hw/a5_core.c +49 −57 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
drivers/media/platform/msm/camera/cam_core/cam_context_utils.c +28 −46 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "CTXT-UTILS %s:%d " fmt, __func__, __LINE__ #include <linux/debugfs.h> #include <linux/videodev2.h> #include <linux/slab.h> Loading @@ -25,6 +23,7 @@ #include "cam_req_mgr_util.h" #include "cam_sync_api.h" #include "cam_trace.h" #include "cam_debug_util.h" int cam_context_buf_done_from_hw(struct cam_context *ctx, void *done_event_data, uint32_t bubble_state) Loading @@ -36,7 +35,7 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx, (struct cam_hw_done_event_data *)done_event_data; if (list_empty(&ctx->active_req_list)) { pr_err("Buf done with no active request\n"); CAM_ERR(CAM_CTXT, "no active request"); return -EIO; } Loading @@ -46,13 +45,13 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx, trace_cam_buf_done("UTILS", ctx, req); if (done->request_id != req->request_id) { pr_err("mismatch: done request [%lld], active request [%lld]\n", CAM_ERR(CAM_CTXT, "mismatch: done req[%lld], active req[%lld]", done->request_id, req->request_id); return -EIO; } if (!req->num_out_map_entries) { pr_err("active request with no output fence objects to signal\n"); CAM_ERR(CAM_CTXT, "no output fence to signal"); return -EIO; } Loading Loading @@ -80,13 +79,13 @@ int cam_context_apply_req_to_hw(struct cam_context *ctx, struct cam_hw_config_args cfg; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } if (list_empty(&ctx->pending_req_list)) { pr_err("No available request for Apply id %lld\n", CAM_ERR(CAM_CTXT, "No available request for Apply id %lld", apply->request_id); rc = -EFAULT; goto end; Loading Loading @@ -127,7 +126,7 @@ static void cam_context_sync_callback(int32_t sync_obj, int status, void *data) spin_unlock(&ctx->lock); if (!req) { pr_err("No more request obj free\n"); CAM_ERR(CAM_CTXT, "No more request obj free"); return; } Loading @@ -146,7 +145,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx, struct cam_ctx_request *req; if ((!ctx->hw_mgr_intf) || (!ctx->hw_mgr_intf->hw_release)) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); return -EINVAL; } Loading @@ -168,7 +167,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx, req = list_first_entry(&ctx->active_req_list, struct cam_ctx_request, list); list_del_init(&req->list); pr_debug("signal fence in active list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in active list, num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) { if (req->out_map_entries[i].sync_id > 0) Loading @@ -187,7 +186,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx, cam_sync_deregister_callback( cam_context_sync_callback, ctx, req->in_map_entries[i].sync_id); pr_debug("signal out fence in pending list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in pending list, num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) if (req->out_map_entries[i].sync_id > 0) Loading @@ -211,7 +210,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, int32_t i = 0; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } Loading @@ -225,7 +224,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, spin_unlock(&ctx->lock); if (!req) { pr_err("No more request obj free\n"); CAM_ERR(CAM_CTXT, "No more request obj free"); rc = -ENOMEM; goto end; } Loading @@ -239,20 +238,12 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, (uint64_t *) &packet_addr, &len); if (rc != 0) { pr_err("Can not get packet address\n"); CAM_ERR(CAM_CTXT, "Can not get packet address"); rc = -EINVAL; goto free_req; } packet = (struct cam_packet *) (packet_addr + cmd->offset); pr_debug("pack_handle %llx\n", cmd->packet_handle); pr_debug("packet address is 0x%llx\n", packet_addr); pr_debug("packet with length %zu, offset 0x%llx\n", len, cmd->offset); pr_debug("Packet request id 0x%llx\n", packet->header.request_id); pr_debug("Packet size 0x%x\n", packet->header.size); pr_debug("packet op %d\n", packet->header.op_code); /* preprocess the configuration */ memset(&cfg, 0, sizeof(cfg)); Loading @@ -269,7 +260,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, rc = ctx->hw_mgr_intf->hw_prepare_update( ctx->hw_mgr_intf->hw_mgr_priv, &cfg); if (rc != 0) { pr_err("Prepare config packet failed in HW layer\n"); CAM_ERR(CAM_CTXT, "Prepare config packet failed in HW layer"); rc = -EFAULT; goto free_req; } Loading @@ -289,7 +280,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, cam_context_sync_callback, (void *)ctx, req->in_map_entries[i].sync_id); pr_debug("register in fence callback: %d ret = %d\n", CAM_DBG(CAM_CTXT, "register in fence cb: %d ret = %d", req->in_map_entries[i].sync_id, rc); } goto end; Loading @@ -302,7 +293,6 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, list_add_tail(&req->list, &ctx->free_req_list); spin_unlock(&ctx->lock); end: pr_debug("Config dev successful\n"); return rc; } Loading @@ -315,25 +305,24 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, struct cam_hw_release_args release; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } pr_debug("acquire cmd: session_hdl 0x%x, num_resources %d\n", cmd->session_handle, cmd->num_resources); pr_debug(" handle type %d, res %lld\n", cmd->handle_type, CAM_DBG(CAM_CTXT, "ses hdl: %x, num_res: %d, type: %d, res: %lld", cmd->session_handle, cmd->num_resources, cmd->handle_type, cmd->resource_hdl); if (cmd->num_resources > CAM_CTX_RES_MAX) { pr_err("Too much resources in the acquire\n"); CAM_ERR(CAM_CTXT, "resource limit exceeded"); rc = -ENOMEM; goto end; } /* for now we only support user pointer */ if (cmd->handle_type != 1) { pr_err("Only user pointer is supported"); CAM_ERR(CAM_CTXT, "Only user pointer is supported"); rc = -EINVAL; goto end; } Loading @@ -344,15 +333,11 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, param.num_acq = cmd->num_resources; param.acquire_info = cmd->resource_hdl; pr_debug("ctx %pK: acquire hw resource: hw_intf: 0x%pK, priv 0x%pK", ctx, ctx->hw_mgr_intf, ctx->hw_mgr_intf->hw_mgr_priv); pr_debug("acquire_hw_func 0x%pK\n", ctx->hw_mgr_intf->hw_acquire); /* call HW manager to reserve the resource */ rc = ctx->hw_mgr_intf->hw_acquire(ctx->hw_mgr_intf->hw_mgr_priv, ¶m); if (rc != 0) { pr_err("Acquire device failed\n"); CAM_ERR(CAM_CTXT, "Acquire device failed"); goto end; } Loading @@ -365,11 +350,10 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, req_hdl_param.media_entity_flag = 0; req_hdl_param.priv = ctx; pr_debug("get device handle from bridge\n"); ctx->dev_hdl = cam_create_device_hdl(&req_hdl_param); if (ctx->dev_hdl <= 0) { rc = -EFAULT; pr_err("Can not create device handle\n"); CAM_ERR(CAM_CTXT, "Can not create device handle"); goto free_hw; } cmd->dev_handle = ctx->dev_hdl; Loading @@ -377,7 +361,6 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx, /* store session information */ ctx->session_hdl = cmd->session_handle; pr_err("dev_handle = %x\n", cmd->dev_handle); return rc; free_hw: Loading @@ -395,14 +378,14 @@ int32_t cam_context_start_dev_to_hw(struct cam_context *ctx, struct cam_hw_start_args arg; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } if ((cmd->session_handle != ctx->session_hdl) || (cmd->dev_handle != ctx->dev_hdl)) { pr_err("Invalid session hdl[%d], dev_handle[%d]\n", CAM_ERR(CAM_CTXT, "Invalid session hdl[%d], dev_handle[%d]", cmd->session_handle, cmd->dev_handle); rc = -EPERM; goto end; Loading @@ -413,12 +396,11 @@ int32_t cam_context_start_dev_to_hw(struct cam_context *ctx, &arg); if (rc) { /* HW failure. user need to clean up the resource */ pr_err("Start HW failed\n"); CAM_ERR(CAM_CTXT, "Start HW failed"); goto end; } } pr_debug("start device success\n"); end: return rc; } Loading @@ -431,7 +413,7 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) struct cam_ctx_request *req; if (!ctx->hw_mgr_intf) { pr_err("HW interface is not ready\n"); CAM_ERR(CAM_CTXT, "HW interface is not ready"); rc = -EFAULT; goto end; } Loading @@ -449,7 +431,7 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request, list); list_del_init(&req->list); pr_debug("signal fence in pending list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in pending list. fence num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) if (req->out_map_entries[i].sync_id != -1) Loading @@ -462,7 +444,7 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) req = list_first_entry(&ctx->active_req_list, struct cam_ctx_request, list); list_del_init(&req->list); pr_debug("signal fence in active list. fence num %d\n", CAM_DBG(CAM_CTXT, "signal fence in active list. fence num %d", req->num_out_map_entries); for (i = 0; i < req->num_out_map_entries; i++) if (req->out_map_entries[i].sync_id != -1) Loading
drivers/media/platform/msm/camera/cam_icp/cam_icp_context.c +9 −10 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "CAM-ICP-CTXT %s:%d " fmt, __func__, __LINE__ #include <linux/debugfs.h> #include <linux/videodev2.h> #include <linux/slab.h> Loading @@ -26,6 +24,7 @@ #include "cam_req_mgr_util.h" #include "cam_mem_mgr.h" #include "cam_trace.h" #include "cam_debug_util.h" static int __cam_icp_acquire_dev_in_available(struct cam_context *ctx, struct cam_acquire_dev_cmd *cmd) Loading @@ -48,7 +47,7 @@ static int __cam_icp_release_dev_in_acquired(struct cam_context *ctx, rc = cam_context_release_dev_to_hw(ctx, cmd); if (rc) pr_err("Unable to release device\n"); CAM_ERR(CAM_ICP, "Unable to release device"); ctx->state = CAM_CTX_AVAILABLE; trace_cam_context_state("ICP", ctx); Loading Loading @@ -76,7 +75,7 @@ static int __cam_icp_config_dev_in_ready(struct cam_context *ctx, rc = cam_context_prepare_dev_to_hw(ctx, cmd); if (rc) pr_err("Unable to prepare device\n"); CAM_ERR(CAM_ICP, "Failed to prepare device"); return rc; } Loading @@ -88,7 +87,7 @@ static int __cam_icp_stop_dev_in_ready(struct cam_context *ctx, rc = cam_context_stop_dev_to_hw(ctx); if (rc) pr_err("Unable to stop device\n"); CAM_ERR(CAM_ICP, "Failed to stop device"); ctx->state = CAM_CTX_ACQUIRED; trace_cam_context_state("ICP", ctx); Loading @@ -102,11 +101,11 @@ static int __cam_icp_release_dev_in_ready(struct cam_context *ctx, rc = __cam_icp_stop_dev_in_ready(ctx, NULL); if (rc) pr_err("Unable to stop device\n"); CAM_ERR(CAM_ICP, "Failed to stop device"); rc = __cam_icp_release_dev_in_acquired(ctx, cmd); if (rc) pr_err("Unable to stop device\n"); CAM_ERR(CAM_ICP, "Failed to release device"); return rc; } Loading Loading @@ -167,7 +166,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, int rc; if ((!ctx) || (!ctx->base) || (!hw_intf)) { pr_err("Invalid params: %pK %pK\n", ctx, hw_intf); CAM_ERR(CAM_ICP, "Invalid params: %pK %pK", ctx, hw_intf); rc = -EINVAL; goto err; } Loading @@ -175,7 +174,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, rc = cam_context_init(ctx->base, NULL, hw_intf, ctx->req_base, CAM_CTX_REQ_MAX); if (rc) { pr_err("Camera Context Base init failed!\n"); CAM_ERR(CAM_ICP, "Camera Context Base init failed"); goto err; } Loading @@ -190,7 +189,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, int cam_icp_context_deinit(struct cam_icp_context *ctx) { if ((!ctx) || (!ctx->base)) { pr_err("Invalid params: %pK\n", ctx); CAM_ERR(CAM_ICP, "Invalid params: %pK", ctx); return -EINVAL; } Loading
drivers/media/platform/msm/camera/cam_icp/cam_icp_subdev.c +19 −22 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "CAM-ICP %s:%d " fmt, __func__, __LINE__ #include <linux/delay.h> #include <linux/io.h> #include <linux/of.h> Loading @@ -36,6 +34,7 @@ #include "cam_icp_context.h" #include "cam_hw_mgr_intf.h" #include "cam_icp_hw_mgr_intf.h" #include "cam_debug_util.h" #define CAM_ICP_DEV_NAME "cam-icp" Loading Loading @@ -65,13 +64,13 @@ static int cam_icp_subdev_open(struct v4l2_subdev *sd, mutex_lock(&g_icp_dev.icp_lock); if (g_icp_dev.open_cnt >= 1) { pr_err("ICP subdev is already opened\n"); CAM_ERR(CAM_ICP, "ICP subdev is already opened"); rc = -EALREADY; goto end; } if (!node) { pr_err("Invalid args\n"); CAM_ERR(CAM_ICP, "Invalid args"); rc = -EINVAL; goto end; } Loading @@ -79,7 +78,7 @@ static int cam_icp_subdev_open(struct v4l2_subdev *sd, hw_mgr_intf = &node->hw_mgr_intf; rc = hw_mgr_intf->download_fw(hw_mgr_intf->hw_mgr_priv, NULL); if (rc < 0) { pr_err("FW download failed\n"); CAM_ERR(CAM_ICP, "FW download failed"); goto end; } g_icp_dev.open_cnt++; Loading @@ -97,27 +96,27 @@ static int cam_icp_subdev_close(struct v4l2_subdev *sd, mutex_lock(&g_icp_dev.icp_lock); if (g_icp_dev.open_cnt <= 0) { pr_err("ICP subdev is already closed\n"); CAM_ERR(CAM_ICP, "ICP subdev is already closed"); rc = -EINVAL; goto end; } g_icp_dev.open_cnt--; if (!node) { pr_err("Invalid args\n"); CAM_ERR(CAM_ICP, "Invalid args"); rc = -EINVAL; goto end; } hw_mgr_intf = &node->hw_mgr_intf; if (!hw_mgr_intf) { pr_err("hw_mgr_intf is not initialized\n"); CAM_ERR(CAM_ICP, "hw_mgr_intf is not initialized"); rc = -EINVAL; goto end; } rc = hw_mgr_intf->hw_close(hw_mgr_intf->hw_mgr_priv, NULL); if (rc < 0) { pr_err("HW close failed\n"); CAM_ERR(CAM_ICP, "HW close failed"); goto end; } Loading @@ -138,7 +137,7 @@ static int cam_icp_probe(struct platform_device *pdev) struct cam_hw_mgr_intf *hw_mgr_intf; if (!pdev) { pr_err("pdev is NULL\n"); CAM_ERR(CAM_ICP, "pdev is NULL"); return -EINVAL; } Loading @@ -147,7 +146,7 @@ static int cam_icp_probe(struct platform_device *pdev) rc = cam_subdev_probe(&g_icp_dev.sd, pdev, CAM_ICP_DEV_NAME, CAM_ICP_DEVICE_TYPE); if (rc) { pr_err("ICP cam_subdev_probe failed!\n"); CAM_ERR(CAM_ICP, "ICP cam_subdev_probe failed"); goto probe_fail; } Loading @@ -161,26 +160,24 @@ static int cam_icp_probe(struct platform_device *pdev) rc = cam_icp_hw_mgr_init(pdev->dev.of_node, (uint64_t *)hw_mgr_intf); if (rc) { pr_err("ICP HW manager init failed: %d\n", rc); CAM_ERR(CAM_ICP, "ICP HW manager init failed: %d", rc); goto hw_init_fail; } pr_debug("Initializing the ICP contexts\n"); for (i = 0; i < CAM_CTX_MAX; i++) { g_icp_dev.ctx_icp[i].base = &g_icp_dev.ctx[i]; rc = cam_icp_context_init(&g_icp_dev.ctx_icp[i], hw_mgr_intf); if (rc) { pr_err("ICP context init failed!\n"); CAM_ERR(CAM_ICP, "ICP context init failed"); goto ctx_fail; } } pr_debug("Initializing the ICP Node\n"); rc = cam_node_init(node, hw_mgr_intf, g_icp_dev.ctx, CAM_CTX_MAX, CAM_ICP_DEV_NAME); if (rc) { pr_err("ICP node init failed!\n"); CAM_ERR(CAM_ICP, "ICP node init failed"); goto ctx_fail; } Loading @@ -207,20 +204,20 @@ static int cam_icp_remove(struct platform_device *pdev) struct cam_subdev *subdev; if (!pdev) { pr_err("pdev is NULL\n"); return -EINVAL; CAM_ERR(CAM_ICP, "pdev is NULL"); return -ENODEV; } sd = platform_get_drvdata(pdev); if (!sd) { pr_err("V4l2 subdev is NULL\n"); return -EINVAL; CAM_ERR(CAM_ICP, "V4l2 subdev is NULL"); return -ENODEV; } subdev = v4l2_get_subdevdata(sd); if (!subdev) { pr_err("cam subdev is NULL\n"); return -EINVAL; CAM_ERR(CAM_ICP, "cam subdev is NULL"); return -ENODEV; } for (i = 0; i < CAM_CTX_MAX; i++) Loading
drivers/media/platform/msm/camera/cam_icp/hfi.c +20 −44 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ * GNU General Public License for more details. */ #define pr_fmt(fmt) "HFI-FW %s:%d " fmt, __func__, __LINE__ #include <linux/io.h> #include <linux/delay.h> #include <linux/slab.h> Loading @@ -27,6 +25,7 @@ #include "hfi_session_defs.h" #include "hfi_intf.h" #include "cam_icp_hw_mgr_intf.h" #include "cam_debug_util.h" #define HFI_VERSION_INFO_MAJOR_VAL 1 #define HFI_VERSION_INFO_MINOR_VAL 1 Loading @@ -39,9 +38,6 @@ #define HFI_VERSION_INFO_STEP_BMSK 0xFF #define HFI_VERSION_INFO_STEP_SHFT 0 #undef HFI_DBG #define HFI_DBG(fmt, args...) pr_debug(fmt, ##args) static struct hfi_info *g_hfi; unsigned int g_icp_mmu_hdl; Loading @@ -52,21 +48,20 @@ int hfi_write_cmd(void *cmd_ptr) struct hfi_qtbl *q_tbl; struct hfi_q_hdr *q; int rc = 0; int i = 0; if (!cmd_ptr) { pr_err("Invalid args\n"); CAM_ERR(CAM_HFI, "Invalid args"); return -EINVAL; } if (!g_hfi || (g_hfi->hfi_state != HFI_READY)) { pr_err("HFI interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI interface not ready yet"); return -EIO; } mutex_lock(&g_hfi->cmd_q_lock); if (!g_hfi->cmd_q_state) { pr_err("HFI command interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI command interface not ready yet"); mutex_unlock(&g_hfi->cmd_q_lock); return -EIO; } Loading @@ -78,24 +73,20 @@ int hfi_write_cmd(void *cmd_ptr) size_in_words = (*(uint32_t *)cmd_ptr) >> BYTE_WORD_SHIFT; if (!size_in_words) { pr_debug("failed"); CAM_DBG(CAM_HFI, "failed"); rc = -EINVAL; goto err; } HFI_DBG("size_in_words : %u, q->qhdr_write_idx %x\n", size_in_words, q->qhdr_write_idx); read_idx = q->qhdr_read_idx; empty_space = (q->qhdr_write_idx >= read_idx) ? (q->qhdr_q_size - (q->qhdr_write_idx - read_idx)) : (read_idx - q->qhdr_write_idx); if (empty_space <= size_in_words) { pr_err("failed"); CAM_ERR(CAM_HFI, "failed"); rc = -EIO; goto err; } HFI_DBG("empty_space : %u\n", empty_space); new_write_idx = q->qhdr_write_idx + size_in_words; write_ptr = (uint32_t *)(write_q + q->qhdr_write_idx); Loading @@ -110,11 +101,8 @@ int hfi_write_cmd(void *cmd_ptr) memcpy(write_q, (uint8_t *)cmd_ptr + temp, new_write_idx << BYTE_WORD_SHIFT); } for (i = 0; i < size_in_words; i++) pr_debug("%x\n", write_ptr[i]); q->qhdr_write_idx = new_write_idx; HFI_DBG("q->qhdr_write_idx %x\n", q->qhdr_write_idx); cam_io_w((uint32_t)INTR_ENABLE, g_hfi->csr_base + HFI_REG_A5_CSR_HOST2ICPINT); err: Loading @@ -129,15 +117,14 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) uint32_t new_read_idx, size_in_words, temp; uint32_t *read_q, *read_ptr; int rc = 0; int i = 0; if (!pmsg || q_id > Q_DBG) { pr_err("Inavlid args\n"); CAM_ERR(CAM_HFI, "Inavlid args"); return -EINVAL; } if (!g_hfi || (g_hfi->hfi_state != HFI_READY)) { pr_err("HFI interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI interface not ready yet"); return -EIO; } Loading @@ -145,14 +132,14 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) q = &q_tbl_ptr->q_hdr[q_id]; if (q->qhdr_read_idx == q->qhdr_write_idx) { pr_debug("FW or Q not ready, hfi state : %u, r idx : %u, w idx : %u\n", CAM_DBG(CAM_HFI, "Q not ready, state:%u, r idx:%u, w idx:%u", g_hfi->hfi_state, q->qhdr_read_idx, q->qhdr_write_idx); return -EIO; } mutex_lock(&g_hfi->msg_q_lock); if (!g_hfi->msg_q_state) { pr_err("HFI message interface not ready yet\n"); CAM_ERR(CAM_HFI, "HFI message interface not ready yet"); mutex_unlock(&g_hfi->msg_q_lock); return -EIO; } Loading @@ -165,12 +152,9 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) read_ptr = (uint32_t *)(read_q + q->qhdr_read_idx); size_in_words = (*read_ptr) >> BYTE_WORD_SHIFT; HFI_DBG("size_in_words : %u, read_ptr : %pK\n", size_in_words, (void *)read_ptr); if ((size_in_words == 0) || (size_in_words > ICP_HFI_MAX_MSG_SIZE_IN_WORDS)) { pr_err("invalid HFI message packet size - 0x%08x\n", CAM_ERR(CAM_HFI, "invalid HFI message packet size - 0x%08x", size_in_words << BYTE_WORD_SHIFT); q->qhdr_read_idx = q->qhdr_write_idx; rc = -EIO; Loading @@ -178,7 +162,6 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) } new_read_idx = q->qhdr_read_idx + size_in_words; HFI_DBG("new_read_idx : %u\n", new_read_idx); if (new_read_idx < q->qhdr_q_size) { memcpy(pmsg, read_ptr, size_in_words << BYTE_WORD_SHIFT); Loading @@ -190,9 +173,6 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id) new_read_idx << BYTE_WORD_SHIFT); } for (i = 0; i < size_in_words; i++) HFI_DBG("%x\n", read_ptr[i]); q->qhdr_read_idx = new_read_idx; err: mutex_unlock(&g_hfi->msg_q_lock); Loading Loading @@ -265,7 +245,7 @@ void hfi_send_system_cmd(uint32_t type, uint64_t data, uint32_t size) case HFI_CMD_IPEBPS_ASYNC_COMMAND_INDIRECT: break; default: pr_err("command not supported :%d\n", type); CAM_ERR(CAM_HFI, "command not supported :%d", type); break; } } Loading @@ -277,7 +257,7 @@ int hfi_get_hw_caps(void *query_buf) struct cam_icp_query_cap_cmd *query_cmd = NULL; if (!query_buf) { pr_err("%s: query buf is NULL\n", __func__); CAM_ERR(CAM_HFI, "query buf is NULL"); return -EINVAL; } Loading Loading @@ -340,9 +320,8 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, } } HFI_DBG("g_hfi: %pK\n", (void *)g_hfi); if (g_hfi->hfi_state != HFI_DEINIT) { pr_err("hfi_init: invalid state\n"); CAM_ERR(CAM_HFI, "hfi_init: invalid state"); return -EINVAL; } Loading Loading @@ -373,7 +352,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, qtbl_hdr->qtbl_num_active_q = ICP_HFI_NUMBER_OF_QS; /* setup host-to-firmware command queue */ pr_debug("updating the command queue info\n"); cmd_q_hdr = &qtbl->q_hdr[Q_CMD]; cmd_q_hdr->qhdr_status = QHDR_ACTIVE; cmd_q_hdr->qhdr_start_addr = hfi_mem->cmd_q.iova; Loading @@ -384,7 +362,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, cmd_q_hdr->qhdr_write_idx = RESET; /* setup firmware-to-Host message queue */ pr_debug("updating the message queue info\n"); msg_q_hdr = &qtbl->q_hdr[Q_MSG]; msg_q_hdr->qhdr_status = QHDR_ACTIVE; msg_q_hdr->qhdr_start_addr = hfi_mem->msg_q.iova; Loading @@ -395,7 +372,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, msg_q_hdr->qhdr_write_idx = RESET; /* setup firmware-to-Host message queue */ pr_debug("updating the debug queue info\n"); dbg_q_hdr = &qtbl->q_hdr[Q_DBG]; dbg_q_hdr->qhdr_status = QHDR_ACTIVE; dbg_q_hdr->qhdr_start_addr = hfi_mem->dbg_q.iova; Loading @@ -404,7 +380,6 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, dbg_q_hdr->qhdr_pkt_drop_cnt = RESET; dbg_q_hdr->qhdr_read_idx = RESET; dbg_q_hdr->qhdr_write_idx = RESET; pr_debug("Done updating the debug queue info\n"); switch (event_driven_mode) { case INTR_MODE: Loading Loading @@ -473,7 +448,8 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, break; default: pr_err("Invalid event driven mode :%u", event_driven_mode); CAM_ERR(CAM_HFI, "Invalid event driven mode :%u", event_driven_mode); break; } Loading @@ -490,17 +466,17 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, icp_base + HFI_REG_HOST_ICP_INIT_REQUEST); hw_version = cam_io_r(icp_base + HFI_REG_A5_HW_VERSION); HFI_DBG("hw version : [%x]\n", hw_version); rc = readw_poll_timeout((icp_base + HFI_REG_ICP_HOST_INIT_RESPONSE), status, status != ICP_INIT_RESP_SUCCESS, 15, 200); if (rc) { pr_err("timed out , status = %u\n", status); CAM_ERR(CAM_HFI, "timed out , status = %u", status); goto regions_fail; } fw_version = cam_io_r(icp_base + HFI_REG_FW_VERSION); HFI_DBG("fw version : %u[%x]\n", fw_version, fw_version); CAM_DBG(CAM_HFI, "hw version : : [%x], fw version : [%x]", hw_version, fw_version); g_hfi->csr_base = icp_base; g_hfi->hfi_state = HFI_READY; Loading @@ -521,7 +497,7 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, void cam_hfi_deinit(void) { if (!g_hfi) { pr_err("hfi path not established yet\n"); CAM_ERR(CAM_HFI, "hfi path not established yet"); return; } cam_io_w((uint32_t)INTR_DISABLE, Loading
drivers/media/platform/msm/camera/cam_icp/icp_hw/a5_hw/a5_core.c +49 −57 File changed.Preview size limit exceeded, changes collapsed. Show changes