From: Dzmitry Sankouski <dsankouski@gmail.com>
To: Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org,
Dzmitry Sankouski <dsankouski@gmail.com>
Subject: [PATCH RESEND v8 1/3] clk: qcom: clk-rcg2: document calc_rate function
Date: Mon, 18 Nov 2024 13:15:19 +0300 [thread overview]
Message-ID: <20241118-starqltechn_integration_upstream-v8-1-ac8e36a3aa65@gmail.com> (raw)
In-Reply-To: <20241118-starqltechn_integration_upstream-v8-0-ac8e36a3aa65@gmail.com>
Update calc_rate docs to reflect, that pre_div
is not pure divisor, but a register value, and requires conversion.
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
---
Changes in v8:
- format kernel-doc
- test with scripts/kernel-doc
---
drivers/clk/qcom/clk-rcg2.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index bf26c5448f00..b403e4d6dcdd 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -148,12 +148,21 @@ static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index)
return update_config(rcg);
}
-/*
- * Calculate m/n:d rate
+/**
+ * calc_rate() - Calculate rate based on m/n:d values
+ *
+ * @rate: Parent rate.
+ * @m: Multiplier.
+ * @n: Divisor.
+ * @mode: Use zero to ignore m/n calculation.
+ * @hid_div: Pre divisor register value. Pre divisor value
+ * relates to hid_div as pre_div = (hid_div + 1) / 2.
+ *
+ * Return calculated rate according to formula:
*
* parent_rate m
* rate = ----------- x ---
- * hid_div n
+ * pre_div n
*/
static unsigned long
calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div)
--
2.39.2
next prev parent reply other threads:[~2024-11-18 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 10:15 [PATCH RESEND v8 0/3] Add divisor computation feature for sdm845 gp clocks Dzmitry Sankouski
2024-11-18 10:15 ` Dzmitry Sankouski [this message]
2024-11-18 10:15 ` [PATCH RESEND v8 2/3] clk: qcom: clk-rcg2: split __clk_rcg2_configure function Dzmitry Sankouski
2024-11-18 10:15 ` [PATCH RESEND v8 3/3] gcc-sdm845: Add general purpose clock ops Dzmitry Sankouski
2025-01-08 2:13 ` [PATCH RESEND v8 0/3] Add divisor computation feature for sdm845 gp clocks Bjorn Andersson
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=20241118-starqltechn_integration_upstream-v8-1-ac8e36a3aa65@gmail.com \
--to=dsankouski@gmail.com \
--cc=andersson@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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