Skip to content

Support MIPI displays #5556

Description

@digitalentity

ESP32 and other CPUs have support for DSI (MIPI) interface, for example Guition ESP32-S3 4848S040 and other similar devices. High-end STM32 CPUs also have support for DSI MIPI for driving displays.

Support for TinyGo might look like a driver with an interface like this:

// VideoTimings configures the display controller's timing generator.
type VideoTimings struct {
	HActive     uint16 // Active horizontal resolution (pixels)
	HFrontPorch uint16 // Horizontal front porch (cycles/pixels)
	HSyncWidth  uint16 // Horizontal sync pulse width
	HBackPorch  uint16 // Horizontal back porch
	VActive     uint16 // Active vertical resolution (lines)
	VFrontPorch uint16 // Vertical front porch (lines)
	VSyncWidth  uint16 // Vertical sync pulse width
	VBackPorch  uint16 // Vertical back porch
}

// Hardware-specific lanes/pins configuration
type LaneConfig struct {
}

// Control / Command Mode (Panel Configuration)
type DSIController interface {
	// WriteShort sends a 4-byte MIPI DSI Short Packet (Header only, no payload).
	WriteShort(dt uint8, data0, data1 uint8) error

	// WriteLong sends a MIPI DSI Long Packet with a payload buffer.
	WriteLong(dt uint8, payload []byte) error

	// ReadShort initiates a Bus Turnaround (BTA) to read back short response packets.
	ReadShort(dt uint8) (data [2]byte, err error)
}

// Video Pipeline and Framebuffer Management
type DSIStreamer interface {
	// InitVideo configures D-PHY clocking, active lanes, and video timing parameters.
	InitVideo(lanes LaneConfig, timings VideoTimings) error

	// StartVideo starts continuous DMA transmission over D-PHY lanes.
	StartVideo() error

	// StopVideo halts video packet generation (e.g., prior to panel sleep mode).
	StopVideo() error

	// SetFramebuffer assigns the primary buffer for continuous DMA reading. Must be called prior to StartVideo().
	SetFramebuffer(primary []byte) error

	// SwapFramebuffer queues a new buffer address for the DMA engine.
	// Blocks until the next V-Blanking interval.
	SwapFramebuffer(next []byte) error
}

Cheap displays don't implement the DSI command mode (use SPI or I2C for panel configuration). Some HW (ESP32) doesn't implement exactly DSI, but rather support pixel streaming, so the driver may implement one or both interfaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions