Repository navigation
Conversation
A driver for the LT8912B bridge on Adafruit's, Olimex's and M5Stack's boards: chip detection, hot-plug, EDID read and parse, a table of standard modes fitted to a host that divides a fixed clock, a lane-rate check that refuses what the lanes can't carry with the numbers, one to four lanes, HDMI or DVI with LVDS off, the bridge's own test pattern, read-back of the sync counts it measures, and experimental I2S audio. The register tables are Espressif's and Adafruit's (Apache-2.0). The contract runs on CPython and unix MicroPython: 86 checks, including each mode's writes in order against those tables and a real monitor's EDID, and four planted faults each fail it. Not yet run on hardware.
720p60 at 80 MHz with a wider front porch, 960 Mbps on two lanes. Pins, mode and audio sit in one block at the top of each config. When the firmware's mipidsi can't send RGB888 with the lanes kept in high speed, the config shows the bridge's test pattern and raises NotImplementedError naming what's missing. Run on unix MicroPython against fake machine and mipidsi modules, one refusing the options as today's firmware does and one accepting them. Not yet run on hardware.
How to wire Adafruit's board to an ESP32-P4, see colour bars before any DSI video, pick a mode the two lanes carry, and what isn't proven yet.
…er an RGB565 framebuffer
fit() takes vic=, and both HDMI board configs have a VIC setting. A padded mode still announces 0 by default, since its timing isn't the CEA one; some sinks may handle it better with the standard code, such as 4 for 720p60. The contract gains two checks (88 pass on CPython and unix MicroPython). Not run on a board.
RST goes from the LT8912B adapter's pad to the Pico header's pin 22 (GPIO 47), free on the board and unused by the other ESP32-P4-WIFI6 configs. tests/lt8912b_contract.py passes on CPython and MicroPython (88 each).
A program written for Adafruit's CircuitPython adafruit_lt8912b keeps its LT8912B(bus, i2c, width=..., pixel_clock_frequency=..., reset=..., hsync_positive=..., vic=..., aspect_ratio=...) call, and width, height and hot_plug_detected read the same. Like Adafruit's, it resets and configures the bridge over I2C, starts DSI video, checks the bus rate against the pixel clock, then reseeds the bridge's clock from the running video. What stays this driver's own: fit(), check(), read_edid(), parse_edid() and best_mode(), Mode.timing() for LT8912B(bus, i2c, **mode.timing()), audio= and hdmi=, hpd=, status(), and Bridge, the I2C side alone, with the test pattern, clashes() and detect(). The framebuffer stays RGB565 with RGB888 on the wire; color_depth=24 goes to mipidsi as asked, and where mipidsi has no RGB888 framebuffer the error says to leave it out. A mipidsi.Bus that doesn't report its lanes and rate takes num_lanes= and bus_frequency= instead, and says so when they're missing. The board configs build on LT8912B. The simpletest now draws bars over DSI with Adafruit's call; the bridge-only test pattern moves to lt8912b_test_pattern.py. Checked: the contract (118 checks) passes on CPython and unix MicroPython, and each of six planted faults fails it, including video starting before the bridge is set up and color_depth=24 quietly remapped. Adafruit's driver and this one, run on the same fake bus with Adafruit's 720p call, write the same registers in the same order, except that this one writes the TX-off and sync-polarity bytes whole and resets the receiver again after video starts. Both board configs and both examples run on unix MicroPython against fake machine and mipidsi modules. Nothing has run on a board.
mipidsi.Bus(minimum_frequency=) now reports num_lanes and frequency, as CircuitPython's does, so LT8912B reads them and drops the num_lanes= and bus_frequency= stand-ins. A 24-bit framebuffer is accepted by mipidsi too, so color_depth=24 is passed on as Adafruit's driver does. The contract test fakes a bus that reports its figures, and every planted fault still fails.
Contributor
Author
|
The driver now takes the bus's lanes and rate from This needs firmware with omnipython-builds#557 (the |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs first light on a board before review ends. Nothing here has run on hardware yet; every example's
Tested on:line says so.This adds
lt8912b, a driver for the Lontium LT8912B MIPI DSI to HDMI/DVI bridge (Adafruit 6539 and others), two board configs for Waveshare's ESP32-P4-WIFI6 and ESP32-P4-WIFI6-DEV-KIT with Adafruit's board, a guide (docs/guides/hdmi-out.md) and two examples.LT8912Bis a subclass ofmipidsi.Displaywith the same constructor, properties and order of work as Adafruit's CircuitPythonadafruit_lt8912b.LT8912B, so a program written for that keeps itsLT8912B(bus, i2c, width=..., ...)call. On top of that it adds mode fitting for the P4's divided pixel clock (fit,check,Mode.timing()), EDID reading (read_edid,parse_edid,best_mode), experimental HDMI audio over I2S,status(), andBridge, the I2C side alone, which shows the bridge's own test pattern with no DSI video. The framebuffer is RGB565 and the P4 sends RGB888;color_depth=24is passed tomipidsias asked and refused with a clear message wheremipidsihas no RGB888 framebuffer. Because thismipidsi.Busdoesn't report its lanes or rate,LT8912Btakes them asnum_lanes=andbus_frequency=, and says so when they're missing.Real video needs a firmware whose
mipidsi.Displaytakesoutput_color_depthandlow_power_blanking; older firmware raises aTypeErrornaming the argument. The test-pattern example runs on any firmware withmachine.I2C.What was run:
tests/test_lt8912b.pyruns the driver contract (118 checks against the register tables of Espressif's and Adafruit's drivers, a real monitor's EDID, andLT8912Bagainst a fakemipidsi.Display) on CPython and unix MicroPython, and six planted faults each fail it, among them video starting before the bridge is set up andcolor_depth=24quietly remapped. Adafruit's driver and this one, run on the same fake bus with Adafruit's 720p call, write the same registers in the same order, except that this one writes the TX-off and sync-polarity bytes whole, checks the chip ID first, and resets the receiver again after video starts. Both board configs and both examples ran on unix MicroPython against fakemachineandmipidsimodules. Subclassing a native type from Python was checked on unix MicroPython with another native type, not yet withmipidsi.Displayon a P4.libbuild.py check,installers --check, the style check and a-Wdocs build are clean.Not verified: anything on a board, including the bridge locking to the P4's video, the padded timings on real monitors, the cable orientation on the DEV-KIT, and every audio register.