Skip to contentSkip to conversation

Add Unisoc's drm kms module

RFC PATCH Superseded Kevin Tang 6 participants 15 messages Sep 28, 2020 – Oct 16, 2020

Subsystems (4)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Kevin Tang

author
#0 lore raw

v7 cover Add Unisoc's drm kms module

ChangeList:
v1:
1. only upstream modeset and atomic at first commit.
2. remove some unused code;
3. use alpha and blend_mode properties;
3. add yaml support;
4. remove auto-adaptive panel driver;
5. bugfix

v2:
1. add sprd crtc and plane module for KMS, preparing for multi crtc&encoder
2. remove gem drivers, use generic CMA handlers
3. remove redundant "module_init", all the sub modules loading by KMS

v3:
1. multi crtc&encoder design have problem, so rollback to v1

v4:
1. update to gcc-linaro-7.5.0
2. update to Linux 5.6-rc3
3. remove pm_runtime support
4. add COMPILE_TEST, remove unused kconfig
5. "drm_dev_put" on drm_unbind
6. fix some naming convention issue
7. remove semaphore lock for crtc flip
8. remove static variables

v5:
1. optimize encoder and connector code implementation
2. use "platform_get_irq" and "platform_get_resource"
3. drop useless function return type, drop unless debug log
4. custom properties should be separate, so drop it
5. use DRM_XXX replase pr_xxx
6. drop dsi&dphy hal callback ops
7. drop unless callback ops checking
8. add comments for sprd dpu structure

v6:
1. Access registers via readl/writel
2. Checking for unsupported KMS properties (format, rotation, blend_mode, etc) on plane_check ops
3. Remove always true checks for dpu core ops

v7:
1. Fix DTC unit name warnings
2. Fix the problem of maintainers
3. Call drmm_mode_config_init to mode config init
4. Embed drm_device in sprd_drm and use devm_drm_dev_alloc
5. Replace DRM_XXX with drm_xxx on KMS module, but not suitable for other subsystems
6. Remove plane_update stuff, dpu handles all the HW update in crtc->atomic_flush
7. Dsi&Dphy Code structure adjustment, all move to "sprd/"

Kevin Tang (6):
dt-bindings: display: add Unisoc's drm master bindings drm/sprd: add Unisoc's drm kms master
dt-bindings: display: add Unisoc's dpu bindings drm/sprd: add Unisoc's drm display controller driver
dt-bindings: display: add Unisoc's mipi dsi&dphy bindings drm/sprd: add Unisoc's drm mipi dsi&dphy driver

 .../display/sprd/sprd,display-subsystem.yaml       |   39 +
 .../bindings/display/sprd/sprd,sharkl3-dpu.yaml    |   83 ++
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        |   98 ++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |   75 +
 drivers/gpu/drm/Kconfig                            |    2 +
 drivers/gpu/drm/Makefile                           |    1 +
 drivers/gpu/drm/sprd/Kconfig                       |   13 +
 drivers/gpu/drm/sprd/Makefile                      |   12 +
 drivers/gpu/drm/sprd/dpu_r2p0.c                    |  636 +++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl.c                 |  792 +++++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl.h                 | 1475 ++++++++++++++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c             |  276 ++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h             |   34 +
 drivers/gpu/drm/sprd/megacores_pll.c               |  315 +++++
 drivers/gpu/drm/sprd/megacores_pll.h               |  146 ++
 drivers/gpu/drm/sprd/sprd_dphy.c                   |  335 +++++
 drivers/gpu/drm/sprd/sprd_dphy.h                   |   39 +
 drivers/gpu/drm/sprd/sprd_dpu.c                    |  501 +++++++
 drivers/gpu/drm/sprd/sprd_dpu.h                    |  217 +++
 drivers/gpu/drm/sprd/sprd_drm.c                    |  263 ++++
 drivers/gpu/drm/sprd/sprd_drm.h                    |   20 +
 drivers/gpu/drm/sprd/sprd_dsi.c                    | 1102 +++++++++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h                    |  105 ++
 23 files changed, 6579 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml
 create mode 100644 drivers/gpu/drm/sprd/Kconfig
 create mode 100644 drivers/gpu/drm/sprd/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dpu_r2p0.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl.h
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h
 create mode 100644 drivers/gpu/drm/sprd/megacores_pll.c
 create mode 100644 drivers/gpu/drm/sprd/megacores_pll.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.h
Signature · 1 line
2.7.4
author
#1 lore raw

RFC PATCH v7 1/6 dt-bindings: display: add Unisoc's drm master bindings

From: Kevin Tang <[email protected]>

The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,display-subsystem.yaml       | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +39 -0
new file mode 100644
index 0000000..9487a39
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,display-subsystem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+description: |
+  The Unisoc DRM master device is a virtual device needed to list all
+  DPU devices or other display interface nodes that comprise the
+  graphics subsystem.
+
+properties:
+  compatible:
+    const: sprd,display-subsystem
+
+  ports:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Should contain a list of phandles pointing to display interface port
+      of DPU devices.
+
+required:
+  - compatible
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    display-subsystem {
+        compatible = "sprd,display-subsystem";
+        ports = <&dpu_out>;
+    };
+
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH RFC v7 1/6] dt-bindings: display: add Unisoc's drm master bindings

Hi!

Quoted 39 lines · Kevin Tang

From: Kevin Tang <[email protected]>

