From: Christian Marangi <ansuelsmth@gmail.com>
To: Bjorn Andersson <andersson@kernel.org>,
Andy Gross <agross@kernel.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Christian Marangi <ansuelsmth@gmail.com>
Subject: [PATCH v3 3/6] clk: qcom: common: add qcom_find_freq_exact
Date: Tue, 17 Jan 2023 14:54:56 +0100 [thread overview]
Message-ID: <20230117135459.16868-4-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com>
Currently qcom_find_freq will always find a freq following a CEIL logic
but we may need to find the exact requesting frequency or return NULL.
Add qcom_find_freq_exact to perform a search of the exact requested
frequency.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/clk/qcom/common.c | 17 +++++++++++++++++
drivers/clk/qcom/common.h | 2 ++
2 files changed, 19 insertions(+)
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index 75f09e6e057e..ffa91bcc0b0a 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -57,6 +57,23 @@ const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f,
}
EXPORT_SYMBOL_GPL(qcom_find_freq_floor);
+const
+struct freq_tbl *qcom_find_freq_exact(const struct freq_tbl *f, unsigned long rate)
+{
+ if (!f)
+ return NULL;
+
+ if (!f->freq)
+ return f;
+
+ for (; f->freq; f++)
+ if (rate == f->freq)
+ return f;
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(qcom_find_freq_exact);
+
int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src)
{
int i, num_parents = clk_hw_get_num_parents(hw);
diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h
index 9c8f7b798d9f..7bd935332634 100644
--- a/drivers/clk/qcom/common.h
+++ b/drivers/clk/qcom/common.h
@@ -45,6 +45,8 @@ extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f,
unsigned long rate);
extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f,
unsigned long rate);
+extern const struct freq_tbl *qcom_find_freq_exact(const struct freq_tbl *f,
+ unsigned long rate);
extern void
qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count);
extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map,
--
2.38.1
next prev parent reply other threads:[~2023-01-17 13:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 13:54 [PATCH v3 0/6] clk: qcom: clk-rcg2: introduce support for multiple conf for same freq Christian Marangi
2023-01-17 13:54 ` [PATCH v3 1/6] clk: qcom: gcc-ipq6018: drop redundant F define Christian Marangi
2023-01-17 13:54 ` [PATCH v3 2/6] clk: qcom: gcc-sdm660: " Christian Marangi
2023-01-17 13:54 ` Christian Marangi [this message]
2023-01-17 13:54 ` [PATCH v3 4/6] clk: qcom: clk-rcg2: don't re-search config on rcg2_set_rate Christian Marangi
2023-03-29 19:52 ` Stephen Boyd
2023-03-29 22:01 ` Dmitry Baryshkov
2023-01-17 13:54 ` [PATCH v3 5/6] clk: qcom: clk-rcg2: introduce support for multiple conf for same freq Christian Marangi
2023-03-29 19:59 ` Stephen Boyd
2023-01-17 13:54 ` [PATCH v3 6/6] clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf Christian Marangi
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=20230117135459.16868-4-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=konrad.dybcio@somainline.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.