drm/vc4: DPI panel support
Subsystems (7)
cover drm/vc4: DPI panel support
In preparation for working on DSI panel support, I wrote the much simpler support for DPI panels. I've tested it on the 7" DPI panel from Adafruit, with panel-simple support included here.
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 | 67 +++ .../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 | 33 ++ 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 + include/uapi/drm/drm_mode.h | 2 + 13 files changed, 650 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
PATCH 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
@@ -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 · 1 line
2.7.0
PATCH 2/5 panel-simple: Add the 7" DPI panel from Adafruit.
In reply to Eric AnholtThis 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.
--- .../bindings/display/panel/ontat,yx700wv03.txt | 7 +++++ drivers/gpu/drm/panel/panel-simple.c | 33 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt
Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt new file +7 -0
@@ -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 +33 -0
@@ -1176,6 +1176,36 @@ 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 , +}; + +/* 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 , + }, +}; +static const struct of_device_id platform_of_match[] = { { .compatible ="ampire,am800480r3tmqwa1h" ,
@@ -1265,6 +1295,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
PATCH 3/5 drm: Add an encoder and connector type enum for DPI.
In reply to Eric AnholtRight 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
@@ -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
@@ -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 8struct 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 17struct drm_mode_get_connector {
Signature · 1 line
2.7.0
PATCH 4/5 drm/vc4: Add DPI driver
In reply to Eric AnholtThe DPI interface involves taking a ton of our GPIOs to be used as outputs, and routing display signals over them in parallel.
--- .../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
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +67 -0
@@ -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) 00000000rrrrrggggggbbbbb + 2) 000rrrrr00gggggg000bbbbb + 3) 00rrrrr000gggggg00bbbbb0 + 4) 000000rrrrrrggggggbbbbbb + 5) 00rrrrrr00gggggg00bbbbbb + 6) rrrrrrrrggggggggbbbbbbbb + +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>; + }; + }; +};
drivers/gpu/drm/vc4/Kconfig +1 -0
@@ -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
@@ -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
@@ -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 +518 -0
518 lines not on this page · raw message
drivers/gpu/drm/vc4/vc4_drv.c +1 -0
@@ -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
@@ -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
PATCH 5/5 ARM: bcm2835: Add the DPI hardware to the device tree.
In reply to Eric AnholtIt'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
@@ -166,6 +166,17 @@ interrupts = <2 14>; /* pwa1 */ }; + 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>; + status = "disabled"; + }; + aux: aux at 0x7e215000 { compatible = "brcm,bcm2835-aux"; #clock-cells = <1>;
Signature · 1 line
2.7.0
Re: [PATCH 1/5] of: Add vendor prefix for On Tat Industrial Company.
In reply to Eric AnholtQuoted 7 lines · Eric Anholt
This is the vendor for a 7" DPI panel sold by Adafruit which I'd like to describe in DT.
Signed-off-by Eric Anholt <[email protected]>--- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Re: [PATCH 2/5] panel-simple: Add the 7" DPI panel from Adafruit.
In reply to Eric AnholtQuoted 10 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.
Signed-off-by Eric Anholt <[email protected]>--- .../bindings/display/panel/ontat,yx700wv03.txt | 7 +++++ drivers/gpu/drm/panel/panel-simple.c | 33 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/ontat,yx700wv03.txt
--
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
Rob Herring
maintainerRe: [PATCH 4/5] drm/vc4: Add DPI driver
In reply to Eric AnholtQuoted 48 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.
Signed-off-by Eric Anholt <[email protected]>--- .../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.cDocumentation/devicetree/bindings/display/brcm,bcm-vc4.txt +24
-0@@ -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) 00000000rrrrrggggggbbbbb + 2) 000rrrrr00gggggg000bbbbb + 3) 00rrrrr000gggggg00bbbbb0 + 4) 000000rrrrrrggggggbbbbbb + 5) 00rrrrrr00gggggg00bbbbbb + 6) rrrrrrrrggggggggbbbbbbbb + +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
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt Optional properties for HDMI: · line 72
Quoted 10 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +10
-0+- 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
Re: [PATCH 4/5] drm/vc4: Add DPI driver
Quoted 63 lines · Rob Herring
Quoted 48 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.
Signed-off-by Eric Anholt <[email protected]>--- .../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.cDocumentation/devicetree/bindings/display/brcm,bcm-vc4.txt +24
-0@@ -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) 00000000rrrrrggggggbbbbb + 2) 000rrrrr00gggggg000bbbbb + 3) 00rrrrr000gggggg00bbbbb0 + 4) 000000rrrrrrggggggbbbbbb + 5) 00rrrrrr00gggggg00bbbbbb + 6) rrrrrrrrggggggggbbbbbbbb + +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 signalDocumentation/devicetree/bindings/display/brcm,bcm-vc4.txt Optional properties for HDMI: · line 72
Quoted 10 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +10
-0+- 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.
Quoted 3 lines
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.