- B9A: read-only audit of stock LK/DT: the panel is an ST7735S 128x128 on SPI (BLSP1 QUP4, 16 MHz, mode 3, D/C GPIO116, RESET GPIO118), backlight = PM8916 MPP4 current sink 40 mA. - B9B: upstream panel-mipi-dbi with the stock init sequence as firmware; MPP4 sink via pinctrl + gpio-backlight; first light with correct colours/orientation/offsets. - B9C: fbcon (6x8, 21x16) on tty1 + getty, UART console kept, aurora-display service; cache B9C b9ce13c9 written and verified, cold boots with LTE + Wi-Fi + display. - B9L (RAM only): lk2nd second stage with an msm8916 SPI panel port shows a picture before Linux. - Sanitizer: whitelist for b8/ and b9/.
36 lines
1.8 KiB
Python
36 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""B9B: build the panel-mipi-dbi firmware file from the stock Aurora ST7735S init sequence.
|
|
Source of truth = stock LK command table (lk.bin @0x8f64849c, 19 entries); it must equal stock dtb_01
|
|
qcom,mdss-spi-on-command byte-for-byte (else STOP). Nothing is "improved": same commands, same parameters, same
|
|
delays. Only the final RAMWR (0x2c, no params) is dropped - the mipi-dbi driver issues CASET/RASET/RAMWR itself
|
|
for every frame update.
|
|
Format (drivers/gpu/drm/tiny/panel-mipi-dbi.c): "MIPI DBI" + 7x00 + version 1, then cmd, nparams, params...;
|
|
delay = cmd 0x00 with 1 param (ms).
|
|
usage: mk-panel-fw.py lk.bin dtb_01.dts out.bin"""
|
|
import importlib.util, os, sys
|
|
|
|
spec = importlib.util.spec_from_file_location('dp', os.path.join(os.path.dirname(__file__), '../b9a/decode-panel.py'))
|
|
sys_argv = sys.argv; sys.argv = [sys_argv[0], sys_argv[1], sys_argv[2]]
|
|
import io, contextlib
|
|
dp = importlib.util.module_from_spec(spec)
|
|
with contextlib.redirect_stdout(io.StringIO()):
|
|
spec.loader.exec_module(dp) # defines lkc (LK table) and dtc (DT on-command)
|
|
sys.argv = sys_argv
|
|
|
|
lk, dt = dp.lkc, dp.dtc
|
|
if lk != dt or len(lk) != 19:
|
|
sys.exit('STOP: stock LK table != stock DT on-command')
|
|
assert lk[-1] == (b'\x2c', 0), lk[-1]
|
|
|
|
out = bytearray(b'MIPI DBI' + bytes(7) + bytes([1]))
|
|
for payload, wait in lk[:-1]: # 18 commands, RAMWR dropped
|
|
out += bytes([payload[0], len(payload) - 1]) + payload[1:]
|
|
if wait:
|
|
assert wait <= 255
|
|
out += bytes([0x00, 0x01, wait])
|
|
open(sys.argv[3], 'wb').write(out)
|
|
|
|
# human-readable listing
|
|
for payload, wait in lk[:-1]:
|
|
print(f'{payload[0]:02x} {dp.NAMES.get(payload[0], "?"):8s} {payload[1:].hex(" ")}' + (f' + delay {wait} ms' if wait else ''))
|
|
print(f'dropped: 2c RAMWR (driver writes memory itself); file {len(out)} bytes')
|