diff options
author | Dana Conrad <dconrad@fastmail.com> | 2024-08-07 01:12:55 +0000 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2024-09-02 13:29:43 -0400 |
commit | 878e29396c079c08229d5b4698f1fc1d48873ba6 (patch) | |
tree | 447c29dcc1823d706dfffb66437c4d5c65e1ca50 | |
parent | a2cc7546d88bf9c4071f0f56f6c43d59654fc212 (diff) | |
download | rockbox-878e29396c.tar.gz rockbox-878e29396c.zip |
ErosQNative: Add v3 LCD support, conditional on bootloader
bootloader passes the player version to rockbox for LCD init changes
Credit ZappBranigan2972 on forums for original changes
Credit Bilgus for devicedata additions
Change-Id: Ia2ca493edef49b7457e84dc19b05397dc915fa5a
-rw-r--r-- | firmware/export/config/erosqnative.h | 11 | ||||
-rw-r--r-- | firmware/rolo.c | 4 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c | 146 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_x1000/system-x1000.c | 7 | ||||
-rwxr-xr-x | tools/configure | 33 |
5 files changed, 198 insertions, 3 deletions
diff --git a/firmware/export/config/erosqnative.h b/firmware/export/config/erosqnative.h index 75ead37ba8..5eb9ba7021 100644 --- a/firmware/export/config/erosqnative.h +++ b/firmware/export/config/erosqnative.h @@ -9,6 +9,17 @@ #define BOOTFILE "rockbox." BOOTFILE_EXT #define BOOTDIR "/.rockbox" +/* Define EROSQN_VER as a GCC option if desired - + * v1, v2 players: "1" + * v3 players: "3" + * Only bootloader will be affected + */ +#ifdef BOOTLOADER +# ifndef EROSQN_VER /* this should probably go in config/erosqnative.h*/ +# define EROSQN_VER 1 +# endif +#endif + /* CPU defines */ #define CONFIG_CPU X1000 #define X1000_EXCLK_FREQ 24000000 diff --git a/firmware/rolo.c b/firmware/rolo.c index 7be78f8a49..38d350d432 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -56,6 +56,10 @@ #include "crc32.h" #endif +#if defined(HAVE_DEVICEDATA) && !defined(SIMULATOR) +#include "devicedata.h" +#endif + #if CONFIG_CPU == AS3525v2 #include "ascodec.h" #endif diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c index 0d43a3f010..bcc30a71bd 100644 --- a/firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c +++ b/firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c @@ -25,11 +25,138 @@ #include "lcd-x1000.h" #include "gpio-x1000.h" #include "system.h" +#include "devicedata.h" /* for reference on these command/data hex values, see the mipi dcs lcd spec. * * Not everything here is there, but all the standard stuff is. */ -static const uint32_t erosqnative_lcd_cmd_enable[] = { +/* New Display Eroq 2.1 / Hifiwalker 1.7+ / Surfans v3.2, unknown Controller * + * (partially GC9A01 register compatible) * + * https://espruino.microcosm.app/api/v1/files/ \ * + * 9dc1b976d621a2ab3854312cce862c4a9a50dc1b.html#GC9A01 , * + * https://www.buydisplay.com/download/ic/GC9A01A.pdf , * + * https://lcddisplay.co/wp-content/uploads/2023/02/GC9A01.pdf * + * Init sequence From 'EROS Q (c口)_V2.1_20231209固件.zip' * + * update.upt/.iso -> In 'uboot.bin' at 0x52da0-0x5305f * + * http://www.eroshifi.com/download/firmware/122.html */ +static const uint32_t erosqnative_lcd_cmd_enable_v3[] = { + + /* Unlock EXTC? */ + LCD_INSTR_CMD, 0xfe, // Inter Register Enable1 + LCD_INSTR_CMD, 0xef, // Inter Register Enable2 + + LCD_INSTR_CMD, 0x36, // Memory Access Control +/* Bit7 1:vertical flip 0:no vertical flip + Bit6 1:horizontal flip 0:no horizontal flip + Bit3 1:BGR 0:RGB */ + LCD_INSTR_DAT, 0x90, + /* Pixel Format Set */ + LCD_INSTR_CMD, 0x3a, + LCD_INSTR_DAT, 0x55, /* Rockbox uses 16pp, OF specified 18 bpp */ + + LCD_INSTR_CMD, 0x84, // ?? (undocumented) + LCD_INSTR_DAT, 0x04, + LCD_INSTR_CMD, 0x86, // ?? + LCD_INSTR_DAT, 0xfb, + LCD_INSTR_CMD, 0x87, // ?? + LCD_INSTR_DAT, 0x79, + LCD_INSTR_CMD, 0x89, // ?? + LCD_INSTR_DAT, 0x0b, + LCD_INSTR_CMD, 0x8a, // ?? + LCD_INSTR_DAT, 0x20, + LCD_INSTR_CMD, 0x8b, // ?? + LCD_INSTR_DAT, 0x80, + LCD_INSTR_CMD, 0x8d, // ?? + LCD_INSTR_DAT, 0x3b, + LCD_INSTR_CMD, 0x8e, // ?? + LCD_INSTR_DAT, 0xcf, + + LCD_INSTR_CMD, 0xec, // Charge Pump Frequent Control + LCD_INSTR_DAT, 0x33, + LCD_INSTR_DAT, 0x02, + LCD_INSTR_DAT, 0x4c, + + LCD_INSTR_CMD, 0x98, // ?? (undocumented) + LCD_INSTR_DAT, 0x3e, + LCD_INSTR_CMD, 0x9c, // ?? + LCD_INSTR_DAT, 0x4b, + LCD_INSTR_CMD, 0x99, // ?? + LCD_INSTR_DAT, 0x3e, + LCD_INSTR_CMD, 0x9d, // ?? + LCD_INSTR_DAT, 0x4b, + LCD_INSTR_CMD, 0x9b, // ?? + LCD_INSTR_DAT, 0x55, + + LCD_INSTR_CMD, 0xe8, // Frame Rate + LCD_INSTR_DAT, 0x11, + LCD_INSTR_DAT, 0x00, + + LCD_INSTR_CMD, 0xff, // ?? (Adafruit & Co lib. C:0xFF, D:0x60, D:0x01, D:0x04) + LCD_INSTR_DAT, 0x62, // LCD_INSTR_DAT, 0x01, LCD_INSTR_DAT, 0x04, + LCD_INSTR_CMD, 0xc3, // Vreg1a voltage Control + LCD_INSTR_DAT, 0x20, + LCD_INSTR_CMD, 0xc4, // Vreg1b voltage Control + LCD_INSTR_DAT, 0x03, + LCD_INSTR_CMD, 0xc9, // Vreg2a voltage Control + LCD_INSTR_DAT, 0x2a, + + LCD_INSTR_CMD, 0xf0, // SET_GAMMA1 + LCD_INSTR_DAT, 0x4a, + LCD_INSTR_DAT, 0x10, + LCD_INSTR_DAT, 0x0a, + LCD_INSTR_DAT, 0x0a, + LCD_INSTR_DAT, 0x26, + LCD_INSTR_DAT, 0x39, + + LCD_INSTR_CMD, 0xf2, // SET_GAMMA3 + LCD_INSTR_DAT, 0x4a, + LCD_INSTR_DAT, 0x10, + LCD_INSTR_DAT, 0x0a, + LCD_INSTR_DAT, 0x0a, + LCD_INSTR_DAT, 0x26, + LCD_INSTR_DAT, 0x39, + + LCD_INSTR_CMD, 0xf1, // SET_GAMMA2 + LCD_INSTR_DAT, 0x50, + LCD_INSTR_DAT, 0x8f, + LCD_INSTR_DAT, 0xaf, + LCD_INSTR_DAT, 0x3b, + LCD_INSTR_DAT, 0x3f, + LCD_INSTR_DAT, 0x7f, + + LCD_INSTR_CMD, 0xf3, // SET_GAMMA4 + LCD_INSTR_DAT, 0x50, + LCD_INSTR_DAT, 0x8f, + LCD_INSTR_DAT, 0xaf, + LCD_INSTR_DAT, 0x3b, + LCD_INSTR_DAT, 0x3f, + LCD_INSTR_DAT, 0x7f, + + LCD_INSTR_CMD, 0xba, // TE Control + LCD_INSTR_DAT, 0x0a, + +#ifdef BOOTLOADER + LCD_INSTR_CMD, 0x35, // Tearing Effect Line ON + LCD_INSTR_DAT, 0x00, +#endif + + LCD_INSTR_CMD, 0x21, /* Invert */ + + /* Lock EXTC? */ + LCD_INSTR_CMD, 0xfe, // Inter Register Enable1 + LCD_INSTR_CMD, 0xee, + + /* Exit Sleep */ + LCD_INSTR_CMD, 0x11, + LCD_INSTR_UDELAY, 120000, + /* Display On */ + LCD_INSTR_CMD, 0x29, + LCD_INSTR_UDELAY, 20000, + LCD_INSTR_END, +}; + +/* Original Display / Hifiwalker -1.5 / Surfans -2.7 */ +static const uint32_t erosqnative_lcd_cmd_enable_v1[] = { /* Set EXTC? */ LCD_INSTR_CMD, 0xc8, LCD_INSTR_DAT, 0xff, @@ -179,7 +306,22 @@ void lcd_tgt_enable(bool enable) mdelay(5); gpio_set_level(GPIO_LCD_CE, 0); - lcd_exec_commands(&erosqnative_lcd_cmd_enable[0]); +#ifdef BOOTLOADER +# if EROSQN_VER == 3 + lcd_exec_commands(&erosqnative_lcd_cmd_enable_v3[0]); +# else + lcd_exec_commands(&erosqnative_lcd_cmd_enable_v1[0]); +# endif +#else + if (device_data.lcd_version == 3) + { + lcd_exec_commands(&erosqnative_lcd_cmd_enable_v3[0]); + } + else + { + lcd_exec_commands(&erosqnative_lcd_cmd_enable_v1[0]); + } +#endif } else { /* doesn't flash white if we don't do anything... */ #if 0 diff --git a/firmware/target/mips/ingenic_x1000/system-x1000.c b/firmware/target/mips/ingenic_x1000/system-x1000.c index 32ac66ec92..1c850736b6 100644 --- a/firmware/target/mips/ingenic_x1000/system-x1000.c +++ b/firmware/target/mips/ingenic_x1000/system-x1000.c @@ -20,6 +20,7 @@ ****************************************************************************/ #include "system.h" +#include <string.h> #include "mips.h" #include "panic.h" #include "button.h" @@ -36,6 +37,10 @@ #include "x1000/msc.h" #include "x1000/aic.h" +#if defined(HAVE_DEVICEDATA) +#include "devicedata.h" +#endif + #ifdef X1000_CPUIDLE_STATS int __cpu_idle_avg = 0; int __cpu_idle_cur = 0; @@ -88,7 +93,7 @@ void fill_devicedata(struct device_data_t *data) memset(data->payload, 0xff, data->length); data->lcd_version = EROSQN_VER; #else - uint8_t lcd_version = data->lcd_version; + uint8_t lcd_version = device_data.lcd_version; memset(data->payload, 0xff, data->length); data->lcd_version = lcd_version; #endif diff --git a/tools/configure b/tools/configure index 8698c6a38d..d6812cd4c4 100755 --- a/tools/configure +++ b/tools/configure @@ -1676,6 +1676,8 @@ cat <<EOF ==AIGO== 244) M3K Linux 245) Eros Q / K 246) M3K baremetal ==Shanling== 247) Eros Q / K native 260) Q1 + 248) Eros Q / K native v3 + (GC9A01 LCD Controller) EOF buildfor=`input`; @@ -4190,8 +4192,39 @@ fi t_cpu="mips" t_manufacturer="ingenic_x1000" t_model="erosqnative" + # player version, for bootloader usage + # versions 1 and 2 both use 1 + GCCOPTS="$GCCOPTS -DEROSQN_VER=1" ;; + 248|erosqnative_v3) + target_id=116 + modelname="erosqnative" + target="EROS_QN" + memory=32 + mipsr2elcc + appextra="recorder:gui" + plugins="yes" + tool="$rootdir/tools/scramble -add=erosqnative " + boottool="$rootdir/tools/mkspl-x1000 -type=nand -ppb=2 -bpp=2 " + output="rockbox.erosq" + bootoutput="bootloader.erosq" + sysfontbl="16-Terminus" + # toolset is the tools within the tools directory that we build for + # this particular target. + toolset="$x1000tools" + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" + # architecture, manufacturer and model for the target-tree build + t_cpu="mips" + t_manufacturer="ingenic_x1000" + t_model="erosqnative" + # player version, for bootloader usage + # version 3 + GCCOPTS="$GCCOPTS -DEROSQN_VER=3" + ;; + + *) echo "Please select a supported target platform!" exit 7 |