The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,display-subsystem.yaml       | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +15 -0
new file mode 100644
index 0000000..9487a39
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,display-subsystem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+description: |
+  The Unisoc DRM master device is a virtual device needed to list all
+  DPU devices or other display interface nodes that comprise the
+  graphics subsystem.

Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml line 25

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +10 -0
+
+properties:
+  compatible:
+    const: sprd,display-subsystem
+
+  ports:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Should contain a list of phandles pointing to display interface port
+      of DPU devices.

Generally speaking, driver-specific properties should be prefixed by the vendor name to avoid any conflict with generic properties (like the OF-Graph ports subnode in this case)

Maxime

#3 lore raw

Re: [PATCH RFC v7 1/6] dt-bindings: display: add Unisoc's drm master bindings

Quoted 49 lines · Maxime Ripard

Hi!

Quoted 45 lines · Kevin Tang

From: Kevin Tang <[email protected]>

The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,display-subsystem.yaml       | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +21 -0
new file mode 100644
index 0000000..9487a39
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,display-subsystem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+description: |
+  The Unisoc DRM master device is a virtual device needed to list all
+  DPU devices or other display interface nodes that comprise the
+  graphics subsystem.
+
+properties:
+  compatible:
+    const: sprd,display-subsystem
+
+  ports:
Quoted 8 lines

Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml line 25

Quoted 4 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +4 -0
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Should contain a list of phandles pointing to display interface port
+      of DPU devices.

Generally speaking, driver-specific properties should be prefixed by the vendor name to avoid any conflict with generic properties (like the OF-Graph ports subnode in this case)

We try to avoid this virtual node altogether which I commented about on v6 which was ignored.

Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#4 lore raw

Re: [PATCH RFC v7 1/6] dt-bindings: display: add Unisoc's drm master bindings

Hi Rob,
Component framework include master and component, here is master subnode. It seems that everyone else does it, why not me?

Your comments on v6:
"We generally try to avoid this virtual node as it doesn't represent any h/w. Can't you bind the driver to the DPU directly?"

I'm sorry, maybe is my careless, I still don't understand why and how to do it

Quoted 64 lines · Rob Herring <[email protected]> 于2020年9月29日周二 上午12:28写道:
Quoted 49 lines · Maxime Ripard

Hi!

Quoted 45 lines · Kevin Tang

From: Kevin Tang <[email protected]>

The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,display-subsystem.yaml       | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +21 -0
new file mode 100644
index 0000000..9487a39
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,display-subsystem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+description: |
+  The Unisoc DRM master device is a virtual device needed to list all
+  DPU devices or other display interface nodes that comprise the
+  graphics subsystem.
+
+properties:
+  compatible:
+    const: sprd,display-subsystem
+
+  ports:
Quoted 8 lines

Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml line 25

Quoted 4 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +4 -0
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Should contain a list of phandles pointing to display interface port
+      of DPU devices.

Generally speaking, driver-specific properties should be prefixed by the vendor name to avoid any conflict with generic properties (like the OF-Graph ports subnode in this case)

We try to avoid this virtual node altogether which I commented about on v6 which was ignored.

Rob

reviewer
#5 lore raw

Re: [PATCH RFC v7 1/6] dt-bindings: display: add Unisoc's drm master bindings

Quoted 10 lines · Kevin Tang

Hi Rob,
Component framework include master and component, here is master subnode. It seems that everyone else does it, why not me?

Your comments on v6:
"We generally try to avoid this virtual node as it doesn't represent any h/w. Can't you bind the driver to the DPU directly?"

I'm sorry, maybe is my careless, I still don't understand why and how to do it

Devicetree is used to describe hardware rather than virtual things like "sprd,display-subsystem" which is not a real device. That's what I understand for Rob's comments here.

Chunyan

Quoted 67 lines
Quoted 64 lines · Rob Herring <[email protected]> 于2020年9月29日周二 上午12:28写道:
Quoted 49 lines · Maxime Ripard

Hi!

Quoted 45 lines · Kevin Tang

From: Kevin Tang <[email protected]>

The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,display-subsystem.yaml       | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +21 -0
new file mode 100644
index 0000000..9487a39
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,display-subsystem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+description: |
+  The Unisoc DRM master device is a virtual device needed to list all
+  DPU devices or other display interface nodes that comprise the
+  graphics subsystem.
+
+properties:
+  compatible:
+    const: sprd,display-subsystem
+
+  ports:
Quoted 8 lines

Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml line 25

Quoted 4 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +4 -0
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Should contain a list of phandles pointing to display interface port
+      of DPU devices.

Generally speaking, driver-specific properties should be prefixed by the vendor name to avoid any conflict with generic properties (like the OF-Graph ports subnode in this case)

We try to avoid this virtual node altogether which I commented about on v6 which was ignored.

Rob

author
#6 lore raw

RFC PATCH v7 2/6 drm/sprd: add Unisoc's drm kms master

In reply to Kevin Tang

Adds drm support for the Unisoc's display subsystem.

This is drm kms driver, this driver provides support for the application framework in Android, Yocto and more.

Application framework can access Unisoc's display internel peripherals through libdrm or libkms, it's test ok by modetest (DRM/KMS test tool) and Android HWComposer.

RFC v7:
- call drmm_mode_config_init to mode config init
- embed drm_device in sprd_drm and use devm_drm_dev_alloc
- replace DRM_XXX with drm_xxx
- Kconfig optimization

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 drivers/gpu/drm/Kconfig         |   2 +
 drivers/gpu/drm/Makefile        |   1 +
 drivers/gpu/drm/sprd/Kconfig    |  12 +++
 drivers/gpu/drm/sprd/Makefile   |   5 +
 drivers/gpu/drm/sprd/sprd_drm.c | 222 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_drm.h |  16 +++
 6 files changed, 258 insertions(+)
 create mode 100644 drivers/gpu/drm/sprd/Kconfig
 create mode 100644 drivers/gpu/drm/sprd/Makefile
 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h
drivers/gpu/drm/Kconfig +2 -0
index 147d61b..15b4e13 100644
@@ -388,6 +388,8 @@ source "drivers/gpu/drm/tidss/Kconfig"
 
 source "drivers/gpu/drm/xlnx/Kconfig"
 
+source "drivers/gpu/drm/sprd/Kconfig"
+
 # Keep legacy drivers last
 
 menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
index 2f31579..42d1cdd 100644
@@ -124,3 +124,4 @@ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/
 obj-$(CONFIG_DRM_MCDE) += mcde/
 obj-$(CONFIG_DRM_TIDSS) += tidss/
 obj-y			+= xlnx/
+obj-$(CONFIG_DRM_SPRD) += sprd/
drivers/gpu/drm/sprd/Kconfig new file +12 -0
new file mode 100644
index 0000000..6e80cc9
@@ -0,0 +1,12 @@
+config DRM_SPRD
+	tristate "DRM Support for Unisoc SoCs Platform"
+	depends on ARCH_SPRD || COMPILE_TEST
+	depends on DRM && OF
+	select DRM_KMS_HELPER
+	select DRM_GEM_CMA_HELPER
+	select DRM_KMS_CMA_HELPER
+	select DRM_MIPI_DSI
+	help
+	  Choose this option if you have a Unisoc chipset.
+	  If M is selected the module will be called sprd_drm.
+
drivers/gpu/drm/sprd/Makefile new file +5 -0
new file mode 100644
index 0000000..86d95d9
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
+subdir-ccflags-y += -I$(srctree)/$(src)
+
+obj-y := sprd_drm.o
drivers/gpu/drm/sprd/sprd_drm.c new file +222 -0

222 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_drm.h new file +16 -0
new file mode 100644
index 0000000..9781fd5
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 Unisoc Inc.
+ */
+
+#ifndef _SPRD_DRM_H_
+#define _SPRD_DRM_H_
+
+#include <drm/drm_atomic.h>
+#include <drm/drm_print.h>
+
+struct sprd_drm {
+	struct drm_device drm;
+};
+
+#endif /* _SPRD_DRM_H_ */
Signature · 1 line
2.7.4
author
#7 lore raw

RFC PATCH v7 3/6 dt-bindings: display: add Unisoc's dpu bindings

In reply to Kevin Tang

From: Kevin Tang <[email protected]>

DPU (Display Processor Unit) is the Display Controller for the Unisoc SoCs which transfers the image data from a video memory buffer to an internal LCD interface.

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../bindings/display/sprd/sprd,sharkl3-dpu.yaml    | 83 ++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml new file +83 -0
new file mode 100644
index 0000000..a9052e1
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dpu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc Sharkl3 Display Processor Unit (DPU)
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+description: |
+  DPU (Display Processor Unit) is the Display Controller for the Unisoc SoCs
+  which transfers the image data from a video memory buffer to an internal
+  LCD interface.
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dpu
+
+  reg:
+    maxItems: 1
+    description:
+      Physical base address and length of the DPU registers set
+
+  interrupts:
+    maxItems: 1
+    description:
+      The interrupt signal from DPU
+
+  clocks:
+    minItems: 2
+
+  clock-names:
+    items:
+      - const: clk_src_128m
+      - const: clk_src_384m
+
+  power-domains:
+    maxItems: 1
+    description: A phandle to DPU power domain node.
+
+  iommus:
+    maxItems: 1
+    description: A phandle to DPU iommu node.
+
+  port:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the output endpoint, usually output to
+      the associated DSI.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/sprd,sc9860-clk.h>
+    dpu: dpu@63000000 {
+        compatible = "sprd,sharkl3-dpu";
+        reg = <0x63000000 0x1000>;
+        interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+        clock-names = "clk_src_128m", "clk_src_384m";
+
+        clocks = <&pll CLK_TWPLL_128M>,
+          <&pll CLK_TWPLL_384M>;
+
+        dpu_port: port {
+            dpu_out: endpoint {
+                remote-endpoint = <&dsi_in>;
+            };
+        };
+    };
Signature · 1 line
2.7.4
author
#8 lore raw

RFC PATCH v7 4/6 drm/sprd: add Unisoc's drm display controller driver

In reply to Kevin Tang

Adds DPU(Display Processor Unit) support for the Unisoc's display subsystem. It's support multi planes, scaler, rotation, PQ(Picture Quality) and more.

RFC v7:
- Remove plane_update stuff, dpu handles all the HW update in crtc->atomic_flush

RFC v6:
- Access registers via readl/writel
- Checking for unsupported KMS properties (format, rotation, blend_mode, etc) on plane_check ops
- Remove always true checks for dpu core ops

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 drivers/gpu/drm/sprd/Kconfig    |   1 +
 drivers/gpu/drm/sprd/Makefile   |   6 +-
 drivers/gpu/drm/sprd/dpu_r2p0.c | 636 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.c | 479 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.h | 214 ++++++++++++++
 drivers/gpu/drm/sprd/sprd_drm.c |   1 +
 drivers/gpu/drm/sprd/sprd_drm.h |   2 +
 7 files changed, 1337 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/sprd/dpu_r2p0.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.h
drivers/gpu/drm/sprd/Kconfig +1 -0
index 6e80cc9..9b4ef9a 100644
@@ -3,6 +3,7 @@ config DRM_SPRD
 	depends on ARCH_SPRD || COMPILE_TEST
 	depends on DRM && OF
 	select DRM_KMS_HELPER
