Re: [PATCH v2 0/9] soc: qcom: geni: Derive SE clock configuration from OPP table on SA8255P
From: Praveen Talari
Date: Fri Sep 11 2026 - 13:43:21 EST
Hi Konrad,
On 04-09-2026 14:30, Konrad Dybcio wrote:
On 9/4/26 9:56 AM, Ulf Hansson wrote:Currently, geni_se_clk_freq_match() relies on clk_perf_tbl to
On Tue, Sep 1, 2026 at 6:48 PM Praveen Talari[...]
<praveen.talari@xxxxxxxxxxxxxxxx> wrote:
So geni_se_clk_freq_match() is used by two consumer drivers today,The way I read it, isn't geni_se_clk_freq_match() more or less
drivers/spi/spi-geni-qcom.c and drivers/tty/serial/qcom_geni_serial.c.
Beyond the $subject series, there will be even more consumer drivers
that call these platform specific functions. As I said above, I don't
think this is moving things in the right direction.
If this can't be solved with generic frameworks (clocks and OPP),
please clarify why so we can figure out a better way forward.
dev_pm_opp_find_freq_exact() called in a loop with an increasing
divider?
determine the source clock index and divider corresponding to
a requested frequency.
On Linux-managed platforms, clk_perf_tbl is populated by
geni_se_clk_tbl_get(), which enumerates the supported source
clock frequencies using clk_round_rate().
int geni_se_clk_freq_match(struct geni_se *se, unsigned long req_freq,
unsigned int *index, unsigned long *res_freq,
bool exact)
{
[...]
num_clk_levels = geni_se_clk_tbl_get(se, &tbl);
if (num_clk_levels < 0)
return num_clk_levels;
[...]
best_delta = ULONG_MAX;
for (i = 0; i < num_clk_levels; i++) {
divider = DIV_ROUND_UP(tbl[i], req_freq);
new_delta = req_freq - tbl[i] / divider;
if (new_delta < best_delta) {
/* We have a new best! */
*index = i;
*res_freq = tbl[i];
/* If the new best is exact then we're done */
if (new_delta == 0)
return 0;
/* Record how close we got */
best_delta = new_delta;
}
}
[...]
return 0;
}
On firmware-managed platforms, clk_perf_tbl is populated from
the performance-domain OPP table during domain attachment,
allowing geni_se_clk_freq_match() to operate on the same source
clock frequency information irrespective of how the underlying
resources are managed.
As a result, the frequency matching logic, including source
clock selection and divider calculation, remains common across
both Linux-managed and firmware-managed configurations, while
only the mechanism used to apply the selected rate differs.
Thanks,
Praveen Talari
Konrad