summaryrefslogtreecommitdiff
path: root/drivers/interconnect
diff options
context:
space:
mode:
authorGeorgi Djakov <georgi.djakov@linaro.org>2019-11-28 16:48:38 +0300
committerGeorgi Djakov <georgi.djakov@linaro.org>2019-12-16 10:25:24 +0300
commit3172e4d276315afa82c12b14c8dd0db526c7aff1 (patch)
tree877fb52d6afa9e4f3e86dab3bdd5ed41dfbd8c98 /drivers/interconnect
parentc46ab9db64979b0875fff79e1b00013343ca8286 (diff)
downloadlinux-3172e4d276315afa82c12b14c8dd0db526c7aff1.tar.xz
interconnect: Add a common standard aggregate function
Currently there is one very standard aggregation method that is used by several drivers. Let's add this as a common function, so that drivers could just point to it, instead of copy/pasting code. Suggested-by: Evan Green <evgreen@chromium.org> Reviewed-by: Brian Masney <masneyb@onstation.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Evan Green <evgreen@chromium.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Diffstat (limited to 'drivers/interconnect')
-rw-r--r--drivers/interconnect/core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index fbec2e4fdfeb..03625406c69f 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -221,6 +221,16 @@ out:
return ret;
}
+int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
+ u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
+{
+ *agg_avg += avg_bw;
+ *agg_peak = max(*agg_peak, peak_bw);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(icc_std_aggregate);
+
/* of_icc_xlate_onecell() - Translate function using a single index.
* @spec: OF phandle args to map into an interconnect node.
* @data: private data (pointer to struct icc_onecell_data)