+	select VIDEOMODE_HELPERS
 	select DRM_GEM_CMA_HELPER
 	select DRM_KMS_CMA_HELPER
 	select DRM_MIPI_DSI
drivers/gpu/drm/sprd/Makefile +4 -2
index 86d95d9..0ba48f2 100644
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
-subdir-ccflags-y += -I$(srctree)/$(src)
+obj-y := sprd_drm.o \
+	sprd_dpu.o
+
+obj-y += dpu_r2p0.o
 
-obj-y := sprd_drm.o
drivers/gpu/drm/sprd/dpu_r2p0.c new file +636 -0

636 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dpu.c new file +479 -0

479 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dpu.h new file +214 -0

214 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_drm.c +1 -0
index ec101de..ca93be2 100644
@@ -196,6 +196,7 @@ static struct platform_driver sprd_drm_driver = {
 
 static struct platform_driver *sprd_drm_drivers[]  = {
 	&sprd_drm_driver,
+	&sprd_dpu_driver,
 };
 
 static int __init sprd_drm_init(void)
drivers/gpu/drm/sprd/sprd_drm.h +2 -0
index 9781fd5..85d4a8b 100644
@@ -13,4 +13,6 @@ struct sprd_drm {
 	struct drm_device drm;
 };
 
+extern struct platform_driver sprd_dpu_driver;
+
 #endif /* _SPRD_DRM_H_ */
Signature · 1 line
2.7.4
author
#9 lore raw

RFC PATCH v7 5/6 dt-bindings: display: add Unisoc's mipi dsi&dphy bindings

In reply to Kevin Tang

From: Kevin Tang <[email protected]>

Adds MIPI DSI Master and MIPI DSI-PHY (D-PHY)
support for Unisoc's display subsystem.

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 98 ++++++++++++++++++++++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         | 75 +++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +98 -0
new file mode 100644
index 0000000..b6bbf67
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dsi-host.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI Controller
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-host
+
+  reg:
+    maxItems: 1
+    description:
+      Physical base address and length of the registers set for the device.
+
+  interrupts:
+    maxItems: 2
+    description:
+      Should contain DSI interrupt.
+
+  clocks:
+    minItems: 1
+
+  clock-names:
+    items:
+      - const: clk_src_96m
+
+  power-domains:
+    maxItems: 1
+    description: A phandle to DSIM power domain node
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  port@0:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the input endpoint, usually coming from
+      the associated DPU.
+  port@1:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the output endpoint, usually output to
+      the associated DPHY.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - port@0
+  - port@1
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/sprd,sc9860-clk.h>
+    dsi: dsi@63100000 {
+        compatible = "sprd,sharkl3-dsi-host";
+        reg = <0x63100000 0x1000>;
+        interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
+          <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+        clock-names = "clk_src_96m";
+        clocks = <&pll CLK_TWPLL_96M>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+        port@0 {
+            reg = <0>;
+            dsi_in: endpoint {
+                remote-endpoint = <&dpu_out>;
+            };
+        };
+
+        port@1 {
+            reg = <1>;
+            dsi_out: endpoint {
+                remote-endpoint = <&dphy_in>;
+            };
+        };
+    };
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.7.4
#10 lore raw

Re: [PATCH RFC v7 5/6] dt-bindings: display: add Unisoc's mipi dsi&dphy bindings

Hi!

Quoted 71 lines · Kevin Tang

From: Kevin Tang <[email protected]>

Adds MIPI DSI Master and MIPI DSI-PHY (D-PHY)
support for Unisoc's display subsystem.

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 98 ++++++++++++++++++++++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         | 75 +++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +46 -0
new file mode 100644
index 0000000..b6bbf67
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dsi-host.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI Controller
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-host
+
+  reg:
+    maxItems: 1
+    description:
+      Physical base address and length of the registers set for the device.
+
+  interrupts:
+    maxItems: 2
+    description:
+      Should contain DSI interrupt.
+
+  clocks:
+    minItems: 1
+
+  clock-names:
+    items:
+      - const: clk_src_96m
+
+  power-domains:
+    maxItems: 1
+    description: A phandle to DSIM power domain node
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  port@0:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in

Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml line 56

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +10 -0
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the input endpoint, usually coming from
+      the associated DPU.
+  port@1:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the output endpoint, usually output to
+      the associated DPHY.

Is there a specific reason you don't follow the OF-graph and have a ports subnode with your two port@X in there?

Maxime

author
#11 lore raw

Re: [PATCH RFC v7 5/6] dt-bindings: display: add Unisoc's mipi dsi&dphy bindings

Hi maxime,
Sorry, I forgot to describe ports subnode with my two port@X, i will be fix it.

Thanks for reminding

Quoted 90 lines · Maxime Ripard <[email protected]> 于2020年9月28日周一 下午4:20写道:

Hi!

Quoted 71 lines · Kevin Tang

From: Kevin Tang <[email protected]>

Adds MIPI DSI Master and MIPI DSI-PHY (D-PHY)
support for Unisoc's display subsystem.

RFC v7:
- Fix DTC unit name warnings
- Fix the problem of maintainers

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 98 ++++++++++++++++++++++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         | 75 +++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +46 -0
new file mode 100644
index 0000000..b6bbf67
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dsi-host.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI Controller
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-host
+
+  reg:
+    maxItems: 1
+    description:
+      Physical base address and length of the registers set for the device.
+
+  interrupts:
+    maxItems: 2
+    description:
+      Should contain DSI interrupt.
+
+  clocks:
+    minItems: 1
+
+  clock-names:
+    items:
+      - const: clk_src_96m
+
+  power-domains:
+    maxItems: 1
+    description: A phandle to DSIM power domain node
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  port@0:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in

Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml line 56

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +10 -0
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the input endpoint, usually coming from
+      the associated DPU.
+  port@1:
+    type: object
+    description:
+      A port node with endpoint definitions as defined in
+      Documentation/devicetree/bindings/media/video-interfaces.txt.
+      That port should be the output endpoint, usually output to
+      the associated DPHY.

Is there a specific reason you don't follow the OF-graph and have a ports subnode with your two port@X in there?

Maxime

author
#12 lore raw

RFC PATCH v7 6/6 drm/sprd: add Unisoc's drm mipi dsi&dphy driver

In reply to Kevin Tang

Adds dsi host controller support for the Unisoc's display subsystem. Adds dsi phy support for the Unisoc's display subsystem. Only MIPI DSI Displays supported, DP/TV/HMDI will be support in the feature.

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 drivers/gpu/drm/sprd/Makefile          |    9 +-
 drivers/gpu/drm/sprd/dw_dsi_ctrl.c     |  792 +++++++++++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl.h     | 1475 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c |  276 ++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h |   34 +
 drivers/gpu/drm/sprd/megacores_pll.c   |  315 +++++++
 drivers/gpu/drm/sprd/megacores_pll.h   |  146 ++++
 drivers/gpu/drm/sprd/sprd_dphy.c       |  335 ++++++++
 drivers/gpu/drm/sprd/sprd_dphy.h       |   39 +
 drivers/gpu/drm/sprd/sprd_dpu.c        |   22 +
 drivers/gpu/drm/sprd/sprd_dpu.h        |    3 +
 drivers/gpu/drm/sprd/sprd_drm.c        |   40 +
 drivers/gpu/drm/sprd/sprd_drm.h        |    2 +
 drivers/gpu/drm/sprd/sprd_dsi.c        | 1102 ++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h        |  105 +++
 15 files changed, 4693 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl.h
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h
 create mode 100644 drivers/gpu/drm/sprd/megacores_pll.c
 create mode 100644 drivers/gpu/drm/sprd/megacores_pll.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.h
drivers/gpu/drm/sprd/Makefile +7 -2
index 0ba48f2..75d6a519 100644
@@ -1,7 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-y := sprd_drm.o \
-	sprd_dpu.o
+	sprd_dpu.o \
+	sprd_dsi.o \
+	sprd_dphy.o \
+	dpu_r2p0.o \
+	dw_dsi_ctrl.o \
+	dw_dsi_ctrl_ppi.o \
+	megacores_pll.o
 
-obj-y += dpu_r2p0.o
 
drivers/gpu/drm/sprd/dw_dsi_ctrl.c new file +792 -0

792 lines not on this page · raw message

drivers/gpu/drm/sprd/dw_dsi_ctrl.h new file +1475 -0

1,475 lines not on this page · raw message

drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c new file +276 -0

276 lines not on this page · raw message

drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h new file +34 -0
new file mode 100644
index 0000000..eecdd71
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 Unisoc Inc.
+ */
+
+#ifndef _DW_DSI_CTRL_PPI_H_
+#define _DW_DSI_CTRL_PPI_H_
+
+#include "sprd_dphy.h"
+
+void dsi_phy_rstz(struct dphy_context *ctx, int level);
+void dsi_phy_shutdownz(struct dphy_context *ctx, int level);
+void dsi_phy_force_pll(struct dphy_context *ctx, int force);
+void dsi_phy_clklane_ulps_rqst(struct dphy_context *ctx, int en);
+void dsi_phy_clklane_ulps_exit(struct dphy_context *ctx, int en);
+void dsi_phy_datalane_ulps_rqst(struct dphy_context *ctx, int en);
+void dsi_phy_datalane_ulps_exit(struct dphy_context *ctx, int en);
+void dsi_phy_stop_wait_time(struct dphy_context *ctx, u8 byte_clk);
+void dsi_phy_datalane_en(struct dphy_context *ctx);
+void dsi_phy_clklane_en(struct dphy_context *ctx, int en);
+void dsi_phy_clk_hs_rqst(struct dphy_context *ctx, int en);
+u8 dsi_phy_is_pll_locked(struct dphy_context *ctx);
+u8 dsi_phy_is_stop_state_clklane(struct dphy_context *ctx);
+u8 dsi_phy_is_stop_state_datalane(struct dphy_context *ctx);
+u8 dsi_phy_is_ulps_active_datalane(struct dphy_context *ctx);
+u8 dsi_phy_is_ulps_active_clklane(struct dphy_context *ctx);
+void dsi_phy_test_clk(struct dphy_context *ctx, u8 level);
+void dsi_phy_test_clr(struct dphy_context *ctx, u8 level);
+void dsi_phy_test_en(struct dphy_context *ctx, u8 level);
+u8 dsi_phy_test_dout(struct dphy_context *ctx);
+void dsi_phy_test_din(struct dphy_context *ctx, u8 data);
+void dsi_phy_bist_en(struct dphy_context *ctx, int en);
+
+#endif /* _DW_DSI_CTRL_PPI_H_ */
\ No newline at end of file
drivers/gpu/drm/sprd/megacores_pll.c new file +315 -0

315 lines not on this page · raw message

drivers/gpu/drm/sprd/megacores_pll.h new file +146 -0

93 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dphy.c new file +335 -0

335 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dphy.h new file +39 -0
new file mode 100644
index 0000000..ae858ba

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/sprd/sprd_dpu.c +22 -0
index f6aa47b..973fb36 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/sprd/sprd_dpu.h +3 -0
index 88f34ed..b6ad155 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/sprd/sprd_drm.c +40 -0
index ca93be2..a57e079 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/sprd/sprd_drm.h +2 -0
index 85d4a8b..bfd374c 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/sprd/sprd_dsi.c new file +1102 -0

1,102 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dsi.h new file +105 -0

105 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.

#13 lore raw

Re: [PATCH RFC v7 6/6] drm/sprd: add Unisoc's drm mipi dsi&dphy driver

[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]

Hi Kevin,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.9-rc7 next-20200925] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Kevin-Tang/Add-Unisoc-s-drm-kms-module/20200928-142937
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1697e90e763d7cdd15122f9e8226a90513ef03ed
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kevin-Tang/Add-Unisoc-s-drm-kms-module/20200928-142937 git checkout 1697e90e763d7cdd15122f9e8226a90513ef03ed
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/sprd/sprd_dsi.c:185:6: warning: no previous prototype for 'sprd_dsi_init' [-Wmissing-prototypes]
     185 | void sprd_dsi_init(struct sprd_dsi *dsi)
         |      ^~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:225:6: warning: no previous prototype for 'sprd_dsi_fini' [-Wmissing-prototypes]
     225 | void sprd_dsi_fini(struct sprd_dsi *dsi)
         |      ^~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:240:5: warning: no previous prototype for 'sprd_dsi_dpi_video' [-Wmissing-prototypes]
     240 | int sprd_dsi_dpi_video(struct sprd_dsi *dsi)
         |     ^~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:370:6: warning: no previous prototype for 'sprd_dsi_edpi_video' [-Wmissing-prototypes]
     370 | void sprd_dsi_edpi_video(struct sprd_dsi *dsi)
         |      ^~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:408:5: warning: no previous prototype for 'sprd_dsi_wr_pkt' [-Wmissing-prototypes]
     408 | int sprd_dsi_wr_pkt(struct sprd_dsi *dsi, u8 vc, u8 type,
         |     ^~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:463:5: warning: no previous prototype for 'sprd_dsi_rd_pkt' [-Wmissing-prototypes]
     463 | int sprd_dsi_rd_pkt(struct sprd_dsi *dsi, u8 vc, u8 type,
         |     ^~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:517:6: warning: no previous prototype for 'sprd_dsi_set_work_mode' [-Wmissing-prototypes]
     517 | void sprd_dsi_set_work_mode(struct sprd_dsi *dsi, u8 mode)
         |      ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:527:5: warning: no previous prototype for 'sprd_dsi_get_work_mode' [-Wmissing-prototypes]
     527 | int sprd_dsi_get_work_mode(struct sprd_dsi *dsi)
         |     ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:537:6: warning: no previous prototype for 'sprd_dsi_lp_cmd_enable' [-Wmissing-prototypes]
     537 | void sprd_dsi_lp_cmd_enable(struct sprd_dsi *dsi, bool enable)
         |      ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:547:6: warning: no previous prototype for 'sprd_dsi_state_reset' [-Wmissing-prototypes]
     547 | void sprd_dsi_state_reset(struct sprd_dsi *dsi)
         |      ^~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/sprd/sprd_dsi.c:556:5: warning: no previous prototype for 'sprd_dsi_int_status' [-Wmissing-prototypes]

556 | u32 sprd_dsi_int_status(struct sprd_dsi *dsi, int index)
| ^~~~~~~~~~~~~~~~~~~

vim +/sprd_dsi_init +185 drivers/gpu/drm/sprd/sprd_dsi.c

181
182 #define ns_to_cycle(ns, byte_clk) \
183 DIV_ROUND_UP((ns) * (byte_clk), 1000000)
184

 > 185	void sprd_dsi_init(struct sprd_dsi *dsi)
   186	{
   187		struct dsi_context *ctx = &dsi->ctx;
   188		u16 data_hs2lp, data_lp2hs, clk_hs2lp, clk_lp2hs;
   189		u16 max_rd_time;
   190		int div;
   191	
   192		dsi_power_enable(ctx, 0);
   193		dsi_int0_mask(ctx, 0xffffffff);
   194		dsi_int1_mask(ctx, 0xffffffff);
   195		dsi_cmd_mode(ctx);
   196		dsi_eotp_rx_en(ctx, 0);
   197		dsi_eotp_tx_en(ctx, 0);
   198		dsi_ecc_rx_en(ctx, 1);
   199		dsi_crc_rx_en(ctx, 1);
   200		dsi_bta_en(ctx, 1);
   201		dsi_video_vcid(ctx, 0);
   202		dsi_rx_vcid(ctx, 0);
   203	
   204		div = DIV_ROUND_UP(ctx->byte_clk, ctx->esc_clk);
   205		dsi_tx_escape_division(ctx, div);
   206	
   207		max_rd_time = ns_to_cycle(ctx->max_rd_time, ctx->byte_clk);
   208		dsi_max_read_time(ctx, max_rd_time);
   209	
   210		data_hs2lp = ns_to_cycle(ctx->data_hs2lp, ctx->byte_clk);
   211		data_lp2hs = ns_to_cycle(ctx->data_lp2hs, ctx->byte_clk);
   212		clk_hs2lp = ns_to_cycle(ctx->clk_hs2lp, ctx->byte_clk);
   213		clk_lp2hs = ns_to_cycle(ctx->clk_lp2hs, ctx->byte_clk);
   214		dsi_datalane_hs2lp_config(ctx, data_hs2lp);
   215		dsi_datalane_lp2hs_config(ctx, data_lp2hs);
   216		dsi_clklane_hs2lp_config(ctx, clk_hs2lp);
   217		dsi_clklane_lp2hs_config(ctx, clk_lp2hs);
   218	
   219		dsi_power_enable(ctx, 1);
   220	}
   221	
   222	/*
   223	 * Free up resources and shutdown host controller and PHY
   224	 */
 > 225	void sprd_dsi_fini(struct sprd_dsi *dsi)
   226	{
   227		struct dsi_context *ctx = &dsi->ctx;
   228	
   229		dsi_int0_mask(ctx, 0xffffffff);
   230		dsi_int1_mask(ctx, 0xffffffff);
   231		dsi_power_enable(ctx, 0);
   232	}
   233	
   234	/*
   235	 * If not in burst mode, it will compute the video and null packet sizes
   236	 * according to necessity.
   237	 * Configure timers for data lanes and/or clock lane to return to LP when
   238	 * bandwidth is not filled by data.
   239	 */
 > 240	int sprd_dsi_dpi_video(struct sprd_dsi *dsi)
   241	{
   242		struct dsi_context *ctx = &dsi->ctx;
   243		struct videomode *vm = &dsi->ctx.vm;
   244		u16 Bpp_x100;
   245		u16 video_size;
   246		u32 ratio_x1000;
   247		u16 null_pkt_size = 0;
   248		u8 video_size_step;
   249		u32 hs_to;
   250		u32 total_bytes;
   251		u32 bytes_per_chunk;
   252		u32 chunks = 0;
   253		u32 bytes_left = 0;
   254		u32 chunk_overhead;
   255		const u8 pkt_header = 6;
   256		u8 coding;
   257		int div;
   258		u16 hline;
   259	
   260		coding = fmt_to_coding(ctx->format);
   261		video_size = round_video_size(coding, vm->hactive);
   262		Bpp_x100 = calc_bytes_per_pixel_x100(coding);
   263		video_size_step = calc_video_size_step(coding);
   264		ratio_x1000 = ctx->byte_clk * 1000 / (vm->pixelclock / 1000);
   265		hline = vm->hactive + vm->hsync_len + vm->hfront_porch +
   266			vm->hback_porch;
   267	
   268		dsi_power_enable(ctx, 0);
   269		dsi_dpi_frame_ack_en(ctx, ctx->frame_ack_en);
   270		dsi_dpi_color_coding(ctx, coding);
   271		dsi_dpi_video_burst_mode(ctx, ctx->burst_mode);
   272		dsi_dpi_sig_delay(ctx, 95 * hline * ratio_x1000 / 100000);
   273		dsi_dpi_hline_time(ctx, hline * ratio_x1000 / 1000);
   274		dsi_dpi_hsync_time(ctx, vm->hsync_len * ratio_x1000 / 1000);
   275		dsi_dpi_hbp_time(ctx, vm->hback_porch * ratio_x1000 / 1000);
   276		dsi_dpi_vact(ctx, vm->vactive);
   277		dsi_dpi_vfp(ctx, vm->vfront_porch);
   278		dsi_dpi_vbp(ctx, vm->vback_porch);
   279		dsi_dpi_vsync(ctx, vm->vsync_len);
   280		dsi_dpi_hporch_lp_en(ctx, 1);
   281		dsi_dpi_vporch_lp_en(ctx, 1);
   282	
   283		hs_to = (hline * vm->vactive) + (2 * Bpp_x100) / 100;
   284		for (div = 0x80; (div < hs_to) && (div > 2); div--) {
   285			if ((hs_to % div) == 0) {
   286				dsi_timeout_clock_division(ctx, div);
   287				dsi_lp_rx_timeout(ctx, hs_to / div);
   288				dsi_hs_tx_timeout(ctx, hs_to / div);
   289				break;
   290			}
   291		}
   292	
   293		if (ctx->burst_mode == VIDEO_BURST_WITH_SYNC_PULSES) {
   294			dsi_dpi_video_packet_size(ctx, video_size);
   295			dsi_dpi_null_packet_size(ctx, 0);
   296			dsi_dpi_chunk_num(ctx, 0);
   297		} else {
   298			/* non burst transmission */
   299			null_pkt_size = 0;
   300	
   301			/* bytes to be sent - first as one chunk */
   302			bytes_per_chunk = vm->hactive * Bpp_x100 / 100 + pkt_header;
   303	
   304			/* hline total bytes from the DPI interface */
   305			total_bytes = (vm->hactive + vm->hfront_porch) *
   306					ratio_x1000 / ctx->lanes / 1000;
   307	
   308			/* check if the pixels actually fit on the DSI link */
   309			if (total_bytes < bytes_per_chunk) {
   310				DRM_ERROR("current resolution can not be set\n");
   311				return -EINVAL;
   312			}
   313	
   314			chunk_overhead = total_bytes - bytes_per_chunk;
   315	
   316			/* overhead higher than 1 -> enable multi packets */
   317			if (chunk_overhead > 1) {
   318	
   319				/* multi packets */
   320				for (video_size = video_size_step;
   321				     video_size < vm->hactive;
   322				     video_size += video_size_step) {
   323	
   324					if (vm->hactive * 1000 / video_size % 1000)
   325						continue;
   326	
   327					chunks = vm->hactive / video_size;
   328					bytes_per_chunk = Bpp_x100 * video_size / 100
   329							  + pkt_header;
   330					if (total_bytes >= (bytes_per_chunk * chunks)) {
   331						bytes_left = total_bytes -
   332							     bytes_per_chunk * chunks;
   333						break;
   334					}
   335				}
   336	
   337				/* prevent overflow (unsigned - unsigned) */
   338				if (bytes_left > (pkt_header * chunks)) {
   339					null_pkt_size = (bytes_left -
   340							pkt_header * chunks) / chunks;
   341					/* avoid register overflow */
   342					if (null_pkt_size > 1023)
   343						null_pkt_size = 1023;
   344				}
   345	
   346			} else {
   347	
   348				/* single packet */
   349				chunks = 1;
   350	
   351				/* must be a multiple of 4 except 18 loosely */
   352				for (video_size = vm->hactive;
   353				    (video_size % video_size_step) != 0;
   354				     video_size++)
   355					;
   356			}
   357	
   358			dsi_dpi_video_packet_size(ctx, video_size);
   359			dsi_dpi_null_packet_size(ctx, null_pkt_size);
   360			dsi_dpi_chunk_num(ctx, chunks);
   361		}
   362	
   363		dsi_int0_mask(ctx, ctx->int0_mask);
   364		dsi_int1_mask(ctx, ctx->int1_mask);
   365		dsi_power_enable(ctx, 1);
   366	
   367		return 0;
   368	}
   369	
 > 370	void sprd_dsi_edpi_video(struct sprd_dsi *dsi)

371 {
372 struct dsi_context *ctx = &dsi->ctx;
373 const u32 fifo_depth = 1096;
374 const u32 word_length = 4;
375 u32 hactive = ctx->vm.hactive;
376 u32 Bpp_x100;
377 u32 max_fifo_len;
378 u8 coding;
379
380 coding = fmt_to_coding(ctx->format);
381 Bpp_x100 = calc_bytes_per_pixel_x100(coding);
382 max_fifo_len = word_length * fifo_depth * 100 / Bpp_x100;
383
384 dsi_power_enable(ctx, 0);
385 dsi_dpi_color_coding(ctx, coding);
386 dsi_tear_effect_ack_en(ctx, ctx->te_ack_en);
387
388 if (max_fifo_len > hactive)
389 dsi_edpi_max_pkt_size(ctx, hactive);
390 else
391 dsi_edpi_max_pkt_size(ctx, max_fifo_len);
392
393 dsi_int0_mask(ctx, ctx->int0_mask);
394 dsi_int1_mask(ctx, ctx->int1_mask);
395 dsi_power_enable(ctx, 1);
396 }
397

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#14 lore raw
In reply to Kevin Tang

Hi Kevin,

Quoted 8 lines

v7:
1. Fix DTC unit name warnings
2. Fix the problem of maintainers
3. Call drmm_mode_config_init to mode config init
4. Embed drm_device in sprd_drm and use devm_drm_dev_alloc
5. Replace DRM_XXX with drm_xxx on KMS module, but not suitable for other subsystems
6. Remove plane_update stuff, dpu handles all the HW update in crtc->atomic_flush
7. Dsi&Dphy Code structure adjustment, all move to "sprd/"

I can see some of my feedback from last round of review is not addressed. There were makefile fixes and then I asked for a high-level intro.

Can you please revisit last round of review feedback to check what was missed.

Sam

Quoted 62 lines

Kevin Tang (6):
dt-bindings: display: add Unisoc's drm master bindings drm/sprd: add Unisoc's drm kms master
dt-bindings: display: add Unisoc's dpu bindings drm/sprd: add Unisoc's drm display controller driver
dt-bindings: display: add Unisoc's mipi dsi&dphy bindings drm/sprd: add Unisoc's drm mipi dsi&dphy driver

 .../display/sprd/sprd,display-subsystem.yaml       |   39 +
 .../bindings/display/sprd/sprd,sharkl3-dpu.yaml    |   83 ++
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        |   98 ++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |   75 +
 drivers/gpu/drm/Kconfig                            |    2 +
 drivers/gpu/drm/Makefile                           |    1 +
 drivers/gpu/drm/sprd/Kconfig                       |   13 +
 drivers/gpu/drm/sprd/Makefile                      |   12 +
 drivers/gpu/drm/sprd/dpu_r2p0.c                    |  636 +++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl.c                 |  792 +++++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl.h                 | 1475 ++++++++++++++++++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c             |  276 ++++
 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h             |   34 +
 drivers/gpu/drm/sprd/megacores_pll.c               |  315 +++++
 drivers/gpu/drm/sprd/megacores_pll.h               |  146 ++
 drivers/gpu/drm/sprd/sprd_dphy.c                   |  335 +++++
 drivers/gpu/drm/sprd/sprd_dphy.h                   |   39 +
 drivers/gpu/drm/sprd/sprd_dpu.c                    |  501 +++++++
 drivers/gpu/drm/sprd/sprd_dpu.h                    |  217 +++
 drivers/gpu/drm/sprd/sprd_drm.c                    |  263 ++++
 drivers/gpu/drm/sprd/sprd_drm.h                    |   20 +
 drivers/gpu/drm/sprd/sprd_dsi.c                    | 1102 +++++++++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h                    |  105 ++
 23 files changed, 6579 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml
 create mode 100644 drivers/gpu/drm/sprd/Kconfig
 create mode 100644 drivers/gpu/drm/sprd/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dpu_r2p0.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl.h
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.c
 create mode 100644 drivers/gpu/drm/sprd/dw_dsi_ctrl_ppi.h
 create mode 100644 drivers/gpu/drm/sprd/megacores_pll.c
 create mode 100644 drivers/gpu/drm/sprd/megacores_pll.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h
 create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.c
 create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.h
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel