Skip to contentSkip to conversation

SM8150 and SM8250 videocc drivers

PATCH Superseded Jonathan Marek 3 participants 17 messages Sep 4, 2020 – Sep 24, 2020

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover SM8150 and SM8250 videocc drivers

Add videocc drivers for SM8150/SM8250 required to boot and use venus.

v2:
- fixed dt_binding_check/checkpatch warnings in SM8250 bindings
- added 19.2Mhz in SM8250 freq tbls for consistency with other videocc

Jonathan Marek (5):
dt-bindings: clock: combine qcom,sdm845-videocc and

    qcom,sc7180-videocc

dt-bindings: clock: add SM8150 QCOM video clock bindings
dt-bindings: clock: add SM8250 QCOM video clock bindings
clk: qcom: add video clock controller driver for SM8150
clk: qcom: add video clock controller driver for SM8250

 .../bindings/clock/qcom,sc7180-videocc.yaml   |  65 ---
 ...,sdm845-videocc.yaml => qcom,videocc.yaml} |  22 +-
 drivers/clk/qcom/Kconfig                      |  18 +
 drivers/clk/qcom/Makefile                     |   2 +
 drivers/clk/qcom/videocc-sm8150.c             | 276 ++++++++++
 drivers/clk/qcom/videocc-sm8250.c             | 518 ++++++++++++++++++
 .../dt-bindings/clock/qcom,videocc-sm8150.h   |  25 +
 .../dt-bindings/clock/qcom,videocc-sm8250.h   |  42 ++
 8 files changed, 898 insertions(+), 70 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7180-videocc.yaml
 rename Documentation/devicetree/bindings/clock/{qcom,sdm845-videocc.yaml => qcom,videocc.yaml} (62%)
 create mode 100644 drivers/clk/qcom/videocc-sm8150.c
 create mode 100644 drivers/clk/qcom/videocc-sm8250.c
 create mode 100644 include/dt-bindings/clock/qcom,videocc-sm8150.h
 create mode 100644 include/dt-bindings/clock/qcom,videocc-sm8250.h
Signature · 1 line
2.26.1
#1 lore raw

PATCH v2 1/5 dt-bindings: clock: combine qcom,sdm845-videocc and qcom,sc7180-videocc

These two bindings are almost identical, so combine them into one. This will make it easier to add the sm8150 and sm8250 videocc bindings.

---
 .../bindings/clock/qcom,sc7180-videocc.yaml   | 65 -------------------
 ...,sdm845-videocc.yaml => qcom,videocc.yaml} | 14 ++--
 2 files changed, 9 insertions(+), 70 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7180-videocc.yaml
 rename Documentation/devicetree/bindings/clock/{qcom,sdm845-videocc.yaml => qcom,videocc.yaml} (76%)
Documentation/devicetree/bindings/clock/qcom,sc7180-videocc.yaml deleted +0 -65
deleted file mode 100644
index 2feea2b91aa9..000000000000
@@ -1,65 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/clock/qcom,sc7180-videocc.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Qualcomm Video Clock & Reset Controller Binding for SC7180
-
-maintainers:
-  - Taniya Das <[email protected]>
-
-description: |
-  Qualcomm video clock control module which supports the clocks, resets and
-  power domains on SC7180.
-
-  See also dt-bindings/clock/qcom,videocc-sc7180.h.
-
-properties:
-  compatible:
-    const: qcom,sc7180-videocc
-
-  clocks:
-    items:
-      - description: Board XO source
-
-  clock-names:
-    items:
-      - const: bi_tcxo
-
-  '#clock-cells':
-    const: 1
-
-  '#reset-cells':
-    const: 1
-
-  '#power-domain-cells':
-    const: 1
-
-  reg:
-    maxItems: 1
-
-required:
-  - compatible
-  - reg
-  - clocks
-  - clock-names
-  - '#clock-cells'
-  - '#reset-cells'
-  - '#power-domain-cells'
-
-additionalProperties: false
-
-examples:
-  - |
-    #include <dt-bindings/clock/qcom,rpmh.h>
-    clock-controller@ab00000 {
-      compatible = "qcom,sc7180-videocc";
-      reg = <0x0ab00000 0x10000>;
-      clocks = <&rpmhcc RPMH_CXO_CLK>;
-      clock-names = "bi_tcxo";
-      #clock-cells = <1>;
-      #reset-cells = <1>;
-      #power-domain-cells = <1>;
-    };
-...
Documentation/devicetree/bindings/clock/qcom,videocc.yaml renamed from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml +9 -5
similarity index 76%
rename from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml
rename to Documentation/devicetree/bindings/clock/qcom,videocc.yaml
index f7a0cf53d5f0..17666425476f 100644
@@ -1,23 +1,27 @@
 # SPDX-License-Identifier: GPL-2.0-only
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/clock/qcom,sdm845-videocc.yaml#
+$id: http://devicetree.org/schemas/clock/qcom,videocc.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Qualcomm Video Clock & Reset Controller Binding for SDM845
+title: Qualcomm Video Clock & Reset Controller Binding
 
 maintainers:
   - Taniya Das <[email protected]>
 
 description: |
   Qualcomm video clock control module which supports the clocks, resets and
