Skip to content

Commit cb30e02

Browse files
Mike TiptonGeorgi Djakov
authored andcommitted
interconnect: qcom: Add support for per-BCM scaling factors
Currently, bcm-voter always assumes requests are made in KBps and that BCM HW always wants them in Bps, so it always scales the requests by 1000. However, certain use cases and BCMs may use different units. Thus, add support for BCM-specific scaling factors. Signed-off-by: Mike Tipton <mdtipton@codeaurora.org> Link: https://lore.kernel.org/r/20200903192149.30385-7-mdtipton@codeaurora.org Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
1 parent db474be commit cb30e02

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/interconnect/qcom/bcm-voter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
8585
agg_peak[bucket] = max(agg_peak[bucket], temp);
8686
}
8787

88-
temp = agg_avg[bucket] * 1000ULL;
88+
temp = agg_avg[bucket] * bcm->vote_scale;
8989
bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
9090

91-
temp = agg_peak[bucket] * 1000ULL;
91+
temp = agg_peak[bucket] * bcm->vote_scale;
9292
bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
9393
}
9494

drivers/interconnect/qcom/icc-rpmh.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev)
136136
INIT_LIST_HEAD(&bcm->list);
137137
INIT_LIST_HEAD(&bcm->ws_list);
138138

139+
if (!bcm->vote_scale)
140+
bcm->vote_scale = 1000;
141+
139142
/* Link Qnodes to their respective BCMs */
140143
for (i = 0; i < bcm->num_nodes; i++) {
141144
qn = bcm->nodes[i];

drivers/interconnect/qcom/icc-rpmh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct qcom_icc_node {
8080
* @addr: address offsets used when voting to RPMH
8181
* @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm
8282
* @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm
83+
* @vote_scale: scaling factor for vote_x and vote_y
8384
* @dirty: flag used to indicate whether the bcm needs to be committed
8485
* @keepalive: flag used to indicate whether a keepalive is required
8586
* @aux_data: auxiliary data used when calculating threshold values and
@@ -95,6 +96,7 @@ struct qcom_icc_bcm {
9596
u32 addr;
9697
u64 vote_x[QCOM_ICC_NUM_BUCKETS];
9798
u64 vote_y[QCOM_ICC_NUM_BUCKETS];
99+
u64 vote_scale;
98100
bool dirty;
99101
bool keepalive;
100102
struct bcm_db aux_data;

0 commit comments

Comments
 (0)