Skip to content

Commit

Permalink
DPU: add DPU driver for Lichee-Pi-4A board
Browse files Browse the repository at this point in the history
Add driver support for DPU, DSI and HDMI.

Signed-off-by: forain <[email protected]>
  • Loading branch information
forain authored and RevySR committed Jun 25, 2024
1 parent 1a51308 commit ff9e431
Show file tree
Hide file tree
Showing 47 changed files with 12,561 additions and 7 deletions.
14 changes: 14 additions & 0 deletions arch/riscv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,20 @@ config KASAN_SHADOW_OFFSET
default 0xdfffffff00000000 if 64BIT
default 0xffffffff if 32BIT

config ARCH_FORCE_MAX_ORDER
int "Maximum zone order"
default 10
help
The kernel memory allocator divides physically contiguous memory
blocks into "zones", where each zone is a power of two number of
pages. This option selects the largest power of two that the kernel
keeps in the memory allocator. If you need to allocate very large
blocks of physically contiguous memory, then you may need to
increase this value.

The page size is not necessarily 4KB. Keep this in mind
when choosing a value for this option.

config ARCH_FLATMEM_ENABLE
def_bool !NUMA

Expand Down
86 changes: 86 additions & 0 deletions arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
cooling-levels = <0 66 196 255>;
};

lcd0_backlight: pwm-backlight@0 {
compatible = "pwm-backlight";
pwms = <&pwm 0 5000000 0>;
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <7>;
};

reg_tp0_pwr: regulator-tp0-pwr {
compatible = "regulator-fixed";
regulator-name = "tp0-pwr";
Expand Down Expand Up @@ -704,3 +711,82 @@
pinctrl-0 = <&i2s1_pa_pins>;
};

&dpu_enc1 {
ports {
/delete-node/ port@0;
};
};

&disp1_out {
remote-endpoint = <&hdmi_tx_in>;
};

&hdmi_tx {
status = "okay";

port@0 {
/* input */
hdmi_tx_in: endpoint {
remote-endpoint = <&disp1_out>;
};
};
};

&dpu_enc0 {
ports {
/* output */
port@1 {
reg = <1>;

enc0_out: endpoint {
remote-endpoint = <&dsi0_in>;
};
};
};
};

&dhost_0 {
ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;

dsi0_in: endpoint {
remote-endpoint = <&enc0_out>;
};
};

port@1 {
reg = <1>;

dsi0_out: endpoint {
remote-endpoint = <&panel0_in>;
};
};
};

panel0@0 {
compatible = "jadard,jd9365da-h3";
reg = <0>;
backlight = <&lcd0_backlight>;
reset-gpio = <&ioexp3 7 0>; /* active low */
vccio-supply = <&reg_vdd18_lcd0>;
vdd-supply = <&reg_vdd33_lcd0>;

port {
panel0_in: endpoint {
remote-endpoint = <&dsi0_out>;
};
};
};
};

&dsi0 {
status = "okay";
};

&dpu_enc0 {
status = "okay";
};
180 changes: 180 additions & 0 deletions arch/riscv/boot/dts/thead/th1520.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,60 @@
reg = <0xff 0xffef8000 0x0 0x10000>;
};

display-subsystem {
compatible = "verisilicon,display-subsystem";
ports = <&dpu_disp0>, <&dpu_disp1>;
status = "okay";
};

dpu-encoders {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

dpu_enc0: dpu-encoder@0 {
/* default encoder is DSI */
compatible = "verisilicon,dsi-encoder";
reg = <0>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

/* input */
port@0 {
reg = <0>;

enc0_in: endpoint {
remote-endpoint = <&disp0_out>;
};
};
};
};

dpu_enc1: dpu-encoder@1 {
/* default encoder is DSI */
compatible = "verisilicon,dsi-encoder";
reg = <1>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

/* input */
port@0 {
reg = <0>;

enc1_in: endpoint {
remote-endpoint = <&disp1_out>;
};
};
};
};
};

soc {
compatible = "simple-bus";
interrupt-parent = <&plic>;
Expand Down Expand Up @@ -1044,6 +1098,132 @@
status = "disabled";
};

vosys_reg: vosys-reg@ffef528000 {
compatible = "xuantie,th1520-vosys-reg", "syscon";
reg = <0xff 0xef528000 0x0 0x1000>;
status = "okay";
};

dsi0: dw-mipi-dsi0@ffef500000 {
compatible = "xuantie,th1520-mipi-dsi", "simple-bus", "syscon";
reg = <0xff 0xef500000 0x0 0x10000>;
status = "disabled";

dphy_0: dsi0-dphy {
compatible = "xuantie,th1520-mipi-dphy";
regmap = <&dsi0>;
vosys-regmap = <&vosys_reg>;
clocks = <&vosys_clk_gate TH1520_CLKGEN_MIPIDSI0_REFCLK>,
<&vosys_clk_gate TH1520_CLKGEN_MIPIDSI0_CFG_CLK>,
<&vosys_clk_gate TH1520_CLKGEN_MIPIDSI0_PCLK>,
<&clk OSC_24M>,
<&clk OSC_24M>;
clock-names = "refclk", "cfgclk", "pclk", "prefclk", "pcfgclk";
#phy-cells = <0>;
};

dhost_0: dsi0-host {
compatible = "verisilicon,dw-mipi-dsi";
regmap = <&dsi0>;
interrupts = <129 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&vosys_clk_gate TH1520_CLKGEN_MIPIDSI0_PCLK>,
<&vosys_clk_gate TH1520_CLKGEN_MIPIDSI0_PIXCLK>;
clock-names = "pclk", "pixclk";
phys = <&dphy_0>;
phy-names = "dphy";
#address-cells = <1>;
#size-cells = <0>;
};
};

