#!/usr/bin/env python3 """B9A read-only: decode the ST7735S init sequence from (a) stock LK lk.bin command table and (b) stock dtb_01 qcom,mdss-spi-on-command, and compare them byte-for-byte. LK table (gcdb mdss_spi_cmd, 16 B each): u32 size, u32 payload_ptr, u32 wait_ms, u8 cmds_post_tg. DT format (msm-3.10 mdss_spi_panel): repeated [wait_ms, len, cmd, params...]; wait applies after the command. usage: decode-panel.py lk.bin dtb_01.dts""" import re, struct, sys BASE = 0x8f600000 lk = open(sys.argv[1], 'rb').read() dts = open(sys.argv[2]).read() NAMES = {0x01: 'SWRESET', 0x11: 'SLPOUT', 0x20: 'INVOFF', 0x21: 'INVON', 0x28: 'DISPOFF', 0x29: 'DISPON', 0x2a: 'CASET', 0x2b: 'RASET', 0x2c: 'RAMWR', 0x36: 'MADCTL', 0x3a: 'COLMOD', 0xb1: 'FRMCTR1', 0xb2: 'FRMCTR2', 0xb3: 'FRMCTR3', 0xb4: 'INVCTR', 0xc0: 'PWCTR1', 0xc1: 'PWCTR2', 0xc2: 'PWCTR3', 0xc3: 'PWCTR4', 0xc4: 'PWCTR5', 0xc5: 'VMCTR1', 0xe0: 'GMCTRP1', 0xe1: 'GMCTRN1', 0x10: 'SLPIN'} def lk_cmds(table, n): out = [] for i in range(n): size, ptr, wait, post = struct.unpack_from('