Skip to content

Commit bd9497a

Browse files
njhollinghurstpopcornmix
authored andcommitted
drm: Add RP1 DPI driver
Add support for the RP1 DPI hardware. Signed-off-by: Nick Hollinghurst <[email protected]> drm/rp1: depends on, instead of select, MFD_RP1 According to kconfig-language.txt [1], select should be used only for "non-visible symbols ... and for symbols with no dependencies". Since MFD_RP1 both is visible and has a dependency, "select" should not be used and "depends on" should be used instead. In particular, this fixes the build of this kernel tree on NixOS, where its kernel config system will try to answer 'M' to as many config as possible. [1] https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html Signed-off-by: Ratchanan Srirattanamet <[email protected]> drm: rp1: VEC and DPI drivers: Fix bug #5901 Rework probe() to use devm_drm_dev_alloc(), embedding the DRM device in the DPI or VEC device as now seems to be recommended. Change order of resource allocation and driver initialization. This prevents it trying to write to an unmapped register during clean-up, which previously could crash. Signed-off-by: Nick Hollinghurst <[email protected]> drm: rp1: dpi: Add support for MEDIA_BUS_FMT_RGB565_1X24_CPADHI This new format corresponds to the Raspberry Pi legacy DPI mode 3. Signed-off-by: Nick Hollinghurst <[email protected]> drm: rp1: rp1-dpi: Add DRM_FORMAT_ARGB8888 and DRM_FORMAT_ABGR8888 Android requires this. As the underlying hardware doesn't support alpha blending, we ignore the alpha value. Signed-off-by: Jan Kehren <[email protected]> drm: rp1: rp1-dpi: Add interlaced modes and PIO program to fix VSYNC Implement interlaced modes by wobbling the base pointer and VFP width for every field. This results in correct pixels but incorrect VSYNC. Now use PIO to generate a fixed-up VSYNC by sampling DE and HSYNC. This requires DPI's DE output to be mapped to GPIO1, which we check. When DE is not exposed, the internal fixup is disabled. VSYNC/GPIO2 becomes a modified signal, designed to help an external device or PIO program synthesize CSYNC or VSYNC. Signed-off-by: Nick Hollinghurst <[email protected]> drm: rp1: rp1-dpi: Fix optional dependency on RP1_PIO Add optional dependency to Kconfig, and conditionally compile PIO-dependent code. Add a mode validation function to reject interlaced modes when RP1_PIO is not present. Signed-off-by: Nick Hollinghurst <[email protected]> drm: rp1: rp1-dpi: Add "rgb_order" property (to match VC4 DPI) As on VC4, the OF property overrides the order implied by media bus format. Only 4 of the 6 possible orders are supported. New add-on hardware designs should not rely on this "legacy" feature. Signed-off-by: Nick Hollinghurst <[email protected]> drm/rp1: DPI interlace: Improve precision of PIO-generated VSYNC Instead of trying to minimize the delay between seeing HSYNC edge and asserting VSYNC, try to predict the next HSYNC edge precisely. This eliminates the round-trip delay but introduces mode-dependent rounding error. HSYNC->VSYNC lag reduced from ~30ns to -5ns..+10ns (plus up to 5ns synchronization jitter as before). This may benefit e.g. SCART HATs, particularly those that generate Composite Sync using a XNOR gate. Signed-off-by: Nick Hollinghurst <[email protected]>
1 parent 8d7d169 commit bd9497a

File tree

7 files changed

+2028
-0
lines changed

7 files changed

+2028
-0
lines changed

drivers/gpu/drm/rp1/rp1-dpi/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
config DRM_RP1_DPI
3+
tristate "DRM Support for RP1 DPI"
4+
depends on DRM && MFD_RP1
5+
select DRM_GEM_DMA_HELPER
6+
select DRM_KMS_HELPER
7+
select DRM_VRAM_HELPER
8+
select DRM_TTM
9+
select DRM_TTM_HELPER
10+
depends on RP1_PIO || !RP1_PIO
11+
help
12+
Choose this option to enable DPI output on Raspberry Pi RP1
13+
14+
There is an optional dependency on RP1_PIO, as the PIO block
15+
must be used to fix up interlaced sync. Interlaced DPI modes
16+
will be unavailable when RP1_PIO is not selected.

drivers/gpu/drm/rp1/rp1-dpi/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
3+
drm-rp1-dpi-y := rp1_dpi.o rp1_dpi_hw.o rp1_dpi_cfg.o rp1_dpi_pio.o
4+
5+
obj-$(CONFIG_DRM_RP1_DPI) += drm-rp1-dpi.o

0 commit comments

Comments
 (0)