Repository navigation
drm: google: gs-dsim-cmd: Support DCS reads, and tg4c checks the panel ID with them - #125
Conversation
|
Thank you for this. Reads are the piece gs-dsim-cmd has been missing, and the code follows Google's What I checked:
Two things I'd like changed before merging:
Smaller things, none blocking:
Merge order: this goes in after #88 (its two commits sit under yours), and #126 goes after this one if it ends up using reads. It also conflicts with #116 (the Pixel 6 Pro display) in Thanks again. I'll report the Pixel 7 Pro run in this thread. |
Panel drivers need reads: a read of the panel's ID would let the tg4c driver tell the Pixel 9a's three panels (TG4A, TG4B, TG4C) apart. Reads returned -EOPNOTSUPP until now. Do them as Google's dsim_read_data() does: set the maximum return packet size, send the read request with the PKTHDR bus-turnaround bit (24), wait for RX_DATA_DONE, then parse the short or long response from the RX FIFO. Without the BTA bit the panel never answers and the read times out. RX_DATA_DONE is polled: it is unmasked in INTMSK only for the read, so it latches in INTSRC, and the mask is put back afterwards. If the bootloader left DSIM_TIMEOUT at zero, it gets the vendor driver's BTA and LP RX timeouts. Reads take the same lock and the same packet-go check as writes. The RX FIFO is emptied before the request as well as after the response, so a panel that answers after its read timed out can't have that answer taken for the next read's. A short response returns the number of bytes it carried. An acknowledge-and-error report and an EoTp packet fail the read with -EIO, which is stricter than the vendor driver. Tested on the Pixel 9a with a tg4c build that reads its five LHBM brightness bands (six bytes each) at every boot: the reads succeed, and the desktop and 120 Hz are unaffected. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
5e0e520 to
081d98a
Compare
|
Thanks for going through it this closely. Both items and the smaller points are in (head 081d98a, rebased onto
Smaller points: a short response returns the bytes it actually carried (1 or 2). A comment at the error-report and EoTp cases says the strictness is on purpose. The limit is Boot of both commits on the palmtop ( checkpatch |
The Pixel 9a comes with one of three panels. Google's tegu device tree lists TG4A, TG4B and TG4C, each with its own driver, and their commands differ: TG4B's rate switch, for one, sends more than TG4C's, so TG4C's commands would leave a TG4B half switched. Read the panel's ID as Google's gs_panel does: one byte each from 0xDA, 0xDB, 0xDC and 0xA1, the MIPI DCS ID1 to ID3 and the start of the device descriptor block. The bootloader passes the same four bytes, last first, in exynos_drm.panel_name, and Google's get_panel_rev() finds the panel's build in the 0xDB byte in both orders. Our Pixel 9a reports google-tg4c.2d008004: ID1 0x04, ID2 0x80 (Google's PVT build) and ID3 0x00. A panel whose ID1 (the module's manufacturer, whose low nibble Google's gs_panel_model_init() takes as the vendor) or ID3 (the module ID) differs from those gets no commands: brightness, LHBM, the rate switch, display on/off and sleep all fail with -ENODEV, so it keeps the bootloader's picture at 60 Hz, as with gs_dsim_cmd.allow_tx off. ID2 changes with the build and is not compared. The ID is read at probe, and if gs-dsim-cmd refuses the read there (-EPERM: allow_tx is off; the Pixel 9a's device package turns it on from a start script, which can run after the panel has probed), before the first command instead. A read that fails any other way leaves the panel driven as before. Google's kernel never compares these bytes itself: it takes the panel the bootloader names, and TG4A's and TG4B's IDs are not in its sources. So the check is against TG4C's own ID, not a list of the others'. Google sources, android-gs-tegu-6.1-android16: - kernel/google-modules/display/common e34756e6205a: gs_panel/gs_panel.c (ext_info_regs, _gs_panel_read_extinfo(), gs_panel_first_enable_helper()), gs_drm/gs_drm_connector.c (dsim_get_panel_id()), gs_panel/gs_panel_funcs_defaults.c (gs_panel_model_init()) - kernel/google-modules/display/panels/tegu e3a801fb038f: panel-gs-tg4a.c, panel-gs-tg4b.c (tg4b_change_frequency()), panel-gs-tg4c.c (tg4c_change_frequency(), tg4c_get_panel_rev()) - kernel/devices/google/tegu 6276884d9940: dts/zuma-tegu-connector.dtsi (the three panel nodes) Tested on the Pixel 9a (7.3.0-rc6-omamobile-push1-g88a7314c6409, this commit on the reads commit, bootloader panel_name google-tg4c.2d008004): the ID was read 11 s into the boot, before the first command, and logged as "panel ID 04 80 00 2d". Brightness writes, DPMS off and on, and 120 Hz to 60 Hz and back all worked as before, with no "staying at 60 Hz" line. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
081d98a to
912a7e5
Compare
|
Thank you, @W4HO-ham. The panel ID check is the user I hoped these reads would get, and thank you for saying plainly what it can and can't tell apart. What I checked on
One small thing, not a blocker. If a read at probe comes back On merge order, this goes in before #116, which then needs a rebase: its split of |
|
Merged. Thanks, @W4HO-ham. |
gs-dsim-cmd returned -EOPNOTSUPP for every read. This adds reads, following Google's
dsim_read_data(): set the maximum return packet size, send the request with the PKTHDR bus-turnaround bit (24), poll RX_DATA_DONE, then parse the RX FIFO. The BTA bit is the part that matters: without it the panel never answers. The RX FIFO is drained before each request as well as after, so a late answer to a timed-out read can't be taken for the next one.The user is the second commit: tg4c reads the panel's ID (0xDA, 0xDB, 0xDC, 0xA1, as Google's
gs_paneldoes) and sends no commands to a panel whose ID1 and ID3 aren't the TG4C's. That answers the point on omarchy-mobile#74 about TG4A, TG4B and TG4C. Google's sources don't carry TG4A's and TG4B's IDs, so the check accepts the TG4C's own ID rather than refusing a list.Two commits on
omamobile(#88 is in now):drm: google: gs-dsim-cmd: Support DCS readsdrm/panel: google-tg4c: Send no commands to a panel that is not a TG4CTested on the palmtop with both (
7.3.0-rc6-omamobile-push1-g88a7314c6409):panel ID 04 80 00 2d(the bootloader'sgoogle-tg4c.2d008004, last byte first) before the first command. Brightness, DPMS off and on, and 120 Hz to 60 Hz and back all worked, andtools/phone-smokepassed every required row. An earlier build of the reads, with a test panel driver, read tg4c's five LHBM bands; LHBM in #126 doesn't need them. No read has timed out with this code, so the recovery after a timeout is untested. checkpatch--strictand W=1 are clean.