Skip to contentSkip to conversation

Add Unisoc's drm kms module

RFC PATCH Superseded Kevin Tang 2 participants 9 messages Mar 13, 2020 – Jul 28, 2020

Subsystems (4)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Kevin Tang

author
#0 lore raw

v5 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

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

 .../devicetree/bindings/display/sprd/dphy.yaml     |   75 +
 .../devicetree/bindings/display/sprd/dpu.yaml      |   82 ++
 .../devicetree/bindings/display/sprd/drm.yaml      |   36 +
 .../devicetree/bindings/display/sprd/dsi.yaml      |   98 ++
 drivers/gpu/drm/Kconfig                            |    2 +
 drivers/gpu/drm/Makefile                           |    1 +
 drivers/gpu/drm/sprd/Kconfig                       |   12 +
 drivers/gpu/drm/sprd/Makefile                      |   13 +
 drivers/gpu/drm/sprd/disp_lib.c                    |   57 +
 drivers/gpu/drm/sprd/disp_lib.h                    |   16 +
 drivers/gpu/drm/sprd/dphy/Makefile                 |    7 +
 drivers/gpu/drm/sprd/dphy/pll/Makefile             |    3 +
 drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c  |  473 +++++++
 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c          |  201 +++
 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.h          |   22 +
 drivers/gpu/drm/sprd/dpu/Makefile                  |    7 +
 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c                |  750 ++++++++++
 drivers/gpu/drm/sprd/dsi/Makefile                  |    8 +
 drivers/gpu/drm/sprd/dsi/core/Makefile             |    4 +
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c      |  964 +++++++++++++
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h      | 1477 ++++++++++++++++++++
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c  |  328 +++++
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.h  |   32 +
 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c            |  590 ++++++++
 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h            |   26 +
 drivers/gpu/drm/sprd/sprd_dphy.c                   |  209 +++
 drivers/gpu/drm/sprd/sprd_dphy.h                   |   50 +
 drivers/gpu/drm/sprd/sprd_dpu.c                    |  526 +++++++
 drivers/gpu/drm/sprd/sprd_dpu.h                    |  173 +++
 drivers/gpu/drm/sprd/sprd_drm.c                    |  227 +++
 drivers/gpu/drm/sprd/sprd_drm.h                    |   18 +
 drivers/gpu/drm/sprd/sprd_dsi.c                    |  571 ++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h                    |  108 ++
 33 files changed, 7166 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/dphy.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/dpu.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/drm.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/dsi.yaml
 create mode 100644 drivers/gpu/drm/sprd/Kconfig
 create mode 100644 drivers/gpu/drm/sprd/Makefile
 create mode 100644 drivers/gpu/drm/sprd/disp_lib.c
 create mode 100644 drivers/gpu/drm/sprd/disp_lib.h
 create mode 100644 drivers/gpu/drm/sprd/dphy/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dphy/pll/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c
 create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c
 create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.h
 create mode 100644 drivers/gpu/drm/sprd/dpu/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.h
 create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.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 v5 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../devicetree/bindings/display/sprd/drm.yaml      | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/drm.yaml
