On 21/01/2023 00:11, Stephen Boyd wrote:
Quoting Dmitry Baryshkov (2023-01-19 22:14:13)
Turn CBF into the interconnect provider. Scale CBF frequency (bandwidth)
according to CPU frequencies.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
---
drivers/clk/qcom/clk-cbf-8996.c | 143 +++++++++++++++++++++++++++++++-
1 file changed, 142 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/qcom/clk-cbf-8996.c b/drivers/clk/qcom/clk-cbf-8996.c
index 9cde0e660228..b049b4f7b270 100644
--- a/drivers/clk/qcom/clk-cbf-8996.c
+++ b/drivers/clk/qcom/clk-cbf-8996.c
@@ -5,11 +5,14 @@
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
+#include <linux/interconnect-provider.h>
#include <linux/of.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
+#include <dt-bindings/interconnect/qcom,msm8996-cbf.h>
+
#include "clk-alpha-pll.h"
#include "clk-regmap.h"
@@ -225,6 +228,133 @@ static const struct regmap_config cbf_msm8996_regmap_config = {
.val_format_endian = REGMAP_ENDIAN_LITTLE,
};
+#ifdef CONFIG_INTERCONNECT
Can you move this driver to drivers/interconnect/ ?
Only the interconnect part? At some point I considered dropping the
whole CBF mux support and moving the whole driver to
drivers/interconnect, but I could not find a good way to use alpha-pll
from the interconnect driver. Would you recommend one?
+struct qcom_msm8996_cbf_icc_provider {
+ struct icc_provider provider;
+ struct clk *clk;
+};
+
+#define to_qcom_cbf_provider(_provider) \
+ container_of(_provider, struct qcom_msm8996_cbf_icc_provider, provider)
+
+enum {
+ CBF_MASTER_NODE = 2000,
[...]
+static int qcom_msm8996_cbf_icc_remove(struct platform_device *pdev)
+{
+ struct icc_provider *provider = platform_get_drvdata(pdev);
+
+ icc_nodes_remove(provider);
+ icc_provider_del(provider);
+
+ return 0;
+}
+#else
+static int qcom_msm8996_cbf_icc_register(struct platform_device *pdev)
+{
+ dev_warn(&pdev->dev, "interconnects support is disabled, CBF clock is fixed\n");
+
+ return 0;
+}
+#define qcom_msm8996_cbf_icc_remove(pdev) (0)
It's like two drivers in one.
+#endif
+
static int qcom_msm8996_cbf_probe(struct platform_device *pdev)
{
void __iomem *base;
--
With best wishes
Dmitry