Skip to contentSkip to conversation

Add Unisoc's drm kms module

PATCH In review Kevin Tang 2 participants 13 messages Nov 30, 2020 – Dec 2, 2020

Subsystems (4)
lore
Share & tools
lore

Kevin Tang

author
#0 lore raw

cover Add Unisoc's drm kms module

ChangeList:
RFC 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

RFC 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

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

RFC 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

RFC 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

RFC 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

RFC 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/"

v0:
1. Remove dpu_core_ops stuff layer for sprd drtc driver, but dpu_layer need to keeping. Because all the HW update in crtc->atomic_flush, we need temporary storage all layers for the dpu pageflip of atomic_flush.
2. Add ports subnode with port@X.

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        |  107 ++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |   84 ++
 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                    |  598 ++++++++
 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                    |  457 ++++++
 drivers/gpu/drm/sprd/sprd_dpu.h                    |  175 +++
 drivers/gpu/drm/sprd/sprd_drm.c                    |  265 ++++
 drivers/gpu/drm/sprd/sprd_drm.h                    |   22 +
 drivers/gpu/drm/sprd/sprd_dsi.c                    | 1105 +++++++++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h                    |  105 ++
 23 files changed, 6480 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

PATCH 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

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 1/6] dt-bindings: display: add Unisoc's drm master bindings

Quoted 2 lines · Kevin Tang

From: Kevin Tang <[email protected]>

Once again, DT patches must Cc the DT list if you want them reviewed.

Quoted 28 lines

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

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 +9 -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:

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

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +10 -0
+  - 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

As I said before, we try to avoid these virtual nodes. Make the DRM driver bind to the DPU node.

The case where this might be needed is if you have h/w that's a mixture of shared and discrete blocks. I don't see anything here matching that.

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

author
#3 lore raw

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

Hi Rob

Quoted 6 lines · Rob Herring <[email protected]> 于2020年12月1日周二 上午4:29写道:
Quoted 2 lines · Kevin Tang

From: Kevin Tang <[email protected]>

Once again, DT patches must Cc the DT list if you want them reviewed.

Ok, i will add DT list to my Cc list.

Quoted 11 lines
Quoted 11 lines

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

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,display-subsystem.yaml       | 39

++++++++++++++++++++++

Quoted 2 lines
Quoted 2 lines
 1 file changed, 39 insertions(+)
 create mode 100644

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

Quoted 2 lines
Quoted 2 lines

diff --git

a/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml

Quoted 4 lines
Quoted 4 lines

new file mode 100644
index 0000000..9487a39
--- /dev/null
+++

b/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml

Quoted 5 lines

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

Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +4 -0
@@ -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#

Quoted 19 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +5 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:

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

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +10 -0
+  - 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

As I said before, we try to avoid these virtual nodes. Make the DRM driver bind to the DPU node.

Quoted 3 lines

The case where this might be needed is if you have h/w that's a mixture of shared and discrete blocks. I don't see anything here matching that.

This is how I understand this sentence: "h/w that's a mixture of shared and discrete blocks"
We have multiple display controllers and corresponding physical interfaces, typical dual-screen display scenario
E.g:
1. dpu0 and dpu1 both binding to DSI for dual mipi-dsi display;
2. dpu0 binding to DSI for primary display, and dpu1 binding to DP for external display;

It looks like this:
dpu0------>MIPI-DSI------>DPHY/CPHY Combo------>Panel0

                        ^
    ----------------|
    |

dpu1------>DisplayPort------>PHY------>Panel1

For DTS like this:
display-subsystem {
compatible = "sprd,display-subsystem";
ports = <&dpu0_out>, <&dpu1_out>;
};

But this is our first time submitting code to the community, following the suggestions of other reviewers, we only submitted a basic version. Other virtual nodes and corresponding drivers will be submitted later.

Quoted 2 lines

Rob

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

#4 lore raw

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

Quoted 69 lines · Kevin Tang

Hi Rob