Documentation/devicetree/bindings/display/sprd/drm.yaml new file +36 -0
new file mode 100644
index 0000000..b5792c0
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/drm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc DRM master device
+
+maintainers:
+  - Mark Rutland <[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:
+    description:
+      Should contain a list of phandles pointing to display interface port
+      of DPU devices.
+
+required:
+  - compatible
+  - ports
+
+examples:
+  - |
+    display-subsystem {
+        compatible = "sprd,display-subsystem";
+        ports = <&dpu_out>;
+    };
+
Signature · 1 line
2.7.4
author
#2 lore raw

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

In reply to Kevin Tang

From: Kevin Tang <[email protected]>

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 Baolin Wang <[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 | 226 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_drm.h |  16 +++
 6 files changed, 262 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 d0aa6cf..ce76a4d 100644
@@ -389,6 +389,8 @@ source "drivers/gpu/drm/aspeed/Kconfig"
 
 source "drivers/gpu/drm/mcde/Kconfig"
 
+source "drivers/gpu/drm/sprd/Kconfig"
+
 # Keep legacy drivers last
 
 menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
index 6493088..2178577 100644
@@ -122,3 +122,4 @@ obj-$(CONFIG_DRM_LIMA)  += lima/
 obj-$(CONFIG_DRM_PANFROST) += panfrost/
 obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/
 obj-$(CONFIG_DRM_MCDE) += mcde/
+obj-$(CONFIG_DRM_SPRD) += sprd/
drivers/gpu/drm/sprd/Kconfig new file +12 -0
new file mode 100644
index 0000000..b189a54
@@ -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 chipsets.
+	  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 +226 -0

226 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_drm.h new file +16 -0
new file mode 100644
index 0000000..edf0881
@@ -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
#3 lore raw

RFC PATCH v5 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../devicetree/bindings/display/sprd/dpu.yaml      | 82 ++++++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/dpu.yaml
Documentation/devicetree/bindings/display/sprd/dpu.yaml new file +82 -0
new file mode 100644
index 0000000..54ba9b6f
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/dpu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc SoC Display Processor Unit (DPU)
+
+maintainers:
+  - Mark Rutland <[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:
+    description: A phandle to DPU power domain node.
+
+  iommus:
+    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@0x63000000 {
+          compatible = "sprd,sharkl3-dpu";
+          reg = <0x0 0x63000000 0x0 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
#4 lore raw

RFC PATCH v5 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 drivers/gpu/drm/sprd/Makefile       |   5 +-
 drivers/gpu/drm/sprd/dpu/Makefile   |   7 +
 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 750 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.c     | 501 ++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.h     | 170 ++++++++
 drivers/gpu/drm/sprd/sprd_drm.c     |   1 +
 drivers/gpu/drm/sprd/sprd_drm.h     |   2 +
 7 files changed, 1435 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sprd/dpu/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dpu/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/Makefile +4 -1
index 86d95d9..88ab32a 100644
@@ -2,4 +2,7 @@
 
 subdir-ccflags-y += -I$(srctree)/$(src)
 
-obj-y := sprd_drm.o
+obj-y := sprd_drm.o \
+	sprd_dpu.o
+
+obj-y += dpu/
drivers/gpu/drm/sprd/dpu/Makefile new file +7 -0
new file mode 100644
index 0000000..73bd497
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+ifdef CONFIG_ARM64
+KBUILD_CFLAGS += -mstrict-align
+endif
+
+obj-y += dpu_r2p0.o
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +750 -0

750 lines not on this page · raw message

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

501 lines not on this page · raw message

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

170 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_drm.c +1 -0
index 4706185..200020f 100644
@@ -200,6 +200,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 edf0881..3c32f3a 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
#5 lore raw

Re: [PATCH RFC v5 4/6] drm/sprd: add Unisoc's drm display controller driver

Hey Kevin,

Quoted 8 lines · 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
Quoted 8 lines
---
 drivers/gpu/drm/sprd/Makefile       |   5 +-
 drivers/gpu/drm/sprd/dpu/Makefile   |   7 +
 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 750 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.c     | 501 ++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.h     | 170 ++++++++
 drivers/gpu/drm/sprd/sprd_drm.c     |   1 +
 drivers/gpu/drm/sprd/sprd_drm.h     |   2 +

Seems like v5 (patch at least, I did not look at the rest) does not address a handful of the feedback.
- Access registers via readl/writel, instead of current approach
- With ^^ you can drop the compiler workaround
- Checking for unsupported KMS properties (format, rotation, etc)
should happen in the XXX_check callbacks
- Remove always true checks, around the (rather moot) abstraction layer

For the future, please keep the revision/changelog within the corresponding patch. This way reviewers can see, from the onset, what is addressed.
Look at git log -- drivers/gpu/drm for examples.

-Emil

author
#6 lore raw

Re: [PATCH RFC v5 4/6] drm/sprd: add Unisoc's drm display controller driver

Hi Emil,
Sorry, I left for a long time because of other things. Now i'm back~

V6 fix access registers via readl/writel, check unsupported KMS properties (format, rotation, blend mode, etc) by plane_check callback ops
and remove always true checks for dpu core ops

Add changelog within the corresponding patch from now on, thanks for your advice.

BR,
Kevin

Quoted 36 lines · Emil Velikov <[email protected]> 于2020年3月20日周五 上午2:07写道:

Hey Kevin,

Quoted 8 lines · 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
Quoted 8 lines
---
 drivers/gpu/drm/sprd/Makefile       |   5 +-
 drivers/gpu/drm/sprd/dpu/Makefile   |   7 +
 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 750 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.c     | 501 ++++++++++++++++++++++++
 drivers/gpu/drm/sprd/sprd_dpu.h     | 170 ++++++++
 drivers/gpu/drm/sprd/sprd_drm.c     |   1 +
 drivers/gpu/drm/sprd/sprd_drm.h     |   2 +

Seems like v5 (patch at least, I did not look at the rest) does not address a handful of the feedback.
- Access registers via readl/writel, instead of current approach
- With ^^ you can drop the compiler workaround
- Checking for unsupported KMS properties (format, rotation, etc)
should happen in the XXX_check callbacks
- Remove always true checks, around the (rather moot) abstraction layer

For the future, please keep the revision/changelog within the corresponding patch. This way reviewers can see, from the onset, what is addressed.
Look at git log -- drivers/gpu/drm for examples.

-Emil

author
#7 lore raw

RFC PATCH v5 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 .../devicetree/bindings/display/sprd/dphy.yaml     | 75 +++++++++++++++++
 .../devicetree/bindings/display/sprd/dsi.yaml      | 98 ++++++++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sprd/dphy.yaml
 create mode 100644 Documentation/devicetree/bindings/display/sprd/dsi.yaml
Documentation/devicetree/bindings/display/sprd/dphy.yaml new file +75 -0
new file mode 100644
index 0000000..1b83260
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sprd/dphy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unisoc MIPI DSI-PHY (D-PHY)
+
+maintainers:
+  - Mark Rutland <[email protected]>
+
+properties:
+  compatible:
+    const: sprd,sharkl3-dsi-phy
+
+  reg:
+    maxItems: 1
+    description:
+      Must be the dsi controller base address.
+
+  "#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 output endpoint, usually output to
+      the associated panel.
+  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 input endpoint, usually coming from
+      the associated DSI controller.
+
+required:
+  - compatible
+  - reg
+  - port@0
+  - port@1
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    dphy: dphy {
+        compatible = "sprd,sharkl3-dsi-phy";
+        reg = <0x0 0x63100000 0x0 0x1000>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        /* input port*/
+        port@1 {
+            reg = <1>;
+            dphy_in: endpoint {
+    	          remote-endpoint = <&dsi_out>;
+            };
+        };
+
+        /* output port */
+        port@0 {
+    	      reg = <0>;
+    	      dphy_out: endpoint {
+    		        remote-endpoint = <&panel_in>;
+    	      };
+        };
+    };
Documentation/devicetree/bindings/display/sprd/dsi.yaml new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#8 lore raw

RFC PATCH v5 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 Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
---
 drivers/gpu/drm/sprd/Makefile                     |    7 +-
 drivers/gpu/drm/sprd/disp_lib.c                   |   57 +
 drivers/gpu/drm/sprd/disp_lib.h                   |   16 +
 drivers/gpu/drm/sprd/dphy/Makefile                |    7 +
 drivers/gpu/drm/sprd/dphy/pll/Makefile            |    3 +
 drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c |  473 +++++++
 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c         |  201 +++
 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.h         |   22 +
 drivers/gpu/drm/sprd/dsi/Makefile                 |    8 +
 drivers/gpu/drm/sprd/dsi/core/Makefile            |    4 +
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c     |  964 ++++++++++++++
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h     | 1477 +++++++++++++++++++++
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c |  328 +++++
 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.h |   32 +
 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c           |  590 ++++++++
 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h           |   26 +
 drivers/gpu/drm/sprd/sprd_dphy.c                  |  209 +++
 drivers/gpu/drm/sprd/sprd_dphy.h                  |   50 +
 drivers/gpu/drm/sprd/sprd_dpu.c                   |   25 +
 drivers/gpu/drm/sprd/sprd_dpu.h                   |    3 +
 drivers/gpu/drm/sprd/sprd_dsi.c                   |  571 ++++++++
 drivers/gpu/drm/sprd/sprd_dsi.h                   |  108 ++
 22 files changed, 5180 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sprd/disp_lib.c
 create mode 100644 drivers/gpu/drm/sprd/disp_lib.h
 create mode 100644 drivers/gpu/drm/sprd/dphy/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dphy/pll/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c
 create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c
 create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.h
 create mode 100644 drivers/gpu/drm/sprd/dsi/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/Makefile
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.h
 create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c
 create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.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 +6 -1
index 88ab32a..c78565d 100644
@@ -3,6 +3,11 @@
 subdir-ccflags-y += -I$(srctree)/$(src)
 
 obj-y := sprd_drm.o \
-	sprd_dpu.o
+	sprd_dpu.o \
+	sprd_dsi.o \
+	sprd_dphy.o
 
+obj-y += disp_lib.o
 obj-y += dpu/
+obj-y += dsi/
+obj-y += dphy/
drivers/gpu/drm/sprd/disp_lib.c new file +57 -0

57 lines not on this page · raw message

drivers/gpu/drm/sprd/disp_lib.h new file +16 -0
new file mode 100644
index 0000000..adbd239
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 Unisoc Inc.
+ */
+
+#ifndef _DISP_LIB_H_
+#define _DISP_LIB_H_
+
+#include <linux/list.h>
+#include <drm/drm_print.h>
+
+struct device *sprd_disp_pipe_get_by_port(struct device *dev, int port);
+struct device *sprd_disp_pipe_get_input(struct device *dev);
+struct device *sprd_disp_pipe_get_output(struct device *dev);
+
+#endif /* _DISP_LIB_H_ */
drivers/gpu/drm/sprd/dphy/Makefile new file +7 -0
new file mode 100644
index 0000000..6637c27
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+subdir-ccflags-y += -I$(srctree)/$(src)
+
+obj-y := sprd_dphy_api.o
+
+obj-y += pll/
drivers/gpu/drm/sprd/dphy/pll/Makefile new file +3 -0
new file mode 100644
index 0000000..59e74ec
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += megacores_sharkle.o
drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c new file +473 -0

473 lines not on this page · raw message

drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c new file +201 -0

201 lines not on this page · raw message

drivers/gpu/drm/sprd/dphy/sprd_dphy_api.h new file +22 -0
new file mode 100644
index 0000000..5def380
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 Unisoc Inc.
+ */
+
+#ifndef _SPRD_DPHY_API_H_
+#define _SPRD_DPHY_API_H_
+
+#include "sprd_dphy.h"
+
+int sprd_dphy_power_on(struct sprd_dphy *dphy);
+void sprd_dphy_power_off(struct sprd_dphy *dphy);
+void sprd_dphy_data_ulps_enter(struct sprd_dphy *dphy);
+void sprd_dphy_data_ulps_exit(struct sprd_dphy *dphy);
+void sprd_dphy_clk_ulps_enter(struct sprd_dphy *dphy);
+void sprd_dphy_clk_ulps_exit(struct sprd_dphy *dphy);
+void sprd_dphy_force_pll(struct sprd_dphy *dphy, bool enable);
+void sprd_dphy_hs_clk_en(struct sprd_dphy *dphy, bool enable);
+void sprd_dphy_test_write(struct sprd_dphy *dphy, u8 address, u8 data);
+u8 sprd_dphy_test_read(struct sprd_dphy *dphy, u8 address);
+
+#endif /* _SPRD_DPHY_API_H_ */
\ No newline at end of file
drivers/gpu/drm/sprd/dsi/Makefile new file +8 -0
new file mode 100644
index 0000000..d95189c
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+
+subdir-ccflags-y += -I$(srctree)/$(src)
+
+obj-y += sprd_dsi_api.o
+
+obj-y += core/
+
drivers/gpu/drm/sprd/dsi/core/Makefile new file +4 -0
new file mode 100644
index 0000000..41f6477
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += dsi_ctrl_r1p0.o dsi_ctrl_r1p0_ppi.o
+
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c new file +964 -0

964 lines not on this page · raw message

drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h new file +1477 -0

1,232 lines not on this page · raw message

drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c new file +328 -0

328 lines not on this page · raw message

drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.h new file +32 -0
new file mode 100644
index 0000000..7477604

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

drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c new file +590 -0

590 lines not on this page · raw message

drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h new file +26 -0
new file mode 100644
index 0000000..91eef86

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

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

209 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dphy.h new file +50 -0

50 lines not on this page · raw message

drivers/gpu/drm/sprd/sprd_dpu.c +25 -0
index 241b0af..a270887 100644

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

drivers/gpu/drm/sprd/sprd_dpu.h +3 -0
index e50b8b6..4ed6d5d 100644

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

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

571 lines not on this page · raw message

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

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