From 7eb3653915f20b46ef61e2aa81413d4c088d5252 Mon Sep 17 00:00:00 2001 From: Wyes Karny Date: Thu, 7 May 2020 00:34:12 +0530 Subject: [PATCH] msm: camera: reqmgr: Work queue names added Added wrapper functions for each workq to enable workq names in log. CRs-Fixed: 2684378 Change-Id: If5b3671fbf20777cc891cba4b27cad6ed3a0d146 Signed-off-by: Wyes Karny --- drivers/cam_fd/fd_hw_mgr/cam_fd_hw_mgr.c | 8 +++++- .../icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c | 25 ++++++++++++++++--- drivers/cam_isp/cam_isp_context.c | 8 +++++- drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c | 8 +++++- drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c | 16 ++++++++++-- .../cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.c | 9 +++++-- .../lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c | 8 +++++- drivers/cam_req_mgr/cam_req_mgr_core.c | 11 ++++++-- drivers/cam_req_mgr/cam_req_mgr_workq.c | 8 +++--- drivers/cam_req_mgr/cam_req_mgr_workq.h | 9 ++++++- 10 files changed, 91 insertions(+), 19 deletions(-) diff --git a/drivers/cam_fd/fd_hw_mgr/cam_fd_hw_mgr.c b/drivers/cam_fd/fd_hw_mgr/cam_fd_hw_mgr.c index 644767d9e5..041fad4ed7 100644 --- a/drivers/cam_fd/fd_hw_mgr/cam_fd_hw_mgr.c +++ b/drivers/cam_fd/fd_hw_mgr/cam_fd_hw_mgr.c @@ -1936,6 +1936,11 @@ int cam_fd_hw_mgr_deinit(struct device_node *of_node) return 0; } +static void cam_req_mgr_process_workq_cam_fd_worker(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + int cam_fd_hw_mgr_init(struct device_node *of_node, struct cam_hw_mgr_intf *hw_mgr_intf) { @@ -2081,7 +2086,8 @@ int cam_fd_hw_mgr_init(struct device_node *of_node, } rc = cam_req_mgr_workq_create("cam_fd_worker", CAM_FD_WORKQ_NUM_TASK, - &g_fd_hw_mgr.work, CRM_WORKQ_USAGE_IRQ, 0); + &g_fd_hw_mgr.work, CRM_WORKQ_USAGE_IRQ, 0, + cam_req_mgr_process_workq_cam_fd_worker); if (rc) { CAM_ERR(CAM_FD, "Unable to create a worker, rc=%d", rc); goto detach_smmu; diff --git a/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c b/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c index 1c804d5df6..c976ae7b48 100644 --- a/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c +++ b/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c @@ -5942,28 +5942,45 @@ compat_hw_name_failed: return rc; } +static void cam_req_mgr_process_workq_icp_command_queue(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + +static void cam_req_mgr_process_workq_icp_message_queue(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + +static void cam_req_mgr_process_workq_icp_timer_queue(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + static int cam_icp_mgr_create_wq(void) { int rc; int i; rc = cam_req_mgr_workq_create("icp_command_queue", ICP_WORKQ_NUM_TASK, - &icp_hw_mgr.cmd_work, CRM_WORKQ_USAGE_NON_IRQ, - 0); + &icp_hw_mgr.cmd_work, CRM_WORKQ_USAGE_NON_IRQ, 0, + cam_req_mgr_process_workq_icp_command_queue); if (rc) { CAM_ERR(CAM_ICP, "unable to create a command worker"); goto cmd_work_failed; } rc = cam_req_mgr_workq_create("icp_message_queue", ICP_WORKQ_NUM_TASK, - &icp_hw_mgr.msg_work, CRM_WORKQ_USAGE_IRQ, 0); + &icp_hw_mgr.msg_work, CRM_WORKQ_USAGE_IRQ, 0, + cam_req_mgr_process_workq_icp_message_queue); if (rc) { CAM_ERR(CAM_ICP, "unable to create a message worker"); goto msg_work_failed; } rc = cam_req_mgr_workq_create("icp_timer_queue", ICP_WORKQ_NUM_TASK, - &icp_hw_mgr.timer_work, CRM_WORKQ_USAGE_IRQ, 0); + &icp_hw_mgr.timer_work, CRM_WORKQ_USAGE_IRQ, 0, + cam_req_mgr_process_workq_icp_timer_queue); if (rc) { CAM_ERR(CAM_ICP, "unable to create a timer worker"); goto timer_work_failed; diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index 4b9c4a671f..ffb69adbb4 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -4325,6 +4325,11 @@ end: return rc; } +static void cam_req_mgr_process_workq_offline_ife_worker(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + static int __cam_isp_ctx_acquire_hw_v2(struct cam_context *ctx, void *args) { @@ -4449,7 +4454,8 @@ static int __cam_isp_ctx_acquire_hw_v2(struct cam_context *ctx, ctx_isp->offline_context = true; rc = cam_req_mgr_workq_create("offline_ife", 20, - &ctx_isp->workq, CRM_WORKQ_USAGE_IRQ, 0); + &ctx_isp->workq, CRM_WORKQ_USAGE_IRQ, 0, + cam_req_mgr_process_workq_offline_ife_worker); if (rc) CAM_ERR(CAM_ISP, "Failed to create workq for offline IFE rc:%d", diff --git a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index bfdc76f930..4717768f79 100644 --- a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -7648,6 +7648,11 @@ err: return -ENOMEM; } +static void cam_req_mgr_process_workq_cam_ife_worker(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) { int rc = -EFAULT; @@ -7813,7 +7818,8 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) /* Create Worker for ife_hw_mgr with 10 tasks */ rc = cam_req_mgr_workq_create("cam_ife_worker", 10, - &g_ife_hw_mgr.workq, CRM_WORKQ_USAGE_NON_IRQ, 0); + &g_ife_hw_mgr.workq, CRM_WORKQ_USAGE_NON_IRQ, 0, + cam_req_mgr_process_workq_cam_ife_worker); if (rc < 0) { CAM_ERR(CAM_ISP, "Unable to create worker"); goto end; diff --git a/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c b/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c index 24511b904d..e89c28146e 100644 --- a/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c +++ b/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c @@ -1290,6 +1290,16 @@ copy_error: return rc; } +static void cam_req_mgr_process_workq_jpeg_command_queue(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + +static void cam_req_mgr_process_workq_jpeg_message_queue(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + static int cam_jpeg_setup_workqs(void) { int rc, i; @@ -1298,7 +1308,8 @@ static int cam_jpeg_setup_workqs(void) "jpeg_command_queue", CAM_JPEG_WORKQ_NUM_TASK, &g_jpeg_hw_mgr.work_process_frame, - CRM_WORKQ_USAGE_NON_IRQ, 0); + CRM_WORKQ_USAGE_NON_IRQ, 0, + cam_req_mgr_process_workq_jpeg_command_queue); if (rc) { CAM_ERR(CAM_JPEG, "unable to create a worker %d", rc); goto work_process_frame_failed; @@ -1308,7 +1319,8 @@ static int cam_jpeg_setup_workqs(void) "jpeg_message_queue", CAM_JPEG_WORKQ_NUM_TASK, &g_jpeg_hw_mgr.work_process_irq_cb, - CRM_WORKQ_USAGE_IRQ, 0); + CRM_WORKQ_USAGE_IRQ, 0, + cam_req_mgr_process_workq_jpeg_message_queue); if (rc) { CAM_ERR(CAM_JPEG, "unable to create a worker %d", rc); goto work_process_irq_cb_failed; diff --git a/drivers/cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.c b/drivers/cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.c index 537fc48a61..5cf8c55c0e 100644 --- a/drivers/cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.c +++ b/drivers/cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.c @@ -1041,6 +1041,11 @@ err: return rc; } +static void cam_req_mgr_process_workq_cam_lrme_device_submit_worker( + struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} int cam_lrme_mgr_register_device( struct cam_hw_intf *lrme_hw_intf, @@ -1068,8 +1073,8 @@ int cam_lrme_mgr_register_device( CAM_DBG(CAM_LRME, "Create submit workq for %s", buf); rc = cam_req_mgr_workq_create(buf, CAM_LRME_WORKQ_NUM_TASK, - &hw_device->work, CRM_WORKQ_USAGE_NON_IRQ, - 0); + &hw_device->work, CRM_WORKQ_USAGE_NON_IRQ, 0, + cam_req_mgr_process_workq_cam_lrme_device_submit_worker); if (rc) { CAM_ERR(CAM_LRME, "Unable to create a worker, rc=%d", rc); diff --git a/drivers/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c b/drivers/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c index 3c5aab0b36..ecf4d38ffb 100644 --- a/drivers/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c +++ b/drivers/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c @@ -78,6 +78,11 @@ error: return rc; } +static void cam_req_mgr_process_workq_cam_lrme_hw_worker(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + static int cam_lrme_hw_dev_component_bind(struct device *dev, struct device *master_dev, void *data) { @@ -117,7 +122,8 @@ static int cam_lrme_hw_dev_component_bind(struct device *dev, rc = cam_req_mgr_workq_create("cam_lrme_hw_worker", CAM_LRME_HW_WORKQ_NUM_TASK, - &lrme_core->work, CRM_WORKQ_USAGE_IRQ, 0); + &lrme_core->work, CRM_WORKQ_USAGE_IRQ, 0, + cam_req_mgr_process_workq_cam_lrme_hw_worker); if (rc) { CAM_ERR(CAM_LRME, "Unable to create a workq, rc=%d", rc); goto free_memory; diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index 63294dfb2c..ef8b04ff76 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -3463,6 +3463,11 @@ end: return rc; } +static void cam_req_mgr_process_workq_link_worker(struct work_struct *w) +{ + cam_req_mgr_process_workq(w); +} + int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) { int rc = 0; @@ -3541,7 +3546,8 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) link_info->u.link_info_v1.session_hdl, link->link_hdl); wq_flag = CAM_WORKQ_FLAG_HIGH_PRIORITY | CAM_WORKQ_FLAG_SERIAL; rc = cam_req_mgr_workq_create(buf, CRM_WORKQ_NUM_TASKS, - &link->workq, CRM_WORKQ_USAGE_NON_IRQ, wq_flag); + &link->workq, CRM_WORKQ_USAGE_NON_IRQ, wq_flag, + cam_req_mgr_process_workq_link_worker); if (rc < 0) { CAM_ERR(CAM_CRM, "FATAL: unable to create worker"); __cam_req_mgr_destroy_link_info(link); @@ -3650,7 +3656,8 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info) link_info->u.link_info_v2.session_hdl, link->link_hdl); wq_flag = CAM_WORKQ_FLAG_HIGH_PRIORITY | CAM_WORKQ_FLAG_SERIAL; rc = cam_req_mgr_workq_create(buf, CRM_WORKQ_NUM_TASKS, - &link->workq, CRM_WORKQ_USAGE_NON_IRQ, wq_flag); + &link->workq, CRM_WORKQ_USAGE_NON_IRQ, wq_flag, + cam_req_mgr_process_workq_link_worker); if (rc < 0) { CAM_ERR(CAM_CRM, "FATAL: unable to create worker"); __cam_req_mgr_destroy_link_info(link); diff --git a/drivers/cam_req_mgr/cam_req_mgr_workq.c b/drivers/cam_req_mgr/cam_req_mgr_workq.c index 29d98503f3..0c9ff7c419 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_workq.c +++ b/drivers/cam_req_mgr/cam_req_mgr_workq.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #include "cam_req_mgr_workq.h" @@ -88,7 +88,7 @@ static int cam_req_mgr_process_task(struct crm_workq_task *task) * cam_req_mgr_process_workq() - main loop handling * @w: workqueue task pointer */ -static void cam_req_mgr_process_workq(struct work_struct *w) +void cam_req_mgr_process_workq(struct work_struct *w) { struct cam_req_mgr_core_workq *workq = NULL; struct crm_workq_task *task; @@ -172,7 +172,7 @@ end: int cam_req_mgr_workq_create(char *name, int32_t num_tasks, struct cam_req_mgr_core_workq **workq, enum crm_workq_context in_irq, - int flags) + int flags, void (*func)(struct work_struct *w)) { int32_t i, wq_flags = 0, max_active_tasks = 0; struct crm_workq_task *task; @@ -202,7 +202,7 @@ int cam_req_mgr_workq_create(char *name, int32_t num_tasks, } /* Workq attributes initialization */ - INIT_WORK(&crm_workq->work, cam_req_mgr_process_workq); + INIT_WORK(&crm_workq->work, func); spin_lock_init(&crm_workq->lock_bh); CAM_DBG(CAM_CRM, "LOCK_DBG workq %s lock %pK", name, &crm_workq->lock_bh); diff --git a/drivers/cam_req_mgr/cam_req_mgr_workq.h b/drivers/cam_req_mgr/cam_req_mgr_workq.h index c09cb5eb64..95c435ced9 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_workq.h +++ b/drivers/cam_req_mgr/cam_req_mgr_workq.h @@ -98,6 +98,12 @@ struct cam_req_mgr_core_workq { } task; }; +/** + * cam_req_mgr_process_workq() - main loop handling + * @w: workqueue task pointer + */ +void cam_req_mgr_process_workq(struct work_struct *w); + /** * cam_req_mgr_workq_create() * @brief : create a workqueue @@ -108,12 +114,13 @@ struct cam_req_mgr_core_workq { * @in_irq : Set to one if workq might be used in irq context * @flags : Bitwise OR of Flags for workq behavior. * e.g. CAM_REQ_MGR_WORKQ_HIGH_PRIORITY | CAM_REQ_MGR_WORKQ_SERIAL + * @func : function pointer for cam_req_mgr_process_workq wrapper function * This function will allocate and create workqueue and pass * the workq pointer to caller. */ int cam_req_mgr_workq_create(char *name, int32_t num_tasks, struct cam_req_mgr_core_workq **workq, enum crm_workq_context in_irq, - int flags); + int flags, void (*func)(struct work_struct *w)); /** * cam_req_mgr_workq_destroy()