From 12554247bbc9fd1e18a979de60b90a2759fb5c4e Mon Sep 17 00:00:00 2001 From: Huy Duong Date: Fri, 27 Sep 2024 13:57:45 +0700 Subject: [PATCH] Enable GC9A01 display driver --- .../boot/dts/rv1103g-luckfox-pico-mini-b.dts | 98 ++++++++++++++++++- .../configs/luckfox_rv1106_linux_defconfig | 3 +- 2 files changed, 98 insertions(+), 3 deletions(-) diff --git a/sysdrv/source/kernel/arch/arm/boot/dts/rv1103g-luckfox-pico-mini-b.dts b/sysdrv/source/kernel/arch/arm/boot/dts/rv1103g-luckfox-pico-mini-b.dts index 7567b3846..4abcbf37a 100755 --- a/sysdrv/source/kernel/arch/arm/boot/dts/rv1103g-luckfox-pico-mini-b.dts +++ b/sysdrv/source/kernel/arch/arm/boot/dts/rv1103g-luckfox-pico-mini-b.dts @@ -51,13 +51,109 @@ dr_mode = "peripheral"; }; +&pinctrl { + lcd { + gc9a01_pins: gc9a01-pins { + rockchip,pins = + /* lcd_reset */ + <1 RK_PD0 1 &pcfg_pull_none_drv_level_3>, + /* lcd_dc */ + <1 RK_PD1 1 &pcfg_pull_none_drv_level_3>, + /* lcd_led */ + <1 RK_PD2 1 &pcfg_pull_none_drv_level_3>; + }; + }; +}; + /**********SPI**********/ /* SPI0_M0 */ &spi0 { - status = "disabled"; + status = "okay"; + spidev@0 { + status = "disabled"; spi-max-frequency = <50000000>; }; + + fbtft@0 { + status = "disabled"; + }; + + gc9a01@0 { + compatible = "ilitek,ili9340"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&gc9a01_pins>; + reset = <&gpio1 RK_PD0 GPIO_ACTIVE_LOW>; + dc = <&gpio1 RK_PD1 GPIO_ACTIVE_HIGH>; + led-gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_LOW>; + spi-max-frequency = <8000000>; + buswidth = <8>; + width = <240>; + height = <240>; + rotate = <0>; + fps = <50>; + bgr; + debug = <0>; + init = < + 0x01000011 /* Sleep mode OFF */ + 0x02000078 /* Delay 120ms */ + 0x010000EF /* Inter register enable 2 */ + 0x010000EB 0x14 + /* BEGIN set inter_command HIGH */ + 0x010000FE /* Inter register enable 1 */ + 0x010000EF /* Inter register enable 2 */ + /* END set inter_command HIGH */ + 0x010000EB 0x14 + 0x01000084 0x40 + 0x01000085 0xFF + 0x01000086 0xFF + 0x01000087 0xFF + 0x01000088 0x0A + 0x01000089 0x21 + 0x0100008A 0x00 + 0x0100008B 0x80 + 0x0100008C 0x01 + 0x0100008D 0x01 + 0x0100008E 0xFF + 0x0100008F 0xFF + 0x010000B6 0x00 0x00 /* Display function control */ + 0x01000036 0x08 /* Memory access control */ + 0x0100003A 0x05 /* Pixel format */ + 0x01000090 0x08 0x08 0x08 0x08 + 0x010000BD 0x06 + 0x010000BC 0x00 + 0x010000FF 0x60 0x01 0x04 + 0x010000C3 0x13 /* Voltage regulator 1a */ + 0x010000C4 0x13 /* Voltage regulator 1b */ + 0x010000C9 0x22 /* Voltage regulator 2a */ + 0x010000BE 0x11 + 0x010000E1 0x10 0x0E + 0x010000DF 0x21 0x0c 0x02 + 0x010000F0 0x45 0x09 0x08 0x08 0x26 0x2A /* Set gamma1 */ + 0x010000F1 0x43 0x70 0x72 0x36 0x37 0x6F /* Set gamma2 */ + 0x010000F2 0x45 0x09 0x08 0x08 0x26 0x2A /* Set gamma3 */ + 0x010000F3 0x43 0x70 0x72 0x36 0x37 0x6F /* Set gamma4 */ + 0x010000ED 0x1B 0x0B + 0x010000AE 0x77 + 0x010000CD 0x63 + 0x01000070 0x07 0x07 0x04 0x0E 0x0F 0x09 0x07 0x08 0x03 + 0x010000E8 0x34 /* Frame rate */ + 0x01000062 0x18 0x0D 0x71 0xED 0x70 0x70 0x18 0x0F 0x71 0xEF 0x70 0x70 + 0x01000063 0x18 0x11 0x71 0xF1 0x70 0x70 0x18 0x13 0x71 0xF3 0x70 0x70 + 0x01000064 0x28 0x29 0xF1 0x01 0xF1 0x00 0x07 + 0x01000066 0x3C 0x00 0xCD 0x67 0x45 0x45 0x10 0x00 0x00 0x00 + 0x01000067 0x00 0x3C 0x00 0x00 0x00 0x01 0x54 0x10 0x32 0x98 + 0x01000074 0x10 0x85 0x80 0x00 0x00 0x4E 0x00 + 0x01000098 0x3e 0x07 + 0x01000035 /* Tearing effect ON */ + 0x01000021 /* Display inversion ON */ + 0x01000011 /* Sleep mode OFF */ + 0x0200000C /* Delay 12ms */ + 0x01000029 /* Display ON */ + 0x02000014 /* Delay 20ms */ + >; + }; }; /**********I2C**********/ diff --git a/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig b/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig index 6373f0886..bb22b9dd4 100755 --- a/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig +++ b/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig @@ -276,8 +276,7 @@ CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y CONFIG_RK_CONSOLE_THREAD=y CONFIG_FIQ_DEBUGGER_FIQ_GLUE=y CONFIG_FB_TFT=y -CONFIG_FB_TFT_ST7735R=y -CONFIG_FB_TFT_ST7789V=y +CONFIG_FB_TFT_ILI9340=y CONFIG_COMMON_CLK_PROCFS=y # CONFIG_ARM_ARCH_TIMER_EVTSTREAM is not set # CONFIG_IOMMU_SUPPORT is not set