-  power domains on SDM845.
+  power domains on SDM845/SC7180.
 
-  See also dt-bindings/clock/qcom,videocc-sdm845.h.
+  See also:
+    dt-bindings/clock/qcom,videocc-sdm845.h
+    dt-bindings/clock/qcom,videocc-sc7180.h
 
 properties:
   compatible:
-    const: qcom,sdm845-videocc
+    enum:
+      - qcom,sdm845-videocc
+      - qcom,sc7180-videocc
 
   clocks:
     items:
Signature · 1 line
2.26.1
maintainer Reviewed-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] dt-bindings: clock: combine qcom,sdm845-videocc and qcom,sc7180-videocc

Quoted 11 lines · Jonathan Marek

These two bindings are almost identical, so combine them into one. This will make it easier to add the sm8150 and sm8250 videocc bindings.

---
 .../bindings/clock/qcom,sc7180-videocc.yaml   | 65 -------------------
 ...,sdm845-videocc.yaml => qcom,videocc.yaml} | 14 ++--
 2 files changed, 9 insertions(+), 70 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7180-videocc.yaml
 rename Documentation/devicetree/bindings/clock/{qcom,sdm845-videocc.yaml => qcom,videocc.yaml} (76%)
maintainer
#3 lore raw

Re: [PATCH v2 1/5] dt-bindings: clock: combine qcom,sdm845-videocc and qcom,sc7180-videocc

In reply to Jonathan Marek

Quoting Jonathan Marek (2020-09-03 20:09:50)

Quoted 20 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml renamed from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml +2 -2
similarity index 76%
rename from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml
rename to Documentation/devicetree/bindings/clock/qcom,videocc.yaml
index f7a0cf53d5f0..17666425476f 100644
@@ -1,23 +1,27 @@
 # SPDX-License-Identifier: GPL-2.0-only
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/clock/qcom,sdm845-videocc.yaml#
+$id: http://devicetree.org/schemas/clock/qcom,videocc.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Qualcomm Video Clock & Reset Controller Binding for SDM845
+title: Qualcomm Video Clock & Reset Controller Binding
 
 maintainers:
   - Taniya Das <[email protected]>

Documentation/devicetree/bindings/clock/qcom,videocc.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml renamed from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml +4 -2
 
 description: |
   Qualcomm video clock control module which supports the clocks, resets and
-  power domains on SDM845.
+  power domains on SDM845/SC7180.
 
-  See also dt-bindings/clock/qcom,videocc-sdm845.h.
+  See also:
+    dt-bindings/clock/qcom,videocc-sdm845.h
+    dt-bindings/clock/qcom,videocc-sc7180.h

Sort this alphabetically please.

Documentation/devicetree/bindings/clock/qcom,videocc.yaml line 24

Quoted 7 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml renamed from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml +3 -1
 properties:
   compatible:
