Skip to contentSkip to conversation

drm/vc4: DPI panel support

PATCH Applied Eric Anholt 4 participants 10 messages Mar 25, 2016 – Apr 15, 2016

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover drm/vc4: DPI panel support

This is round 2 of the DPI panel support for vc4. This time the custom properties are dropped in favor of connector->display_info.bus_formats[].

Testable tree is at:

https://github.com/anholt/linux/tree/drm-vc4-dpi-boot

Eric Anholt (5):
of: Add vendor prefix for On Tat Industrial Company.
panel-simple: Add the 7" DPI panel from Adafruit.
drm: Add an encoder and connector type enum for DPI. drm/vc4: Add DPI driver
ARM: bcm2835: Add the DPI hardware to the device tree.

 .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  36 ++
 .../bindings/display/panel/ontat,yx700wv03.txt     |   7 +
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 arch/arm/boot/dts/bcm283x.dtsi                     |  11 +
 drivers/gpu/drm/drm_crtc.c                         |   2 +
 drivers/gpu/drm/panel/panel-simple.c               |  35 ++
 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 +
 include/uapi/drm/drm_mode.h                        |   2 +
 13 files changed, 623 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt
 create mode 100644 drivers/gpu/drm/vc4/vc4_dpi.c
Signature · 6 lines
2.7.0

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

PATCH v2 1/5 of: Add vendor prefix for On Tat Industrial Company.

This is the vendor for a 7" DPI panel sold by Adafruit which I'd like to describe in DT.

---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 72e2c5a..b35b5f8 100644
@@ -166,6 +166,7 @@ nxp	NXP Semiconductors
 okaya	Okaya Electric America, Inc.
 olimex	OLIMEX Ltd.
 onnn	ON Semiconductor Corp.
+ontat	On Tat Industrial Company
 opencores	OpenCores.org
 option	Option NV
 ortustech	Ortus Technology Co., Ltd.
Signature · 6 lines
2.7.0

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

PATCH v2 2/5 panel-simple: Add the 7" DPI panel from Adafruit.

In reply to Eric Anholt

This is a basic TFT panel with a 40-pin FPC connector on it. The specification doesn't define timings, but the Adafruit instructions were setting up 800x480 CVT.

v2: Add .bus_format and vsync/hsync flags.

---
 .../bindings/display/panel/ontat,yx700wv03.txt     |  7 +++++
 drivers/gpu/drm/panel/panel-simple.c               | 35 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt
Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt new file +7 -0
new file mode 100644
index 0000000..3d8a5e0
@@ -0,0 +1,7 @@
+On Tat Industrial Company 7" DPI TFT panel.
+
+Required properties:
+- compatible: should be "ontat,yx700wv03"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
drivers/gpu/drm/panel/panel-simple.c +35 -0
index f88a631..642c5ca 100644
@@ -1176,6 +1176,38 @@ static const struct panel_desc shelly_sca07010_bfn_lnn = {
 	.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };
 
