Skip to content

Commit

Permalink
drm/starfive: Add StarFive drm driver
Browse files Browse the repository at this point in the history
Add starfive DRM Display driver framework

Signed-off-by: jack.zhu <[email protected]>
Signed-off-by: keith.zhao <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: José Expósito <[email protected]>
Signed-off-by: Emil Renner Berthing <[email protected]>
  • Loading branch information
sw.multimedia authored and esmil committed Oct 28, 2024
1 parent a978758 commit 61ec5b8
Show file tree
Hide file tree
Showing 21 changed files with 3,391 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/cache/sifive_ccache.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ static void ccache_flush_range(phys_addr_t start, size_t len)
}
}

void sifive_ccache_flush_range(phys_addr_t start, size_t len)
{
ccache_flush_range(start, len);
}
EXPORT_SYMBOL_GPL(sifive_ccache_flush_range);

static const struct riscv_nonstd_cache_ops ccache_mgmt_ops __initconst = {
.wback = &ccache_flush_range,
.inv = &ccache_flush_range,
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ source "drivers/gpu/drm/renesas/Kconfig"

source "drivers/gpu/drm/sun4i/Kconfig"

source "drivers/gpu/drm/starfive/Kconfig"

source "drivers/gpu/drm/omapdrm/Kconfig"

source "drivers/gpu/drm/tilcdc/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ obj-$(CONFIG_DRM_ATMEL_HLCDC) += atmel-hlcdc/
obj-y += renesas/
obj-y += omapdrm/
obj-$(CONFIG_DRM_SUN4I) += sun4i/
obj-$(CONFIG_DRM_STARFIVE) += starfive/
obj-y += tilcdc/
obj-$(CONFIG_DRM_QXL) += qxl/
obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/
Expand Down
17 changes: 17 additions & 0 deletions drivers/gpu/drm/starfive/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2021 StarFive Technology Co., Ltd.

config DRM_STARFIVE
tristate "DRM Support for StarFive SoCs"
depends on DRM
depends on SIFIVE_CCACHE && RISCV_NONSTANDARD_CACHE_OPS
depends on SOC_STARFIVE || COMPILE_TEST
select DRM_GEM_DMA_HELPER
select DRM_KMS_HELPER
select DRM_MIPI_DSI
select DRM_PANEL
help
Choose this option if you have a StarFive SoCs.
The module will be called starfive-drm
This driver provides kernel mode setting and
buffer management to userspace.
13 changes: 13 additions & 0 deletions drivers/gpu/drm/starfive/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2021 StarFive Technology Co., Ltd.
#
starfive-drm-y := starfive_drm_drv.o \
starfive_drm_gem.o \
starfive_drm_crtc.o \
starfive_drm_encoder.o \
starfive_drm_plane.o \
starfive_drm_lcdc.o \
starfive_drm_vpp.o

obj-$(CONFIG_DRM_STARFIVE) += starfive-drm.o
56 changes: 56 additions & 0 deletions drivers/gpu/drm/starfive/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Display Subsystem:(default FBdev)

Steps switch to DRM:
1、Disable fbdev,close below config items:
CONFIG_FB_STARFIVE=y
CONFIG_FB_STARFIVE_HDMI_TDA998X=y
CONFIG_FB_STARFIVE_VIDEO=y

2、open DRM hdmi pipeline,enable items:
CONFIG_DRM_I2C_NXP_TDA998X=y
CONFIG_DRM_I2C_NXP_TDA9950=y
CONFIG_DRM_STARFIVE=y
CONFIG_FRAMEBUFFER_CONSOLE=y

Precautions:when use DRM hdmi pipeline,please make sure CONFIG_DRM_STARFIVE_MIPI_DSI is disable ,
or will cause color abnormal.

3、open DRM mipi pipeline

enable items:
CONFIG_PHY_M31_DPHY_RX0=y
CONFIG_DRM_STARFIVE_MIPI_DSI=y


change jh7100.dtsi display-encoder as below:

display-encoder {
compatible = "starfive,display-encoder";
encoder-type = <6>; //2-TMDS, 3-LVDS, 6-DSI, 8-DPI
status = "okay";

ports {
port@0 {
endpoint {
remote-endpoint = <&dsi_out_port>;
};
};

port@1 {
endpoint {
remote-endpoint = <&crtc_0_out>;
};
};
};
};

install libdrm:
make buildroot_initramfs-menuconfig
choose:
BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBDRM_RADEON=y
BR2_PACKAGE_LIBDRM_AMDGPU=y
BR2_PACKAGE_LIBDRM_NOUVEAU=y
BR2_PACKAGE_LIBDRM_ETNAVIV=y
BR2_PACKAGE_LIBDRM_INSTALL_TESTS=y

Loading

0 comments on commit 61ec5b8

Please sign in to comment.