2022-07-12 02:08:22

by Leo Yan

[permalink] [raw]
Subject: [PATCH v6 0/5] interconnect: qcom: icc-rpm: Support bucket

This patch set is to support bucket in icc-rpm driver, so it implements
the similar mechanism in the icc-rpmh driver.

It uses interconnect path tag to indicate the bandwidth voting is for
which buckets, and there have three kinds of buckets: AWC, WAKE and
SLEEP, finally the wake and sleep bucket values are used to set the
corresponding clock (active and sleep clocks). So far, we keep the AWC
bucket but doesn't really use it.

Note, this patch set is dependent on an out of tree patch "interconnect:
icc-rpm: Set destination bandwidth as well as source bandwidth" [1].
With the dependent patch, this patch set can be cleanly applied on the
Linux kernel master branch with the latest commit 32346491ddf2
("Linux 5.19-rc6").

[1] https://lore.kernel.org/linux-pm/[email protected]/T/#r304f7b103c806e1570d555a0f5aaf83ae3990ac0

Changes from v5:
- Removed unsed local variable 'max_agg_peak' in qcom_icc_set() (Georgi).

Changes from v4:
- Added Krzysztof's Acked tag for DT binding document patch;
- Fixed the unalignment between function qcom_icc_pre_bw_aggregate() and
its comment (Georgi);
- Simplified qcom_icc_bus_aggregate() with removing unused parameter
'max_agg_peak';
- Removed unsed local variable 'max_peak_bw' in qcom_icc_set() (Georgi).

Changes from v3:
- Removed $ref and redundant sentence in DT binding document for
'#interconnect-cells' (Krzysztof Kozlowski).

Changes from v2:
- Fixed for DT checker error for command ''make DT_CHECKER_FLAGS=-m
dt_binding_check' (Rob Herring).

Changes from v1:
- Added description for property "#interconnect-cells" (Rob Herring);
- Added Dimtry's reviewed tags for patches 02 and 03 (Dmitry Baryshkov);
- Rebased on the latest mainline kernel and resolved conflict.


Leo Yan (5):
dt-bindings: interconnect: Update property for icc-rpm path tag
interconnect: qcom: Move qcom_icc_xlate_extended() to a common file
interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended()
interconnect: qcom: icc-rpm: Support multiple buckets
interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values

.../bindings/interconnect/qcom,rpm.yaml | 6 +-
drivers/interconnect/qcom/Makefile | 3 +
drivers/interconnect/qcom/icc-common.c | 34 +++++
drivers/interconnect/qcom/icc-common.h | 13 ++
drivers/interconnect/qcom/icc-rpm.c | 129 +++++++++++++++---
drivers/interconnect/qcom/icc-rpm.h | 6 +
drivers/interconnect/qcom/icc-rpmh.c | 26 +---
drivers/interconnect/qcom/icc-rpmh.h | 1 -
drivers/interconnect/qcom/sm8450.c | 1 +
9 files changed, 176 insertions(+), 43 deletions(-)
create mode 100644 drivers/interconnect/qcom/icc-common.c
create mode 100644 drivers/interconnect/qcom/icc-common.h

--
2.25.1


2022-07-12 02:18:29

by Leo Yan

[permalink] [raw]
Subject: [PATCH v6 2/5] interconnect: qcom: Move qcom_icc_xlate_extended() to a common file

since there have conflict between two headers icc-rpmh.h and icc-rpm.h,
the function qcom_icc_xlate_extended() is declared in icc-rpmh.h thus
it cannot be used by icc-rpm driver.

Move the function to a new common file icc-common.c so that allow it to
be called by multiple drivers.

Signed-off-by: Leo Yan <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
drivers/interconnect/qcom/Makefile | 3 +++
drivers/interconnect/qcom/icc-common.c | 34 ++++++++++++++++++++++++++
drivers/interconnect/qcom/icc-common.h | 13 ++++++++++
drivers/interconnect/qcom/icc-rpmh.c | 26 +-------------------
drivers/interconnect/qcom/icc-rpmh.h | 1 -
drivers/interconnect/qcom/sm8450.c | 1 +
6 files changed, 52 insertions(+), 26 deletions(-)
create mode 100644 drivers/interconnect/qcom/icc-common.c
create mode 100644 drivers/interconnect/qcom/icc-common.h

