Re: [PATCH 1/2] soc: qcom: ice: enable ICE clock scaling API

From: Abhinaba Rakshit

Date: Thu Nov 20 2025 - 05:11:29 EST


On Fri, Oct 03, 2025 at 10:10:28PM +0530, Manivannan Sadhasivam wrote:
> On Wed, Oct 01, 2025 at 05:08:19PM +0530, Abhinaba Rakshit wrote:
> > Add ICE clock scaling API based on the parsed clk supported
> > frequencies from dt entry.
> >
>
> Explain the purpose.
>
> > Signed-off-by: Abhinaba Rakshit <abhinaba.rakshit@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/soc/qcom/ice.c | 25 +++++++++++++++++++++++++
> > include/soc/qcom/ice.h | 1 +
> > 2 files changed, 26 insertions(+)
> >
> > diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
> > index c467b55b41744ebec0680f5112cc4bb1ba00c513..ec8d6bb9f426deee1038616282176bfc8e5b9ec1 100644
> > --- a/drivers/soc/qcom/ice.c
> > +++ b/drivers/soc/qcom/ice.c
> > @@ -97,6 +97,8 @@ struct qcom_ice {
> > struct clk *core_clk;
> > bool use_hwkm;
> > bool hwkm_init_complete;
> > + u32 max_freq;
> > + u32 min_freq;
> > };
> >
> > static bool qcom_ice_check_supported(struct qcom_ice *ice)
> > @@ -514,10 +516,25 @@ int qcom_ice_import_key(struct qcom_ice *ice,
> > }
> > EXPORT_SYMBOL_GPL(qcom_ice_import_key);
> >
> > +int qcom_ice_scale_clk(struct qcom_ice *ice, bool scale_up)
> > +{
> > + int ret = 0;
> > +
> > + if (scale_up && ice->max_freq)
> > + ret = clk_set_rate(ice->core_clk, ice->max_freq);
> > + else if (!scale_up && ice->min_freq)
> > + ret = clk_set_rate(ice->core_clk, ice->min_freq);
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(qcom_ice_scale_clk);
> > +
> > static struct qcom_ice *qcom_ice_create(struct device *dev,
> > void __iomem *base)
> > {
> > struct qcom_ice *engine;
> > + const __be32 *prop;
> > + int len;
> >
> > if (!qcom_scm_is_available())
> > return ERR_PTR(-EPROBE_DEFER);
> > @@ -549,6 +566,14 @@ static struct qcom_ice *qcom_ice_create(struct device *dev,
> > if (IS_ERR(engine->core_clk))
> > return ERR_CAST(engine->core_clk);
> >
> > + prop = of_get_property(dev->of_node, "freq-table-hz", &len);
> > + if (!prop || len < 2 * sizeof(uint32_t)) {
> > + dev_err(dev, "Freq-hz property not found or invalid length\n");
>
> We have deprecated the 'freq-table-hz' property in favor of
> 'operating-points-v2'. So you should not be using it in new code. Also, throwing
> error in the absence of this property is a no-go.

Sure, will move the soultion using OPP-table in patchset v2.

>
> - Mani
>
> --
> மணிவண்ணன் சதாசிவம்