Skip to contentSkip to conversation

clk: qcom: Add SM8350 camera clock controller

PATCH In review Vladimir Zapolskiy 4 participants 10 messages Nov 7 – Nov 10

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover clk: qcom: Add SM8350 camera clock controller

Add the camera clock controller (CAMCC) for Qualcomm SM8350 SoC, the clock configuration was taken from camcc-lahaina.c from msm-5.10.

CAM_CC_PLL0 runs at 1200MHz, which requires the SVS_L1 level of the MX rail, so it is set as the MX performance state in the device tree node.

Changes from v1 to v2:
* removed linux/mod_devicetable.h explicit include per ask (Uwe),
* PLL2 AUX2 input cannot be used in a meaningful way, removed it (Sashiko bot),
* Lucid 5LPE PLLs should not fallback to Trion configuration (Sashiko bot).

Link to v1:
* https://lore.kernel.org/all/[email protected]/

Vladimir Zapolskiy (4):
dt-bindings: clock: qcom: Add SM8350 camera clock controller
clk: qcom: clk-alpha-pll: Add Lucid 5LPE PLL type
clk: qcom: Add SM8350 camera clock controller driver
arm64: dts: qcom: sm8350: Add camera clock controller

 .../bindings/clock/qcom,sm8350-camcc.yaml     |   69 +
 arch/arm64/boot/dts/qcom/sm8350.dtsi          |   15 +
 drivers/clk/qcom/Kconfig                      |    9 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/camcc-sm8350.c               | 2646 +++++++++++++++++
 drivers/clk/qcom/clk-alpha-pll.c              |   19 +
 drivers/clk/qcom/clk-alpha-pll.h              |    1 +
 include/dt-bindings/clock/qcom,sm8350-camcc.h |  149 +
 8 files changed, 2909 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sm8350-camcc.yaml
 create mode 100644 drivers/clk/qcom/camcc-sm8350.c
 create mode 100644 include/dt-bindings/clock/qcom,sm8350-camcc.h
Signature · 1 line
2.51.0
#1 lore raw

PATCH v2 1/4 dt-bindings: clock: qcom: Add SM8350 camera clock controller

Add device tree bindings for the camera clock controller on Qualcomm SM8350 SoC.

---
 .../bindings/clock/qcom,sm8350-camcc.yaml     |  69 ++++++++
 include/dt-bindings/clock/qcom,sm8350-camcc.h | 149 ++++++++++++++++++
 2 files changed, 218 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sm8350-camcc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,sm8350-camcc.h
Documentation/devicetree/bindings/clock/qcom,sm8350-camcc.yaml new file +69 -0
new file mode 100644
index 000000000000..f34562da4640
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,sm8350-camcc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Camera Clock & Reset Controller on SM8350
+
+maintainers:
+  - Vladimir Zapolskiy <[email protected]>
+
+description: |
+  Qualcomm camera clock control module provides the clocks,
+  resets and power domains on SM8350.
+
+  See also:
+    include/dt-bindings/clock/qcom,sm8350-camcc.h
+
+properties:
+  compatible:
+    const: qcom,sm8350-camcc
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: Board active XO source
+      - description: Sleep clock source
+
+  power-domains:
+    items:
+      - description: MMCX power domain
+      - description: MX power domain
+
+  required-opps:
+    items:
+      - description: MMCX performance point
+      - description: MX performance point
+
+required:
+  - compatible
+  - clocks
+  - power-domains
+  - required-opps
+
+allOf:
+  - $ref: qcom,gcc.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    #include <dt-bindings/power/qcom,rpmhpd.h>
+
+    clock-controller@ad00000 {
+      compatible = "qcom,sm8350-camcc";
+      reg = <0x0ad00000 0x10000>;
+      clocks = <&rpmhcc RPMH_CXO_CLK>,
+               <&rpmhcc RPMH_CXO_CLK_A>,
+               <&sleep_clk>;
+      power-domains = <&rpmhpd RPMHPD_MMCX>,
+                      <&rpmhpd RPMHPD_MX>;
+      required-opps = <&rpmhpd_opp_low_svs>,
+                      <&rpmhpd_opp_svs_l1>;
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+...
include/dt-bindings/clock/qcom,sm8350-camcc.h new file +149 -0

149 lines not on this page · raw message

Signature · 1 line
2.51.0
#3 lore raw

PATCH v2 2/4 clk: qcom: clk-alpha-pll: Add Lucid 5LPE PLL type

In reply to Vladimir Zapolskiy

Lucid 5LPE PLLs have the same register layout as Trion and Lucid PLLs, but the bitfields are not identical, for instance PLL_UPDATE_BYPASS bit is not present, and the PLL configuration should be done by calling its own separate clk_lucid_5lpe_pll_configure() function.

Add a separate Lucid 5LPE PLL type to select the proper PLL configuration function in qcom_clk_alpha_pll_configure().

---
 drivers/clk/qcom/clk-alpha-pll.c | 19 +++++++++++++++++++
 drivers/clk/qcom/clk-alpha-pll.h |  1 +
 2 files changed, 20 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +19 -0
index 60173b076cc5..3062b86f07f6 100644
@@ -147,6 +147,22 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
 		[PLL_OFF_OPMODE] = 0x38,
 		[PLL_OFF_ALPHA_VAL] = 0x40,
 	},
+	[CLK_ALPHA_PLL_TYPE_LUCID_5LPE] = {
+		[PLL_OFF_L_VAL] = 0x04,
+		[PLL_OFF_CAL_L_VAL] = 0x08,
+		[PLL_OFF_USER_CTL] = 0x0c,
+		[PLL_OFF_USER_CTL_U] = 0x10,
+		[PLL_OFF_USER_CTL_U1] = 0x14,
+		[PLL_OFF_CONFIG_CTL] = 0x18,
+		[PLL_OFF_CONFIG_CTL_U] = 0x1c,
+		[PLL_OFF_CONFIG_CTL_U1] = 0x20,
+		[PLL_OFF_TEST_CTL] = 0x24,
+		[PLL_OFF_TEST_CTL_U] = 0x28,
+		[PLL_OFF_TEST_CTL_U1] = 0x2c,
+		[PLL_OFF_STATUS] = 0x30,
+		[PLL_OFF_OPMODE] = 0x38,
+		[PLL_OFF_ALPHA_VAL] = 0x40,
+	},
 	[CLK_ALPHA_PLL_TYPE_AGERA] = {
 		[PLL_OFF_L_VAL] = 0x04,
 		[PLL_OFF_ALPHA_VAL] = 0x08,
@@ -3025,6 +3041,9 @@ void qcom_clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regm
 	case CLK_ALPHA_PLL_TYPE_TRION:
 		clk_trion_pll_configure(pll, regmap, pll->config);
 		break;
+	case CLK_ALPHA_PLL_TYPE_LUCID_5LPE:
+		clk_lucid_5lpe_pll_configure(pll, regmap, pll->config);
+		break;
 	case CLK_ALPHA_PLL_TYPE_HUAYRA_2290:
 		clk_huayra_2290_pll_configure(pll, regmap, pll->config);
 		break;
drivers/clk/qcom/clk-alpha-pll.h +1 -0
index 3a2157bebc52..3c26ea917f52 100644
@@ -21,6 +21,7 @@ enum {
 	CLK_ALPHA_PLL_TYPE_FABIA,
 	CLK_ALPHA_PLL_TYPE_TRION,
 	CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
+	CLK_ALPHA_PLL_TYPE_LUCID_5LPE,
 	CLK_ALPHA_PLL_TYPE_AGERA,
 	CLK_ALPHA_PLL_TYPE_ZONDA,
 	CLK_ALPHA_PLL_TYPE_REGERA = CLK_ALPHA_PLL_TYPE_ZONDA,
Signature · 1 line
2.51.0
#6 lore raw

PATCH v2 3/4 clk: qcom: Add SM8350 camera clock controller driver

In reply to Vladimir Zapolskiy

Add a driver for the camera clock controller on Qualcomm SM8350 SoC.

The clock controller has six Lucid 5LPE PLLs and one Zonda 5LPE PLL, clock and GDSC data is taken from the downstream Qualcomm msm-5.4 kernel.

---
 drivers/clk/qcom/Kconfig        |    9 +
 drivers/clk/qcom/Makefile       |    1 +
 drivers/clk/qcom/camcc-sm8350.c | 2646 +++++++++++++++++++++++++++++++
 3 files changed, 2656 insertions(+)
 create mode 100644 drivers/clk/qcom/camcc-sm8350.c
drivers/clk/qcom/Kconfig +9 -0
index 27d0ab24d50a..2b1d56691010 100644
@@ -1527,6 +1527,15 @@ config SM_CAMCC_8250
 	  Support for the camera clock controller on SM8250 devices.
 	  Say Y if you want to support camera devices and camera functionality.
 
+config SM_CAMCC_8350
+	tristate "SM8350 Camera Clock Controller"
+	depends on ARM64 || COMPILE_TEST
+	select SM_GCC_8350
+	default m if ARCH_QCOM
+	help
+	  Support for the camera clock controller on SM8350 devices.
+	  Say Y if you want to support camera devices and camera functionality.
+
 config SM_CAMCC_8450
 	tristate "SM8450 Camera Clock Controller"
 	depends on ARM64 || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 6affb5073f26..546e60947cde 100644
@@ -170,6 +170,7 @@ obj-$(CONFIG_SM_CAMCC_6350) += camcc-sm6350.o
 obj-$(CONFIG_SM_CAMCC_7150) += camcc-sm7150.o
 obj-$(CONFIG_SM_CAMCC_8150) += camcc-sm8150.o
 obj-$(CONFIG_SM_CAMCC_8250) += camcc-sm8250.o
+obj-$(CONFIG_SM_CAMCC_8350) += camcc-sm8350.o
 obj-$(CONFIG_SM_CAMCC_8450) += camcc-sm8450.o
 obj-$(CONFIG_SM_CAMCC_8550) += camcc-sm8550.o
 obj-$(CONFIG_SM_CAMCC_8650) += camcc-sm8650.o
drivers/clk/qcom/camcc-sm8350.c new file +2646 -0

2,646 lines not on this page · raw message

Signature · 1 line
2.51.0
#8 lore raw

PATCH v2 4/4 arm64: dts: qcom: sm8350: Add camera clock controller

In reply to Vladimir Zapolskiy

Add the camera clock controller device tree node to SM8350 SoC dtsi.

The camera clock controller PLLs are powered by MX rail, CAM_CC_PLL0 runs at 1200MHz, which requires SVS_L1 level of MX, while all other camera clock controller PLLs can run at SVS level of MX or lower.

---
 arch/arm64/boot/dts/qcom/sm8350.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/qcom/sm8350.dtsi +15 -0
index 55b32050ce9c..a51942c99f8a 100644
@@ -2830,6 +2830,21 @@ videocc: clock-controller@abf0000 {
 			#power-domain-cells = <1>;
 		};
 
+		camcc: clock-controller@ad00000 {
+			compatible = "qcom,sm8350-camcc";
+			reg = <0 0x0ad00000 0 0x10000>;
+			clocks = <&rpmhcc RPMH_CXO_CLK>,
+				 <&rpmhcc RPMH_CXO_CLK_A>,
+				 <&sleep_clk>;
+			power-domains = <&rpmhpd RPMHPD_MMCX>,
+					<&rpmhpd RPMHPD_MX>;
+			required-opps = <&rpmhpd_opp_low_svs>,
+					<&rpmhpd_opp_svs_l1>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+		};
+
 		mdss: display-subsystem@ae00000 {
 			compatible = "qcom,sm8350-mdss";
 			reg = <0 0x0ae00000 0 0x1000>;
Signature · 1 line
2.51.0
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: clock: qcom: Add SM8350 camera clock controller

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

Add device tree bindings for the camera clock controller on Qualcomm SM8350 SoC.

---
 .../bindings/clock/qcom,sm8350-camcc.yaml     |  69 ++++++++
 include/dt-bindings/clock/qcom,sm8350-camcc.h | 149 ++++++++++++++++++
 2 files changed, 218 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sm8350-camcc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,sm8350-camcc.h

Best regards,
Krzysztof

Reviewed-by on v2 4/4
#9 lore raw

Re: [PATCH v2 4/4] arm64: dts: qcom: sm8350: Add camera clock controller

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

Add the camera clock controller device tree node to SM8350 SoC dtsi.

The camera clock controller PLLs are powered by MX rail, CAM_CC_PLL0 runs at 1200MHz, which requires SVS_L1 level of MX, while all other camera clock controller PLLs can run at SVS level of MX or lower.

---
 arch/arm64/boot/dts/qcom/sm8350.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Best regards,
Krzysztof

Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] clk: qcom: clk-alpha-pll: Add Lucid 5LPE PLL type

In reply to Vladimir Zapolskiy
Quoted 4 lines · Vladimir Zapolskiy

Lucid 5LPE PLLs have the same register layout as Trion and Lucid PLLs, but the bitfields are not identical, for instance PLL_UPDATE_BYPASS bit is not present, and the PLL configuration should be done by calling its own separate clk_lucid_5lpe_pll_configure() function.

Oh.. very interesting.. seems like these are used on SM8350 and SC8280XP across the board, including in GCC.. funny how that never surfaced for N years

Konrad

Reviewed-by on v2 2/4
#5 lore raw

Re: [PATCH v2 2/4] clk: qcom: clk-alpha-pll: Add Lucid 5LPE PLL type

In reply to Vladimir Zapolskiy
Quoted 9 lines · Vladimir Zapolskiy

Lucid 5LPE PLLs have the same register layout as Trion and Lucid PLLs, but the bitfields are not identical, for instance PLL_UPDATE_BYPASS bit is not present, and the PLL configuration should be done by calling its own separate clk_lucid_5lpe_pll_configure() function.

Add a separate Lucid 5LPE PLL type to select the proper PLL configuration function in qcom_clk_alpha_pll_configure().

Reviewed-by on v2 3/4
#7 lore raw

Re: [PATCH v2 3/4] clk: qcom: Add SM8350 camera clock controller driver

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

Add a driver for the camera clock controller on Qualcomm SM8350 SoC.

The clock controller has six Lucid 5LPE PLLs and one Zonda 5LPE PLL, clock and GDSC data is taken from the downstream Qualcomm msm-5.4 kernel.