Re: [PATCH DNM RFC 14/16] clk: qcom: Enable clk-dvfs on SM8650

From: Dmitry Baryshkov

Date: Wed Oct 14 2026 - 10:42:00 EST


On Wed, Oct 14, 2026 at 02:19:14PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>
> Make use of the clock-dvfs infrastructure and fill in the power
> requirements for SM8650's clocks to ensure the hardware can operate in
> accordance with the specification.
>
> Assisted-by: LLM
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> ---
> This commit is a DNM since some of the affected drivers are shared
> between multiple platforms, this will be properly reworked if we agree
> on merging the clk-DVFS infra.
> ---
> drivers/clk/qcom/camcc-sm8650.c | 282 ++++++++++++++++++++++++
> drivers/clk/qcom/dispcc-sm8550.c | 328 ++++++++++++++++++++++++----
> drivers/clk/qcom/gcc-sm8650.c | 261 ++++++++++++++++++++++
> drivers/clk/qcom/gpucc-sm8650.c | 101 ++++++++-
> drivers/clk/qcom/videocc-sm8550.c | 135 ++++++++++--
> include/dt-bindings/clock/qcom,sm8650-gcc.h | 2 +
> 6 files changed, 1041 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/clk/qcom/camcc-sm8650.c b/drivers/clk/qcom/camcc-sm8650.c
> index 3aad816ed233..188649368564 100644
> --- a/drivers/clk/qcom/camcc-sm8650.c
> +++ b/drivers/clk/qcom/camcc-sm8650.c
> @@ -6,12 +6,15 @@
> #include <linux/clk-provider.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> +#include <linux/pm.h>
> #include <linux/regmap.h>
>
> #include <dt-bindings/clock/qcom,sm8650-camcc.h>
> +#include <dt-bindings/power/qcom,rpmhpd.h>

I've commented to the cover letter. For me it feels like the layering
violation.

>
> #include "clk-alpha-pll.h"
> #include "clk-branch.h"
> +#include "clk-dvfs.h"
> #include "clk-rcg.h"
> #include "clk-regmap.h"
> #include "common.h"
> @@ -46,6 +49,110 @@ enum {
> P_SLEEP_CLK,
> };
>
> +/*
> + * Downstream uses CRM/CESTA for PLL3-7/10 and the CAMNOC AXI RT, CPHY RX,
> + * CSID, IFE0-2 and SFE0-2 RCGs. Until upstream supports that path, manage
> + * their rail requirements through clock-owned DVFS.
> + */
> +enum {
> + DT_PMDOMAIN_MMCX,
> + DT_PMDOMAIN_MXC,
> + DT_PMDOMAIN_MX,
> +};
> +
> +static const struct qcom_clk_dvfs_data cam_cc_pll0_dvfs = {
> + .pd_indices = (const unsigned int[]) { DT_PMDOMAIN_MXC },
> + .num_pd_indices = 1,
> + .rates = (const struct qcom_clk_dvfs_rate[]) {
> + { 615000000, RPMH_REGULATOR_LEVEL_LOW_SVS_D1 },
> + { 1100000000, RPMH_REGULATOR_LEVEL_SVS },
> + { 1600000000, RPMH_REGULATOR_LEVEL_SVS_L1 },
> + { 2000000000, RPMH_REGULATOR_LEVEL_NOM },
> + { 2100000000, RPMH_REGULATOR_LEVEL_TURBO_L1 },
> + },
> + .num_rates = 5,
> +};
> +
> +static const struct qcom_clk_dvfs_data cam_cc_camnoc_axi_rt_clk_src_dvfs = {
> + .pd_indices = (const unsigned int[]) { DT_PMDOMAIN_MMCX, DT_PMDOMAIN_MXC },
> + .num_pd_indices = 2,
> + .rates = (const struct qcom_clk_dvfs_rate[]) {
> + { 300000000, RPMH_REGULATOR_LEVEL_LOW_SVS },
> + { 400000000, RPMH_REGULATOR_LEVEL_SVS },

And does it actually have the same vote on both MMCX and MXC? I'd need
to check the clock tree.

> + },
> + .num_rates = 2,
> +};
> +
> +static const struct qcom_clk_dvfs_data cam_cc_cci_0_clk_src_dvfs = {
> + .pd_indices = (const unsigned int[]) { DT_PMDOMAIN_MMCX },
> + .num_pd_indices = 1,
> + .rates = (const struct qcom_clk_dvfs_rate[]) {
> + { 37500000, RPMH_REGULATOR_LEVEL_LOW_SVS },
> + },
> + .num_rates = 1,
> +};
> +
> +static const struct qcom_clk_dvfs_data cam_cc_cphy_rx_clk_src_dvfs = {
> + .pd_indices = (const unsigned int[]) {
> + DT_PMDOMAIN_MMCX, DT_PMDOMAIN_MX, DT_PMDOMAIN_MXC,

Three domains... If we want to have three votes, we really need to have
three votes in the .rates array. But then it starts to feel like an OPP
table.

> + },
> + .num_pd_indices = 3,
> + .rates = (const struct qcom_clk_dvfs_rate[]) {
> + { 400000000, RPMH_REGULATOR_LEVEL_LOW_SVS },
> + { 480000000, RPMH_REGULATOR_LEVEL_SVS },
> + },
> + .num_rates = 2,
> +};
> +

--
With best wishes
Dmitry