diff --git a/drivers/interconnect/qcom/Makefile b/drivers/interconnect/qcom/Makefile
index 8d1fe9d38ac3..e6451470f812 100644
--- a/drivers/interconnect/qcom/Makefile
+++ b/drivers/interconnect/qcom/Makefile
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: GPL-2.0

+obj-$(CONFIG_INTERCONNECT_QCOM) += interconnect_qcom.o
+
+interconnect_qcom-y := icc-common.o
icc-bcm-voter-objs := bcm-voter.o
qnoc-msm8916-objs := msm8916.o
qnoc-msm8939-objs := msm8939.o
diff --git a/drivers/interconnect/qcom/icc-common.c b/drivers/interconnect/qcom/icc-common.c
new file mode 100644
index 000000000000..0822ce207b5d
--- /dev/null
+++ b/drivers/interconnect/qcom/icc-common.c
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Linaro Ltd.
+ */
+
+#include <linux/of.h>
+#include <linux/slab.h>
+
+#include "icc-common.h"
+
+struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data)
+{
+ struct icc_node_data *ndata;
+ struct icc_node *node;
+
+ node = of_icc_xlate_onecell(spec, data);
+ if (IS_ERR(node))
+ return ERR_CAST(node);
+
+ ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
+ if (!ndata)
+ return ERR_PTR(-ENOMEM);
+
+ ndata->node = node;
+
+ if (spec->args_count == 2)
+ ndata->tag = spec->args[1];
+
+ if (spec->args_count > 2)
+ pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np);
+
+ return ndata;
+}
+EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended);
diff --git a/drivers/interconnect/qcom/icc-common.h b/drivers/interconnect/qcom/icc-common.h
new file mode 100644
index 000000000000..33bb2c38dff3
--- /dev/null
+++ b/drivers/interconnect/qcom/icc-common.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2022 Linaro Ltd.
+ */
+
+#ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__
+#define __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__
+
+#include <linux/interconnect-provider.h>
+
+struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data);
+
+#endif
diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
index 3c40076eb5fb..505d53e80d96 100644
--- a/drivers/interconnect/qcom/icc-rpmh.c
+++ b/drivers/interconnect/qcom/icc-rpmh.c
@@ -11,6 +11,7 @@
#include <linux/slab.h>

#include "bcm-voter.h"
+#include "icc-common.h"
#include "icc-rpmh.h"

/**
@@ -100,31 +101,6 @@ int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
}
EXPORT_SYMBOL_GPL(qcom_icc_set);

-struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data)
-{
- struct icc_node_data *ndata;
- struct icc_node *node;
-
- node = of_icc_xlate_onecell(spec, data);
- if (IS_ERR(node))
- return ERR_CAST(node);
-
- ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
- if (!ndata)
- return ERR_PTR(-ENOMEM);
-
- ndata->node = node;
-
- if (spec->args_count == 2)
- ndata->tag = spec->args[1];
-
- if (spec->args_count > 2)
- pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np);
-
- return ndata;
-}
-EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended);
-
/**
* qcom_icc_bcm_init - populates bcm aux data and connect qnodes
* @bcm: bcm to be initialized
diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
index d29929461c17..04391c1ba465 100644
--- a/drivers/interconnect/qcom/icc-rpmh.h
+++ b/drivers/interconnect/qcom/icc-rpmh.h
@@ -131,7 +131,6 @@ struct qcom_icc_desc {
int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
int qcom_icc_set(struct icc_node *src, struct icc_node *dst);
-struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data);
int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev);
void qcom_icc_pre_aggregate(struct icc_node *node);
int qcom_icc_rpmh_probe(struct platform_device *pdev);
diff --git a/drivers/interconnect/qcom/sm8450.c b/drivers/interconnect/qcom/sm8450.c
index 7e3d372b712f..e821fd0b2f66 100644
--- a/drivers/interconnect/qcom/sm8450.c
+++ b/drivers/interconnect/qcom/sm8450.c
@@ -12,6 +12,7 @@
#include <dt-bindings/interconnect/qcom,sm8450.h>

#include "bcm-voter.h"
+#include "icc-common.h"
#include "icc-rpmh.h"
#include "sm8450.h"

--
2.25.1