-    const: qcom,sdm845-videocc
+    enum:
+      - qcom,sdm845-videocc
+      - qcom,sc7180-videocc

Sort this alphabetically please.

Quoted 6 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml renamed from Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml +0 -0
   clocks:
     items:
Signature · 1 line
2.26.1
#4 lore raw

PATCH v2 2/5 dt-bindings: clock: add SM8150 QCOM video clock bindings

In reply to Jonathan Marek

Add device tree bindings for video clock controller for SM8150 SoCs.

---
 .../bindings/clock/qcom,videocc.yaml          |  4 ++-
 .../dt-bindings/clock/qcom,videocc-sm8150.h   | 25 +++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clock/qcom,videocc-sm8150.h
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +3 -1
index 17666425476f..d04f5bd28dde 100644
@@ -11,17 +11,19 @@ maintainers:
 
 description: |
   Qualcomm video clock control module which supports the clocks, resets and
-  power domains on SDM845/SC7180.
+  power domains on SDM845/SC7180/SM8150.
 
   See also:
     dt-bindings/clock/qcom,videocc-sdm845.h
     dt-bindings/clock/qcom,videocc-sc7180.h
+    dt-bindings/clock/qcom,videocc-sm8150.h
 
 properties:
   compatible:
     enum:
       - qcom,sdm845-videocc
       - qcom,sc7180-videocc
+      - qcom,sm8150-videocc
 
   clocks:
     items:
include/dt-bindings/clock/qcom,videocc-sm8150.h new file +25 -0
new file mode 100644
index 000000000000..e24ee840cfdb
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SM8150_H
+#define _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SM8150_H
+
+/* VIDEO_CC clocks */
+#define VIDEO_CC_IRIS_AHB_CLK		0
+#define VIDEO_CC_IRIS_CLK_SRC		1
+#define VIDEO_CC_MVS0_CORE_CLK		2
+#define VIDEO_CC_MVS1_CORE_CLK		3
+#define VIDEO_CC_MVSC_CORE_CLK		4
+#define VIDEO_CC_PLL0			5
+
+/* VIDEO_CC Resets */
+#define VIDEO_CC_MVSC_CORE_CLK_BCR	0
+
+/* VIDEO_CC GDSCRs */
+#define VENUS_GDSC			0
+#define VCODEC0_GDSC			1
+#define VCODEC1_GDSC			2
+
+#endif
Signature · 1 line
2.26.1
maintainer Reviewed-by on v2 2/5
#5 lore raw

Re: [PATCH v2 2/5] dt-bindings: clock: add SM8150 QCOM video clock bindings

Quoted 9 lines · Jonathan Marek

Add device tree bindings for video clock controller for SM8150 SoCs.

---
 .../bindings/clock/qcom,videocc.yaml          |  4 ++-
 .../dt-bindings/clock/qcom,videocc-sm8150.h   | 25 +++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clock/qcom,videocc-sm8150.h
#7 lore raw

PATCH v2 3/5 dt-bindings: clock: add SM8250 QCOM video clock bindings

In reply to Jonathan Marek

Add device tree bindings for video clock controller for SM8250 SoCs.

---
 .../bindings/clock/qcom,videocc.yaml          |  8 +++-
 .../dt-bindings/clock/qcom,videocc-sm8250.h   | 42 +++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clock/qcom,videocc-sm8250.h
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +7 -1
index d04f5bd28dde..66a6066ae353 100644
@@ -11,12 +11,13 @@ maintainers:
 
 description: |
   Qualcomm video clock control module which supports the clocks, resets and
-  power domains on SDM845/SC7180/SM8150.
+  power domains on SDM845/SC7180/SM8150/SM8250.
 
   See also:
     dt-bindings/clock/qcom,videocc-sdm845.h
     dt-bindings/clock/qcom,videocc-sc7180.h
     dt-bindings/clock/qcom,videocc-sm8150.h
+    dt-bindings/clock/qcom,videocc-sm8250.h
 
 properties:
   compatible:
@@ -24,14 +25,19 @@ properties:
       - qcom,sdm845-videocc
       - qcom,sc7180-videocc
       - qcom,sm8150-videocc
