diff mbox series

[V4,2/9] interconnect: Set peak requirement as twice of average

Message ID 1586946198-13912-3-git-send-email-akashast@codeaurora.org
State New
Headers show
Series Add interconnect support to QSPI and QUP drivers | expand

Commit Message

Akash Asthana April 15, 2020, 10:23 a.m. UTC
Lot of ICC clients are not aware of their actual peak requirement,
most commonly they tend to guess their peak requirement as
(some factor) * avg_bw.

Centralize random peak guess as twice of average, out into the core
to maintain consistency across the clients. Client can always
override this setting if they got a better idea.

Signed-off-by: Akash Asthana <akashast@codeaurora.org>
---
 drivers/interconnect/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index f5699ed..ad3938e 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -516,6 +516,10 @@  EXPORT_SYMBOL_GPL(icc_set_tag);
  * The @path can be NULL when the "interconnects" DT properties is missing,
  * which will mean that no constraints will be set.
  *
+ * This function assumes peak_bw as twice of avg_bw, if peak_bw is not mentioned
+ * explicitly by clients. Clients can pass peak_bw as 0 < peak_bw <=avg_bw to
+ * make it a noops.
+ *
  * Returns 0 on success, or an appropriate error code otherwise.
  */
 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
@@ -531,6 +535,12 @@  int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
 	if (WARN_ON(IS_ERR(path) || !path->num_nodes))
 		return -EINVAL;
 
+	/*
+	 * Assume peak requirement as twice of avg requirement, if it is not
+	 * mentioned explicitly.
+	 */
+	peak_bw = peak_bw ? peak_bw : 2 * avg_bw;
+
 	mutex_lock(&icc_lock);
 
 	old_avg = path->reqs[0].avg_bw;