dsi1: dw-mipi-dsi1@ffef510000 {
compatible = "xuantie,th1520-mipi-dsi", "simple-bus", "syscon";
reg = <0xff 0xef510000 0x0 0x10000>;
status = "disabled";

dphy_1: dsi1-dphy {
compatible = "xuantie,th1520-mipi-dphy";
regmap = <&dsi1>;
vosys-regmap = <&vosys_reg>;
clocks = <&vosys_clk_gate TH1520_CLKGEN_MIPIDSI1_REFCLK>,
<&vosys_clk_gate TH1520_CLKGEN_MIPIDSI1_CFG_CLK>,
<&vosys_clk_gate TH1520_CLKGEN_MIPIDSI1_PCLK>,
<&clk OSC_24M>,
<&clk OSC_24M>;
clock-names = "refclk", "cfgclk", "pclk", "prefclk", "pcfgclk";
#phy-cells = <0>;
};

dhost_1: dsi1-host {
compatible = "verisilicon,dw-mipi-dsi";
regmap = <&dsi1>;
interrupts = <129 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&vosys_clk_gate TH1520_CLKGEN_MIPIDSI1_PCLK>,
<&vosys_clk_gate TH1520_CLKGEN_MIPIDSI1_PIXCLK>;
clock-names = "pclk", "pixclk";
phys = <&dphy_1>;
phy-names = "dphy";
#address-cells = <1>;
#size-cells = <0>;
};
};

hdmi_tx: dw-hdmi-tx@ffef540000 {
compatible = "xuantie,th1520-hdmi-tx";
reg = <0xff 0xef540000 0x0 0x40000>;
interrupts = <111 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&vosys_clk_gate TH1520_CLKGEN_HDMI_PCLK>,
<&vosys_clk_gate TH1520_CLKGEN_HDMI_SFR_CLK>,
<&vosys_clk_gate TH1520_CLKGEN_HDMI_CEC_CLK>,
<&vosys_clk_gate TH1520_CLKGEN_HDMI_PIXCLK>;
clock-names = "iahb", "isfr", "cec", "pixclk";
reg-io-width = <4>;
phy_version = <301>;
/* TODO: add phy property */
status = "disabled";
};

dpu: dc8200@ffef600000 {
compatible = "verisilicon,dc8200";
#address-cells = <1>;
#size-cells = <0>;
reg = <0xff 0xef600000 0x0 0x100>,
<0xff 0xef600800 0x0 0x2000>,
<0xff 0xef630010 0x0 0x60>;
interrupts = <93 IRQ_TYPE_LEVEL_HIGH>;
vosys-regmap = <&vosys_reg>;
clocks = <&vosys_clk_gate TH1520_CLKGEN_DPU_CCLK>,
<&vosys_clk_gate TH1520_CLKGEN_DPU_PIXCLK0>,
<&vosys_clk_gate TH1520_CLKGEN_DPU_PIXCLK1>,
<&vosys_clk_gate TH1520_CLKGEN_DPU_ACLK>,
<&vosys_clk_gate TH1520_CLKGEN_DPU_HCLK>,
<&clk DPU0_PLL_DIV_CLK>,
<&clk DPU1_PLL_DIV_CLK>,
<&clk DPU0_PLL_FOUTPOSTDIV>,
<&clk DPU1_PLL_FOUTPOSTDIV>;
clock-names = "core_clk", "pix_clk0", "pix_clk1",
"axi_clk", "cfg_clk", "pixclk0",
"pixclk1", "dpu0_pll_foutpostdiv",
"dpu1_pll_foutpostdiv";
status = "okay";

dpu_disp0: port@0 {
reg = <0>;

disp0_out: endpoint {
remote-endpoint = <&enc0_in>;
};
};

dpu_disp1: port@1 {
reg = <1>;

disp1_out: endpoint {
remote-endpoint = <&enc1_in>;
};
};
};

aon_suspend_ctrl: aon_suspend_ctrl {
compatible = "thead,th1520-aon-suspend-ctrl";
status = "okay";
Expand Down
9 changes: 7 additions & 2 deletions arch/riscv/configs/th1520_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,15 @@ CONFIG_SUNXI_WATCHDOG=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_DRM=y
CONFIG_DRM_NOUVEAU=m
CONFIG_DRM_SUN4I=m
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_PANEL_JADARD_JD9365DA_H3=y
CONFIG_DRM_VERISILICON=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_FB=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_ARCH_FORCE_MAX_ORDER=15
CONFIG_LOGO=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PLATFORM=y
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ source "drivers/gpu/drm/solomon/Kconfig"

source "drivers/gpu/drm/sprd/Kconfig"

source "drivers/gpu/drm/verisilicon/Kconfig"

config DRM_HYPERV
tristate "DRM Support for Hyper-V synthetic video device"
depends on DRM && PCI && MMU && HYPERV
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,4 @@ obj-$(CONFIG_DRM_HYPERV) += hyperv/
obj-y += solomon/
obj-$(CONFIG_DRM_SPRD) += sprd/
obj-$(CONFIG_DRM_LOONGSON) += loongson/
obj-$(CONFIG_DRM_VERISILICON) += verisilicon/
Loading

0 comments on commit ff9e431

Please sign in to comment.