Firmware of Silead Touchscreen Controller for Jumper EZpad 6 Pro.
Révision | 5df9899f20102e5e1cda0ed2b2c828cc7aab51cd (tree) |
---|---|
l'heure | 2018-05-15 03:57:27 |
Auteur | Gregor Riepl <onitake@gmai...> |
Commiter | Gregor Riepl |
Updated readme with silead_ts information and other stuff
@@ -1,5 +1,4 @@ | ||
1 | -gsl-firmware | |
2 | -============ | |
1 | +# gsl-firmware | |
3 | 2 | |
4 | 3 | This repository contains firmware images for the Silead |
5 | 4 | touchscreen controllers in various tablet (and other) devices. |
@@ -18,14 +17,11 @@ for more information. | ||
18 | 17 | |
19 | 18 | In contrast, everything in the tools directory is published under |
20 | 19 | the GNU General Public license v2, as laid out in |
21 | -[tools/LICENSE](tools/LICENSE). | |
20 | +[tools/LICENSE](tools/LICENSE). See [tools/AUTHORS.md](tools/AUTHORS.md) | |
21 | +for copyright information. | |
22 | 22 | |
23 | -See below for instructions on how to submit firmware for a | |
24 | -new device. | |
25 | 23 | |
26 | - | |
27 | -Device list | |
28 | ------------ | |
24 | +## Device list | |
29 | 25 | |
30 | 26 | | Manufacturer | Device | Tested | Firmware | |
31 | 27 | |---------------|---------------------------------|---------|----------------------------------------------------------------| |
@@ -63,8 +59,7 @@ Device list | ||
63 | 59 | |
64 | 60 | |
65 | 61 | |
66 | -Adding new firmware | |
67 | -------------------- | |
62 | +## Adding new firmware | |
68 | 63 | |
69 | 64 | To request new firmware to be added to the list, please send a |
70 | 65 | pull request with the following structure: |
@@ -78,14 +73,16 @@ pull request with the following structure: | ||
78 | 73 | firmware. See [firmware/README.md.template](firmware/README.md.template) |
79 | 74 | for an example with explanations. |
80 | 75 | - `firmware/<manufacturer>/<device>/silead.fw` |
81 | - (optional) The extracted firmware in legacy format, as | |
82 | - created by fw_extractor, untscfg or unscramble (see below) | |
76 | + (optional) The extracted firmware, as created by fw_extractor, | |
77 | + untscfg, unscramble or scanwindrv. (see below) | |
78 | +- `firmware/linux/gsl1680-<manufacturer>-<device>.fw` | |
79 | + (optional) The same file as silead.fw, for use with the silead.ko driver | |
80 | + that is part of the Linux kernel. (see below) | |
83 | 81 | - `firmware/<manufacturer>/<device>/silead_ts.fw` |
84 | - (optional) Firmware created by fwtool (see below) | |
85 | - using correct parameters. | |
82 | + (optional) Firmware created by fwtool using correct parameters. (see below) | |
83 | + For use with the alternative gslx680_ts_acpi driver. | |
86 | 84 | - `README.md` |
87 | - A patch to this readme file that adds an entry to the | |
88 | - device list. | |
85 | + A patch to this readme file that adds an entry to the device list. | |
89 | 86 | |
90 | 87 | The "Tested" field should only be "Yes" if you have confirmed that |
91 | 88 | the converted firmware works with silead_ts.ko or gslx680_ts_acpi.ko |
@@ -93,18 +90,20 @@ and the touchscreen responds properly, i.e. the device parameters | ||
93 | 90 | are good. |
94 | 91 | |
95 | 92 | |
96 | -Firmware formats | |
97 | ----------------- | |
93 | +## Extracting firmware | |
98 | 94 | |
99 | 95 | Original vendor firmware comes in various formats, depending |
100 | 96 | on the operating system and driver version. |
101 | 97 | |
102 | -The Android driver can be found under this path (or similar): | |
98 | + | |
99 | +### Android driver | |
100 | + | |
101 | +The official Android driver can be found under this path (or similar): | |
103 | 102 | /system/vendor/modules/gslx680.ko |
104 | -Copy this to a SD card or use a GNU/Linux chroot to scp it over, or use | |
105 | -adb pull. | |
106 | -On your build machine, on the command line, use the script | |
107 | -'firmware/fw_extractor' to extract the firmware to its own file. | |
103 | +Copy this file to an SD card, use a file transfer utility, or use `adb pull`. | |
104 | + | |
105 | +On your build machine, use the script 'firmware/fw_extractor' from the command | |
106 | +line to extract the firmware from the driver: | |
108 | 107 | |
109 | 108 | tools/fw_extractor my_android_gslx680.ko |
110 | 109 |
@@ -115,43 +114,130 @@ knowing which is right for your device. You will have to try each. | ||
115 | 114 | Sometimes, the file names will give a clue, like panel size, product |
116 | 115 | name, resolution or chip name. Test the matching ones first. |
117 | 116 | |
117 | + | |
118 | +### Windows driver | |
119 | + | |
118 | 120 | If you have a Windows driver instead, the firmware either comes in |
119 | 121 | the form of a file named GSL_TS_CFG.h (or similar) or SileadTouch.fw. |
120 | 122 | The latter is just a scrambled version of GSL_TS_CFG.h and can be easily |
121 | 123 | restored by XORing every byte with 0x88. |
122 | 124 | |
123 | -To convert GSL_TS_CFG.h into a binary firmware, use: | |
125 | +To convert GSL_TS_CFG.h to binary, use: | |
124 | 126 | |
125 | 127 | tools/untscfg GSL_TS_CFG.h firmware.fw |
126 | 128 | |
127 | -And for a scrambled SileadTouch.fw: | |
129 | +For a scrambled SileadTouch.fw, use: | |
128 | 130 | |
129 | 131 | tools/unscramble SileadTouch.fw firmware.fw |
130 | 132 | |
131 | 133 | If your vendor only supplied a Windows driver and no separate |
132 | 134 | firmware, you can still extract the firmware blob that is contained |
133 | -inside. This requires some manual work in a hex editor, however. | |
135 | +inside. | |
136 | + | |
137 | +Use the scanwindrv script to extract it: | |
138 | + | |
139 | + tools/scanwindrv SileadTouch.sys | |
140 | + | |
141 | +As with the Android driver, this may produce multiple firmware files named | |
142 | +firmware_00.fw, firmware_01.fw, etc. - you have to test them to find the | |
143 | +correct one for your device. | |
144 | + | |
145 | + | |
146 | +## Usage | |
147 | + | |
148 | +There are currently two open-source drivers available for Silead chips: | |
149 | +silead_ts and gslx680_ts_acpi. | |
150 | + | |
151 | +silead_ts ships with the Linux kernel since version 4.8 and is the recommended | |
152 | +driver. gslx680_ts_acpi can still be useful for initial testing or if silead_ts | |
153 | +does not work for you. | |
154 | + | |
155 | +When Silead touchscreen support was added to ACPI (PC) platforms, the | |
156 | +integrator did not anticipate any uses cases outside the device vendor's | |
157 | +ecosystems. For this reason, it is required to pass additional | |
158 | +device parameters to the driver that are neither contained in the firmware | |
159 | +nor in the ACPI DSDT. silead_ts handles this in the kernel, using an | |
160 | +ACPI override/quirk table, while gslx680_ts_acpi expects firmware in a | |
161 | +different format that contains this information. | |
162 | + | |
163 | +Since silead_ts requires a kernel modification (and thus a reboot or kexec) | |
164 | +whenever parameters are changed, testing is easier with gslx680_ts_acpi. | |
165 | +There, parameters can be changed in the firmware, then updated by unloading and | |
166 | +reloading the kernel module. | |
167 | + | |
168 | +After the device parameters are known, you should add support to silead_ts | |
169 | +and submit a kernel patch to the | |
170 | +[linux-input mailing list](http://vger.kernel.org/vger-lists.html#linux-input). | |
171 | + | |
172 | + | |
173 | +### silead_ts | |
174 | + | |
175 | +First, decide on a unique name for the firmware. The recommended format is: | |
176 | +`gsl<chip name>-<manufacturer>-<device>.fw` | |
177 | +If you don't know the chip name, use gsl1680. Manufacturer and device name | |
178 | +should be shortened to make the name readable, but still sufficiently unique. | |
179 | + | |
180 | +Fetch the current Linux source code and open `drivers/platform/x86/silead_dmi.c` | |
181 | +in a text editor. | |
182 | + | |
183 | +Supposing you named your firmware `gsl1680-mycompany-mytablet.fw` and the | |
184 | +touchscreen has a resolution of 128x128 points, add a new section to the file: | |
185 | + | |
186 | +```c | |
187 | +static const struct property_entry mycompany_mytablet_props[] = { | |
188 | + PROPERTY_ENTRY_U32("touchscreen-size-x", 128), | |
189 | + PROPERTY_ENTRY_U32("touchscreen-size-y", 128), | |
190 | + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-mycompany_mytablet.fw"), | |
191 | + PROPERTY_ENTRY_U32("silead,max-fingers", 10), | |
192 | + { } | |
193 | +}; | |
194 | + | |
195 | +static const struct silead_ts_dmi_data mycompany_mytablet_data = { | |
196 | + .acpi_name = "MSSL1680:00", | |
197 | + .properties = mycompany_mytablet_props, | |
198 | +}; | |
199 | +``` | |
200 | + | |
201 | +In some rare cases, the `acpi_name` may be different. | |
202 | + | |
203 | +Further below, there is a list named `silead_ts_dmi_table`: | |
204 | +```c | |
205 | +static const struct dmi_system_id silead_ts_dmi_table[] = { | |
206 | +``` | |
207 | + | |
208 | +Add a new entry to this list: | |
209 | +```c | |
210 | + { | |
211 | + /* Teclast X3 Plus */ | |
212 | + .driver_data = (void *)&mycompany_mytablet_data, | |
213 | + .matches = { | |
214 | + DMI_MATCH(DMI_SYS_VENDOR, "MyCompany"), | |
215 | + DMI_MATCH(DMI_PRODUCT_NAME, "MyTablet"), | |
216 | + DMI_MATCH(DMI_BOARD_NAME, "Generic Board"), | |
217 | + }, | |
218 | + }, | |
219 | +``` | |
220 | + | |
221 | +The exact values and suitable matching tags depend on the particular device. | |
222 | +You can find them with the help of `dmidecode`. | |
223 | +Look for the section called "System Information". | |
134 | 224 | |
135 | -Search for the hex sequence F0 00 00 00, followed by a 32 bit | |
136 | -number of the form xx 00 00 00 (i.e. an 8 bit value in a little | |
137 | -endian 32 bit word) and lots of yy 00 00 00 zz zz zz zz word pairs | |
138 | -(where yy is counting from 00 to 7C and zz is any hex code). | |
139 | -There are normally several blocks of data with the same pattern that | |
140 | -follow. Copy all of them into a new file and call it firmware.fw. | |
141 | -This should be the firmware image for your device. | |
225 | +[See here for an example patch](https://patchwork.kernel.org/patch/10179961/). | |
142 | 226 | |
143 | -See [here](firmware/trekstor/surftab-twin-10.1-ST10432-8/README.md#command-to-find-the-offsets-used-for-extraction) for an example with some help from grep and dd. | |
227 | +After adding the override tables, you have to recompile your kernel, | |
228 | +as the DMI overrides are outside the context of the driver. Install and reboot. | |
229 | +You may also try reloading the kernel using `kexec`, but this can lead to an | |
230 | +unstable system and is not recommended. | |
144 | 231 | |
145 | 232 | |
146 | -gslx680-acpi | |
147 | ------------- | |
233 | +### gslx680_ts_acpi | |
148 | 234 | |
149 | 235 | The [gslx680-acpi](https://github.com/onitake/gslx680-acpi) driver |
150 | -requires firmware in a special, more compact format. | |
236 | +requires firmware in a special compact format. | |
151 | 237 | |
152 | 238 | Use [firmware/fwtool](firmware/fwtool) to convert regular firmware |
153 | -into this format. The tool will also set some non-generic | |
154 | -device parameters, such as panel width and height, tracking support, etc. | |
239 | +into this format. The tool will also store device parameters (such as | |
240 | +such as panel width and height, tracking support, etc.) inside the firmware. | |
155 | 241 | |
156 | 242 | The file format is described in 'firmware/Firmware/Silead.pm'. |
157 | 243 | Use perldoc or a text editor to read. |