drm: add kms driver for loongson display controller
Subsystems (2)
PATCH v3 1/1 drm: add kms driver for loongson display controller
From: suijingfeng <[email protected]>
Loongson display controller IP has been integrated in both Loongson North Bridge chipset(ls7a1000 and ls7a2000) and Loongson SoCs(ls2k1000 and ls2k2000 etc), it even been included in Loongson BMC products.
The display controller is a PCI device, it has two display pipe. For the DC in LS7A1000 and LS2K1000 each way has a DVO output interface which provide RGB888 signals, vertical & horizontal synchronisations, and the pixel clock. Each CRTC is able to support 1920x1080@60Hz, the maximum resolution is 2048x2048 according to the hardware spec.
For the DC in LS7A2000, each display pipe is equipped with a built-in HDMI encoder which is compliant with HDMI 1.4 specification. Thus it support 3840x2160@30Hz. The first display pipe is also equipped with a transparent vga encoder which is parallel with the HDMI encoder. The DC in LS7A2000 is more complete, besides above feature, it has two hardware cursors, two hardware vblank counter and two scanout position recorders.
v1 -> v2:
1) Use hpd status reg when polling for ls7a2000
2) Fix all warnings emerged when compile with W=1
v2 -> v3:
1) Add COMPILE_TEST in Kconfig and make the driver off by default
2) Alphabetical sorting headers
3) Untangle register access functions as much as possible
4) Switch to TTM based memory manager and prefer cached mapping for Loongson SoC
5) Add chip id detection method, now all models are distinguishable.
6) Revise builtin HDMI phy driver, nearly all main stream mode below 4K@30Hz is tested, this driver supported these mode very well.
As a basic kms 2D driver, the user experience is good enough when using X server under mate and xfce desktop environment. This dirver is ready to be merged, and i will take the responsibility if there any bug happen.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/lsdc/Kconfig | 16 + drivers/gpu/drm/lsdc/Makefile | 15 + drivers/gpu/drm/lsdc/lsdc_crtc.c | 376 ++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_debugfs.c | 233 ++++++++++++ drivers/gpu/drm/lsdc/lsdc_drv.c | 569 ++++++++++++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_drv.h | 377 ++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_i2c.c | 193 ++++++++++ drivers/gpu/drm/lsdc/lsdc_irq.c | 85 +++++ drivers/gpu/drm/lsdc/lsdc_output.c | 465 +++++++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_plane.c | 440 +++++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_pll.c | 468 +++++++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_pll.h | 78 ++++ drivers/gpu/drm/lsdc/lsdc_probe.c | 74 ++++ drivers/gpu/drm/lsdc/lsdc_regs.h | 343 +++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_ttm.c | 450 ++++++++++++++++++++++ drivers/gpu/drm/lsdc/lsdc_ttm.h | 62 +++ include/drm/drm_gem_vram_helper.h | 4 - 19 files changed, 4247 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/lsdc/Kconfig create mode 100644 drivers/gpu/drm/lsdc/Makefile create mode 100644 drivers/gpu/drm/lsdc/lsdc_crtc.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_debugfs.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_drv.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_drv.h create mode 100644 drivers/gpu/drm/lsdc/lsdc_i2c.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_irq.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_output.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_plane.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_pll.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_pll.h create mode 100644 drivers/gpu/drm/lsdc/lsdc_probe.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_regs.h create mode 100644 drivers/gpu/drm/lsdc/lsdc_ttm.c create mode 100644 drivers/gpu/drm/lsdc/lsdc_ttm.h
drivers/gpu/drm/Kconfig +2 -0
@@ -367,6 +367,8 @@ source "drivers/gpu/drm/solomon/Kconfig" source "drivers/gpu/drm/sprd/Kconfig" +source "drivers/gpu/drm/lsdc/Kconfig" + config DRM_HYPERV tristate "DRM Support for Hyper-V synthetic video device" depends on DRM && PCI && MMU && HYPERV
drivers/gpu/drm/Makefile +1 -0
@@ -190,3 +190,4 @@ obj-y += gud/ obj-$(CONFIG_DRM_HYPERV) += hyperv/ obj-y += solomon/ obj-$(CONFIG_DRM_SPRD) += sprd/ +obj-$(CONFIG_DRM_LSDC) += lsdc/
drivers/gpu/drm/lsdc/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0 + +config DRM_LSDC + tristate "DRM support for Loongson Display Controller" + depends on DRM && PCI + depends on LOONGARCH || MIPS || COMPILE_TEST + depends on OF + select DRM_KMS_HELPER + select DRM_TTM + select DRM_TTM_HELPER + help + This is a KMS driver for loongson display controller in the + LS7A1000/LS7A2000 bridge chip and LS2K2000/LS2K1000/LS2K0500 + SoC. If "M" is selected, the module will be called lsdc. + + If in doubt, say "N".
drivers/gpu/drm/lsdc/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0 + +lsdc-y := \ + lsdc_crtc.o \ + lsdc_debugfs.o \ + lsdc_drv.o \ + lsdc_i2c.o \ + lsdc_irq.o \ + lsdc_output.o \ + lsdc_plane.o \ + lsdc_pll.o \ + lsdc_probe.o \ + lsdc_ttm.o + +obj-$(CONFIG_DRM_LSDC) += lsdc.o
drivers/gpu/drm/lsdc/lsdc_crtc.c new file +376 -0
376 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_debugfs.c new file +233 -0
233 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_drv.c new file +569 -0
569 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_drv.h new file +377 -0
377 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_i2c.c new file +193 -0
193 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_irq.c new file +85 -0
85 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_output.c new file +465 -0
465 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_plane.c new file +440 -0
440 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_pll.c new file +468 -0
219 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_pll.h new file +78 -0
78 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_probe.c new file +74 -0
74 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_regs.h new file +343 -0
343 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_ttm.c new file +450 -0
450 lines not on this page · raw message
drivers/gpu/drm/lsdc/lsdc_ttm.h new file +62 -0
62 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.