Skip to contentSkip to conversation

Add support for LPASS Core and Audio Clock for SC7280

PATCH Superseded Taniya Das 3 participants 9 messages Nov 2, 2021

Subsystems (4)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Taniya Das

author
#0 lore raw

cover Add support for LPASS Core and Audio Clock for SC7280

This patchset supports the following.
- Few PLLs might require to a higher time to detect lock, thus increase the polling time.
- GDSC which require clocks to be explicitly enabled before access.
- LPASS core and audio clock driver support for SC7280.

Taniya Das (4):
clk: qcom: clk-alpha-pll: Increase PLL lock detect poll time
clk: qcom: gdsc: Add support for clock voting from GDSC
dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7280
clk: qcom: lpass: Add support for LPASS clock controller for SC7280

 .../bindings/clock/qcom,sc7280-lpasscorecc.yaml    | 137 ++++
 drivers/clk/qcom/Kconfig                           |   9 +
 drivers/clk/qcom/Makefile                          |   1 +
 drivers/clk/qcom/clk-alpha-pll.c                   |   2 +-
 drivers/clk/qcom/gdsc.c                            |  45 +-
 drivers/clk/qcom/gdsc.h                            |   3 +
 drivers/clk/qcom/lpassaudiocc-sc7280.c             | 831 +++++++++++++++++++++
 drivers/clk/qcom/lpasscorecc-sc7280.c              | 491 ++++++++++++
 .../dt-bindings/clock/qcom,lpassaudiocc-sc7280.h   |  43 ++
 .../dt-bindings/clock/qcom,lpasscorecc-sc7280.h    |  26 +
 10 files changed, 1581 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
 create mode 100644 drivers/clk/qcom/lpassaudiocc-sc7280.c
 create mode 100644 drivers/clk/qcom/lpasscorecc-sc7280.c
 create mode 100644 include/dt-bindings/clock/qcom,lpassaudiocc-sc7280.h
 create mode 100644 include/dt-bindings/clock/qcom,lpasscorecc-sc7280.h

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

author
#1 lore raw

PATCH 1/4 clk: qcom: clk-alpha-pll: Increase PLL lock detect poll time

PLL poll for lock detection can take more than 100us for certain type of PLLs, thus update to 200us.

---
 drivers/clk/qcom/clk-alpha-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-alpha-pll.c +1 -1
