From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Maulik Shah <maulik.shah@oss.qualcomm.com>
Subject: Re: [PATCH 1/2] soc: qcom: rpmh: Add support to read back resource settings
Date: Tue, 24 Jun 2025 16:44:12 +0200 [thread overview]
Message-ID: <c4947591-4d09-4f49-8458-b993b5f95a2a@oss.qualcomm.com> (raw)
In-Reply-To: <20250623-add-rpmh-read-support-v1-1-ae583d260195@oss.qualcomm.com>
On 6/23/25 6:43 PM, Kamal Wadhwa wrote:
> From: Maulik Shah <maulik.shah@oss.qualcomm.com>
>
> All rpmh_*() APIs so far have supported placing votes for various
> resource settings but the H/W also have option to read resource
> settings.
>
> This change adds a 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.
>
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
> ---
[...]
> u32 msgid;
> - u32 cmd_msgid = CMD_MSGID_LEN | CMD_MSGID_WRITE;
> + u32 cmd_msgid = CMD_MSGID_LEN;
> u32 cmd_enable = 0;
> struct tcs_cmd *cmd;
> int i, j;
>
> /* Convert all commands to RR when the request has wait_for_compl set */
> cmd_msgid |= msg->wait_for_compl ? CMD_MSGID_RESP_REQ : 0;
> + cmd_msgid |= (!msg->is_read) ? CMD_MSGID_WRITE : 0;
if (!msg->is_read)
cmd_msgid |= CMD_MSGID_WRITE
looks more human-readable
[...]
> +/**
> + * rpmh_read: Read a resource value
> + *
> + * @dev: The device making the request
> + * @state: Must be Active state
> + * @cmd: The payload having address of resource to read
> + * @n: The number of elements in @cmd, must be single command
> + *
> + * Reads the value for the resource address given in tcs_cmd->addr
> + * and returns the tcs_cmd->data filled with same.
> + *
> + * May sleep. Do not call from atomic contexts.
> + *
> + * Return:
> + * * 0 - Success
> + * * -Error - Error code
This isn't valid kerneldoc
> + */
> +int rpmh_read(const struct device *dev, enum rpmh_state state, struct tcs_cmd *cmd, u32 n)
> +{
> + int ret;
> + DECLARE_COMPLETION_ONSTACK(compl);
> + DEFINE_RPMH_MSG_ONSTACK(dev, state, &compl, rpm_msg);
A reverse-Christmas-tree sorting would be nice here
> +
> + if (n != 1 || state != RPMH_ACTIVE_ONLY_STATE)
if n must be one, why is it a parameter?
Konrad
next prev parent reply other threads:[~2025-06-24 14:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 16:43 [PATCH 0/2] Add support to read RPMH regulator settings Kamal Wadhwa
2025-06-23 16:43 ` [PATCH 1/2] soc: qcom: rpmh: Add support to read back resource settings Kamal Wadhwa
2025-06-24 14:44 ` Konrad Dybcio [this message]
2025-07-08 5:07 ` Maulik Shah (mkshah)
2025-06-23 16:43 ` [PATCH 2/2] regulator: qcom-rpmh: Add support to read regulator settings Kamal Wadhwa
2025-06-23 17:03 ` Mark Brown
2025-07-24 6:48 ` Kamal Wadhwa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c4947591-4d09-4f49-8458-b993b5f95a2a@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=kamal.wadhwa@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maulik.shah@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®