summaryrefslogtreecommitdiff
path: root/drivers/interconnect/qcom/icc-rpm.c
diff options
context:
space:
mode:
authorKonrad Dybcio <konrad.dybcio@linaro.org>2023-08-25 18:38:23 +0300
committerGeorgi Djakov <djakov@kernel.org>2023-10-09 15:07:22 +0300
commitdd014803f260b337daaabcde259daf70d5b26b5e (patch)
treeb27501fc8f2fd2b2c06e8ee19fc26b0eb4add092 /drivers/interconnect/qcom/icc-rpm.c
parent0bb80ecc33a8fb5a682236443c1e740d5c917d1d (diff)
downloadlinux-dd014803f260b337daaabcde259daf70d5b26b5e.tar.xz
interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients
Presumably due to the hardware being so complex, some nodes (or busses) have different (usually higher) requirements for bandwidth than what the usual calculations would suggest. Looking at the available downstream files, it seems like AB values are adjusted per-bus and IB values are adjusted per-node. With that in mind, introduce percentage-based coefficient struct members and use them in the calculations. One thing to note is that the IB coefficient is inverse (100/ib_percent) which feels a bit backwards, but it's necessary for precision.. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-1-c04b60caa467@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
Diffstat (limited to 'drivers/interconnect/qcom/icc-rpm.c')
-rw-r--r--drivers/interconnect/qcom/icc-rpm.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
index 2c16917ba1fd..8b02aa8aa96a 100644
--- a/drivers/interconnect/qcom/icc-rpm.c
+++ b/drivers/interconnect/qcom/icc-rpm.c
@@ -298,7 +298,8 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
*/
static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_rate)
{
- u64 agg_avg_rate, agg_rate;
+ struct qcom_icc_provider *qp = to_qcom_provider(provider);
+ u64 agg_avg_rate, agg_peak_rate, agg_rate;
struct qcom_icc_node *qn;
struct icc_node *node;
int i;
@@ -315,8 +316,19 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_r
else
agg_avg_rate = qn->sum_avg[i];
- agg_rate = max_t(u64, agg_avg_rate, qn->max_peak[i]);
- do_div(agg_rate, qn->buswidth);
+ if (qp->ab_coeff) {
+ agg_avg_rate = agg_avg_rate * qp->ab_coeff;
+ agg_avg_rate = div_u64(agg_avg_rate, 100);
+ }
+
+ if (qp->ib_coeff) {
+ agg_peak_rate = qn->max_peak[i] * 100;
+ agg_peak_rate = div_u64(qn->max_peak[i], qp->ib_coeff);
+ } else {
+ agg_peak_rate = qn->max_peak[i];
+ }
+
+ agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate);
agg_clk_rate[i] = max_t(u64, agg_clk_rate[i], agg_rate);
}