Re: [PATCH v4 17/22] interconnect: qcom: icc-rpm: Control bus rpmcc from icc

From: Stephan Gerhold
Date: Tue Jun 13 2023 - 16:39:15 EST


On Tue, Jun 13, 2023 at 10:36:15PM +0200, Stephan Gerhold wrote:
> Not even compile tested this time!

Would have probably been worth it, sigh:

>
> /*
> * Downstream checks whether the requested rate is zero, but it makes little sense
> * to vote for a value that's below the lower threshold, so let's not do so.
> */
> if (qp->keep_alive)
> agg_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE]
> = max(ICC_BUS_CLK_MIN_RATE, agg_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE]);
>
> /* Some providers have a non-RPM-owned bus clock - convert kHz->Hz for the CCF */
> if (qp->bus_clk) {
> rate = max_t(u64, agg_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE],
> agg_clk_rate[QCOM_SMD_RPM_SLEEP_STATE]);
> /* ARM32 caps clk_set_rate arg to u32.. Nothing we can do about that! */
> reate = min_t(u64, 1000ULL * rate, ULONG_MAX);
> return clk_set_rate(qp->bus_clk, rate);
> }
>
> for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) {
> /* RPM only accepts <=INT_MAX rates */
> rate = min_t(u64, active_rate, INT_MAX);

-> rate = min_t(u64, agg_clk_rate[i], INT_MAX);

> if (rate == qp->bus_clk_rate[i])
> continue;
>
> ret = qcom_icc_rpm_set_bus_rate(qp->bus_clk_desc, rate, i);
> if (ret)
> return ret;
>
> /* Cache the rate after we've successfully commited it to RPM */
> qp->bus_clk_rate[i] = rate;
> }