+/* 800x480 CVT.  The panel appears to be quite accepting, at least as
+ * far as pixel clocks, but this is the timing that was being used in
+ * the Adafruit installation instructions.
+ */
+static const struct drm_display_mode ontat_yx700wv03_mode = {
+	.clock = 29500,
+	.hdisplay = 800,
+	.hsync_start = 824,
+	.hsync_end = 896,
+	.htotal = 992,
+	.vdisplay = 480,
+	.vsync_start = 483,
+	.vsync_end = 493,
+	.vtotal = 500,
+	.vrefresh = 60,
+	.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+};
+
+/* Specification at
+ * https://www.adafruit.com/images/product-files/2406/c3163.pdf
+ */
+static const struct panel_desc ontat_yx700wv03 = {
+	.modes = &ontat_yx700wv03_mode,
+	.num_modes = 1,
+	.bpc = 8,
+	.size = {
+		.width = 154,
+		.height = 83,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+};
+
 static const struct of_device_id platform_of_match[] = {
 	{
 		.compatible = "ampire,am800480r3tmqwa1h",
@@ -1265,6 +1297,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "okaya,rs800480t-7x0gp",
 		.data = &okaya_rs800480t_7x0gp,
 	}, {
+		.compatible = "ontat,yx700wv03",
+		.data = &ontat_yx700wv03,
+	}, {
 		.compatible = "ortustech,com43h4m85ulc",
 		.data = &ortustech_com43h4m85ulc,
 	}, {
Signature · 1 line
2.7.0
#5 lore raw

PATCH v2 3/5 drm: Add an encoder and connector type enum for DPI.

In reply to Eric Anholt

Right now exynos is exposing DPI as a TMDS encoder and VGA connector, which seems rather misleading. This isn't just an internal detail, since xrandr actually exposes "VGA" as the output name. Define some new enums so that vc4's DPI can have a more informative name.

I considered other names for the connector as well. For VC4, the Adafruit DPI kippah takes the 28 GPIO pins and routes them to a standard-ish 40-pin FPC connector, but "40-pin FPC" doesn't uniquely identify an ordering of pins (apparently some other orderings exist), doesn't explain things as well for the user (who, if anything, knows their product is a DPI kippah/panel combo), and actually doesn't have to exist (one could connect the 28 GPIOs directly to something else). Simply "DPI" seems like a good compromise name to distinguish from the HDMI, DSI, and TV connectors .

---
 drivers/gpu/drm/drm_crtc.c  | 2 ++
 include/uapi/drm/drm_mode.h | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -0
index f619121..64bd954 100644
@@ -168,6 +168,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
 	{ DRM_MODE_CONNECTOR_eDP, "eDP" },
 	{ DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" },
 	{ DRM_MODE_CONNECTOR_DSI, "DSI" },
+	{ DRM_MODE_CONNECTOR_DPI, "DPI" },
 };
 
 static const struct drm_prop_enum_list drm_encoder_enum_list[] = {
@@ -179,6 +180,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = {
 	{ DRM_MODE_ENCODER_VIRTUAL, "Virtual" },
 	{ DRM_MODE_ENCODER_DSI, "DSI" },
 	{ DRM_MODE_ENCODER_DPMST, "DP MST" },
+	{ DRM_MODE_ENCODER_DPI, "DPI" },
 };
 
 static const struct drm_prop_enum_list drm_subpixel_enum_list[] = {
include/uapi/drm/drm_mode.h +2 -0
index 50adb46..1eb85f7 100644
@@ -202,6 +202,7 @@ struct drm_mode_get_plane_res {
 #define DRM_MODE_ENCODER_VIRTUAL 5
 #define DRM_MODE_ENCODER_DSI	6
 #define DRM_MODE_ENCODER_DPMST	7
+#define DRM_MODE_ENCODER_DPI	8
 
 struct drm_mode_get_encoder {
 	__u32 encoder_id;
@@ -241,6 +242,7 @@ struct drm_mode_get_encoder {
 #define DRM_MODE_CONNECTOR_eDP		14
 #define DRM_MODE_CONNECTOR_VIRTUAL      15
 #define DRM_MODE_CONNECTOR_DSI		16
+#define DRM_MODE_CONNECTOR_DPI		17
 
 struct drm_mode_get_connector {
 
Signature · 1 line
2.7.0
#7 lore raw

PATCH v2 4/5 drm/vc4: Add DPI driver

In reply to 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.

---
 .../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
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +36 -0
index 56a961a..14c4fd5 100644
@@ -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@7e807000 {
 	compatible = "brcm,bcm2835-pixelvalve2";
@@ -60,6 +70,32 @@ hdmi: hdmi@7e902000 {
 	clock-names = "pixel", "hdmi";
 };
 
+dpi: dpi@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@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>;
+		};
+	};
+};
drivers/gpu/drm/vc4/Kconfig +1 -0
index 5848104..e53df59 100644
@@ -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.
drivers/gpu/drm/vc4/Makefile +1 -0
index 4c6a99f..fb77db7 100644
@@ -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 \
drivers/gpu/drm/vc4/vc4_debugfs.c +1 -0
index d76ad10..245115d 100644
@@ -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},
drivers/gpu/drm/vc4/vc4_dpi.c new file +520 -0

520 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_drv.c +1 -0
index f1655ff..0474777 100644
@@ -247,6 +247,7 @@ static const struct component_master_ops vc4_drm_ops = {
 
 static struct platform_driver *const component_drivers[] = {
 	&vc4_hdmi_driver,
+	&vc4_dpi_driver,
 	&vc4_crtc_driver,
 	&vc4_hvs_driver,
 	&vc4_v3d_driver,
drivers/gpu/drm/vc4/vc4_drv.h +5 -0
index 83db0b7..8f22dd2 100644
@@ -16,6 +16,7 @@ struct vc4_dev {
 	struct vc4_hvs *hvs;
 	struct vc4_crtc *crtc[3];
 	struct vc4_v3d *v3d;
+	struct vc4_dpi *dpi;
 
 	struct drm_fbdev_cma *fbdev;
 
@@ -406,6 +407,10 @@ void vc4_debugfs_cleanup(struct drm_minor *minor);
 /* vc4_drv.c */
 void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
 
+/* vc4_dpi.c */
+extern struct platform_driver vc4_dpi_driver;
+int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);
+
 /* vc4_gem.c */
 void vc4_gem_init(struct drm_device *dev);
 void vc4_gem_destroy(struct drm_device *dev);
Signature · 1 line
2.7.0
#9 lore raw

PATCH v2 5/5 ARM: bcm2835: Add the DPI hardware to the device tree.

In reply to Eric Anholt

It's currently marked disabled, as it's not useful without a panel associated with it and the GPIO pins routed to ALT2.

---
 arch/arm/boot/dts/bcm283x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +11 -0
index bbe4eab..d1e6340 100644
@@ -166,6 +166,17 @@
 			interrupts = <2 14>; /* pwa1 */
 		};
 
+		dpi: dpi@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>;
+			status = "disabled";
+		};
+
 		aux: aux@0x7e215000 {
 			compatible = "brcm,bcm2835-aux";
 			#clock-cells = <1>;
Signature · 1 line
2.7.0
maintainer Acked-by on v2 4/5
#8 lore raw

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

In reply to Eric Anholt
Quoted 9 lines · 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.

---
 .../devicetree/bindings/display/brcm,bcm-vc4.txt   |  36 ++
Quoted 8 lines
 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
Reviewed-by on v2 3/5
#6 lore raw

Re: [PATCH 3/5] drm: Add an encoder and connector type enum for DPI.

In reply to Eric Anholt
Quoted 15 lines · Eric Anholt

Right now exynos is exposing DPI as a TMDS encoder and VGA connector, which seems rather misleading. This isn't just an internal detail, since xrandr actually exposes "VGA" as the output name. Define some new enums so that vc4's DPI can have a more informative name.

I considered other names for the connector as well. For VC4, the Adafruit DPI kippah takes the 28 GPIO pins and routes them to a standard-ish 40-pin FPC connector, but "40-pin FPC" doesn't uniquely identify an ordering of pins (apparently some other orderings exist), doesn't explain things as well for the user (who, if anything, knows their product is a DPI kippah/panel combo), and actually doesn't have to exist (one could connect the 28 GPIOs directly to something else). Simply "DPI" seems like a good compromise name to distinguish from the HDMI, DSI, and TV connectors .

Quoted 1 line

Follow-up patch to fix up existing drivers? Either way

through a vc4 pull request (Dave has recently okayed that I can do such acks for non-i915 trees).

Cheers, Daniel

Quoted 52 lines
---
 drivers/gpu/drm/drm_crtc.c  | 2 ++
 include/uapi/drm/drm_mode.h | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -0
index f619121..64bd954 100644
@@ -168,6 +168,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
 	{ DRM_MODE_CONNECTOR_eDP, "eDP" },
 	{ DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" },
 	{ DRM_MODE_CONNECTOR_DSI, "DSI" },
+	{ DRM_MODE_CONNECTOR_DPI, "DPI" },
 };
 
 static const struct drm_prop_enum_list drm_encoder_enum_list[] = {
@@ -179,6 +180,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = {
 	{ DRM_MODE_ENCODER_VIRTUAL, "Virtual" },
 	{ DRM_MODE_ENCODER_DSI, "DSI" },
 	{ DRM_MODE_ENCODER_DPMST, "DP MST" },
+	{ DRM_MODE_ENCODER_DPI, "DPI" },
 };
 
 static const struct drm_prop_enum_list drm_subpixel_enum_list[] = {
include/uapi/drm/drm_mode.h +2 -0
index 50adb46..1eb85f7 100644
@@ -202,6 +202,7 @@ struct drm_mode_get_plane_res {
 #define DRM_MODE_ENCODER_VIRTUAL 5
 #define DRM_MODE_ENCODER_DSI	6
 #define DRM_MODE_ENCODER_DPMST	7
+#define DRM_MODE_ENCODER_DPI	8
 
 struct drm_mode_get_encoder {
 	__u32 encoder_id;
@@ -241,6 +242,7 @@ struct drm_mode_get_encoder {
 #define DRM_MODE_CONNECTOR_eDP		14
 #define DRM_MODE_CONNECTOR_VIRTUAL      15
 #define DRM_MODE_CONNECTOR_DSI		16
+#define DRM_MODE_CONNECTOR_DPI		17
 
 struct drm_mode_get_connector {
 
Signature · 6 lines
2.7.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [PATCH 1/5] of: Add vendor prefix for On Tat Industrial Company.

In reply to Eric Anholt
Quoted 8 lines · Eric Anholt

This is the vendor for a 7" DPI panel sold by Adafruit which I'd like to describe in DT.

---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

Applied, thanks.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160415/144654cb/attachment.sig>

#4 lore raw

Re: [PATCH 2/5] panel-simple: Add the 7" DPI panel from Adafruit.

In reply to Eric Anholt
Quoted 6 lines · Eric Anholt

This is a basic TFT panel with a 40-pin FPC connector on it. The specification doesn't define timings, but the Adafruit instructions were setting up 800x480 CVT.

v2: Add .bus_format and vsync/hsync flags.

Quoted 7 lines
---
 .../bindings/display/panel/ontat,yx700wv03.txt     |  7 +++++
 drivers/gpu/drm/panel/panel-simple.c               | 35 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt

Applied, thanks.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160415/e570ea0d/attachment.sig>