index eaedcce..7cf6cfa 100644
@@ -204,7 +204,7 @@ static int wait_for_pll(struct clk_alpha_pll *pll, u32 mask, bool inverse,
 	if (ret)
 		return ret;
 
-	for (count = 100; count > 0; count--) {
+	for (count = 200; count > 0; count--) {
 		ret = regmap_read(pll->clkr.regmap, PLL_MODE(pll), &val);
 		if (ret)
 			return ret;

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer
#2 lore raw

Re: [PATCH v1 1/4] clk: qcom: clk-alpha-pll: Increase PLL lock detect poll time

Quoting Taniya Das (2021-11-02 02:56:50)

Quoted 1 line

PLL poll for lock detection can take more than 100us for certain type

What types of PLLs? Is this fixing something that's broken? Or fixing a future problem?

Quoted 2 lines

of PLLs, thus update to 200us.

Does it needs a Fixes tag?

Quoted 17 lines
---
 drivers/clk/qcom/clk-alpha-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-alpha-pll.c +1 -1
index eaedcce..7cf6cfa 100644
@@ -204,7 +204,7 @@ static int wait_for_pll(struct clk_alpha_pll *pll, u32 mask, bool inverse,
        if (ret)
                return ret;
 
-       for (count = 100; count > 0; count--) {
+       for (count = 200; count > 0; count--) {
                ret = regmap_read(pll->clkr.regmap, PLL_MODE(pll), &val);
                if (ret)
author
#3 lore raw

PATCH 2/4 clk: qcom: gdsc: Add support for clock voting from GDSC

In reply to Taniya Das

In the cases where the clock is required to be enabled before the genpd enable add support for the same.

---
 drivers/clk/qcom/gdsc.c | 45 +++++++++++++++++++++++++++++++++++++++------
 drivers/clk/qcom/gdsc.h |  3 +++
 2 files changed, 42 insertions(+), 6 deletions(-)
drivers/clk/qcom/gdsc.c +39 -6
index 7e1dd8c..1caca32 100644
@@ -4,6 +4,7 @@
  */
 
 #include <linux/bitops.h>
+#include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/export.h>
@@ -256,6 +257,15 @@ static int _gdsc_enable(struct gdsc *sc)
 	if (sc->pwrsts == PWRSTS_ON)
 		return gdsc_deassert_reset(sc);
 
+	if (sc->clk) {
+		ret = clk_enable(sc->clk);
+		if (ret) {
+			pr_err("Failed to enable clock %s\n", sc->clk_name);
+			return ret;
+		}
+		sc->clk_enable = true;
+	}
+
 	if (sc->flags & SW_RESET) {
 		gdsc_assert_reset(sc);
 		udelay(1);
@@ -269,8 +279,11 @@ static int _gdsc_enable(struct gdsc *sc)
 	}
 
 	ret = gdsc_toggle_logic(sc, GDSC_ON);
-	if (ret)
+	if (ret) {
+		if (sc->clk)
+			clk_disable(sc->clk);
 		return ret;
+	}
 
 	if (sc->pwrsts & PWRSTS_OFF)
 		gdsc_force_mem_on(sc);
@@ -287,8 +300,12 @@ static int _gdsc_enable(struct gdsc *sc)
 	/* Turn on HW trigger mode if supported */
 	if (sc->flags & HW_CTRL) {
 		ret = gdsc_hwctrl(sc, true);
-		if (ret)
+		if (ret) {
+			if (sc->clk)
+				clk_disable(sc->clk);
 			return ret;
+		}
+
 		/*
 		 * Wait for the GDSC to go through a power down and
 		 * up cycle.  In case a firmware ends up polling status
@@ -329,7 +346,7 @@ static int _gdsc_disable(struct gdsc *sc)
 	if (sc->flags & HW_CTRL) {
 		ret = gdsc_hwctrl(sc, false);
 		if (ret < 0)
-			return ret;
+			goto disable_clk;
 		/*
 		 * Wait for the GDSC to go through a power down and
 		 * up cycle.  In case we end up polling status
@@ -340,7 +357,7 @@ static int _gdsc_disable(struct gdsc *sc)
 
 		ret = gdsc_poll_status(sc, GDSC_ON);
 		if (ret)
-			return ret;
+			goto disable_clk;
 	}
 
 	if (sc->pwrsts & PWRSTS_OFF)
@@ -348,12 +365,16 @@ static int _gdsc_disable(struct gdsc *sc)
 
 	ret = gdsc_toggle_logic(sc, GDSC_OFF);
 	if (ret)
-		return ret;
+		goto disable_clk;
 
 	if (sc->flags & CLAMP_IO)
 		gdsc_assert_clamp_io(sc);
 
-	return 0;
+disable_clk:
+	if (sc->clk && sc->clk_enable)
+		clk_disable(sc->clk);
+
+	return ret;
 }
 
 static int gdsc_disable(struct generic_pm_domain *domain)
@@ -478,6 +499,18 @@ int gdsc_register(struct gdsc_desc *desc,
 			return PTR_ERR(scs[i]->rsupply);
 	}
 
+	for (i = 0; i < num; i++) {
+		if (!scs[i])
+			continue;
+
+		scs[i]->clk = devm_clk_get(dev, scs[i]->clk_name);
+		if (IS_ERR(scs[i]->clk))
+			return PTR_ERR(scs[i]->clk);
+		ret = clk_prepare(scs[i]->clk);
+		if (ret)
+			return ret;
+	}
+
 	data->num_domains = num;
 	for (i = 0; i < num; i++) {
 		if (!scs[i])
drivers/clk/qcom/gdsc.h +3 -0
index 702d47a..cff5440 100644
@@ -59,6 +59,9 @@ struct gdsc {
 
 	const char 			*supply;
 	struct regulator		*rsupply;
+	const char			*clk_name;
+	struct clk			*clk;
+	bool				clk_enable;
 	struct device 			*dev;
 };
 

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer
#4 lore raw

Re: [PATCH v1 2/4] clk: qcom: gdsc: Add support for clock voting from GDSC

Quoting Taniya Das (2021-11-02 02:56:51)

Quoted 2 lines

In the cases where the clock is required to be enabled before the genpd enable add support for the same.

Please describe more. One sentence is not enough here.

Quoted 13 lines
---
 drivers/clk/qcom/gdsc.c | 45 +++++++++++++++++++++++++++++++++++++++------
 drivers/clk/qcom/gdsc.h |  3 +++
 2 files changed, 42 insertions(+), 6 deletions(-)
drivers/clk/qcom/gdsc.c +0 -0
index 7e1dd8c..1caca32 100644
@@ -478,6 +499,18 @@ int gdsc_register(struct gdsc_desc *desc,
                        return PTR_ERR(scs[i]->rsupply);

drivers/clk/qcom/gdsc.c int gdsc_register(struct gdsc_desc *desc, · line 509

Quoted 10 lines
drivers/clk/qcom/gdsc.c +8 -0
        }
 
+       for (i = 0; i < num; i++) {
+               if (!scs[i])
+                       continue;
+
+               scs[i]->clk = devm_clk_get(dev, scs[i]->clk_name);
+               if (IS_ERR(scs[i]->clk))
+                       return PTR_ERR(scs[i]->clk);
+               ret = clk_prepare(scs[i]->clk);

Why do we keep it prepared forever? And don't we have support for writing directly into cxc registers?

Quoted 7 lines
drivers/clk/qcom/gdsc.c +4 -0
+               if (ret)
+                       return ret;
+       }
+
        data->num_domains = num;
        for (i = 0; i < num; i++) {
                if (!scs[i])
author
#5 lore raw

PATCH 3/4 dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7280

In reply to Taniya Das

The LPASS(Low Power Audio Subsystem) clock provider have a bunch of generic properties that are needed in a device tree. Also add clock ids for LPASS core clocks and audio clock IDs for LPASS client to request for the clocks.

---
 .../bindings/clock/qcom,sc7280-lpasscorecc.yaml    | 137 +++++++++++++++++++++
 .../dt-bindings/clock/qcom,lpassaudiocc-sc7280.h   |  43 +++++++
 .../dt-bindings/clock/qcom,lpasscorecc-sc7280.h    |  26 ++++
 3 files changed, 206 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,lpassaudiocc-sc7280.h
 create mode 100644 include/dt-bindings/clock/qcom,lpasscorecc-sc7280.h
Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml new file +137 -0
new file mode 100644
index 0000000..9c437c6
@@ -0,0 +1,137 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,sc7280-lpasscorecc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm LPASS Core & Audio Clock Controller Binding for SC7280
+
+maintainers:
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm LPASS core and audio clock control module which supports the
+  clocks and power domains on SC7280.
+
+  See also:
+  - dt-bindings/clock/qcom,lpasscorecc-sc7280.h
+  - dt-bindings/clock/qcom,lpassaudiocc-sc7280.h
+
+properties:
+  compatible:
+    enum:
+      - qcom,sc7280-lpassaoncc
+      - qcom,sc7280-lpassaudiocc
+      - qcom,sc7280-lpasscorecc
+      - qcom,sc7280-lpasshm
+
+  clocks:
+    items:
+      - description: gcc_cfg_noc_lpass_clk
+      - description: Board XO source
+      - description: lpass_aon_cc_main_rcg source clock
+
+  clock-names:
+    items:
+      - const: iface
+      - const: bi_tcxo
+      - const: lpass_aon_cc_main_rcg
+
+  power-domains:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+  '#power-domain-cells':
+    const: 1
+
+  reg:
+    maxItems: 1
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: qcom,sc7280-lpasshm
+then:
+  properties:
+    clocks:
+      maxItems: 2
+
+else:
+  properties:
+    clocks:
+      minItems: 1
+
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    #include <dt-bindings/clock/qcom,gcc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpassaudiocc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpasscorecc-sc7280.h>
+    clock-controller@3c00000 {
+      compatible = "qcom,sc7280-lpasshm";
+      reg = <0x3c00000 0x28>;
+      clocks = <&gcc GCC_CFG_NOC_LPASS_CLK>;
+      clock-names = "iface";
+      #clock-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    #include <dt-bindings/clock/qcom,gcc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpassaudiocc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpasscorecc-sc7280.h>
+    clock-controller@3900000 {
+      compatible = "qcom,sc7280-lpasscorecc";
+      reg = <0x3900000 0x50000>;
+      clocks = <&gcc GCC_CFG_NOC_LPASS_CLK>, <&rpmhcc RPMH_CXO_CLK>;
+      clock-names = "iface", "bi_tcxo";
+      power-domains = <&lpass_hm LPASS_CORE_CC_LPASS_CORE_HM_GDSC>;
+      #clock-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    #include <dt-bindings/clock/qcom,gcc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpassaudiocc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpasscorecc-sc7280.h>
+    clock-controller@3380000 {
+      compatible = "qcom,sc7280-lpassaoncc";
+      reg = <0x3380000 0x30000>;
+      clocks = <&lpasscc LPASS_CORE_CC_CORE_CLK>, <&rpmhcc RPMH_CXO_CLK>;
+      clock-names = "iface", "bi_tcxo";
+      #clock-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    #include <dt-bindings/clock/qcom,gcc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpassaudiocc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpasscorecc-sc7280.h>
+    clock-controller@3300000 {
+      compatible = "qcom,sc7280-lpassaudiocc";
+      reg = <0x3300000 0x30000>;
+      clocks = <&rpmhcc RPMH_CXO_CLK>,
+               <&lpass_aon LPASS_AON_CC_MAIN_RCG_CLK_SRC>;
+      clock-names = "bi_tcxo", "lpass_aon_cc_main_rcg";
+      power-domains = <&lpass_aon LPASS_AON_CC_LPASS_AUDIO_HM_GDSC>;
+      #clock-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+...
include/dt-bindings/clock/qcom,lpassaudiocc-sc7280.h new file +43 -0

43 lines not on this page · raw message

include/dt-bindings/clock/qcom,lpasscorecc-sc7280.h new file +26 -0
new file mode 100644
index 0000000..28ed2a0
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7280_H
+#define _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7280_H
+
+/* LPASS_CORE_CC clocks */
+#define LPASS_CORE_CC_DIG_PLL				0
+#define LPASS_CORE_CC_DIG_PLL_OUT_MAIN_DIV_CLK_SRC	1
+#define LPASS_CORE_CC_DIG_PLL_OUT_ODD			2
+#define LPASS_CORE_CC_CORE_CLK				3
+#define LPASS_CORE_CC_CORE_CLK_SRC			4
+#define LPASS_CORE_CC_EXT_IF0_CLK_SRC			5
+#define LPASS_CORE_CC_EXT_IF0_IBIT_CLK			6
+#define LPASS_CORE_CC_EXT_IF1_CLK_SRC			7
+#define LPASS_CORE_CC_EXT_IF1_IBIT_CLK			8
+#define LPASS_CORE_CC_LPM_CORE_CLK			9
+#define LPASS_CORE_CC_LPM_MEM0_CORE_CLK			10
+#define LPASS_CORE_CC_SYSNOC_MPORT_CORE_CLK		11
+
+/* LPASS_CORE_CC power domains */
+#define LPASS_CORE_CC_LPASS_CORE_HM_GDSC		0
+
+#endif

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer
#6 lore raw

Re: [PATCH v1 3/4] dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7280

Quoted 6 lines · Taniya Das

The LPASS(Low Power Audio Subsystem) clock provider have a bunch of generic properties that are needed in a device tree. Also add clock ids for LPASS core clocks and audio clock IDs for LPASS client to request for the clocks.

Quoted 9 lines
---
 .../bindings/clock/qcom,sc7280-lpasscorecc.yaml    | 137 +++++++++++++++++++++
 .../dt-bindings/clock/qcom,lpassaudiocc-sc7280.h   |  43 +++++++
 .../dt-bindings/clock/qcom,lpasscorecc-sc7280.h    |  26 ++++
 3 files changed, 206 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,lpassaudiocc-sc7280.h
 create mode 100644 include/dt-bindings/clock/qcom,lpasscorecc-sc7280.h

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3c00000: clocks: [[4294967295, 169]] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3c00000: clock-names: ['iface'] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3c00000: clocks: [[4294967295, 169]] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3900000: clocks: [[4294967295, 169], [4294967295, 0]] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3900000: clock-names: ['iface', 'bi_tcxo'] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3900000: clocks: [[4294967295, 169], [4294967295, 0]] is too long
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3380000: clocks: [[4294967295, 3], [4294967295, 0]] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3380000: clock-names: ['iface', 'bi_tcxo'] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3380000: clocks: [[4294967295, 3], [4294967295, 0]] is too long
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3300000: clocks: [[4294967295, 0], [4294967295, 6]] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3300000: clock-names:0: 'iface' was expected
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3300000: clock-names:1: 'bi_tcxo' was expected
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3300000: clock-names: ['bi_tcxo', 'lpass_aon_cc_main_rcg'] is too short
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.example.dt.yaml: clock-controller@3300000: clocks: [[4294967295, 0], [4294967295, 6]] is too long
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/qcom,sc7280-lpasscorecc.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1549550

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

author
#7 lore raw

PATCH 4/4 clk: qcom: lpass: Add support for LPASS clock controller for SC7280

In reply to Taniya Das

The Low Power Audio subsystem core and audio clocks are required for Audio client to be able to request for the clocks and power domains.

---
 drivers/clk/qcom/Kconfig               |   9 +
 drivers/clk/qcom/Makefile              |   1 +
 drivers/clk/qcom/lpassaudiocc-sc7280.c | 831 +++++++++++++++++++++++++++++++++
 drivers/clk/qcom/lpasscorecc-sc7280.c  | 491 +++++++++++++++++++
 4 files changed, 1332 insertions(+)
 create mode 100644 drivers/clk/qcom/lpassaudiocc-sc7280.c
 create mode 100644 drivers/clk/qcom/lpasscorecc-sc7280.c
drivers/clk/qcom/Kconfig +9 -0
index 74efc82..4dcabc6 100644
@@ -435,6 +435,15 @@ config SC_LPASS_CORECC_7180
 	  Say Y if you want to use LPASS clocks and power domains of the LPASS
 	  core clock controller.
 
+config SC_LPASS_CORECC_7280
+	tristate "SC7280 LPASS Core & Audio Clock Controller"
+	select SC_GCC_7280
+	help
+	  Support for the LPASS(Low Power Audio Subsystem) core and audio clock
+	  controller on SC7280 devices.
+	  Say Y if you want to use LPASS clocks and power domains of the LPASS
+	  core clock controller.
+
 config SC_MSS_7180
 	tristate "SC7180 Modem Clock Controller"
 	select SC_GCC_7180
drivers/clk/qcom/Makefile +1 -0
index 1718c34..9e4b8e1 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_SC_GPUCC_7180) += gpucc-sc7180.o
 obj-$(CONFIG_SC_GPUCC_7280) += gpucc-sc7280.o
 obj-$(CONFIG_SC_LPASSCC_7280) += lpasscc-sc7280.o
 obj-$(CONFIG_SC_LPASS_CORECC_7180) += lpasscorecc-sc7180.o
+obj-$(CONFIG_SC_LPASS_CORECC_7280) += lpasscorecc-sc7280.o lpassaudiocc-sc7280.o
 obj-$(CONFIG_SC_MSS_7180) += mss-sc7180.o
 obj-$(CONFIG_SC_VIDEOCC_7180) += videocc-sc7180.o
 obj-$(CONFIG_SC_VIDEOCC_7280) += videocc-sc7280.o
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +831 -0

831 lines not on this page · raw message

drivers/clk/qcom/lpasscorecc-sc7280.c new file +491 -0

491 lines not on this page · raw message

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer
#8 lore raw

Re: [PATCH v1 4/4] clk: qcom: lpass: Add support for LPASS clock controller for SC7280

Quoting Taniya Das (2021-11-02 02:56:53)

Quoted 18 lines

The Low Power Audio subsystem core and audio clocks are required for Audio client to be able to request for the clocks and power domains.

---
 drivers/clk/qcom/Kconfig               |   9 +
 drivers/clk/qcom/Makefile              |   1 +
 drivers/clk/qcom/lpassaudiocc-sc7280.c | 831 +++++++++++++++++++++++++++++++++
 drivers/clk/qcom/lpasscorecc-sc7280.c  | 491 +++++++++++++++++++
 4 files changed, 1332 insertions(+)
 create mode 100644 drivers/clk/qcom/lpassaudiocc-sc7280.c
 create mode 100644 drivers/clk/qcom/lpasscorecc-sc7280.c
drivers/clk/qcom/Kconfig +0 -0
index 74efc82..4dcabc6 100644

drivers/clk/qcom/Kconfig config SC_LPASS_CORECC_7180 · line 440

Quoted 6 lines
drivers/clk/qcom/Kconfig +3 -0
@@ -435,6 +435,15 @@ config SC_LPASS_CORECC_7180
          Say Y if you want to use LPASS clocks and power domains of the LPASS
          core clock controller.
 
+config SC_LPASS_CORECC_7280
+       tristate "SC7280 LPASS Core & Audio Clock Controller"
+       select SC_GCC_7280

select GDSC too

Quoted 55 lines
drivers/clk/qcom/Kconfig +6 -0
+       help
+         Support for the LPASS(Low Power Audio Subsystem) core and audio clock
+         controller on SC7280 devices.
+         Say Y if you want to use LPASS clocks and power domains of the LPASS
+         core clock controller.
+
 config SC_MSS_7180
        tristate "SC7180 Modem Clock Controller"
        select SC_GCC_7180
drivers/clk/qcom/Makefile +1 -0
index 1718c34..9e4b8e1 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_SC_GPUCC_7180) += gpucc-sc7180.o
 obj-$(CONFIG_SC_GPUCC_7280) += gpucc-sc7280.o
 obj-$(CONFIG_SC_LPASSCC_7280) += lpasscc-sc7280.o
 obj-$(CONFIG_SC_LPASS_CORECC_7180) += lpasscorecc-sc7180.o
+obj-$(CONFIG_SC_LPASS_CORECC_7280) += lpasscorecc-sc7280.o lpassaudiocc-sc7280.o
 obj-$(CONFIG_SC_MSS_7180) += mss-sc7180.o
 obj-$(CONFIG_SC_VIDEOCC_7180) += videocc-sc7180.o
 obj-$(CONFIG_SC_VIDEOCC_7280) += videocc-sc7280.o
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +28 -0
new file mode 100644
index 0000000..52e7f8e
@@ -0,0 +1,831 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,lpassaudiocc-sc7280.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "gdsc.h"
+
+enum {
+       P_BI_TCXO,

drivers/clk/qcom/lpassaudiocc-sc7280.c line 38

Quoted 10 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +10 -0
+       P_LPASS_AON_CC_PLL_OUT_EVEN,
+       P_LPASS_AON_CC_PLL_OUT_MAIN,
+       P_LPASS_AON_CC_PLL_OUT_MAIN_CDIV_DIV_CLK_SRC,
+       P_LPASS_AON_CC_PLL_OUT_ODD,
+       P_LPASS_AUDIO_CC_PLL_OUT_AUX,
+       P_LPASS_AUDIO_CC_PLL_OUT_AUX2_DIV_CLK_SRC,
+       P_LPASS_AUDIO_CC_PLL_MAIN_DIV_CLK,
+};
+
+static struct pll_vco zonda_vco[] = {

const

Quoted 10 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +10 -0
+       { 595200000, 3600000000, 0 },
+};
+
+/* 1128.96MHz configuration */
+static const struct alpha_pll_config lpass_audio_cc_pll_config = {
+       .l = 0x3a,
+       .alpha = 0xcccc,
+       .config_ctl_val = 0x08200920,
+       .config_ctl_hi_val = 0x05002001,
+       .config_ctl_hi1_val = 0x00000000,

drivers/clk/qcom/lpassaudiocc-sc7280.c line 58

Quoted 10 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +10 -0
+       .user_ctl_val = 0x03000101,
+};
+
+static struct clk_alpha_pll lpass_audio_cc_pll = {
+       .offset = 0x0,
+       .vco_table = zonda_vco,
+       .num_vco = ARRAY_SIZE(zonda_vco),
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_ZONDA],
+       .clkr = {
+               .hw.init = &(struct clk_init_data){

const struct clk_init_data

BTW, we should do that for all the qcom clk drivers.

drivers/clk/qcom/lpassaudiocc-sc7280.c line 61

Quoted 3 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +3 -0
+                       .name = "lpass_audio_cc_pll",
+                       .parent_data = &(const struct clk_parent_data){
+                               .fw_name = "bi_tcxo",

To make the kernel smaller we should consider using integers in the .index field instead of .fw_name so that we don't have to store around strings.

Quoted 20 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +20 -0
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_zonda_ops,
+               },
+       },
+};
+
+static const struct clk_div_table post_div_table_lpass_audio_cc_pll_out_aux2[] = {
+       { 0x1, 2 },
+       { }
+};
+
+static struct clk_alpha_pll_postdiv lpass_audio_cc_pll_out_aux2 = {
+       .offset = 0x0,
+       .post_div_shift = 8,
+       .post_div_table = post_div_table_lpass_audio_cc_pll_out_aux2,
+       .num_post_div = ARRAY_SIZE(post_div_table_lpass_audio_cc_pll_out_aux2),
+       .width = 2,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_ZONDA],
+       .clkr.hw.init = &(struct clk_init_data){

drivers/clk/qcom/lpassaudiocc-sc7280.c line 91

Quoted 10 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +10 -0
+               .name = "lpass_audio_cc_pll_out_aux2",
+               .parent_hws = (const struct clk_hw*[]){
+                       &lpass_audio_cc_pll.clkr.hw,
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_zonda_ops,
+       },
+};
+
+static struct pll_vco lucid_vco[] = {

const

Quoted 29 lines
drivers/clk/qcom/lpassaudiocc-sc7280.c new file +3 -0
+       { 249600000, 2000000000, 0 },
+};
+
drivers/clk/qcom/lpasscorecc-sc7280.c new file +20 -0
new file mode 100644
index 0000000..812d9bd
@@ -0,0 +1,491 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,lpasscorecc-sc7280.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"

[...]

drivers/clk/qcom/lpasscorecc-sc7280.c line 306

Quoted 13 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +13 -0
+               .hw.init = &(struct clk_init_data){
+                       .name = "lpass_core_cc_sysnoc_mport_core_clk",
+                       .parent_hws = (const struct clk_hw*[]){
+                               &lpass_core_cc_core_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct gdsc  lpass_core_cc_lpass_core_hm_gdsc = {

Only one space after gdsc please

Quoted 50 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +50 -0
+       .gdscr = 0x0,
+       .pd = {
+               .name = "lpass_core_cc_lpass_core_hm_gdsc",
+       },
+       .pwrsts = PWRSTS_OFF_ON,
+       .flags = RETAIN_FF_ENABLE,
+       .clk_name = "iface",
+};
+
+static struct clk_regmap *lpass_core_cc_sc7280_clocks[] = {
+       [LPASS_CORE_CC_CORE_CLK] = &lpass_core_cc_core_clk.clkr,
+       [LPASS_CORE_CC_CORE_CLK_SRC] = &lpass_core_cc_core_clk_src.clkr,
+       [LPASS_CORE_CC_DIG_PLL] = &lpass_core_cc_dig_pll.clkr,
+       [LPASS_CORE_CC_DIG_PLL_OUT_MAIN_DIV_CLK_SRC] =
+               &lpass_core_cc_dig_pll_out_main_div_clk_src.clkr,
+       [LPASS_CORE_CC_DIG_PLL_OUT_ODD] = &lpass_core_cc_dig_pll_out_odd.clkr,
+       [LPASS_CORE_CC_EXT_IF0_CLK_SRC] = &lpass_core_cc_ext_if0_clk_src.clkr,
+       [LPASS_CORE_CC_EXT_IF0_IBIT_CLK] = &lpass_core_cc_ext_if0_ibit_clk.clkr,
+       [LPASS_CORE_CC_EXT_IF1_CLK_SRC] = &lpass_core_cc_ext_if1_clk_src.clkr,
+       [LPASS_CORE_CC_EXT_IF1_IBIT_CLK] = &lpass_core_cc_ext_if1_ibit_clk.clkr,
+       [LPASS_CORE_CC_LPM_CORE_CLK] = &lpass_core_cc_lpm_core_clk.clkr,
+       [LPASS_CORE_CC_LPM_MEM0_CORE_CLK] = &lpass_core_cc_lpm_mem0_core_clk.clkr,
+       [LPASS_CORE_CC_SYSNOC_MPORT_CORE_CLK] = &lpass_core_cc_sysnoc_mport_core_clk.clkr,
+};
+
+static struct regmap_config lpass_core_cc_sc7280_regmap_config = {
+       .reg_bits = 32,
+       .reg_stride = 4,
+       .val_bits = 32,
+       .fast_io = true,
+};
+
+static const struct qcom_cc_desc lpass_core_cc_sc7280_desc = {
+       .config = &lpass_core_cc_sc7280_regmap_config,
+       .clks = lpass_core_cc_sc7280_clocks,
+       .num_clks = ARRAY_SIZE(lpass_core_cc_sc7280_clocks),
+};
+
+static const struct of_device_id lpass_core_cc_sc7280_match_table[] = {
+       { .compatible = "qcom,sc7280-lpasscorecc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, lpass_core_cc_sc7280_match_table);
+
+static struct gdsc *lpass_core_hm_sc7280_gdscs[] = {
+       [LPASS_CORE_CC_LPASS_CORE_HM_GDSC] = &lpass_core_cc_lpass_core_hm_gdsc,
+};
+
+static const struct qcom_cc_desc lpass_core_hm_sc7280_desc = {
+       .config = &lpass_core_cc_sc7280_regmap_config,

drivers/clk/qcom/lpasscorecc-sc7280.c line 366

Quoted 10 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +10 -0
+       .gdscs = lpass_core_hm_sc7280_gdscs,
+       .num_gdscs = ARRAY_SIZE(lpass_core_hm_sc7280_gdscs),
+};
+
+static void lpass_pm_runtime_disable(void *data)
+{
+       pm_runtime_disable(data);
+}
+
+static void lpass_pm_clk_destroy(void *data)

Please make the symbols unique. This is the same function name twice.

Quoted 76 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +76 -0
+{
+       pm_clk_destroy(data);
+}
+
+static int lpass_create_pm_clks(struct platform_device *pdev)
+{
+       int ret;
+
+       pm_runtime_use_autosuspend(&pdev->dev);
+       pm_runtime_set_autosuspend_delay(&pdev->dev, 100);
+       pm_runtime_enable(&pdev->dev);
+
+       ret = devm_add_action_or_reset(&pdev->dev, lpass_pm_runtime_disable, &pdev->dev);
+       if (ret)
+               return ret;
+
+       ret = pm_clk_create(&pdev->dev);
+       if (ret)
+               return ret;
+       ret = devm_add_action_or_reset(&pdev->dev, lpass_pm_clk_destroy, &pdev->dev);
+       if (ret)
+               return ret;
+
+       ret = pm_clk_add(&pdev->dev, "iface");
+       if (ret < 0)
+               dev_err(&pdev->dev, "failed to acquire iface clock\n");
+
+       return ret;
+}
+
+static int lpass_core_cc_sc7280_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       int ret;
+
+       ret = lpass_create_pm_clks(pdev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &lpass_core_cc_sc7280_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_lucid_pll_configure(&lpass_core_cc_dig_pll, regmap, &lpass_core_cc_dig_pll_config);
+
+       ret = qcom_cc_really_probe(pdev, &lpass_core_cc_sc7280_desc, regmap);
+       if (ret) {
+               dev_err(&pdev->dev, "Failed to register LPASS CORE CC clocks\n");
+               return ret;
+       }
+
+       pm_runtime_mark_last_busy(&pdev->dev);
+       pm_runtime_put_autosuspend(&pdev->dev);
+
+       return ret;
+}
+
+static const struct dev_pm_ops lpass_core_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver lpass_core_cc_sc7280_driver = {
+       .probe = lpass_core_cc_sc7280_probe,
+       .driver = {
+               .name = "lpass_core_cc-sc7280",
+               .of_match_table = lpass_core_cc_sc7280_match_table,
+               .pm = &lpass_core_cc_pm_ops,
+       },
+};
+
+static int lpass_hm_core_probe(struct platform_device *pdev)
+{
+       const struct qcom_cc_desc *desc;
+       int ret;
+
+       lpass_core_cc_sc7280_regmap_config.name = "lpass_hm_core";

drivers/clk/qcom/lpasscorecc-sc7280.c line 452

Quoted 10 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +10 -0
+       desc = &lpass_core_hm_sc7280_desc;
+
+       ret = qcom_cc_probe_by_index(pdev, 0, desc);
+       if (ret)
+               goto destroy_clk;
+
+       return 0;
+
+destroy_clk:
+       return ret;
	return qcom_cc_probe_by_index(...);

is equivalent.

drivers/clk/qcom/lpasscorecc-sc7280.c line 458

Quoted 6 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +6 -0
+}
+
+static const struct of_device_id lpass_hm_sc7280_match_table[] = {
+       {
+               .compatible = "qcom,sc7280-lpasshm",
+       },

Please reduce to one line instead of three.

Quoted 4 lines
drivers/clk/qcom/lpasscorecc-sc7280.c new file +4 -0
+       { }
+};
+MODULE_DEVICE_TABLE(of, lpass_hm_sc7280_match_table);
+