+      - qcom,sm8250-videocc
 
   clocks:
+    minItems: 1
     items:
       - description: Board XO source
+      - description: Board XO source, always-on (required by sm8250 only)
 
   clock-names:
+    minItems: 1
     items:
       - const: bi_tcxo
+      - const: bi_tcxo_ao
 
   '#clock-cells':
     const: 1
include/dt-bindings/clock/qcom,videocc-sm8250.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.26.1
maintainer Reviewed-by on v2 3/5
#8 lore raw

Re: [PATCH v2 3/5] dt-bindings: clock: add SM8250 QCOM video clock bindings

Quoted 9 lines · Jonathan Marek

Add device tree bindings for video clock controller for SM8250 SoCs.

---
 .../bindings/clock/qcom,videocc.yaml          |  8 +++-
 .../dt-bindings/clock/qcom,videocc-sm8250.h   | 42 +++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clock/qcom,videocc-sm8250.h
maintainer
#9 lore raw

Re: [PATCH v2 3/5] dt-bindings: clock: add SM8250 QCOM video clock bindings

In reply to Jonathan Marek

Quoting Jonathan Marek (2020-09-03 20:09:52)

Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +0 -0
index d04f5bd28dde..66a6066ae353 100644

Documentation/devicetree/bindings/clock/qcom,videocc.yaml properties: · line 34

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +3 -0
@@ -24,14 +25,19 @@ properties:
       - qcom,sdm845-videocc
       - qcom,sc7180-videocc
       - qcom,sm8150-videocc
+      - qcom,sm8250-videocc
 
   clocks:
+    minItems: 1
     items:
       - description: Board XO source
+      - description: Board XO source, always-on (required by sm8250 only)

I'd expect every SoC to need it. Can you leave it out for now and we can add it when it becomes required?

#10 lore raw

PATCH v2 4/5 clk: qcom: add video clock controller driver for SM8150

In reply to Jonathan Marek

Add support for the video clock controller found on SM8150 based devices.

Derived from the downstream driver.

---
 drivers/clk/qcom/Kconfig          |   9 +
 drivers/clk/qcom/Makefile         |   1 +
 drivers/clk/qcom/videocc-sm8150.c | 276 ++++++++++++++++++++++++++++++
 3 files changed, 286 insertions(+)
 create mode 100644 drivers/clk/qcom/videocc-sm8150.c
drivers/clk/qcom/Kconfig +9 -0
index 058327310c25..40d7ee9886c9 100644
@@ -444,6 +444,15 @@ config SM_GPUCC_8250
 	  Say Y if you want to support graphics controller devices and
 	  functionality such as 3D graphics.
 
+config SM_VIDEOCC_8150
+	tristate "SM8150 Video Clock Controller"
+	select SDM_GCC_8150
+	select QCOM_GDSC
+	help
+	  Support for the video clock controller on SM8150 devices.
+	  Say Y if you want to support video devices and functionality such as
+	  video encode and decode.
+
 config SPMI_PMIC_CLKDIV
 	tristate "SPMI PMIC clkdiv Support"
 	depends on SPMI || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 9677e769e7e9..6f4c580d2728 100644
@@ -68,6 +68,7 @@ obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o
 obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o
 obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
 obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
+obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
 obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
 obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
 obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
drivers/clk/qcom/videocc-sm8150.c new file +276 -0

276 lines not on this page · raw message

Signature · 1 line
2.26.1
#11 lore raw

PATCH v2 5/5 clk: qcom: add video clock controller driver for SM8250

In reply to Jonathan Marek

Add support for the video clock controller found on SM8250 based devices.

Derived from the downstream driver.

---
 drivers/clk/qcom/Kconfig          |   9 +
 drivers/clk/qcom/Makefile         |   1 +
 drivers/clk/qcom/videocc-sm8250.c | 518 ++++++++++++++++++++++++++++++
 3 files changed, 528 insertions(+)
 create mode 100644 drivers/clk/qcom/videocc-sm8250.c
