[PATCH 4/5] drm/vc4: Add DPI driver

2016-03-25 Thread Rob Herring
On Thu, Mar 24, 2016 at 05:23:50PM -0700, Eric Anholt wrote:
> The DPI interface involves taking a ton of our GPIOs to be used as
> outputs, and routing display signals over them in parallel.
> 
> v2: Use display_info.bus_formats[] to replace our custom DT
> properties.
> 
> Signed-off-by: Eric Anholt 
> ---
>  .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  36 ++

Acked-by: Rob Herring 

>  drivers/gpu/drm/vc4/Kconfig|   1 +
>  drivers/gpu/drm/vc4/Makefile   |   1 +
>  drivers/gpu/drm/vc4/vc4_debugfs.c  |   1 +
>  drivers/gpu/drm/vc4/vc4_dpi.c  | 520 
> +
>  drivers/gpu/drm/vc4/vc4_drv.c  |   1 +
>  drivers/gpu/drm/vc4/vc4_drv.h  |   5 +
>  7 files changed, 565 insertions(+)
>  create mode 100644 drivers/gpu/drm/vc4/vc4_dpi.c


[PATCH 4/5] drm/vc4: Add DPI driver

2016-03-24 Thread Eric Anholt
The DPI interface involves taking a ton of our GPIOs to be used as
outputs, and routing display signals over them in parallel.

v2: Use display_info.bus_formats[] to replace our custom DT
properties.

Signed-off-by: Eric Anholt 
---
 .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  36 ++
 drivers/gpu/drm/vc4/Kconfig|   1 +
 drivers/gpu/drm/vc4/Makefile   |   1 +
 drivers/gpu/drm/vc4/vc4_debugfs.c  |   1 +
 drivers/gpu/drm/vc4/vc4_dpi.c  | 520 +
 drivers/gpu/drm/vc4/vc4_drv.c  |   1 +
 drivers/gpu/drm/vc4/vc4_drv.h  |   5 +
 7 files changed, 565 insertions(+)
 create mode 100644 drivers/gpu/drm/vc4/vc4_dpi.c

diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt 
b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
index 56a961a..14c4fd5 100644
--- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
+++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
@@ -35,6 +35,16 @@ Optional properties for HDMI:
  as an interrupt/status bit in the HDMI controller
  itself).  See bindings/pinctrl/brcm,bcm2835-gpio.txt

+Required properties for DPI:
+- compatible:  Should be "brcm,bcm2835-dpi"
+- reg: Physical base address and length of the registers
+- clocks:  a) core: The core clock the unit runs on
+   b) pixel: The pixel clock that feeds the pixelvalve
+- port:Port node with a single endpoint connecting to 
the
+ panel device, as defined in [1]
+
+[1] Documentation/devicetree/bindings/media/video-interfaces.txt
+
 Example:
 pixelvalve at 7e807000 {
compatible = "brcm,bcm2835-pixelvalve2";
@@ -60,6 +70,32 @@ hdmi: hdmi at 7e902000 {
clock-names = "pixel", "hdmi";
 };

+dpi: dpi at 7e208000 {
+   compatible = "brcm,bcm2835-dpi";
+   reg = <0x7e208000 0x8c>;
+   clocks = <&clocks BCM2835_CLOCK_VPU>,
+<&clocks BCM2835_CLOCK_DPI>;
+   clock-names = "core", "pixel";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port {
+   dpi_out: endpoint at 0 {
+   remote-endpoint = <&panel_in>;
+   };
+   };
+};
+
 vc4: gpu {
compatible = "brcm,bcm2835-vc4";
 };
+
+panel: panel {
+   compatible = "ontat,yx700wv03", "simple-panel";
+
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <&dpi_out>;
+   };
+   };
+};
diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
index 5848104..e53df59 100644
--- a/drivers/gpu/drm/vc4/Kconfig
+++ b/drivers/gpu/drm/vc4/Kconfig
@@ -5,6 +5,7 @@ config DRM_VC4
select DRM_KMS_HELPER
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
+   select DRM_PANEL
help
  Choose this option if you have a system that has a Broadcom
  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
