Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

interconnect: qcom: icc-rpm: Check for node-specific rate coefficients

Some nodes may have different coefficients than the general values for
bus they're attached to. Check for that and use them if present. See
[1], [2] for reference.

[1] https://github.com/sonyxperiadev/kernel/commit/7456d9779af9ad6bb9c7ee6f33d5c5a8d3648e24
[2] https://github.com/artem/android_kernel_sony_msm8996/commit/bf7a8985dcaf0eab5bc2562d2d6775e7e29c0f30
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-4-c04b60caa467@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>

authored by

Konrad Dybcio and committed by
Georgi Djakov
ba3f8266 919791d8

+14 -4
+10 -4
drivers/interconnect/qcom/icc-rpm.c
··· 300 300 else 301 301 agg_avg_rate = qn->sum_avg[ctx]; 302 302 303 - if (qp->ab_coeff) { 304 - agg_avg_rate = agg_avg_rate * qp->ab_coeff; 303 + if (qn->ab_coeff) { 304 + agg_avg_rate = agg_avg_rate * qn->ab_coeff; 305 305 agg_avg_rate = div_u64(agg_avg_rate, 100); 306 306 } 307 307 308 - if (qp->ib_coeff) { 308 + if (qn->ib_coeff) { 309 309 agg_peak_rate = qn->max_peak[ctx] * 100; 310 - agg_peak_rate = div_u64(qn->max_peak[ctx], qp->ib_coeff); 310 + agg_peak_rate = div_u64(qn->max_peak[ctx], qn->ib_coeff); 311 311 } else { 312 312 agg_peak_rate = qn->max_peak[ctx]; 313 313 } ··· 562 562 563 563 for (i = 0; i < num_nodes; i++) { 564 564 size_t j; 565 + 566 + if (!qnodes[i]->ab_coeff) 567 + qnodes[i]->ab_coeff = qp->ab_coeff; 568 + 569 + if (!qnodes[i]->ib_coeff) 570 + qnodes[i]->ib_coeff = qp->ib_coeff; 565 571 566 572 node = icc_node_create(qnodes[i]->id); 567 573 if (IS_ERR(node)) {
+4
drivers/interconnect/qcom/icc-rpm.h
··· 103 103 * @mas_rpm_id: RPM id for devices that are bus masters 104 104 * @slv_rpm_id: RPM id for devices that are bus slaves 105 105 * @qos: NoC QoS setting parameters 106 + * @ab_coeff: a percentage-based coefficient for compensating the AB calculations 107 + * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations 106 108 * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz 107 109 */ 108 110 struct qcom_icc_node { ··· 120 118 int mas_rpm_id; 121 119 int slv_rpm_id; 122 120 struct qcom_icc_qos qos; 121 + u16 ab_coeff; 122 + u16 ib_coeff; 123 123 u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; 124 124 }; 125 125