From 6e5b8e421559b0dac074b826bd259d21c2335ae8 Mon Sep 17 00:00:00 2001 From: Liu Ying Date: Mon, 5 Dec 2016 13:38:22 +0800 Subject: [PATCH] MLK-15001-10 gpu: Add dpu base driver DPU is the display processing unit embedded in i.MX8qm and i.MX8qxp. It was originally designed by Fujitsu. The first revision has capture controller, display controller and blit engine. The second revision is a lite one and has display controller and blit engine. This patch adds a base driver for DPU, which provides a thin register wrapper, interrurpt support and client platform device register for the upper layer to use. Currently, the driver only supports the display controller at the pixel processing level and only the fetchdecodes are supported/tested as the fetch units. Signed-off-by: Liu Ying --- .../bindings/display/imx/fsl-imx-drm.txt | 71 + drivers/gpu/Makefile | 1 + drivers/gpu/dpu/Kconfig | 9 + drivers/gpu/dpu/Makefile | 5 + drivers/gpu/dpu/dpu-common.c | 1293 +++++++++++++++++ drivers/gpu/dpu/dpu-constframe.c | 202 +++ drivers/gpu/dpu/dpu-disengcfg.c | 138 ++ drivers/gpu/dpu/dpu-extdst.c | 485 +++++++ drivers/gpu/dpu/dpu-fetchdecode.c | 503 +++++++ drivers/gpu/dpu/dpu-fetchlayer.c | 295 ++++ drivers/gpu/dpu/dpu-framegen.c | 366 +++++ drivers/gpu/dpu/dpu-layerblend.c | 383 +++++ drivers/gpu/dpu/dpu-prv.h | 233 +++ drivers/gpu/dpu/dpu-tcon.c | 233 +++ drivers/video/Kconfig | 1 + include/video/dpu.h | 526 +++++++ 16 files changed, 4744 insertions(+) create mode 100644 drivers/gpu/dpu/Kconfig create mode 100644 drivers/gpu/dpu/Makefile create mode 100644 drivers/gpu/dpu/dpu-common.c create mode 100644 drivers/gpu/dpu/dpu-constframe.c create mode 100644 drivers/gpu/dpu/dpu-disengcfg.c create mode 100644 drivers/gpu/dpu/dpu-extdst.c create mode 100644 drivers/gpu/dpu/dpu-fetchdecode.c create mode 100644 drivers/gpu/dpu/dpu-fetchlayer.c create mode 100644 drivers/gpu/dpu/dpu-framegen.c create mode 100644 drivers/gpu/dpu/dpu-layerblend.c create mode 100644 drivers/gpu/dpu/dpu-prv.h create mode 100644 drivers/gpu/dpu/dpu-tcon.c create mode 100644 include/video/dpu.h diff --git a/Documentation/devicetree/bindings/display/imx/fsl-imx-drm.txt b/Documentation/devicetree/bindings/display/imx/fsl-imx-drm.txt index 971c3eedb1c7..8553f63f7a14 100644 --- a/Documentation/devicetree/bindings/display/imx/fsl-imx-drm.txt +++ b/Documentation/devicetree/bindings/display/imx/fsl-imx-drm.txt @@ -53,6 +53,77 @@ ipu: ipu@18000000 { }; }; +Freescale i.MX DPU +==================== + +Required properties: +- compatible: Should be "fsl,-dpu" +- reg: should be register base and length as documented in the + datasheet +- intsteer: phandle pointing to interrupt steer. +- interrupts, interrupt-names: Should contain interrupts and names as + documented in the datasheet. +- clocks, clock-names: phandles to the DPU clocks described in + Documentation/devicetree/bindings/clock/clock-bindings.txt + The following clocks are expected on i.MX8qm and i.MX8qxp: + "pll0" - PLL clock for display interface 0 + "pll1" - PLL clock for display interface 1 + "disp0" - pixel clock for display interface 0 + "disp1" - pixel clock for display interface 1 + The needed clock numbers for each are documented in + Documentation/devicetree/bindings/clock/imx8qm-clock.txt, and in + Documentation/devicetree/bindings/clock/imx8qxp-clock.txt. +- power-domains: phandle pointing to power domain. +Optional properties: +- port@[0-1]: Port nodes with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + ports 0 and 1 should correspond to display interface 0 and + display interface 1, respectively. + +example: + +dpu: dpu@56180000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx8qm-dpu"; + reg = <0x0 0x56180000 0x0 0x40000>; + intsteer = <&dpu1_intsteer>; + interrupts = , + , + , + , + , + , + , + ; + interrupt-names = "irq_common", + "irq_stream0a", + "irq_stream0b", + "irq_stream1a", + "irq_stream1b", + "irq_reserved0", + "irq_reserved1", + "irq_blit"; + clocks = <&clk IMX8QM_DC0_PLL0_CLK>, + <&clk IMX8QM_DC0_PLL1_CLK>, + <&clk IMX8QM_DC0_DISP0_CLK>, + <&clk IMX8QM_DC0_DISP1_CLK>; + clock-names = "pll0", "pll1", "disp0", "disp1"; + power-domains = <&pd_dc0>; + + dpu1_disp1: port@1 { + reg = <1>; + + dpu1_disp1_lvds0: lvds0-endpoint { + remote-endpoint = <&ldb1_lvds0>; + }; + + dpu1_disp1_lvds1: lvds1-endpoint { + remote-endpoint = <&ldb1_lvds1>; + }; + }; +}; + Parallel display support ======================== diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile index e9ed439a5b65..3dc8f3f26d49 100644 --- a/drivers/gpu/Makefile +++ b/drivers/gpu/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_TEGRA_HOST1X) += host1x/ obj-y += drm/ vga/ obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/ +obj-$(CONFIG_IMX_DPU_CORE) += dpu/ diff --git a/drivers/gpu/dpu/Kconfig b/drivers/gpu/dpu/Kconfig new file mode 100644 index 000000000000..1a1f5a977fa7 --- /dev/null +++ b/drivers/gpu/dpu/Kconfig @@ -0,0 +1,9 @@ +config IMX_DPU_CORE + tristate "i.MX DPU core support" + depends on ARCH_FSL_IMX8QM || ARCH_FSL_IMX8QXP + depends on RESET_CONTROLLER + select GENERIC_IRQ_CHIP + help + Choose this if you have a Freescale i.MX8QM or i.MX8QXP system and + want to use the Display Processing Unit. This option only enables + DPU base support. diff --git a/drivers/gpu/dpu/Makefile b/drivers/gpu/dpu/Makefile new file mode 100644 index 000000000000..df07880f4e8b --- /dev/null +++ b/drivers/gpu/dpu/Makefile @@ -0,0 +1,5 @@ +obj-$(CONFIG_IMX_DPU_CORE) += imx-dpu-core.o + +imx-dpu-core-objs := dpu-common.o dpu-constframe.o dpu-disengcfg.o \ + dpu-extdst.o dpu-fetchdecode.o dpu-framegen.o \ + dpu-fetchlayer.o dpu-layerblend.o dpu-tcon.o diff --git a/drivers/gpu/dpu/dpu-common.c b/drivers/gpu/dpu/dpu-common.c new file mode 100644 index 000000000000..0f47ff9c041c --- /dev/null +++ b/drivers/gpu/dpu/dpu-common.c @@ -0,0 +1,1293 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include