From 5f08487df0c86e5eedf393467eb4da8b620b506a Mon Sep 17 00:00:00 2001 From: Jishnu Prakash Date: Sun, 25 Dec 2022 19:57:23 +0530 Subject: [PATCH] regulator: rpmh-regulator: Add IPC logging for RPMh regulator votes Add support to record a limited number of the most recent RPMh regulator votes in an IPC log. This can be useful for debug in case there is a requirement to see the last few RPMh regulator votes at any given time. Change-Id: I2f57d8abc6acf3260172c9adf24936cdd2d2bf58 Signed-off-by: Jishnu Prakash --- drivers/regulator/rpmh-regulator.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/rpmh-regulator.c b/drivers/regulator/rpmh-regulator.c index 2ed0616a4f98..f6b12495897a 100644 --- a/drivers/regulator/rpmh-regulator.c +++ b/drivers/regulator/rpmh-regulator.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -130,6 +131,16 @@ enum rpmh_regulator_reg_index { /* XOB voting registers are found in the VRM hardware module */ #define CMD_DB_HW_XOB CMD_DB_HW_VRM +#define IPC_LOG_PAGES 10 + +#define rpmh_reg_dbg(fmt, ...) \ + do { \ + ipc_log_string(rpmh_reg_ipc_log, fmt, ##__VA_ARGS__); \ + pr_debug(fmt, ##__VA_ARGS__); \ + } while (0) + +static void *rpmh_reg_ipc_log; + /** * struct rpmh_regulator_request - rpmh request data * @reg: Array of RPMh accelerator register values @@ -596,7 +607,7 @@ static void rpmh_regulator_req(struct rpmh_vreg *vreg, } } - pr_debug("%s\n", buf); + rpmh_reg_dbg("%s\n", buf); } /** @@ -2093,11 +2104,14 @@ static struct platform_driver rpmh_regulator_driver = { static int rpmh_regulator_init(void) { + rpmh_reg_ipc_log = ipc_log_context_create(IPC_LOG_PAGES, "rpmh_regulator", 0); return platform_driver_register(&rpmh_regulator_driver); } static void rpmh_regulator_exit(void) { + if (rpmh_reg_ipc_log) + ipc_log_context_destroy(rpmh_reg_ipc_log); platform_driver_unregister(&rpmh_regulator_driver); }