summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorgi Djakov <georgi.djakov@linaro.org>2019-08-09 08:13:24 -0400
committerGeorgi Djakov <georgi.djakov@linaro.org>2019-08-13 16:02:48 -0400
commitcbd5a9c28bb5d2560be34fc6a2b6e60197628433 (patch)
tree1c04f2c9a88b51b68c98e295117e9b9c7fcdae4a
parent127ab2cc5f19692efe422935267b9db0845b2b04 (diff)
interconnect: Add pre_aggregate() callback
Introduce an optional callback in interconnect provider drivers. It can be used for implementing actions, that need to be executed before the actual aggregation of the bandwidth requests has started. The benefit of this for now is that it will significantly simplify the code in provider drivers. Suggested-by: Evan Green <evgreen@chromium.org> Reviewed-by: Evan Green <evgreen@chromium.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
-rw-r--r--drivers/interconnect/core.c3
-rw-r--r--include/linux/interconnect-provider.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 251354bb7fdc..7b971228df38 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -205,6 +205,9 @@ static int aggregate_requests(struct icc_node *node)
205 node->avg_bw = 0; 205 node->avg_bw = 0;
206 node->peak_bw = 0; 206 node->peak_bw = 0;
207 207
208 if (p->pre_aggregate)
209 p->pre_aggregate(node);
210
208 hlist_for_each_entry(r, &node->req_list, req_node) 211 hlist_for_each_entry(r, &node->req_list, req_node)
209 p->aggregate(node, r->tag, r->avg_bw, r->peak_bw, 212 p->aggregate(node, r->tag, r->avg_bw, r->peak_bw,
210 &node->avg_bw, &node->peak_bw); 213 &node->avg_bw, &node->peak_bw);
diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h
index 4ee19fd41568..b16f9effa555 100644
--- a/include/linux/interconnect-provider.h
+++ b/include/linux/interconnect-provider.h
@@ -36,6 +36,8 @@ struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec,
36 * @nodes: internal list of the interconnect provider nodes 36 * @nodes: internal list of the interconnect provider nodes
37 * @set: pointer to device specific set operation function 37 * @set: pointer to device specific set operation function
38 * @aggregate: pointer to device specific aggregate operation function 38 * @aggregate: pointer to device specific aggregate operation function
39 * @pre_aggregate: pointer to device specific function that is called
40 * before the aggregation begins (optional)
39 * @xlate: provider-specific callback for mapping nodes from phandle arguments 41 * @xlate: provider-specific callback for mapping nodes from phandle arguments
40 * @dev: the device this interconnect provider belongs to 42 * @dev: the device this interconnect provider belongs to
41 * @users: count of active users 43 * @users: count of active users
@@ -47,6 +49,7 @@ struct icc_provider {
47 int (*set)(struct icc_node *src, struct icc_node *dst); 49 int (*set)(struct icc_node *src, struct icc_node *dst);
48 int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw, 50 int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw,
49 u32 peak_bw, u32 *agg_avg, u32 *agg_peak); 51 u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
52 void (*pre_aggregate)(struct icc_node *node);
50 struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); 53 struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data);
51 struct device *dev; 54 struct device *dev;
52 int users; 55 int users;