Skip to content

Commit a02fe5c

Browse files
njhollinghurstpopcornmix
authored andcommitted
drm: Add RP1 DSI driver
Add support for the RP1 DSI 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: rp1-dsi: Fix escape clock divider and timeouts. Escape clock divider was fixed at 5, which is correct at 800Mbps/lane but increasingly out of spec for higher rates. Compute it correctly. High speed timeout was fixed at 5*512 == 2560 byte-clocks per lane. Compute it conservatively to be 8/7 times the line period (assuming there will be a transition to LP some time during each scanline?) keeping the old value as a lower bound. Increase LPRX TO to 1024, and BTA TO to 0xb00 (same value as in bridge/synopsys/dw-mipi-dsi). (No change to LP_CMD_TIM. To do: compute this correctly.) Signed-off-by: Nick Hollinghurst <[email protected]> drm: rp1: rp1-dsi: Switch to PLL_SYS source for DPI when 8 * lanes > bpp To support 4 lanes, re-parent DPI clock source between DSI byteclock (using the new "variable sources" defined in clk-rp1) and PLL_SYS. This is to cover cases in which byteclock < pixclock <= 200MHz. Tidying: All frequencies now in Hz (not kHz), where DSI speed is now represented by byteclock to simplify arithmetic. Clamp DPI and byte clocks to their legal ranges; fix up HSTX timeout to avoid an unsafe assumption that it would return to LP state for every scanline. Because of RP1's clock topology, the ratio between DSI and DPI clocks may not be exact with 3 or 4 lanes, leading to slightly irregular timings each time DSI switches between HS and LP states. Tweak to inhibit LP during Horizontal BP when sync pulses were requested. Signed-off-by: Nick Hollinghurst <[email protected]> drm: rp1: rp1-dsi: 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]> drivers: drm: rp1-dsi: Implement more DSI options and flags Now implementing: - Per-command selection of LP or HS for commands (previously LP) - EoTp transmission option (previously EoTp was always disabled) - Non-continuous clock option (previously always continuous) - Per-command enabling of ACK request (in command mode only) Make a plausible (and possibly correct) attempt to measure the longest LP command that will fit into vertical blanking lines. DON'T set both "Burst Mode" and "Sync Events" flags together. This is redundant in the standard IP; in this RP1 variant it would enable Sync Pulses but may break with some video timings. Signed-off-by: Nick Hollinghurst <[email protected]>
1 parent 1a44240 commit a02fe5c

File tree

10 files changed

+2720
-0
lines changed

10 files changed

+2720
-0
lines changed

drivers/gpu/drm/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ source "drivers/gpu/drm/v3d/Kconfig"
470470

471471
source "drivers/gpu/drm/vc4/Kconfig"
472472

473+
source "drivers/gpu/drm/rp1/Kconfig"
474+
473475
source "drivers/gpu/drm/loongson/Kconfig"
474476

475477
source "drivers/gpu/drm/etnaviv/Kconfig"

drivers/gpu/drm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,4 @@ obj-y += solomon/
229229
obj-$(CONFIG_DRM_SPRD) += sprd/
230230
obj-$(CONFIG_DRM_LOONGSON) += loongson/
231231
obj-$(CONFIG_DRM_POWERVR) += imagination/
232+
obj-y += rp1/

drivers/gpu/drm/rp1/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source "drivers/gpu/drm/rp1/rp1-dsi/Kconfig"
2+
3+
source "drivers/gpu/drm/rp1/rp1-dpi/Kconfig"
4+
5+
source "drivers/gpu/drm/rp1/rp1-vec/Kconfig"

drivers/gpu/drm/rp1/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
obj-$(CONFIG_DRM_RP1_DSI) += rp1-dsi/
2+
obj-$(CONFIG_DRM_RP1_DPI) += rp1-dpi/
3+
obj-$(CONFIG_DRM_RP1_VEC) += rp1-vec/
4+

drivers/gpu/drm/rp1/rp1-dsi/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
config DRM_RP1_DSI
3+
tristate "DRM Support for RP1 DSI"
4+
depends on DRM && MFD_RP1
5+
select DRM_GEM_DMA_HELPER
6+
select DRM_KMS_HELPER
7+
select DRM_MIPI_DSI
8+
select DRM_VRAM_HELPER
9+
select DRM_TTM
10+
select DRM_TTM_HELPER
11+
select GENERIC_PHY
12+
select GENERIC_PHY_MIPI_DPHY
13+
help
14+
Choose this option to enable DSI display on RP1

drivers/gpu/drm/rp1/rp1-dsi/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-dsi-y := rp1_dsi.o rp1_dsi_dma.o rp1_dsi_dsi.o
4+
5+
obj-$(CONFIG_DRM_RP1_DSI) += drm-rp1-dsi.o

0 commit comments

Comments
 (0)