From edbafe65eef2b58625db1e113fbbfb1fe10c0291 Mon Sep 17 00:00:00 2001 From: Maulik Shah Date: Sat, 1 Aug 2026 13:30:27 +0530 Subject: soc: qcom: rpmh: Add support to read back resource settings All rpmh_*() APIs so far have supported placing votes for various resource settings but the H/W also have option to read resource settings. Add new rpmh_read() API to allow clients to read back resource setting from H/W. This will be useful for clients like regulators, which currently don't have a way to know the settings applied during bootloader stage. Reviewed-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov Signed-off-by: Maulik Shah Signed-off-by: Kamal Wadhwa Link: https://patch.msgid.link/20260801-b4-read-rpmh-v5-v6-1-9fcb54928523@oss.qualcomm.com Signed-off-by: Mark Brown --- include/soc/qcom/rpmh.h | 5 +++++ include/soc/qcom/tcs.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/soc/qcom/rpmh.h b/include/soc/qcom/rpmh.h index bdbee1a97d36..14ecbf242b6b 100644 --- a/include/soc/qcom/rpmh.h +++ b/include/soc/qcom/rpmh.h @@ -11,6 +11,8 @@ #if IS_ENABLED(CONFIG_QCOM_RPMH) +int rpmh_read(const struct device *dev, struct tcs_cmd *cmd); + int rpmh_write(const struct device *dev, enum rpmh_state state, const struct tcs_cmd *cmd, u32 n); @@ -24,6 +26,9 @@ void rpmh_invalidate(const struct device *dev); #else +static inline int rpmh_read(const struct device *dev, struct tcs_cmd *cmd) +{ return -ENODEV; } + static inline int rpmh_write(const struct device *dev, enum rpmh_state state, const struct tcs_cmd *cmd, u32 n) { return -ENODEV; } diff --git a/include/soc/qcom/tcs.h b/include/soc/qcom/tcs.h index cff67ce25488..45b8513be2f9 100644 --- a/include/soc/qcom/tcs.h +++ b/include/soc/qcom/tcs.h @@ -51,6 +51,7 @@ struct tcs_cmd { * struct tcs_request: A set of tcs_cmds sent together in a TCS * * @state: state for the request. + * @is_read: set for read only requests * @wait_for_compl: wait until we get a response from the h/w accelerator * (same as setting cmd->wait for all commands in the request) * @num_cmds: the number of @cmds in this request @@ -58,6 +59,7 @@ struct tcs_cmd { */ struct tcs_request { enum rpmh_state state; + bool is_read; u32 wait_for_compl; u32 num_cmds; struct tcs_cmd *cmds; -- cgit v1.2.3