index 4c6a99f..fb77db7 100644
--- a/drivers/gpu/drm/vc4/Makefile
+++ b/drivers/gpu/drm/vc4/Makefile
@@ -7,6 +7,7 @@ vc4-y := \
vc4_bo.o \
vc4_crtc.o \
vc4_drv.o \
+   vc4_dpi.o \
vc4_kms.o \
vc4_gem.o \
vc4_hdmi.o \
diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c 
b/drivers/gpu/drm/vc4/vc4_debugfs.c
index d76ad10..245115d 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -17,6 +17,7 @@

 static const struct drm_info_list vc4_debugfs_list[] = {
{"bo_stats", vc4_bo_stats_debugfs, 0},
+   {"dpi_regs", vc4_dpi_debugfs_regs, 0},
{"hdmi_regs", vc4_hdmi_debugfs_regs, 0},
{"hvs_regs", vc4_hvs_debugfs_regs, 0},
{"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0},
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
new file mode 100644
index 000..9817dbf
--- /dev/null
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -0,0 +1,520 @@
+/*
+ * Copyright (C) 2016 Broadcom Limited
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see .
+ */
+
+/**
+ * DOC: VC4 DPI module
+ *
+ * The VC4 DPI hardware supports MIPI DPI type 4 and Nokia ViSSI
+ * signals, which are routed out to GPIO0-27 with the ALT2 function.
+ */
+

[PATCH 4/5] drm/vc4: Add DPI driver

2016-03-24 Thread Eric Anholt
Rob Herring  writes:

> On Fri, Mar 18, 2016 at 07:42:45PM -0700, Eric Anholt wrote:
>> The DPI interface involves taking a ton of our GPIOs to be used as
>> outputs, and routing display signals over them in parallel.
>> 
>> Signed-off-by: Eric Anholt 
>> ---
>>  .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  67 +++
>>  drivers/gpu/drm/vc4/Kconfig|   1 +
>>  drivers/gpu/drm/vc4/Makefile   |   1 +
>>  drivers/gpu/drm/vc4/vc4_debugfs.c  |   1 +
>>  drivers/gpu/drm/vc4/vc4_dpi.c  | 518 
>> +
>>  drivers/gpu/drm/vc4/vc4_drv.c  |   1 +
>>  drivers/gpu/drm/vc4/vc4_drv.h  |   5 +
>>  7 files changed, 594 insertions(+)
>>  create mode 100644 drivers/gpu/drm/vc4/vc4_dpi.c
>> 
>> diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt 
>> b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
>> index 56a961a..1782c3f 100644
>> --- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
>> +++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
>> @@ -35,6 +35,44 @@ Optional properties for HDMI:
>>as an interrupt/status bit in the HDMI controller
>>itself).  See bindings/pinctrl/brcm,bcm2835-gpio.txt
>>  
>> +Required properties for DPI:
>> +- compatible:   Should be "brcm,bcm2835-dpi"
>> +- reg:  Physical base address and length of the 
>> registers
>> +- clocks:   a) core: The core clock the unit runs on
>> +b) pixel: The pixel clock that feeds the pixelvalve
>> +- port: Port node with a single endpoint connecting to 
>> the
>> +  panel device, as defined in [1]
>> +- brcm,output-format:   Output data format, must be one of:
>> +0) disabled
>> +1) rggb
>> +2) 000r00gg000b
>> +3) 00r000gg00b0
>> +4) 00rrggbb
>> +5) 00rr00gg00bb
>> +6) 
>> +
>> +Optional properties for DPI:
>> +- brcm,rgb-order:   RGB reordering, must be one of:
>> +0) RGB
>> +1) BGR
>> +2) GRB
>> +3) BRG
>
>> +- brcm,hsync-disable:   Disables the hsync signal
>> +- brcm,vsync-disable:   Disables the vsync signal
>> +- brcm,output-enable-disable:   Disables the output enable signal
>> +- brcm,hsync-falling:   Outputs the hsync signal on the falling 
>> clk edge
>> +- brcm,vsync-falling:   Outputs the vsync signal on the falling 
>> clk edge
>> +- brcm,output-enable-falling:   Outputs the output enable signal on the
>> +  falling clk edge
>> +- brcm,output-enable-invert:Inverts the polarity of the output 
>> enable
>> +  signal
>> +- brcm,pixel-clk-invert:Inverts the polarity of the pixel clk signal
>> +- brcm,output-enable-mode:  Sets output enable when (vsync | hsync)
>> +  instead of (hactive & vactive)
>
> These are all really properties of what the panel requires and we 
> already have video timings binding that would cover some of these.
>
> Also, do you have actual users? Some of these seem like they would be 
> rare or never. I've not seen panels caring about which clock edge the 
> sync signals are on.