Quoted 6 lines · Rob Herring <[email protected]> 于2020年12月1日周二 上午4:29写道:
Quoted 2 lines · Kevin Tang

From: Kevin Tang <[email protected]>

Once again, DT patches must Cc the DT list if you want them reviewed.

Ok, i will add DT list to my Cc list.

Quoted 43 lines
Quoted 29 lines

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

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 +9 -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:

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

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml new file +10 -0
+  - 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

As I said before, we try to avoid these virtual nodes. Make the DRM driver bind to the DPU node.

Quoted 3 lines

The case where this might be needed is if you have h/w that's a mixture of shared and discrete blocks. I don't see anything here matching that.

This is how I understand this sentence: "h/w that's a mixture of shared and discrete blocks" We have multiple display controllers and corresponding physical interfaces, typical dual-screen display scenario E.g:
1. dpu0 and dpu1 both binding to DSI for dual mipi-dsi display;
2. dpu0 binding to DSI for primary display, and dpu1 binding to DP for external display;

It looks like this:
dpu0------>MIPI-DSI------>DPHY/CPHY Combo------>Panel0

                        ^
    ----------------|
    |
Quoted 7 lines

dpu1------>DisplayPort------>PHY------>Panel1

For DTS like this:
display-subsystem {
compatible = "sprd,display-subsystem";
ports = <&dpu0_out>, <&dpu1_out>;
};

Yeah, this would be one such case. Just make this scenario clear in commit message.

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

author
#5 lore raw

PATCH 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.

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 8156900..d3001e7 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
#6 lore raw

PATCH 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.

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
#7 lore raw

PATCH 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.

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 | 598 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.c | 457 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.h | 175 ++++++++++++
 drivers/gpu/drm/sprd/sprd_drm.c |   1 +
 drivers/gpu/drm/sprd/sprd_drm.h |   2 +
 7 files changed, 1238 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 +598 -0

598 lines not on this page · raw message

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

457 lines not on this page · raw message

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

175 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
#8 lore raw

PATCH 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.

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 107 +++++++++++++++++++++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |  84 ++++++++++++++++
 2 files changed, 191 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 +107 -0
new file mode 100644
index 0000000..fe0e89d
@@ -0,0 +1,107 @@
+# 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
+
+  ports:
+    type: object
+
+    properties:
+      "#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:
+      - "#address-cells"
+      - "#size-cells"
+      - port@0
+      - port@1
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+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>;
+        ports {
+            #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 +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.7.4
#9 lore raw

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

Quoted 163 lines · Kevin Tang

From: Kevin Tang <[email protected]>

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

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 107 +++++++++++++++++++++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |  84 ++++++++++++++++
 2 files changed, 191 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 +107 -0
new file mode 100644
index 0000000..fe0e89d
@@ -0,0 +1,107 @@
+# 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
+
+  ports:
+    type: object
+
+    properties:
+      "#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:
+      - "#address-cells"
+      - "#size-cells"
+      - port@0
+      - port@1
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+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>;
+        ports {
+            #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 +28 -0
new file mode 100644
index 0000000..b4715d5
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dsi-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI-PHY (D-PHY)
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-phy
+
+  reg:
+    maxItems: 1
+    description:
+      Must be the dsi controller base address.
+
+  ports:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":

Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml line 38

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml new file +10 -0
+        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 output endpoint, usually output to
+          the associated panel.
+      port@1:

For PHYs, we use the PHY binding, not the graph binding. Please follow what practically every other DSI PHY does.

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

author
#10 lore raw

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

Hi Rob,

Quoted 182 lines · Rob Herring <[email protected]> 于2020年12月1日周二 上午4:31写道:
Quoted 11 lines · Kevin Tang

From: Kevin Tang <[email protected]>

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

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 107

+++++++++++++++++++++

Quoted 1 line
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |  84

++++++++++++++++

Quoted 2 lines
 2 files changed, 191 insertions(+)
 create mode 100644

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

Quoted 1 line
 create mode 100644

Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml

Quoted 2 lines

diff --git

a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml

Quoted 4 lines

new file mode 100644
index 0000000..fe0e89d
--- /dev/null
+++

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

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

Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +4 -0
@@ -0,0 +1,107 @@
+# 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#

Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +5 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI Controller
+
+maintainers:

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

Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +10 -0
+  - 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.

Quoted 88 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +88 -0
+
+  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
+
+  ports:
+    type: object
+
+    properties:
+      "#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:
+      - "#address-cells"
+      - "#size-cells"
+      - port@0
+      - port@1
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+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>;
+        ports {
+            #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>;
+                };
+            };
+        };
+    };
Quoted 1 line