drivers/clk/qcom/Kconfig +9 -0
index 40d7ee9886c9..95efa38211d5 100644
@@ -453,6 +453,15 @@ config SM_VIDEOCC_8150
 	  Say Y if you want to support video devices and functionality such as
 	  video encode and decode.
 
+config SM_VIDEOCC_8250
+	tristate "SM8250 Video Clock Controller"
+	select SDM_GCC_8250
+	select QCOM_GDSC
+	help
+	  Support for the video clock controller on SM8250 devices.
+	  Say Y if you want to support video devices and functionality such as
+	  video encode and decode.
+
 config SPMI_PMIC_CLKDIV
 	tristate "SPMI PMIC clkdiv Support"
 	depends on SPMI || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 6f4c580d2728..55fb20800b66 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o
 obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
 obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
 obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
+obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o
 obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
 obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
 obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
drivers/clk/qcom/videocc-sm8250.c new file +518 -0

518 lines not on this page · raw message

Signature · 1 line
2.26.1
maintainer
#12 lore raw

Re: [PATCH v2 5/5] clk: qcom: add video clock controller driver for SM8250

Quoting Jonathan Marek (2020-09-03 20:09:54)

Quoted 62 lines

Add support for the video clock controller found on SM8250 based devices.

Derived from the downstream driver.

---
 drivers/clk/qcom/Kconfig          |   9 +
 drivers/clk/qcom/Makefile         |   1 +
 drivers/clk/qcom/videocc-sm8250.c | 518 ++++++++++++++++++++++++++++++
 3 files changed, 528 insertions(+)
 create mode 100644 drivers/clk/qcom/videocc-sm8250.c
drivers/clk/qcom/Kconfig +9 -0
index 40d7ee9886c9..95efa38211d5 100644
@@ -453,6 +453,15 @@ config SM_VIDEOCC_8150
          Say Y if you want to support video devices and functionality such as
          video encode and decode.
 
+config SM_VIDEOCC_8250
+       tristate "SM8250 Video Clock Controller"
+       select SDM_GCC_8250
+       select QCOM_GDSC
+       help
+         Support for the video clock controller on SM8250 devices.
+         Say Y if you want to support video devices and functionality such as
+         video encode and decode.
+
 config SPMI_PMIC_CLKDIV
        tristate "SPMI PMIC clkdiv Support"
        depends on SPMI || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 6f4c580d2728..55fb20800b66 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o
 obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
 obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
 obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
+obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o
 obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
 obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
 obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
drivers/clk/qcom/videocc-sm8250.c new file +12 -0
new file mode 100644
index 000000000000..a814d10945c4
@@ -0,0 +1,518 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,videocc-sm8250.h>
+

[...]

Quoted 16 lines
drivers/clk/qcom/videocc-sm8250.c new file +16 -0
+static struct clk_rcg2 video_cc_ahb_clk_src = {
+       .cmd_rcgr = 0xbd4,
+       .mnd_width = 0,
+       .hid_width = 5,
+       .parent_map = video_cc_parent_map_0,
+       .freq_tbl = ftbl_video_cc_ahb_clk_src,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "video_cc_ahb_clk_src",
+               .parent_data = video_cc_parent_data_0,
+               .num_parents = ARRAY_SIZE(video_cc_parent_data_0),
+               .flags = CLK_SET_RATE_PARENT,
+               .ops = &clk_rcg2_shared_ops,
+       },
+};
+
+static struct clk_rcg2 video_cc_xo_clk_src = {

drivers/clk/qcom/videocc-sm8250.c line 255

Quoted 10 lines
drivers/clk/qcom/videocc-sm8250.c new file +10 -0
+       .cmd_rcgr = 0xecc,
+       .mnd_width = 0,
+       .hid_width = 5,
+       .parent_map = video_cc_parent_map_0,
+       .freq_tbl = ftbl_video_cc_ahb_clk_src,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "video_cc_xo_clk_src",
+               .parent_data = video_cc_parent_data_0,
+               .num_parents = ARRAY_SIZE(video_cc_parent_data_0),
+               .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,

Similar critical clk comment, see below.

Quoted 7 lines
drivers/clk/qcom/videocc-sm8250.c new file +7 -0
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_branch video_cc_ahb_clk = {
+       .halt_reg = 0xe58,
+       .halt_check = BRANCH_HALT,

drivers/clk/qcom/videocc-sm8250.c line 272

Quoted 10 lines
drivers/clk/qcom/videocc-sm8250.c new file +10 -0
+       .clkr = {
+               .enable_reg = 0xe58,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "video_cc_ahb_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &video_cc_ahb_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,

Similar critical clk comment, see below.

drivers/clk/qcom/videocc-sm8250.c line 280

Quoted 8 lines
drivers/clk/qcom/videocc-sm8250.c new file +8 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch video_cc_mvs0_clk = {
+       .halt_reg = 0xd34,
+       .halt_check = BRANCH_HALT_SKIP, /* TODO: hw gated ? */

Is this resolved?

Quoted 15 lines
drivers/clk/qcom/videocc-sm8250.c new file +15 -0
+       .clkr = {
+               .enable_reg = 0xd34,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "video_cc_mvs0_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &video_cc_mvs0_div_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+

[...]

Quoted 4 lines
drivers/clk/qcom/videocc-sm8250.c new file +4 -0
+
+static struct clk_branch video_cc_xo_clk = {
+       .halt_reg = 0xeec,
+       .halt_check = BRANCH_HALT,

drivers/clk/qcom/videocc-sm8250.c line 380

Quoted 10 lines
drivers/clk/qcom/videocc-sm8250.c new file +10 -0
+       .clkr = {
+               .enable_reg = 0xeec,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "video_cc_xo_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &video_cc_xo_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,

Please add a coment why it's critical. If no consumer of this clk exists it's preferred to move the enabling to probe and not waste memory modeling it in software.

Quoted 5 lines
drivers/clk/qcom/videocc-sm8250.c new file +5 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
#13 lore raw

Re: [PATCH v2 5/5] clk: qcom: add video clock controller driver for SM8250

Quoted 113 lines · Stephen Boyd

Quoting Jonathan Marek (2020-09-03 20:09:54)

Quoted 62 lines

Add support for the video clock controller found on SM8250 based devices.

Derived from the downstream driver.

---
  drivers/clk/qcom/Kconfig          |   9 +
  drivers/clk/qcom/Makefile         |   1 +
  drivers/clk/qcom/videocc-sm8250.c | 518 ++++++++++++++++++++++++++++++
  3 files changed, 528 insertions(+)

create mode 100644 drivers/clk/qcom/videocc-sm8250.c

drivers/clk/qcom/Kconfig +9 -0
index 40d7ee9886c9..95efa38211d5 100644
@@ -453,6 +453,15 @@ config SM_VIDEOCC_8150
           Say Y if you want to support video devices and functionality such as
           video encode and decode.
 
+config SM_VIDEOCC_8250
+       tristate "SM8250 Video Clock Controller"
+       select SDM_GCC_8250
+       select QCOM_GDSC
+       help
+         Support for the video clock controller on SM8250 devices.
+         Say Y if you want to support video devices and functionality such as
+         video encode and decode.
+
  config SPMI_PMIC_CLKDIV
         tristate "SPMI PMIC clkdiv Support"
         depends on SPMI || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 6f4c580d2728..55fb20800b66 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o
  obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
  obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
  obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
+obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o
  obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
  obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
  obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
drivers/clk/qcom/videocc-sm8250.c new file +12 -0
new file mode 100644
index 000000000000..a814d10945c4
@@ -0,0 +1,518 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,videocc-sm8250.h>
+

[...]

Quoted 16 lines
drivers/clk/qcom/videocc-sm8250.c new file +16 -0
+static struct clk_rcg2 video_cc_ahb_clk_src = {
+       .cmd_rcgr = 0xbd4,
+       .mnd_width = 0,
+       .hid_width = 5,
+       .parent_map = video_cc_parent_map_0,
+       .freq_tbl = ftbl_video_cc_ahb_clk_src,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "video_cc_ahb_clk_src",
+               .parent_data = video_cc_parent_data_0,
+               .num_parents = ARRAY_SIZE(video_cc_parent_data_0),
+               .flags = CLK_SET_RATE_PARENT,
+               .ops = &clk_rcg2_shared_ops,
+       },
+};
+
+static struct clk_rcg2 video_cc_xo_clk_src = {

drivers/clk/qcom/videocc-sm8250.c line 255

Quoted 10 lines
drivers/clk/qcom/videocc-sm8250.c new file +10 -0
+       .cmd_rcgr = 0xecc,
+       .mnd_width = 0,
+       .hid_width = 5,
+       .parent_map = video_cc_parent_map_0,
+       .freq_tbl = ftbl_video_cc_ahb_clk_src,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "video_cc_xo_clk_src",
+               .parent_data = video_cc_parent_data_0,
+               .num_parents = ARRAY_SIZE(video_cc_parent_data_0),
+               .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,

Similar critical clk comment, see below.

Quoted 7 lines
drivers/clk/qcom/videocc-sm8250.c new file +7 -0
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_branch video_cc_ahb_clk = {
+       .halt_reg = 0xe58,
+       .halt_check = BRANCH_HALT,

drivers/clk/qcom/videocc-sm8250.c line 272

Quoted 10 lines
drivers/clk/qcom/videocc-sm8250.c new file +10 -0
+       .clkr = {
+               .enable_reg = 0xe58,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "video_cc_ahb_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &video_cc_ahb_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,

Similar critical clk comment, see below.

Quoted 11 lines

drivers/clk/qcom/videocc-sm8250.c line 280

Quoted 8 lines
drivers/clk/qcom/videocc-sm8250.c new file +8 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch video_cc_mvs0_clk = {
+       .halt_reg = 0xd34,
+       .halt_check = BRANCH_HALT_SKIP, /* TODO: hw gated ? */

Is this resolved?

Downstream has this clock as BRANCH_HALT_VOTED, but with the upstream venus driver (with patches to enable sm8250), that results in a "video_cc_mvs0_clk status stuck at 'off" error. AFAIK venus enables/disables this clock on its own (venus still works without touching this clock), but I didn't want to remove this in case it might be needed. I removed these clocks in the v3 I just sent.

Quoted 40 lines
Quoted 15 lines
drivers/clk/qcom/videocc-sm8250.c new file +15 -0
+       .clkr = {
+               .enable_reg = 0xd34,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "video_cc_mvs0_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &video_cc_mvs0_div_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+

[...]

Quoted 4 lines
drivers/clk/qcom/videocc-sm8250.c new file +4 -0
+
+static struct clk_branch video_cc_xo_clk = {
+       .halt_reg = 0xeec,
+       .halt_check = BRANCH_HALT,

drivers/clk/qcom/videocc-sm8250.c line 380

Quoted 10 lines
drivers/clk/qcom/videocc-sm8250.c new file +10 -0
+       .clkr = {
+               .enable_reg = 0xeec,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "video_cc_xo_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &video_cc_xo_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,

Please add a coment why it's critical. If no consumer of this clk exists it's preferred to move the enabling to probe and not waste memory modeling it in software.

Quoted 5 lines
drivers/clk/qcom/videocc-sm8250.c new file +5 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
maintainer
#14 lore raw

Re: [PATCH v2 5/5] clk: qcom: add video clock controller driver for SM8250

Quoting Jonathan Marek (2020-09-23 09:07:16)

Quoted 15 lines · Stephen Boyd
Quoted 13 lines

Quoting Jonathan Marek (2020-09-03 20:09:54)

drivers/clk/qcom/videocc-sm8250.c line 280

Quoted 8 lines
drivers/clk/qcom/videocc-sm8250.c new file +8 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch video_cc_mvs0_clk = {
+       .halt_reg = 0xd34,
+       .halt_check = BRANCH_HALT_SKIP, /* TODO: hw gated ? */

Is this resolved?

Quoted 7 lines

Downstream has this clock as BRANCH_HALT_VOTED, but with the upstream venus driver (with patches to enable sm8250), that results in a "video_cc_mvs0_clk status stuck at 'off" error. AFAIK venus enables/disables this clock on its own (venus still works without touching this clock), but I didn't want to remove this in case it might be needed. I removed these clocks in the v3 I just sent.

Hmm. Does downstream use these clks? There have been some clk stuck problems with venus recently that were attributed to improperly enabling clks before enabling interconnects and power domains. Maybe it's the same problem.

#15 lore raw

Re: [PATCH v2 5/5] clk: qcom: add video clock controller driver for SM8250

Quoted 24 lines · Stephen Boyd

Quoting Jonathan Marek (2020-09-23 09:07:16)

Quoted 15 lines · Stephen Boyd
Quoted 13 lines

Quoting Jonathan Marek (2020-09-03 20:09:54)

drivers/clk/qcom/videocc-sm8250.c line 280

Quoted 8 lines
drivers/clk/qcom/videocc-sm8250.c new file +8 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch video_cc_mvs0_clk = {
+       .halt_reg = 0xd34,
+       .halt_check = BRANCH_HALT_SKIP, /* TODO: hw gated ? */

Is this resolved?

Quoted 7 lines

Downstream has this clock as BRANCH_HALT_VOTED, but with the upstream venus driver (with patches to enable sm8250), that results in a "video_cc_mvs0_clk status stuck at 'off" error. AFAIK venus enables/disables this clock on its own (venus still works without touching this clock), but I didn't want to remove this in case it might be needed. I removed these clocks in the v3 I just sent.

Quoted 5 lines

Hmm. Does downstream use these clks? There have been some clk stuck problems with venus recently that were attributed to improperly enabling clks before enabling interconnects and power domains. Maybe it's the same problem.

Yes, downstream uses these clks.

The "stuck" problem still happens if GSDCS/interconnects are always on, and like I mentioned, venus works even with these clocks completely removed.

I think venus controls these clocks (and downstream just happens to try enabling it at a point where venus has already enabled it?). I'm not too sure about this, it might have something to do with the GDSC having the HW_CTRL flag too..

maintainer
#16 lore raw

Re: [PATCH v2 5/5] clk: qcom: add video clock controller driver for SM8250

Quoting Jonathan Marek (2020-09-23 17:54:59)

Quoted 33 lines · Stephen Boyd
Quoted 24 lines

Quoting Jonathan Marek (2020-09-23 09:07:16)

Quoted 15 lines · Stephen Boyd
Quoted 13 lines

Quoting Jonathan Marek (2020-09-03 20:09:54)

drivers/clk/qcom/videocc-sm8250.c line 280

Quoted 8 lines
drivers/clk/qcom/videocc-sm8250.c new file +8 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch video_cc_mvs0_clk = {
+       .halt_reg = 0xd34,
+       .halt_check = BRANCH_HALT_SKIP, /* TODO: hw gated ? */

Is this resolved?

Quoted 7 lines

Downstream has this clock as BRANCH_HALT_VOTED, but with the upstream venus driver (with patches to enable sm8250), that results in a "video_cc_mvs0_clk status stuck at 'off" error. AFAIK venus enables/disables this clock on its own (venus still works without touching this clock), but I didn't want to remove this in case it might be needed. I removed these clocks in the v3 I just sent.

Quoted 5 lines

Hmm. Does downstream use these clks? There have been some clk stuck problems with venus recently that were attributed to improperly enabling clks before enabling interconnects and power domains. Maybe it's the same problem.

Yes, downstream uses these clks.

Quoted 8 lines

The "stuck" problem still happens if GSDCS/interconnects are always on, and like I mentioned, venus works even with these clocks completely removed.

I think venus controls these clocks (and downstream just happens to try enabling it at a point where venus has already enabled it?). I'm not too sure about this, it might have something to do with the GDSC having the HW_CTRL flag too..

Ok. Maybe Taniya has an idea.