I was using output-format, rgb_order, output-enable-mode to get my panel
to work.  I'm suspicious that the !output_enable_mode is not useful,
though (Note: I had documented it backwards: false is hsync|vsync, true
is hactive&vactive).  That just left me with output-format.  I think
.bus_format in the panel_desc can cover that, so I've now dropped all of
these brcm properties.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: 



[PATCH 4/5] drm/vc4: Add DPI driver

2016-03-21 Thread Rob Herring
On Fri, Mar 18, 2016 at 07:42:45PM -0700, Eric Anholt wrote:
> The DPI interface involves taking a ton of our GPIOs to be used as
> outputs, and routing display signals over them in parallel.
> 
> Signed-off-by: Eric Anholt 
> ---
>  .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  67 +++
>  drivers/gpu/drm/vc4/Kconfig|   1 +
>  drivers/gpu/drm/vc4/Makefile   |   1 +
>  drivers/gpu/drm/vc4/vc4_debugfs.c  |   1 +
>  drivers/gpu/drm/vc4/vc4_dpi.c  | 518 
> +
>  drivers/gpu/drm/vc4/vc4_drv.c  |   1 +
>  drivers/gpu/drm/vc4/vc4_drv.h  |   5 +
>  7 files changed, 594 insertions(+)
>  create mode 100644 drivers/gpu/drm/vc4/vc4_dpi.c
> 
> diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt 
> b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
> index 56a961a..1782c3f 100644
> --- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
> +++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
> @@ -35,6 +35,44 @@ Optional properties for HDMI:
> as an interrupt/status bit in the HDMI controller
> itself).  See bindings/pinctrl/brcm,bcm2835-gpio.txt
>  
> +Required properties for DPI:
> +- compatible:Should be "brcm,bcm2835-dpi"
> +- reg:   Physical base address and length of the 
> registers
> +- clocks:a) core: The core clock the unit runs on
> + b) pixel: The pixel clock that feeds the pixelvalve
> +- port:  Port node with a single endpoint connecting to 
> the
> +   panel device, as defined in [1]
> +- brcm,output-format:Output data format, must be one of:
> + 0) disabled
> + 1) rggb
> + 2) 000r00gg000b
> + 3) 00r000gg00b0
> + 4) 00rrggbb
> + 5) 00rr00gg00bb
> + 6) 
> +
> +Optional properties for DPI:
> +- brcm,rgb-order:RGB reordering, must be one of:
> + 0) RGB
> + 1) BGR
> + 2) GRB
> + 3) BRG

> +- brcm,hsync-disable:Disables the hsync signal
> +- brcm,vsync-disable:Disables the vsync signal
> +- brcm,output-enable-disable:Disables the output enable signal
> +- brcm,hsync-falling:Outputs the hsync signal on the falling 
> clk edge
> +- brcm,vsync-falling:Outputs the vsync signal on the falling 
> clk edge
> +- brcm,output-enable-falling:Outputs the output enable signal on the
> +   falling clk edge
> +- brcm,output-enable-invert: Inverts the polarity of the output enable
> +   signal
> +- brcm,pixel-clk-invert: Inverts the polarity of the pixel clk signal
> +- brcm,output-enable-mode:   Sets output enable when (vsync | hsync)
> +   instead of (hactive & vactive)

These are all really properties of what the panel requires and we 
already have video timings binding that would cover some of these.

Also, do you have actual users? Some of these seem like they would be 
rare or never. I've not seen panels caring about which clock edge the 
sync signals are on.

Rob


[PATCH 4/5] drm/vc4: Add DPI driver

2016-03-18 Thread Eric Anholt
The DPI interface involves taking a ton of our GPIOs to be used as
outputs, and routing display signals over them in parallel.