diff --git

a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml

Quoted 4 lines

new file mode 100644
index 0000000..b4715d5
--- /dev/null
+++

b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml

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

Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml new file +4 -0
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:

http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dsi-phy.yaml#

Quoted 29 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml new file +29 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI-PHY (D-PHY)
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-phy
+
+  reg:
+    maxItems: 1
+    description:
+      Must be the dsi controller base address.
+
+  ports:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+      port@0:
+        type: object
+        description:
Quoted 9 lines

Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml new file +5 -0
+          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 panel.
+      port@1:

For PHYs, we use the PHY binding, not the graph binding. Please follow what practically every other DSI PHY does.

It seems that the dphy driver does not need to exist alone, so i remove dphy and dsi graph binding, merge the dphy driver into the dsi driver.

Quoted 3 lines

Rob

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

#11 lore raw

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

Quoted 183 lines · Kevin Tang

Hi Rob,

Quoted 170 lines · Rob Herring <[email protected]> 于2020年12月1日周二 上午4:31写道:
Quoted 168 lines · Kevin Tang

From: Kevin Tang <[email protected]>

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

Cc Orson Zhai <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../display/sprd/sprd,sharkl3-dsi-host.yaml        | 107 +++++++++++++++++++++
 .../display/sprd/sprd,sharkl3-dsi-phy.yaml         |  84 ++++++++++++++++
 2 files changed, 191 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 +107 -0
new file mode 100644
index 0000000..fe0e89d
@@ -0,0 +1,107 @@
+# 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
+
+  ports:
+    type: object
+
+    properties:
+      "#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:
+      - "#address-cells"
+      - "#size-cells"
+      - port@0
+      - port@1
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+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>;
+        ports {
+            #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 +33 -0
new file mode 100644
index 0000000..b4715d5
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dsi-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI-PHY (D-PHY)
+
+maintainers:
+  - Kevin Tang <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-phy
+
+  reg:
+    maxItems: 1
+    description:
+      Must be the dsi controller base address.
+
+  ports:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+      port@0:
+        type: object
+        description:
Quoted 8 lines

Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-phy.yaml new file +5 -0
+          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 panel.
+      port@1:

For PHYs, we use the PHY binding, not the graph binding. Please follow what practically every other DSI PHY does.

Quoted 1 line

It seems that the dphy driver does not need to exist alone, so i remove dphy and dsi graph binding, merge the dphy driver into the dsi driver.

Maybe not now, but what about in the future? PHYs tend to change with every process node and digital blocks like the DSI controller may not.

If the DPHY is a separate h/w block then it should be a separate node in the DT. Whether you have 1 driver or 2 is independent of the DT binding. Drivers and DT nodes don't have to be 1:1. It's just convenient when they are.

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

author
#12 lore raw

PATCH 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_drm.c        |   42 +
 drivers/gpu/drm/sprd/sprd_drm.h        |    4 +
 drivers/gpu/drm/sprd/sprd_dsi.c        | 1105 ++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h        |  105 +++
 13 files changed, 4675 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..7b78c6d

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

drivers/gpu/drm/sprd/sprd_drm.c +42 -0

42 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_drm.h +4 -0
index 85d4a8b..29361e6 100644

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

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

1,105 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.