From: Georgi Djakov <georgi.djakov@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Georgi Djakov <georgi.djakov@linaro.org>,
Evan Green <evgreen@chromium.org>,
Brian Masney <masneyb@onstation.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: [PATCH 06/12] interconnect: Add a common standard aggregate function
Date: Fri, 17 Jan 2020 11:58:10 +0200 [thread overview]
Message-ID: <20200117095816.23575-7-georgi.djakov@linaro.org> (raw)
In-Reply-To: <20200117095816.23575-1-georgi.djakov@linaro.org>
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>
---
drivers/interconnect/core.c | 10 ++++++++++
include/linux/interconnect-provider.h | 8 ++++++++
2 files changed, 18 insertions(+)
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 @@ static int apply_constraints(struct icc_path *path)
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)
diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h
index 31440c921216..0c494534b4d3 100644
--- a/include/linux/interconnect-provider.h
+++ b/include/linux/interconnect-provider.h
@@ -92,6 +92,8 @@ struct icc_node {
#if IS_ENABLED(CONFIG_INTERCONNECT)
+int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
+ u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
struct icc_node *icc_node_create(int id);
void icc_node_destroy(int id);
int icc_link_create(struct icc_node *node, const int dst_id);
@@ -104,6 +106,12 @@ int icc_provider_del(struct icc_provider *provider);
#else
+static inline int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
+ u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
+{
+ return -ENOTSUPP;
+}
+
static inline struct icc_node *icc_node_create(int id)
{
return ERR_PTR(-ENOTSUPP);
next prev parent reply other threads:[~2020-01-17 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 9:58 [GIT PULL 00/12] interconnect changes for 5.6 Georgi Djakov
2020-01-17 9:58 ` [PATCH 01/12] interconnect: Add a common helper for removing all nodes Georgi Djakov
2020-01-17 9:58 ` [PATCH 02/12] interconnect: qcom: Use the new common helper for node removal Georgi Djakov
2020-01-17 9:58 ` [PATCH 03/12] interconnect: Move internal structs into a separate file Georgi Djakov
2020-01-17 9:58 ` [PATCH 04/12] interconnect: Add a name to struct icc_path Georgi Djakov
2020-01-17 9:58 ` [PATCH 05/12] interconnect: Add basic tracepoints Georgi Djakov
2020-01-17 9:58 ` Georgi Djakov [this message]
2020-01-17 9:58 ` [PATCH 07/12] interconnect: qcom: Use the standard aggregate function Georgi Djakov
2020-01-17 9:58 ` [PATCH 08/12] interconnect: Add interconnect_graph file to debugfs Georgi Djakov
2020-01-17 9:58 ` [PATCH 09/12] interconnect: Print the tag in the debugfs summary Georgi Djakov
2020-01-17 9:58 ` [PATCH 10/12] interconnect: Check for valid path in icc_set_bw() Georgi Djakov
2020-01-17 9:58 ` [PATCH 11/12] dt-bindings: interconnect: Add Qualcomm MSM8916 DT bindings Georgi Djakov
2020-01-17 9:58 ` [PATCH 12/12] interconnect: qcom: Add MSM8916 interconnect provider driver Georgi Djakov
2020-01-22 9:05 ` [GIT PULL 00/12] interconnect changes for 5.6 Greg KH
2020-01-22 9:15 ` Georgi Djakov
2020-01-22 9:07 ` Georgi Djakov
2020-01-22 9:15 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200117095816.23575-7-georgi.djakov@linaro.org \
--to=georgi.djakov@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=evgreen@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=masneyb@onstation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox