Skip to content

Commit ba3f826

Browse files
konradybcioGeorgi Djakov
authored andcommitted
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] sonyxperiadev/kernel@7456d97 [2] artem/android_kernel_sony_msm8996@bf7a898 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>
1 parent 919791d commit ba3f826

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

drivers/interconnect/qcom/icc-rpm.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,14 @@ static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node
300300
else
301301
agg_avg_rate = qn->sum_avg[ctx];
302302

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;
305305
agg_avg_rate = div_u64(agg_avg_rate, 100);
306306
}
307307

308-
if (qp->ib_coeff) {
308+
if (qn->ib_coeff) {
309309
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);
311311
} else {
312312
agg_peak_rate = qn->max_peak[ctx];
313313
}
@@ -563,6 +563,12 @@ int qnoc_probe(struct platform_device *pdev)
563563
for (i = 0; i < num_nodes; i++) {
564564
size_t j;
565565

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;
571+
566572
node = icc_node_create(qnodes[i]->id);
567573
if (IS_ERR(node)) {
568574
ret = PTR_ERR(node);

drivers/interconnect/qcom/icc-rpm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ struct qcom_icc_qos {
103103
* @mas_rpm_id: RPM id for devices that are bus masters
104104
* @slv_rpm_id: RPM id for devices that are bus slaves
105105
* @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
106108
* @bus_clk_rate: a pointer to an array containing bus clock rates in Hz
107109
*/
108110
struct qcom_icc_node {
@@ -118,6 +120,8 @@ struct qcom_icc_node {
118120
int mas_rpm_id;
119121
int slv_rpm_id;
120122
struct qcom_icc_qos qos;
123+
u16 ab_coeff;
124+
u16 ib_coeff;
121125
u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM];
122126
};
123127

0 commit comments

Comments
 (0)