From 29ca31b84050c86353b9e7207491e4c1201b10ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=AD=90=E6=87=BF?= Date: Tue, 30 Jul 2024 14:48:39 +0800 Subject: [PATCH] dts: k230: update k230-canmv DTS, add BPI canmv k230d zero DTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄子懿 --- .../dts/canaan/bananapi-canmv-k230d-zero.dts | 61 +++++++++++++++ .../dts/canaan/display-hx8399-1080x1920.dtsi | 56 +++++++++++++ .../dts/canaan/display-st7701-480x800.dtsi | 71 +++++++++++++++++ arch/riscv/boot/dts/canaan/k230-canmv.dts | 17 ++++ arch/riscv/boot/dts/canaan/k230-evb.dts | 6 ++ arch/riscv/boot/dts/canaan/k230.dtsi | 53 +------------ arch/riscv/boot/dts/canaan/k230d-canmv.dts | 78 ++----------------- .../gpu/drm/panel/panel-canaan-universal.c | 8 +- 8 files changed, 221 insertions(+), 129 deletions(-) create mode 100644 arch/riscv/boot/dts/canaan/bananapi-canmv-k230d-zero.dts create mode 100644 arch/riscv/boot/dts/canaan/display-hx8399-1080x1920.dtsi create mode 100644 arch/riscv/boot/dts/canaan/display-st7701-480x800.dtsi diff --git a/arch/riscv/boot/dts/canaan/bananapi-canmv-k230d-zero.dts b/arch/riscv/boot/dts/canaan/bananapi-canmv-k230d-zero.dts new file mode 100644 index 0000000000000..51e889e45c501 --- /dev/null +++ b/arch/riscv/boot/dts/canaan/bananapi-canmv-k230d-zero.dts @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2024 Yangyu Chen + */ + +#include "k230.dtsi" +#include "display-st7701-480x800.dtsi" + +/ { + model = "Banana Pi CanMV K230D Zero"; + compatible = "canaan,canmv-k230", "canaan,kendryte-k230"; + + aliases { + serial2 = &uart2; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "root=/dev/mmcblk0p2 loglevel=8 rw rootdelay=4 \ + rootfstype=ext4 console=ttyS0,115200 earlycon=sbi"; + }; + + ddr: memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x8000000>; + }; +}; + +&uart0 { + status = "okay"; +}; +&uart2 { + status = "okay"; +}; +&mmc_sd1{ + status = "okay"; + no-1-8-v; + cap-sd-highspeed; + mshc_ctrl_r = <0x00>; +}; +&usb0 { + status = "okay"; +}; +&usb1 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; + touchscreen@38 { + compatible = "edt,edt-ft5306"; + reg = <0x38>; + reset-gpios = <&gpio1_ports 4 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio1_ports>; + interrupts = <27 IRQ_TYPE_EDGE_FALLING>; + }; +}; + +&lcd { + dsi_reset-gpios = <&gpio1_ports 5 GPIO_ACTIVE_HIGH>; +}; diff --git a/arch/riscv/boot/dts/canaan/display-hx8399-1080x1920.dtsi b/arch/riscv/boot/dts/canaan/display-hx8399-1080x1920.dtsi new file mode 100644 index 0000000000000..b46c940b03b44 --- /dev/null +++ b/arch/riscv/boot/dts/canaan/display-hx8399-1080x1920.dtsi @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0 +&vo { + vth_line = <11>; +}; + +&lcd { + panel-width-mm = <1080>; + panel-height-mm = <1920>; + panel-dsi-lane = <4>; + + panel-init-sequence = [ + 39 00 04 B9 FF 83 99 + 39 00 02 D2 AA + 39 00 10 B1 02 04 71 91 01 32 33 11 11 ab 4d 56 73 02 02 + 39 00 10 B2 00 80 80 ae 05 07 5a 11 00 00 10 1e 70 03 d4 + 39 00 2d B4 00 FF 02 C0 02 c0 00 00 08 00 04 06 00 32 04 0a + 08 21 03 01 + 00 0f b8 8b 02 c0 02 c0 00 00 08 00 04 06 00 32 04 0a 08 01 + 00 0f b8 01 + 39 00 22 D3 00 00 00 00 00 00 06 00 00 10 04 00 04 00 00 00 + 00 00 00 00 00 00 00 01 00 05 05 07 00 00 00 05 40 + 39 00 21 D5 18 18 19 19 18 18 21 20 01 00 07 06 05 04 03 02 + 18 18 18 18 18 18 2f 2f 30 30 31 31 18 18 18 18 + 39 00 21 D6 18 18 19 19 40 40 20 21 02 03 04 05 06 07 00 01 + 40 40 40 40 40 40 2f 2f 30 30 31 31 40 40 40 40 + 39 00 11 D8 a2 aa 02 a0 a2 a8 02 a0 b0 00 00 00 b0 00 00 00 + 39 00 02 BD 01 + 39 00 11 D8 B0 00 00 00 B0 00 00 00 E2 AA 03 F0 E2 AA 03 F0 + 39 00 02 BD 02 + 39 00 09 D8 E2 AA 03 F0 E2 AA 03 F0 + 39 00 02 BD 00 + 39 00 03 B6 8D 8D + 39 00 02 CC 04 + 39 00 03 C6 FF F9 + 39 00 37 E0 00 12 1f 1a 40 4a 59 55 5e 67 6f 75 7a 82 8b 90 + 95 9f a3 ad a2 b2 B6 5e 5a 65 77 00 12 1f 1a 40 4a 59 55 5e + 67 6f 75 7a 82 8b 90 95 + 9f a3 ad a2 b2 B6 5e 5a 65 77 + 39 ff 01 11 + 39 ff 01 29 + ]; + + display-timings { + timing-0 { + clock-frequency = <74250000>; + hactive = <1080>; + vactive = <1920>; + hfront-porch = <40>; + hback-porch = <20>; + hsync-len = <20>; + vfront-porch = <206>; + vback-porch = <8>; + vsync-len = <5>; + }; + }; +}; diff --git a/arch/riscv/boot/dts/canaan/display-st7701-480x800.dtsi b/arch/riscv/boot/dts/canaan/display-st7701-480x800.dtsi new file mode 100644 index 0000000000000..967134eaac533 --- /dev/null +++ b/arch/riscv/boot/dts/canaan/display-st7701-480x800.dtsi @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0 +&vo { + vth_line = <10>; +}; + +&lcd { + panel-width-mm = <480>; + panel-height-mm = <800>; + panel-dsi-lane = <2>; + + panel-init-sequence = [ + 39 00 06 ff 77 01 00 00 13 + 39 00 02 ef 08 + 39 00 06 ff 77 01 00 00 10 + 39 00 03 c0 63 00 + 39 00 03 c1 10 02 + 39 00 03 c2 31 02 + 39 00 02 cc 10 + 39 00 11 b0 c0 0c 92 0c 10 05 02 0d 07 21 04 53 11 6a 32 1f + 39 00 11 b1 c0 87 cf 0c 10 06 00 03 08 1d 06 54 12 e6 ec 0f + 39 00 06 ff 77 01 00 00 11 + 39 00 02 b0 5d + 39 00 02 b1 62 + 39 00 02 b2 82 + 39 00 02 b3 80 + 39 00 02 b5 42 + 39 00 02 b7 85 + 39 00 02 b8 20 + 39 00 02 c0 09 + 39 00 02 c1 78 + 39 00 02 c2 78 + 39 00 02 d0 88 + 39 ff 02 ee 42 + 39 00 04 e0 00 00 02 + 39 00 0c e1 04 a0 06 a0 05 a0 07 a0 00 44 44 + 39 00 0d e2 00 00 33 33 01 a0 00 00 01 a0 00 00 + 39 00 05 e3 00 00 33 33 + 39 00 03 e4 44 44 + 39 00 11 e5 0c 30 a0 a0 0e 32 a0 a0 08 2c a0 a0 0a 2e a0 a0 + 39 00 05 e6 00 00 33 33 + 39 00 03 e7 44 44 + 39 00 11 e8 0d 31 a0 a0 0f 33 a0 a0 09 2d a0 a0 0b 2f a0 a0 + 39 00 08 eb 00 01 e4 e4 44 88 00 + 39 00 11 ed ff f5 47 6f 0b a1 a2 bf fb 2a 1a b0 f6 74 5f ff + 39 00 07 ef 08 08 08 40 3f 64 + 39 00 06 ff 77 01 00 00 13 + 39 00 03 e8 00 0e + 39 00 06 ff 77 01 00 00 00 + 39 ff 01 11 + 39 00 06 ff 77 01 00 00 13 + 39 ff 03 e8 00 0c + 39 00 03 e8 00 00 + 39 00 06 ff 77 01 00 00 00 + 39 00 02 3a 50 + 39 ff 01 29 + ]; + + display-timings { + timing-0 { + clock-frequency = <39600000>; + hactive = <480>; + vactive = <800>; + hfront-porch = <80>; + hback-porch = <20>; + hsync-len = <20>; + vfront-porch = <220>; + vback-porch = <70>; + vsync-len = <10>; + }; + }; +}; diff --git a/arch/riscv/boot/dts/canaan/k230-canmv.dts b/arch/riscv/boot/dts/canaan/k230-canmv.dts index 7a0671aca9a49..a08a8fc8494b1 100644 --- a/arch/riscv/boot/dts/canaan/k230-canmv.dts +++ b/arch/riscv/boot/dts/canaan/k230-canmv.dts @@ -4,6 +4,7 @@ */ #include "k230.dtsi" +#include "display-st7701-480x800.dtsi" / { model = "Canaan CanMV-K230"; @@ -46,3 +47,19 @@ &i2c3 { status = "okay"; }; + +&i2c4 { + status = "okay"; + touchscreen@38 { + compatible = "edt,edt-ft5306"; + reg = <0x38>; + reset-gpios = <&gpio0_ports 21 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio0_ports>; + interrupts = <22 IRQ_TYPE_EDGE_FALLING>; + }; +}; + +&lcd { + dsi_reset-gpios = <&gpio0_ports 20 GPIO_ACTIVE_HIGH>; + backlight_gpio-gpios = <&gpio0_ports 25 GPIO_ACTIVE_HIGH>; +}; diff --git a/arch/riscv/boot/dts/canaan/k230-evb.dts b/arch/riscv/boot/dts/canaan/k230-evb.dts index ebb95f4450a07..a7519c6f064f8 100644 --- a/arch/riscv/boot/dts/canaan/k230-evb.dts +++ b/arch/riscv/boot/dts/canaan/k230-evb.dts @@ -4,6 +4,7 @@ */ #include "k230.dtsi" +#include "display-hx8399-1080x1920.dtsi" / { model = "Kendryte K230 EVB"; @@ -80,3 +81,8 @@ status = "okay"; }; }; + +&lcd { + dsi_reset-gpios = <&gpio0_ports 9 GPIO_ACTIVE_HIGH>; + backlight_gpio-gpios = <&gpio0_ports 31 GPIO_ACTIVE_HIGH>; +}; diff --git a/arch/riscv/boot/dts/canaan/k230.dtsi b/arch/riscv/boot/dts/canaan/k230.dtsi index 9b3534d7ee6b0..585319d50c442 100644 --- a/arch/riscv/boot/dts/canaan/k230.dtsi +++ b/arch/riscv/boot/dts/canaan/k230.dtsi @@ -600,60 +600,9 @@ #size-cells = <0>; status = "okay"; - panel@0 { + lcd: panel@0 { compatible = "canaan,universal"; reg = <0>; - panel-width-mm = <1080>; - panel-height-mm = <1920>; - panel-dsi-lane = <4>; - dsi_reset-gpios = <&gpio0_ports 9 GPIO_ACTIVE_HIGH>; - backlight_gpio-gpios = <&gpio0_ports 31 GPIO_ACTIVE_HIGH>; - - panel-init-sequence = [ - 39 00 04 B9 FF 83 99 - 39 00 02 D2 AA - 39 00 10 B1 02 04 71 91 01 32 33 11 11 ab 4d 56 73 02 02 - 39 00 10 B2 00 80 80 ae 05 07 5a 11 00 00 10 1e 70 03 d4 - 39 00 2d B4 00 FF 02 C0 02 c0 00 00 08 00 04 06 00 32 04 0a - 08 21 03 01 - 00 0f b8 8b 02 c0 02 c0 00 00 08 00 04 06 00 32 04 0a 08 01 - 00 0f b8 01 - 39 00 22 D3 00 00 00 00 00 00 06 00 00 10 04 00 04 00 00 00 - 00 00 00 00 00 00 00 01 00 05 05 07 00 00 00 05 40 - 39 00 21 D5 18 18 19 19 18 18 21 20 01 00 07 06 05 04 03 02 - 18 18 18 18 18 18 2f 2f 30 30 31 31 18 18 18 18 - 39 00 21 D6 18 18 19 19 40 40 20 21 02 03 04 05 06 07 00 01 - 40 40 40 40 40 40 2f 2f 30 30 31 31 40 40 40 40 - 39 00 11 D8 a2 aa 02 a0 a2 a8 02 a0 b0 00 00 00 b0 00 00 00 - 39 00 02 BD 01 - 39 00 11 D8 B0 00 00 00 B0 00 00 00 E2 AA 03 F0 E2 AA 03 F0 - 39 00 02 BD 02 - 39 00 09 D8 E2 AA 03 F0 E2 AA 03 F0 - 39 00 02 BD 00 - 39 00 03 B6 8D 8D - 39 00 02 CC 04 - 39 00 03 C6 FF F9 - 39 00 37 E0 00 12 1f 1a 40 4a 59 55 5e 67 6f 75 7a 82 8b 90 - 95 9f a3 ad a2 b2 B6 5e 5a 65 77 00 12 1f 1a 40 4a 59 55 5e - 67 6f 75 7a 82 8b 90 95 - 9f a3 ad a2 b2 B6 5e 5a 65 77 - 39 ff 01 11 - 39 ff 01 29 - ]; - - display-timings { - timing-0 { - clock-frequency = <74250000>; - hactive = <1080>; - vactive = <1920>; - hfront-porch = <40>; - hback-porch = <20>; - hsync-len = <20>; - vfront-porch = <206>; - vback-porch = <8>; - vsync-len = <5>; - }; - }; }; }; diff --git a/arch/riscv/boot/dts/canaan/k230d-canmv.dts b/arch/riscv/boot/dts/canaan/k230d-canmv.dts index de2ed149e32b0..c75547828c7d0 100644 --- a/arch/riscv/boot/dts/canaan/k230d-canmv.dts +++ b/arch/riscv/boot/dts/canaan/k230d-canmv.dts @@ -4,10 +4,12 @@ */ #include "k230.dtsi" +#include "display-st7701-480x800.dtsi" / { model = "Canaan CanMV-K230"; compatible = "canaan,canmv-k230", "canaan,kendryte-k230"; + aliases { serial2 = &uart2; }; @@ -54,77 +56,7 @@ }; }; -&vo { - vth_line = <10>; -}; - -&dsi { - panel@0 { - panel-width-mm = <480>; - panel-height-mm = <800>; - panel-dsi-lane = <2>; - dsi_reset-gpios = <&gpio0_ports 24 GPIO_ACTIVE_HIGH>; - backlight_gpio-gpios = <&gpio0_ports 25 GPIO_ACTIVE_HIGH>; - - panel-init-sequence = [ - 39 00 06 ff 77 01 00 00 13 - 39 00 02 ef 08 - 39 00 06 ff 77 01 00 00 10 - 39 00 03 c0 63 00 - 39 00 03 c1 10 02 - 39 00 03 c2 31 02 - 39 00 02 cc 10 - 39 00 11 b0 c0 0c 92 0c 10 05 02 0d 07 21 04 53 11 6a 32 1f - 39 00 11 b1 c0 87 cf 0c 10 06 00 03 08 1d 06 54 12 e6 ec 0f - 39 00 06 ff 77 01 00 00 11 - 39 00 02 b0 5d - 39 00 02 b1 62 - 39 00 02 b2 82 - 39 00 02 b3 80 - 39 00 02 b5 42 - 39 00 02 b7 85 - 39 00 02 b8 20 - 39 00 02 c0 09 - 39 00 02 c1 78 - 39 00 02 c2 78 - 39 00 02 d0 88 - 39 ff 02 ee 42 - 39 00 04 e0 00 00 02 - 39 00 0c e1 04 a0 06 a0 05 a0 07 a0 00 44 44 - 39 00 0d e2 00 00 33 33 01 a0 00 00 01 a0 00 00 - 39 00 05 e3 00 00 33 33 - 39 00 03 e4 44 44 - 39 00 11 e5 0c 30 a0 a0 0e 32 a0 a0 08 2c a0 a0 0a 2e a0 a0 - 39 00 05 e6 00 00 33 33 - 39 00 03 e7 44 44 - 39 00 11 e8 0d 31 a0 a0 0f 33 a0 a0 09 2d a0 a0 0b 2f a0 a0 - 39 00 08 eb 00 01 e4 e4 44 88 00 - 39 00 11 ed ff f5 47 6f 0b a1 a2 bf fb 2a 1a b0 f6 74 5f ff - 39 00 07 ef 08 08 08 40 3f 64 - 39 00 06 ff 77 01 00 00 13 - 39 00 03 e8 00 0e - 39 00 06 ff 77 01 00 00 00 - 39 ff 01 11 - 39 00 06 ff 77 01 00 00 13 - 39 ff 03 e8 00 0c - 39 00 03 e8 00 00 - 39 00 06 ff 77 01 00 00 00 - 39 00 02 3a 50 - 39 ff 01 29 - ]; - - display-timings { - timing-0 { - clock-frequency = <39600000>; - hactive = <480>; - vactive = <800>; - hfront-porch = <80>; - hback-porch = <20>; - hsync-len = <20>; - vfront-porch = <220>; - vback-porch = <70>; - vsync-len = <10>; - }; - }; - }; +&lcd { + dsi_reset-gpios = <&gpio0_ports 24 GPIO_ACTIVE_HIGH>; + backlight_gpio-gpios = <&gpio0_ports 25 GPIO_ACTIVE_HIGH>; }; diff --git a/drivers/gpu/drm/panel/panel-canaan-universal.c b/drivers/gpu/drm/panel/panel-canaan-universal.c index 0043714a1b021..98384204840fe 100644 --- a/drivers/gpu/drm/panel/panel-canaan-universal.c +++ b/drivers/gpu/drm/panel/panel-canaan-universal.c @@ -126,12 +126,12 @@ static int canaan_panel_prepare(struct drm_panel *panel) struct canaan_panel *p = panel_to_canaan_panel(panel); // set power on - if (!IS_ERR(p->power_on)) { + if (p->power_on) { // gpiod_direction_output(p->power_on, 1); // gpiod_set_value_cansleep(p->power_on, 1); } // set rst - if (!IS_ERR(p->reset)) { + if (p->reset) { // gpiod_direction_output(p->reset, 1); // gpiod_set_value_cansleep(p->reset, 1); @@ -319,7 +319,7 @@ static int canaan_panel_dsi_probe(struct mipi_dsi_device *dsi) if (IS_ERR(ctx->reset)) { dev_err(&dsi->dev, "Couldn't get our reset GPIO, error: %ld\n", PTR_ERR(ctx->reset)); - // return PTR_ERR(ctx->reset); + ctx->reset = NULL; } else { gpiod_direction_output(ctx->reset, 1); panel_simple_sleep(200); @@ -334,7 +334,7 @@ static int canaan_panel_dsi_probe(struct mipi_dsi_device *dsi) dev_err(&dsi->dev, "Couldn't get our backlight_gpio GPIO, error: %ld\n", PTR_ERR(ctx->power_on)); - // return PTR_ERR(ctx->power_on); + ctx->power_on = NULL; } else { gpiod_direction_output(ctx->power_on, 1); }