summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Conrad <dconrad@fastmail.com>2024-08-07 01:12:55 +0000
committerWilliam Wilgus <me.theuser@yahoo.com>2024-09-02 13:29:43 -0400
commit878e29396c079c08229d5b4698f1fc1d48873ba6 (patch)
tree447c29dcc1823d706dfffb66437c4d5c65e1ca50
parenta2cc7546d88bf9c4071f0f56f6c43d59654fc212 (diff)
downloadrockbox-878e29396c079c08229d5b4698f1fc1d48873ba6.tar.gz
rockbox-878e29396c079c08229d5b4698f1fc1d48873ba6.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.h11
-rw-r--r--firmware/rolo.c4
-rw-r--r--firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c146
-rw-r--r--firmware/target/mips/ingenic_x1000/system-x1000.c7
-rwxr-xr-xtools/configure33
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 @@
9#define BOOTFILE "rockbox." BOOTFILE_EXT 9#define BOOTFILE "rockbox." BOOTFILE_EXT
10#define BOOTDIR "/.rockbox" 10#define BOOTDIR "/.rockbox"
11 11
12/* Define EROSQN_VER as a GCC option if desired -
13 * v1, v2 players: "1"
14 * v3 players: "3"
15 * Only bootloader will be affected
16 */
17#ifdef BOOTLOADER
18# ifndef EROSQN_VER /* this should probably go in config/erosqnative.h*/
19# define EROSQN_VER 1
20# endif
21#endif
22
12/* CPU defines */ 23/* CPU defines */
13#define CONFIG_CPU X1000 24#define CONFIG_CPU X1000
14#define X1000_EXCLK_FREQ 24000000 25#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 @@
56#include "crc32.h" 56#include "crc32.h"
57#endif 57#endif
58 58
59#if defined(HAVE_DEVICEDATA) && !defined(SIMULATOR)
60#include "devicedata.h"
61#endif
62
59#if CONFIG_CPU == AS3525v2 63#if CONFIG_CPU == AS3525v2
60#include "ascodec.h" 64#include "ascodec.h"
61#endif 65#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 @@
25#include "lcd-x1000.h" 25#include "lcd-x1000.h"
26#include "gpio-x1000.h" 26#include "gpio-x1000.h"
27#include "system.h" 27#include "system.h"
28#include "devicedata.h"
28 29
29/* for reference on these command/data hex values, see the mipi dcs lcd spec. * 30/* for reference on these command/data hex values, see the mipi dcs lcd spec. *
30 * Not everything here is there, but all the standard stuff is. */ 31 * Not everything here is there, but all the standard stuff is. */
31 32
32static const uint32_t erosqnative_lcd_cmd_enable[] = { 33/* New Display Eroq 2.1 / Hifiwalker 1.7+ / Surfans v3.2, unknown Controller *
34 * (partially GC9A01 register compatible) *
35 * https://espruino.microcosm.app/api/v1/files/ \ *
36 * 9dc1b976d621a2ab3854312cce862c4a9a50dc1b.html#GC9A01 , *
37 * https://www.buydisplay.com/download/ic/GC9A01A.pdf , *
38 * https://lcddisplay.co/wp-content/uploads/2023/02/GC9A01.pdf *
39 * Init sequence From 'EROS Q (c口)_V2.1_20231209固件.zip' *
40 * update.upt/.iso -> In 'uboot.bin' at 0x52da0-0x5305f *
41 * http://www.eroshifi.com/download/firmware/122.html */
42static const uint32_t erosqnative_lcd_cmd_enable_v3[] = {
43
44 /* Unlock EXTC? */
45 LCD_INSTR_CMD, 0xfe, // Inter Register Enable1
46 LCD_INSTR_CMD, 0xef, // Inter Register Enable2
47
48 LCD_INSTR_CMD, 0x36, // Memory Access Control
49/* Bit7 1:vertical flip 0:no vertical flip
50 Bit6 1:horizontal flip 0:no horizontal flip
51 Bit3 1:BGR 0:RGB */
52 LCD_INSTR_DAT, 0x90,
53 /* Pixel Format Set */
54 LCD_INSTR_CMD, 0x3a,
55 LCD_INSTR_DAT, 0x55, /* Rockbox uses 16pp, OF specified 18 bpp */
56
57 LCD_INSTR_CMD, 0x84, // ?? (undocumented)
58 LCD_INSTR_DAT, 0x04,
59 LCD_INSTR_CMD, 0x86, // ??
60 LCD_INSTR_DAT, 0xfb,
61 LCD_INSTR_CMD, 0x87, // ??
62 LCD_INSTR_DAT, 0x79,
63 LCD_INSTR_CMD, 0x89, // ??
64 LCD_INSTR_DAT, 0x0b,
65 LCD_INSTR_CMD, 0x8a, // ??
66 LCD_INSTR_DAT, 0x20,
67 LCD_INSTR_CMD, 0x8b, // ??
68 LCD_INSTR_DAT, 0x80,
69 LCD_INSTR_CMD, 0x8d, // ??
70 LCD_INSTR_DAT, 0x3b,
71 LCD_INSTR_CMD, 0x8e, // ??
72 LCD_INSTR_DAT, 0xcf,
73
74 LCD_INSTR_CMD, 0xec, // Charge Pump Frequent Control
75 LCD_INSTR_DAT, 0x33,
76 LCD_INSTR_DAT, 0x02,
77 LCD_INSTR_DAT, 0x4c,
78
79 LCD_INSTR_CMD, 0x98, // ?? (undocumented)
80 LCD_INSTR_DAT, 0x3e,
81 LCD_INSTR_CMD, 0x9c, // ??
82 LCD_INSTR_DAT, 0x4b,
83 LCD_INSTR_CMD, 0x99, // ??
84 LCD_INSTR_DAT, 0x3e,
85 LCD_INSTR_CMD, 0x9d, // ??
86 LCD_INSTR_DAT, 0x4b,
87 LCD_INSTR_CMD, 0x9b, // ??
88 LCD_INSTR_DAT, 0x55,
89
90 LCD_INSTR_CMD, 0xe8, // Frame Rate
91 LCD_INSTR_DAT, 0x11,
92 LCD_INSTR_DAT, 0x00,
93
94 LCD_INSTR_CMD, 0xff, // ?? (Adafruit & Co lib. C:0xFF, D:0x60, D:0x01, D:0x04)
95 LCD_INSTR_DAT, 0x62, // LCD_INSTR_DAT, 0x01, LCD_INSTR_DAT, 0x04,
96 LCD_INSTR_CMD, 0xc3, // Vreg1a voltage Control
97 LCD_INSTR_DAT, 0x20,
98 LCD_INSTR_CMD, 0xc4, // Vreg1b voltage Control
99 LCD_INSTR_DAT, 0x03,
100 LCD_INSTR_CMD, 0xc9, // Vreg2a voltage Control
101 LCD_INSTR_DAT, 0x2a,
102
103 LCD_INSTR_CMD, 0xf0, // SET_GAMMA1
104 LCD_INSTR_DAT, 0x4a,
105 LCD_INSTR_DAT, 0x10,
106 LCD_INSTR_DAT, 0x0a,
107 LCD_INSTR_DAT, 0x0a,
108 LCD_INSTR_DAT, 0x26,
109 LCD_INSTR_DAT, 0x39,
110
111 LCD_INSTR_CMD, 0xf2, // SET_GAMMA3
112 LCD_INSTR_DAT, 0x4a,
113 LCD_INSTR_DAT, 0x10,
114 LCD_INSTR_DAT, 0x0a,
115 LCD_INSTR_DAT, 0x0a,
116 LCD_INSTR_DAT, 0x26,
117 LCD_INSTR_DAT, 0x39,
118
119 LCD_INSTR_CMD, 0xf1, // SET_GAMMA2
120 LCD_INSTR_DAT, 0x50,
121 LCD_INSTR_DAT, 0x8f,
122 LCD_INSTR_DAT, 0xaf,
123 LCD_INSTR_DAT, 0x3b,
124 LCD_INSTR_DAT, 0x3f,
125 LCD_INSTR_DAT, 0x7f,
126
127 LCD_INSTR_CMD, 0xf3, // SET_GAMMA4
128 LCD_INSTR_DAT, 0x50,
129 LCD_INSTR_DAT, 0x8f,
130 LCD_INSTR_DAT, 0xaf,
131 LCD_INSTR_DAT, 0x3b,
132 LCD_INSTR_DAT, 0x3f,
133 LCD_INSTR_DAT, 0x7f,
134
135 LCD_INSTR_CMD, 0xba, // TE Control
136 LCD_INSTR_DAT, 0x0a,
137
138#ifdef BOOTLOADER
139 LCD_INSTR_CMD, 0x35, // Tearing Effect Line ON
140 LCD_INSTR_DAT, 0x00,
141#endif
142
143 LCD_INSTR_CMD, 0x21, /* Invert */
144
145 /* Lock EXTC? */
146 LCD_INSTR_CMD, 0xfe, // Inter Register Enable1
147 LCD_INSTR_CMD, 0xee,
148
149 /* Exit Sleep */
150 LCD_INSTR_CMD, 0x11,
151 LCD_INSTR_UDELAY, 120000,
152 /* Display On */
153 LCD_INSTR_CMD, 0x29,
154 LCD_INSTR_UDELAY, 20000,
155 LCD_INSTR_END,
156};
157
158/* Original Display / Hifiwalker -1.5 / Surfans -2.7 */
159static const uint32_t erosqnative_lcd_cmd_enable_v1[] = {
33 /* Set EXTC? */ 160 /* Set EXTC? */
34 LCD_INSTR_CMD, 0xc8, 161 LCD_INSTR_CMD, 0xc8,
35 LCD_INSTR_DAT, 0xff, 162 LCD_INSTR_DAT, 0xff,
@@ -179,7 +306,22 @@ void lcd_tgt_enable(bool enable)
179 mdelay(5); 306 mdelay(5);
180 gpio_set_level(GPIO_LCD_CE, 0); 307 gpio_set_level(GPIO_LCD_CE, 0);
181 308
182 lcd_exec_commands(&erosqnative_lcd_cmd_enable[0]); 309#ifdef BOOTLOADER
310# if EROSQN_VER == 3
311 lcd_exec_commands(&erosqnative_lcd_cmd_enable_v3[0]);
312# else
313 lcd_exec_commands(&erosqnative_lcd_cmd_enable_v1[0]);
314# endif
315#else
316 if (device_data.lcd_version == 3)
317 {
318 lcd_exec_commands(&erosqnative_lcd_cmd_enable_v3[0]);
319 }
320 else
321 {
322 lcd_exec_commands(&erosqnative_lcd_cmd_enable_v1[0]);
323 }
324#endif
183 } else { 325 } else {
184 /* doesn't flash white if we don't do anything... */ 326 /* doesn't flash white if we don't do anything... */
185#if 0 327#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 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "system.h" 22#include "system.h"
23#include <string.h>
23#include "mips.h" 24#include "mips.h"
24#include "panic.h" 25#include "panic.h"
25#include "button.h" 26#include "button.h"
@@ -36,6 +37,10 @@
36#include "x1000/msc.h" 37#include "x1000/msc.h"
37#include "x1000/aic.h" 38#include "x1000/aic.h"
38 39
40#if defined(HAVE_DEVICEDATA)
41#include "devicedata.h"
42#endif
43
39#ifdef X1000_CPUIDLE_STATS 44#ifdef X1000_CPUIDLE_STATS
40int __cpu_idle_avg = 0; 45int __cpu_idle_avg = 0;
41int __cpu_idle_cur = 0; 46int __cpu_idle_cur = 0;
@@ -88,7 +93,7 @@ void fill_devicedata(struct device_data_t *data)
88 memset(data->payload, 0xff, data->length); 93 memset(data->payload, 0xff, data->length);
89 data->lcd_version = EROSQN_VER; 94 data->lcd_version = EROSQN_VER;
90#else 95#else
91 uint8_t lcd_version = data->lcd_version; 96 uint8_t lcd_version = device_data.lcd_version;
92 memset(data->payload, 0xff, data->length); 97 memset(data->payload, 0xff, data->length);
93 data->lcd_version = lcd_version; 98 data->lcd_version = lcd_version;
94#endif 99#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
1676 ==AIGO== 244) M3K Linux 1676 ==AIGO== 244) M3K Linux
1677 245) Eros Q / K 246) M3K baremetal ==Shanling== 1677 245) Eros Q / K 246) M3K baremetal ==Shanling==
1678 247) Eros Q / K native 260) Q1 1678 247) Eros Q / K native 260) Q1
1679 248) Eros Q / K native v3
1680 (GC9A01 LCD Controller)
1679EOF 1681EOF
1680 1682
1681 buildfor=`input`; 1683 buildfor=`input`;
@@ -4190,8 +4192,39 @@ fi
4190 t_cpu="mips" 4192 t_cpu="mips"
4191 t_manufacturer="ingenic_x1000" 4193 t_manufacturer="ingenic_x1000"
4192 t_model="erosqnative" 4194 t_model="erosqnative"
4195 # player version, for bootloader usage
4196 # versions 1 and 2 both use 1
4197 GCCOPTS="$GCCOPTS -DEROSQN_VER=1"
4193 ;; 4198 ;;
4194 4199
4200 248|erosqnative_v3)
4201 target_id=116
4202 modelname="erosqnative"
4203 target="EROS_QN"
4204 memory=32
4205 mipsr2elcc
4206 appextra="recorder:gui"
4207 plugins="yes"
4208 tool="$rootdir/tools/scramble -add=erosqnative "
4209 boottool="$rootdir/tools/mkspl-x1000 -type=nand -ppb=2 -bpp=2 "
4210 output="rockbox.erosq"
4211 bootoutput="bootloader.erosq"
4212 sysfontbl="16-Terminus"
4213 # toolset is the tools within the tools directory that we build for
4214 # this particular target.
4215 toolset="$x1000tools"
4216 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
4217 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
4218 # architecture, manufacturer and model for the target-tree build
4219 t_cpu="mips"
4220 t_manufacturer="ingenic_x1000"
4221 t_model="erosqnative"
4222 # player version, for bootloader usage
4223 # version 3
4224 GCCOPTS="$GCCOPTS -DEROSQN_VER=3"
4225 ;;
4226
4227
4195 *) 4228 *)
4196 echo "Please select a supported target platform!" 4229 echo "Please select a supported target platform!"
4197 exit 7 4230 exit 7