Signed-off-by: Eric Anholt 
---
 .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  67 +++
 drivers/gpu/drm/vc4/Kconfig|   1 +
 drivers/gpu/drm/vc4/Makefile   |   1 +
 drivers/gpu/drm/vc4/vc4_debugfs.c  |   1 +
 drivers/gpu/drm/vc4/vc4_dpi.c  | 518 +
 drivers/gpu/drm/vc4/vc4_drv.c  |   1 +
 drivers/gpu/drm/vc4/vc4_drv.h  |   5 +
 7 files changed, 594 insertions(+)
 create mode 100644 drivers/gpu/drm/vc4/vc4_dpi.c

diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt 
b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
index 56a961a..1782c3f 100644
--- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
+++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
@@ -35,6 +35,44 @@ Optional properties for HDMI:
  as an interrupt/status bit in the HDMI controller
  itself).  See bindings/pinctrl/brcm,bcm2835-gpio.txt

+Required properties for DPI:
+- compatible:  Should be "brcm,bcm2835-dpi"
+- reg: Physical base address and length of the registers
+- clocks:  a) core: The core clock the unit runs on
+   b) pixel: The pixel clock that feeds the pixelvalve
+- port:Port node with a single endpoint connecting to 
the
+ panel device, as defined in [1]
+- brcm,output-format:  Output data format, must be one of:
+   0) disabled
+   1) rggb
+   2) 000r00gg000b
+   3) 00r000gg00b0
+   4) 00rrggbb
+   5) 00rr00gg00bb
+   6) 
+
+Optional properties for DPI:
+- brcm,rgb-order:  RGB reordering, must be one of:
+   0) RGB
+   1) BGR
+   2) GRB
+   3) BRG
+- brcm,hsync-disable:  Disables the hsync signal
+- brcm,vsync-disable:  Disables the vsync signal
+- brcm,output-enable-disable:  Disables the output enable signal
+- brcm,hsync-falling:  Outputs the hsync signal on the falling clk edge
+- brcm,vsync-falling:  Outputs the vsync signal on the falling clk edge
+- brcm,output-enable-falling:  Outputs the output enable signal on the
+ falling clk edge
+- brcm,output-enable-invert:   Inverts the polarity of the output enable
+ signal
+- brcm,pixel-clk-invert:   Inverts the polarity of the pixel clk signal
+- brcm,output-enable-mode: Sets output enable when (vsync | hsync)
+ instead of (hactive & vactive)
+
+
+[1] Documentation/devicetree/bindings/media/video-interfaces.txt
+
 Example:
 pixelvalve at 7e807000 {
compatible = "brcm,bcm2835-pixelvalve2";
@@ -60,6 +98,35 @@ hdmi: hdmi at 7e902000 {
clock-names = "pixel", "hdmi";
 };

+dpi: dpi at 7e208000 {
+   compatible = "brcm,bcm2835-dpi";
+   reg = <0x7e208000 0x8c>;
+   clocks = <&clocks BCM2835_CLOCK_VPU>,
+<&clocks BCM2835_CLOCK_DPI>;
+   clock-names = "core", "pixel";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   brcm,rgb-order = <0>;
+   brcm,output-format = <4>;
+
+   port {
+   dpi_out: endpoint at 0 {
+   remote-endpoint = <&panel_in>;
+   };
+   };
+};
+
 vc4: gpu {
compatible = "brcm,bcm2835-vc4";
 };
+
+panel: panel {
+   compatible = "ontat,yx700wv03", "simple-panel";
+
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <&dpi_out>;
+   };
+   };
+};
diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
index 5848104..e53df59 100644
--- a/drivers/gpu/drm/vc4/Kconfig
+++ b/drivers/gpu/drm/vc4/Kconfig
@@ -5,6 +5,7 @@ config DRM_VC4
select DRM_KMS_HELPER
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
+   select DRM_PANEL
help
  Choose this option if you have a system that has a Broadcom
  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
index 4c6a99f..fb77db7 100644
--- a/drivers/gpu/drm/vc4/Makefile
+++ b/drivers/gpu/drm/vc4/Makefile
@@ -7,6 +7,7 @@ vc4-y := \
vc4_bo.o \
vc4_crtc.o \
vc4_drv.o \
+   vc4_dpi.o \
vc4_kms.o \
vc4_gem.o \
vc4_hdmi.o \
diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c 
b/drivers/gpu/drm/vc4/vc4_debugfs.c
index d76ad