MT8173 DRM support
Subsystems (6)
cover MT8173 DRM support
MT8173 DRM include one master drm device and three sub device: dsi device, crtc main device, and ddp device.
Master drm device control the drm sub device and memory management. dsi device is a drm connector/encoder device which control MIPI/DSI hw block. crtc main is a drm crtc device which control hw components in the display data path.
ddp is a device which control display data path.
Display data path of crtc main is:
[OVL0] -> [COLOR0] -> [AAL] -> [OD] -> [UFOE] -> [RDMA0]
This patch depends on the other patches:
1. MT8173 IOMMU support
http://lists.infradead.org/pipermail/linux-mediatek/2015-March/000058.html 2. add IOMMU dma_ops cherry picked from git://linux-arm.org/linux-rm iommu/dma commit d76a1911b02185bdc5f8b5525f9228cf266725c5
CK Hu (2):
dt-bindings: drm/mediatek: Add Mediatek DRM dts binding drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.
.../bindings/drm/mediatek/mediatek,crtc-main.txt | 38 + .../bindings/drm/mediatek/mediatek,ddp.txt | 22 + .../bindings/drm/mediatek/mediatek,drm.txt | 27 + .../bindings/drm/mediatek/mediatek,dsi.txt | 20 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/mediatek/Kconfig | 28 + drivers/gpu/drm/mediatek/Makefile | 13 + drivers/gpu/drm/mediatek/mediatek_drm_crtc.c | 246 ++++ drivers/gpu/drm/mediatek/mediatek_drm_crtc.h | 80 ++ drivers/gpu/drm/mediatek/mediatek_drm_crtc_main.c | 420 ++++++ drivers/gpu/drm/mediatek/mediatek_drm_ddp.c | 202 +++ drivers/gpu/drm/mediatek/mediatek_drm_ddp.h | 23 + drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.c | 346 +++++ drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.h | 33 + drivers/gpu/drm/mediatek/mediatek_drm_drv.c | 369 ++++++ drivers/gpu/drm/mediatek/mediatek_drm_drv.h | 37 + drivers/gpu/drm/mediatek/mediatek_drm_dsi.c | 1333 ++++++++++++++++++++ drivers/gpu/drm/mediatek/mediatek_drm_dsi.h | 71 ++ drivers/gpu/drm/mediatek/mediatek_drm_fb.c | 339 +++++ drivers/gpu/drm/mediatek/mediatek_drm_fb.h | 43 + drivers/gpu/drm/mediatek/mediatek_drm_gem.c | 315 +++++ drivers/gpu/drm/mediatek/mediatek_drm_gem.h | 94 ++ include/uapi/drm/mediatek_drm.h | 59 + 24 files changed, 4161 insertions(+) create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt create mode 100644 drivers/gpu/drm/mediatek/Kconfig create mode 100644 drivers/gpu/drm/mediatek/Makefile create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_crtc.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_crtc.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_crtc_main.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_drv.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_drv.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_dsi.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_dsi.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_fb.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_fb.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_gem.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_gem.h create mode 100644 include/uapi/drm/mediatek_drm.h
Signature · 7 lines
1.8.1.1.dirty -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC PATCH 1/2 dt-bindings: drm/mediatek: Add Mediatek DRM dts binding
This patch includes
1. Mediatek DRM Device binding
2. Mediatek DSI Device binding
3. Mediatek CRTC Main Device binding
4. Mediatek DDP Device binding
--- .../bindings/drm/mediatek/mediatek,crtc-main.txt | 38 ++++++++++++++++++++++ .../bindings/drm/mediatek/mediatek,ddp.txt | 22 +++++++++++++ .../bindings/drm/mediatek/mediatek,drm.txt | 27 +++++++++++++++ .../bindings/drm/mediatek/mediatek,dsi.txt | 20 ++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +38 -0
@@ -0,0 +1,38 @@ +Mediatek CRTC Main Device +================================ + +The Mediatek CRTC Main device is a crtc device of DRM system. + +Required properties: +- compatible: "mediatek,<chip>-crtc-main" +- interrupts: The interrupt signal from the CRTC Main block. +- reg: Physical base address and length of the controller's registers +- clocks: device clocks + See Documentation/devicetree/bindings/clock/clock-bindings.txt for details. +- ddp: phandle of ddp device which control display data path. + +Example: + +crtc_main: crtc@1400c000 { + compatible = "mediatek,mt8173-crtc-main"; + interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_LOW>; + reg = <0 0x1400c000 0 0x1000>, /* OVL0 */ + <0 0x1400e000 0 0x1000>, /* RDMA0 */ + <0 0x14013000 0 0x1000>, /* COLOR0 */ + <0 0x14015000 0 0x1000>, /* AAL */ + <0 0x1401a000 0 0x1000>, /* UFOE */ + <0 0x14023000 0 0x1000>; /* OD */ + clocks = <&mmsys MM_DISP_OVL0>, + <&mmsys MM_DISP_RDMA0>, + <&mmsys MM_DISP_COLOR0>, + <&mmsys MM_DISP_AAL>, + <&mmsys MM_DISP_UFOE>, + <&mmsys MM_DISP_OD>; + clock-names = "ovl0_disp", + "rdma0_disp", + "color0_disp", + "aal_disp", + "ufoe_disp", + "od_disp"; + ddp = <&ddp>; +};
Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt new file +22 -0
@@ -0,0 +1,22 @@ +Mediatek DDP Device +================================ + +The Mediatek DDP device control the display data path. + +Required properties: +- compatible: "mediatek,<chip>-ddp" +- reg: Physical base address and length of the controller's registers +- power-domains: a phandle to DDP power domain node. +- clocks: device clocks + See Documentation/devicetree/bindings/clock/clock-bindings.txt for details. + +Example: + +ddp: ddp@14000000 { + compatible = "mediatek,mt8173-ddp"; + reg = <0 0x14000000 0 0x100>, /* CONFIG */ + <0 0x14020000 0 0x1000>; /* MUTEX */ + power-domains = <&scpsys MT8173_POWER_DOMAIN_DIS>; + clocks = <&mmsys MM_MUTEX_32K>; + clock-names = "mutex_disp"; +};
Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt new file +27 -0
@@ -0,0 +1,27 @@ +Mediatek DRM Device +================================ + +The Mediatek DRM device is a device needed to list all +display component nodes that comprise the display subsystem. +And it list the memory-related interface. + +Required properties: +- compatible: "mediatek,<chip>-drm" +- larb: Should contain a list of phandles pointing to larb device. + larb definitions as defined in + Documentation/devicetree/bindings/soc/mediatek/mediatek,smi-larb.txt +- iommus: required a iommu node +- connectors: Should contain a list of phandles pointing to connector device. + connector device should be one component of this master. +- crtcs: Should contain a list of phandles pointing to crtc device. + crtc device should be one component of this master. + +Example: + +drm0: drm { + compatible = "mediatek,mt8173-drm"; + larb = <&larb0>; + iommus = <&iommu M4U_PORT_DISP_OVL0>; + connectors = <&dsi>; + crtcs = <&crtc_main>; +};
Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt new file +20 -0
@@ -0,0 +1,20 @@ +Mediatek DSI Device +================================ + +The Mediatek DSI device is a connector device of DRM system. + +Required properties: +- compatible: "mediatek,<chip>-dsi" +- reg: Physical base address and length of the controller's registers +- clocks: device clocks + See Documentation/devicetree/bindings/clock/clock-bindings.txt for details. + +Example: + +dsi: dsi@10215000 { + compatible = "mediatek,mt8173-dsi"; + reg = <0 0x1401B000 0 0x1000>, /* DSI0 */ + <0 0x10215000 0 0x1000>; /* MIPITX */ + clocks = <&mmsys MM_DSI0_ENGINE>, <&mmsys MM_DSI0_DIGITAL>; + clock-names = "dsi0_engine_disp_ck", "dsi0_digital_disp_ck"; +};
Signature · 1 line
1.8.1.1.dirty
RFC PATCH 2/2 drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.
In reply to CK HuThis patch is a DRM Driver for Mediatek SoC MT8173. Now support one crtc with MIPI DSI interface.
We used GEM framework for buffer management and use iommu for physically non-continuous memory.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/mediatek/Kconfig | 28 + drivers/gpu/drm/mediatek/Makefile | 13 + drivers/gpu/drm/mediatek/mediatek_drm_crtc.c | 246 ++++ drivers/gpu/drm/mediatek/mediatek_drm_crtc.h | 80 ++ drivers/gpu/drm/mediatek/mediatek_drm_crtc_main.c | 420 +++++++ drivers/gpu/drm/mediatek/mediatek_drm_ddp.c | 202 ++++ drivers/gpu/drm/mediatek/mediatek_drm_ddp.h | 23 + drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.c | 346 ++++++ drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.h | 33 + drivers/gpu/drm/mediatek/mediatek_drm_drv.c | 369 ++++++ drivers/gpu/drm/mediatek/mediatek_drm_drv.h | 37 + drivers/gpu/drm/mediatek/mediatek_drm_dsi.c | 1333 +++++++++++++++++++++ drivers/gpu/drm/mediatek/mediatek_drm_dsi.h | 71 ++ drivers/gpu/drm/mediatek/mediatek_drm_fb.c | 339 ++++++ drivers/gpu/drm/mediatek/mediatek_drm_fb.h | 43 + drivers/gpu/drm/mediatek/mediatek_drm_gem.c | 315 +++++ drivers/gpu/drm/mediatek/mediatek_drm_gem.h | 94 ++ include/uapi/drm/mediatek_drm.h | 59 + 20 files changed, 4054 insertions(+) create mode 100644 drivers/gpu/drm/mediatek/Kconfig create mode 100644 drivers/gpu/drm/mediatek/Makefile create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_crtc.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_crtc.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_crtc_main.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_drv.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_drv.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_dsi.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_dsi.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_fb.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_fb.h create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_gem.c create mode 100644 drivers/gpu/drm/mediatek/mediatek_drm_gem.h create mode 100644 include/uapi/drm/mediatek_drm.h
drivers/gpu/drm/Kconfig +2 -0
@@ -217,3 +217,5 @@ source "drivers/gpu/drm/sti/Kconfig" source "drivers/gpu/drm/amd/amdkfd/Kconfig" source "drivers/gpu/drm/imx/Kconfig" + +source "drivers/gpu/drm/mediatek/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -67,6 +67,7 @@ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ obj-$(CONFIG_DRM_STI) += sti/ obj-$(CONFIG_DRM_IMX) += imx/ +obj-$(CONFIG_DRM_MEDIATEK) += mediatek/ obj-y += i2c/ obj-y += panel/ obj-y += bridge/
drivers/gpu/drm/mediatek/Kconfig new file +28 -0
@@ -0,0 +1,28 @@ +config DRM_MEDIATEK + tristate "DRM Support for Mediatek SoCs" + depends on DRM + depends on ARCH_MEDIATEK || (ARM && COMPILE_TEST) + select MTK_SMI + select DRM_PANEL + select DRM_MIPI_DSI + select DRM_PANEL_SIMPLE + select DRM_KMS_HELPER + select IOMMU_DMA + help + Choose this option if you have a Mediatek SoCs. + The module will be called mediatek-drm + This driver provides kernel mode setting and + buffer management to userspace. + +config DRM_MEDIATEK_FBDEV + bool "Enable legacy fbdev support for Mediatek DRM" + depends on DRM_MEDIATEK + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_KMS_FB_HELPER + help + Choose this option if you have a need for the legacy + fbdev support. Note that this support also provides + the Linux console on top of the Mediatek DRM mode + setting driver.
drivers/gpu/drm/mediatek/Makefile new file +13 -0
@@ -0,0 +1,13 @@ +mediatek-drm-objs := mediatek_drm_drv.o \ + mediatek_drm_crtc.o \ + mediatek_drm_fb.o \ + mediatek_drm_gem.o \ + mediatek_drm_dsi.o \ + mediatek_drm_ddp.o \ + mediatek_drm_ddp_comp.o \ + mediatek_drm_crtc_main.o + +obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o + +ccflags-y += \ + -Idrivers/gpu/drm
drivers/gpu/drm/mediatek/mediatek_drm_crtc.c new file +246 -0
246 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_crtc.h new file +80 -0
80 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_crtc_main.c new file +420 -0
420 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_ddp.c new file +202 -0
202 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_ddp.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (c) 2015 MediaTek Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _MEDIATEK_DRM_DDP_H_ +#define _MEDIATEK_DRM_DDP_H_ + +void mediatek_ddp_main_path_setup (struct device *dev); + +void mediatek_ddp_clock_on (struct device *dev); + + +#endif +
drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.c new file +346 -0
346 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_ddp_comp.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright (c) 2015 MediaTek Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _MEDIATEK_DRM_DDP_COMP_H_ +#define _MEDIATEK_DRM_DDP_COMP_H_ + + +void mediatek_od_enable_vblank (void __iomem *drm_disp_base); +void mediatek_od_disable_vblank (void __iomem *drm_disp_base); +void mediatek_od_clear_vblank (void __iomem *drm_disp_base); +void mediatek_ovl_layer_config (void __iomem *ovl_base,bool enabled, +unsigned int addr,unsigned int width,unsigned int height, +unsigned int pitch,unsigned int format); + +void main_disp_path_power_on (void __iomem *ovl_base, +void __iomem *rdma_base,void __iomem *color_base, +void __iomem *ufoe_base,void __iomem *od_base); + +void mediatek_ovl_layer_switch (void __iomem *ovl_base, +unsigned layer,bool en); + +#endif +
drivers/gpu/drm/mediatek/mediatek_drm_drv.c new file +369 -0
369 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_drv.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2015 MediaTek Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _MEDIATEK_DRM_DRV_H_ +#define _MEDIATEK_DRM_DRV_H_ + +#define MAX_CRTC 2 +#define MAX_PLANE 4 + +extern struct platform_driver mediatek_ddp_driver; +extern struct platform_driver mtk_dsi_driver; +extern struct platform_driver mediatek_crtc_main_driver; + +struct mtk_drm_private { +struct drm_fb_helper *fb_helper; + +/* +* created crtc object would be contained at this array and +* this array is used to be aware of which crtc did it request vblank. +*/ +struct drm_crtc *crtc[MAX_CRTC ]; +unsigned int pipe; +}; + + +#endif +
drivers/gpu/drm/mediatek/mediatek_drm_dsi.c new file +1333 -0
1,191 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_dsi.h new file +71 -0
71 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_fb.c new file +339 -0
339 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_fb.h new file +43 -0
43 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_gem.c new file +315 -0
315 lines not on this page · raw message
drivers/gpu/drm/mediatek/mediatek_drm_gem.h new file +94 -0
94 lines not on this page · raw message
include/uapi/drm/mediatek_drm.h new file +59 -0
59 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.1.1.dirty
Part of the diff is not shown here. View the raw message.
Re: [RFC][PATCH 2/2] drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.
Hi,
drivers/gpu/drm/mediatek/mediatek_drm_crtc.c line 154
Quoted 5 lines · CK Hu
drivers/gpu/drm/mediatek/mediatek_drm_crtc.c new file +5
-0+/* +* copy the mode data adjusted by mode_fixup() into crtc->mode +* so that hardware can be seet to proper mode. +*/ +memcpy (&crtc->mode, adjusted_mode,sizeof (*adjusted_mode));
Please do not do this. adjusted_mode is already available in crtc->hwmode.
Please also restructure this driver to use the atomic infrastructure. A good example of how to do this can be found in the Rockchip RK3288 driver which was submitted a while ago: it started off as a legacy driver like this, but was converted during the submission phase.
I'm sure there are many more comments to come, but certainly converting to be an atomic driver is the very first step.
Cheers,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 2/2] drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.
In reply to CK HuA naive question and a nit follow. That's probably not what you'd like to see for an RFC, but the patch got tangled up in my mail filter anyhow.
Quoted 5 lines · CK Hu
drivers/gpu/drm/mediatek/Kconfig new file +2
-0+config DRM_MEDIATEK_FBDEV + bool "Enable legacy fbdev support for Mediatek DRM"
drivers/gpu/drm/mediatek/Kconfig line 28
Quoted 10 lines
drivers/gpu/drm/mediatek/Kconfig new file +10
-0+ depends on DRM_MEDIATEK + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_KMS_FB_HELPER + help + Choose this option if you have a need for the legacy + fbdev support. Note that this support also provides + the Linux console on top of the Mediatek DRM mode + setting driver.
Naive question, as I know next to nothing about drivers/gpu/drm. DRM_MEDIATEK_FBDEV isn't used anywhere, as far as I can see. So all that setting this Kconfig symbol does is selecting four other Kconfig symbols. Is selecting those four symbols enough to get fbdev support? Taking the Cargo Cult approach of looking at similar symbols (DRM_I915_FBDEV, DRM_MSM_FBDEV, DRM_STI_FBDEV, and DRM_TEGRA_FBDEV) I noticed that they all do a bit more than just selecting other symbols.
drivers/gpu/drm/mediatek/mediatek_drm_drv.c
Quoted 6 lines
drivers/gpu/drm/mediatek/mediatek_drm_drv.c new file +3
-0+* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation.
This states the license of this driver is GPL v2. (Identical comments seem to be part of all files added in this patch.)
Quoted 1 line
+MODULE_LICENSE("GPL");
And, according to include/linux/module.h, this states the license is GPL v2 or later. So I think that either the comment at the top of these files or the ident used in the MODULE_LICENSE() macro needs to be changed.
Thanks,
Paul Bolle
Philipp Zabel
maintainerRe: [RFC][PATCH 1/2] dt-bindings: drm/mediatek: Add Mediatek DRM dts binding
In reply to CK HuHi,
overall it looks to me like this binding is modeled after the Linux DRM abstractions. Instead, the device nodes should be modeled after the hardware.
Describing each function block as a separate device node is probably not the best choice, as would be combining all devices in the mmsys range into a single device node. So a somewhat arbitrary decision has to be made what to group together. See my comments below:
Am Mittwoch, den 13.05.2015, 23:23 +0800 schrieb CK Hu:
Quoted 24 lines
This patch includes
1. Mediatek DRM Device binding
2. Mediatek DSI Device binding
3. Mediatek CRTC Main Device binding
4. Mediatek DDP Device bindingSigned-off-by CK Hu <[email protected]>--- .../bindings/drm/mediatek/mediatek,crtc-main.txt | 38 ++++++++++++++++++++++ .../bindings/drm/mediatek/mediatek,ddp.txt | 22 +++++++++++++ .../bindings/drm/mediatek/mediatek,drm.txt | 27 +++++++++++++++ .../bindings/drm/mediatek/mediatek,dsi.txt | 20 ++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt create mode 100644 Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txtDocumentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +0
-0
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +4
-0@@ -0,0 +1,38 @@ +Mediatek CRTC Main Device +================================ + +The Mediatek CRTC Main device is a crtc device of DRM system.
"crtc" does not belong in the device tree. There is no crtc hardware. What this node describes is a useful, but fixed configuration of a part of the DISP subsystem function blocks.
In my opinion, it would be better to not describe the separate display pipes in the device tree at all if they are dynamically configurable. What for example if you model two separate fixed pipelines in the device tree and then in the future you want to support the MERGE or SPLIT blocks (I'm not sure what MERGE does, SPLIT seems to be needed for 8-lane DSI)?
As far as I currently understand, there are five source function blocks that can read from memory (OVL0, OVL1, RDMA0, RDMA1, RDMA2) and three sink function blocks (DSI0, DSI1, DPI0) that can be connected to panels, or encoder bridges. How these map to the crtcs doesn't necessarily have to be described in the device tree.
How about a single node that contains all of the DISP functional blocks that don't need their own node (like DSI, which has to be connectable to bridges or panels):
disp: disp@0x1400c000 {
compatible = "mediatek,mt8173-disp";
interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>, /* OVL0 */
<GIC_SPI 181 IRQ_TYPE_LEVEL_LOW>; /* OVL1 */
interrupt-names = "ovl0", "ovl1";
reg = <0 0x1400c000 0 0x1000>, /* OVL0 */
<0 0x1400d000 0 0x1000>, /* OVL1 */
<0 0x1400e000 0 0x1000>, /* RDMA0 */
<0 0x1400f000 0 0x1000>, /* RDMA1 */
<0 0x14010000 0 0x1000>, /* RDMA2 */
<0 0x14013000 0 0x1000>, /* COLOR0 */
<0 0x14014000 0 0x1000>, /* COLOR1 */
<0 0x14015000 0 0x1000>, /* AAL */
<0 0x14016000 0 0x1000>, /* GAMMA */
<0 0x14017000 0 0x1000>, /* MERGE */
<0 0x14018000 0 0x1000>, /* SPLIT0 */
<0 0x14019000 0 0x1000>, /* SPLIT1 */
<0 0x1401a000 0 0x1000>, /* UFOE */
<0 0x14020000 0 0x1000>; /* MUTEX */
<0 0x14023000 0 0x1000>; /* OD */
reg-names = "ovl0", "ovl1", "rdma0", "rdma1", "rdma2",
"color0", "color1", "aal", "gamma", "merge",
"split0", "split1", "ufoe", "mutex", "od";
clocks = <&mmsys CLK_MM_DISP_OVL0>,
<&mmsys CLK_MM_DISP_OVL1>,
<&mmsys CLK_MM_DISP_RDMA0>,
<&mmsys CLK_MM_DISP_RDMA1>,
<&mmsys CLK_MM_DISP_RDMA2>,
<&mmsys CLK_MM_DISP_COLOR0>,
<&mmsys CLK_MM_DISP_COLOR1>,
<&mmsys CLK_MM_DISP_AAL>,
<&mmsys CLK_MM_DISP_GAMMA>,
<&mmsys CLK_MM_DISP_MERGE>,
<&mmsys CLK_MM_DISP_SPLIT0>,
<&mmsys CLK_MM_DISP_SPLIT1>,
<&mmsys CLK_MM_DISP_UFOE>,
<&mmsys CLK_MM_MUTEX_32K>,
<&mmsys CLK_MM_DISP_OD>;
clock-names = "ovl0", "ovl1", "rdma0", "rdma1", "rdma2",
"color0", "color1", "aal", "gamma", "merge",
"split0", "split1", "ufoe", "mutex", "od";
power-domains = <&scpsys MT8173_POWER_DOMAIN_DIS>;
config = <&mmsys>; /* syscon */
};How the muxes in the config area are set up to connect those blocks could be determined by the driver.
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt line 18
Quoted 13 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +13
-0+Required properties: +- compatible: "mediatek,<chip>-crtc-main" +- interrupts: The interrupt signal from the CRTC Main block. +- reg: Physical base address and length of the controller's registers +- clocks: device clocks + See Documentation/devicetree/bindings/clock/clock-bindings.txt for details. +- ddp: phandle of ddp device which control display data path. + +Example: + +crtc_main: crtc@1400c000 { + compatible = "mediatek,mt8173-crtc-main"; + interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_LOW>;
Should it be mentioned that this is the interrupt of the source of the pipeline (OVL0/1)?
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt line 24
Quoted 6 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +6
-0+ reg = <0 0x1400c000 0 0x1000>, /* OVL0 */ + <0 0x1400e000 0 0x1000>, /* RDMA0 */ + <0 0x14013000 0 0x1000>, /* COLOR0 */ + <0 0x14015000 0 0x1000>, /* AAL */ + <0 0x1401a000 0 0x1000>, /* UFOE */ + <0 0x14023000 0 0x1000>; /* OD */
With the amount of register ranges and given the symmetry with the clocks, better use reg-names instead of position to determine the register space for each function block.
reg-names = "ovl0", "rdma0", "color0", "aal", "ufoe", "od";
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt line 36
Quoted 12 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +12
-0+ clocks = <&mmsys MM_DISP_OVL0>, + <&mmsys MM_DISP_RDMA0>, + <&mmsys MM_DISP_COLOR0>, + <&mmsys MM_DISP_AAL>, + <&mmsys MM_DISP_UFOE>, + <&mmsys MM_DISP_OD>; + clock-names = "ovl0_disp", + "rdma0_disp", + "color0_disp", + "aal_disp", + "ufoe_disp", + "od_disp";
I'd drop the disp suffix from the clock input names.
clock-names = "ovl0", "rdma0", "color0", "aal", "ufoe", "od";
Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt line 4
Quoted 13 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt new file +2
-0+ ddp = <&ddp>; +};Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt new file +4
-0@@ -0,0 +1,22 @@ +Mediatek DDP Device +================================ + +The Mediatek DDP device control the display data path.
This is not a real device either. There is nothing wrong with having a ddp driver, but I don't think it is right to describe this driver in the device tree. What we really have here is the mutex function block and some registers in the mmsys config region, which already can be accessed via the mmsys syscon.
With a single disp device node including the mutex and power domain phandle this node would not be necessary.
Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt line 17
Quoted 12 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt new file +12
-0+Required properties: +- compatible: "mediatek,<chip>-ddp" +- reg: Physical base address and length of the controller's registers +- power-domains: a phandle to DDP power domain node. +- clocks: device clocks + See Documentation/devicetree/bindings/clock/clock-bindings.txt for details. + +Example: + +ddp: ddp@14000000 { + compatible = "mediatek,mt8173-ddp"; + reg = <0 0x14000000 0 0x100>, /* CONFIG */
This remaps part of the mmsys register space, which is already a syscon. Why not use syscon to access it?
Quoted 12 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt new file +5
-0+ <0 0x14020000 0 0x1000>; /* MUTEX */ + power-domains = <&scpsys MT8173_POWER_DOMAIN_DIS>; + clocks = <&mmsys MM_MUTEX_32K>; + clock-names = "mutex_disp"; +};Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt new file +0
-0
Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt line 6
Quoted 6 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt new file +6
-0@@ -0,0 +1,27 @@ +Mediatek DRM Device +================================ + +The Mediatek DRM device is a device needed to list all +display component nodes that comprise the display subsystem. +And it list the memory-related interface.
"drm" does not belong in the device tree. There is no "drm" hardware. Other SoCs use the "display-subsystem" name for this node, it would be better to follow that.
Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt line 17
Quoted 10 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt new file +10
-0+Required properties: +- compatible: "mediatek,<chip>-drm" +- larb: Should contain a list of phandles pointing to larb device. + larb definitions as defined in + Documentation/devicetree/bindings/soc/mediatek/mediatek,smi-larb.txt +- iommus: required a iommu node +- connectors: Should contain a list of phandles pointing to connector device. + connector device should be one component of this master. +- crtcs: Should contain a list of phandles pointing to crtc device. + crtc device should be one component of this master.
"connectors" and "crtcs" as used here are DRM concepts, not hardware devices that should exist in the device tree. Ideally you would use something recognizable from the datasheet, like "sinks" or from the device tree, like "ports" if of-graph bindings are used, or just "components" if this also were to include things like the ddp.
Another possibility would be to even merge the
Quoted 17 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt new file +10
-0+ +Example: + +drm0: drm { + compatible = "mediatek,mt8173-drm"; + larb = <&larb0>; + iommus = <&iommu M4U_PORT_DISP_OVL0>; + connectors = <&dsi>; + crtcs = <&crtc_main>; +};Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt new file +0
-0
Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt new file +10
-0@@ -0,0 +1,20 @@ +Mediatek DSI Device +================================ + +The Mediatek DSI device is a connector device of DRM system. + +Required properties: +- compatible: "mediatek,<chip>-dsi" +- reg: Physical base address and length of the controller's registers +- clocks: device clocks + See Documentation/devicetree/bindings/clock/clock-bindings.txt for details.
Will this use the Documentation/devicetree/bindings/mipi/dsi/mipi-dsi-bus.txt bindings to connect panels controlled via the DSI command channel or theDocumentation/devicetree/bindings/graph.txt
bindings to connect panels controlled via I2C or other control buses? If so, this should be documented here.
Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt line 19
Quoted 8 lines
Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt new file +8
-0+Example: + +dsi: dsi@10215000 { + compatible = "mediatek,mt8173-dsi"; + reg = <0 0x1401B000 0 0x1000>, /* DSI0 */ + <0 0x10215000 0 0x1000>; /* MIPITX */ + clocks = <&mmsys MM_DSI0_ENGINE>, <&mmsys MM_DSI0_DIGITAL>; + clock-names = "dsi0_engine_disp_ck", "dsi0_digital_disp_ck";
Maybe shorten the clock names to "engine" and "digital" ? And add an example of panel or bridge connected to the DSI sink.
What about DSI1 and the DPI sink?
best regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel