Re: [PATCH v3 5/5] i2c: qcom-cci: Enforce the required CCI clock rate

Loic Poulain <[email protected]> Sat, 1 Aug 2026 09:14:23 +0200
Newsgroups org.kernel.vger.linux-i2c,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <CAFEp6-3d6POaAnAb6kPxenKxb-68AnGNr7oWz0MU==hppMeUcA@mail.gmail.com>
On Fri, Jul 31, 2026 at 10:55=E2=80=AFPM Andi Shyti <[email protected]>=
 wrote:
>
> Hi Loic,
>
> ...
>
> > @@ -588,6 +646,10 @@ static int __maybe_unused cci_resume_runtime(struc=
t device *dev)
> >       struct cci *cci =3D dev_get_drvdata(dev);
> >       int ret;
> >
> > +     ret =3D cci_set_core_rate(cci, cci_get_required_rate(cci));
> > +     if (ret)
> > +             return ret;
> > +
> >       ret =3D cci_enable_clocks(cci);
> >       if (ret)
> >               return ret;
> > @@ -694,6 +756,19 @@ static int cci_probe(struct platform_device *pdev)
> >               return dev_err_probe(dev, PTR_ERR(cci->cci_clk),
> >                                    "failed to get CCI clock\n");
> >
> > +     ret =3D devm_pm_opp_set_clkname(dev, "cci");
> > +     if (ret)
> > +             return dev_err_probe(dev, ret, "failed to set CCI OPP clk=
\n");
>
> what if CONFIG_PM_OPP is not configured in?

In that case we will 'gracefully' fail the probe as the operation will
return -EOPNOTSUPP. Actually, this mirrors spi-qup and spi-qcom-qspi.
On a qcom arm64 build, several always-present symbols pull it in.
That said, it could be better to make the dependency explicit rather
than rely on transitive selects and add select PM_OPP to the qcom-cci
Kconfig entry?



>
> Thanks,
> Andi
>
> > +
> > +     /* OPP table is optional */
> > +     ret =3D devm_pm_opp_of_add_table(dev);
> > +     if (ret && ret !=3D -ENODEV)
> > +             return dev_err_probe(dev, ret, "failed to add OPP table\n=
");