PebbleOS v4.47.0-1075-g013613c8a
Loading...
Searching...
No Matches
MIPI DSI

MIPI DSI hosts. More...

Modules

 STM32 DSI host
 MIPI DSI host of the STM32H7, in adapted command mode.
 

Data Structures

struct  pbl_mipi_dsi_device
 A panel on a host. More...
 
struct  pbl_mipi_dsi_msg
 A packet to send, and what to read back. More...
 
struct  pbl_mipi_dsi_host_ops
 Host operations. More...
 
struct  pbl_mipi_dsi_host
 Host. More...
 

Macros

#define PBL_MIPI_DSI_DCS_MAX_PARAMS   63U
 Most parameters of a DCS command pbl_mipi_dsi_dcs_write() sends.
 
#define PBL_MIPI_DSI_HOST_INIT(sym, _name, _init, _parent, _ops)
 Initializer of a host.
 

Enumerations

enum  pbl_mipi_dsi_pixel_format { PBL_MIPI_DSI_FMT_RGB888 , PBL_MIPI_DSI_FMT_RGB666 , PBL_MIPI_DSI_FMT_RGB666_PACKED , PBL_MIPI_DSI_FMT_RGB565 }
 Pixel formats of the video stream. More...
 

Functions

int pbl_mipi_dsi_attach (const struct pbl_mipi_dsi_device *dsi)
 Set the link up for a device and start it.
 
int pbl_mipi_dsi_detach (const struct pbl_mipi_dsi_device *dsi)
 Stop the link of a device.
 
int pbl_mipi_dsi_dcs_write (const struct pbl_mipi_dsi_device *dsi, uint8_t cmd, const uint8_t *data, size_t len)
 Send a DCS command with its parameters, as the shortest packet that holds them.
 
int pbl_mipi_dsi_dcs_read (const struct pbl_mipi_dsi_device *dsi, uint8_t cmd, uint8_t *data, size_t len)
 Send a DCS command that reads, and read its response.
 
int pbl_mipi_dsi_generic_write (const struct pbl_mipi_dsi_device *dsi, const uint8_t *data, size_t len)
 Send generic data, as the shortest packet that holds it.
 

Data types of the packets a host sends

#define PBL_MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM   0x03U
 
#define PBL_MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM   0x04U
 
#define PBL_MIPI_DSI_DCS_SHORT_WRITE   0x05U
 
#define PBL_MIPI_DSI_DCS_READ   0x06U
 
#define PBL_MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM   0x13U
 
#define PBL_MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM   0x14U
 
#define PBL_MIPI_DSI_DCS_SHORT_WRITE_PARAM   0x15U
 
#define PBL_MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM   0x23U
 
#define PBL_MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM   0x24U
 
#define PBL_MIPI_DSI_GENERIC_LONG_WRITE   0x29U
 
#define PBL_MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE   0x37U
 
#define PBL_MIPI_DSI_DCS_LONG_WRITE   0x39U
 

Mode flags

#define PBL_MIPI_DSI_MODE_VIDEO   PBL_BIT(0)
 Video mode: the host streams pixels, else the panel has its own frame memory.
 
#define PBL_MIPI_DSI_MODE_VIDEO_BURST   PBL_BIT(1)
 In video mode, lines in bursts at the full rate of the link, low power in between.
 
#define PBL_MIPI_DSI_MODE_VIDEO_SYNC_PULSE   PBL_BIT(2)
 In video mode, sync pulses with their ends, else sync events.
 
#define PBL_MIPI_DSI_MODE_LPM   PBL_BIT(3)
 Commands in low power, else at high speed.
 

Detailed Description

MIPI DSI hosts.

A host is the controller a panel is wired to over MIPI DSI. The driver of the panel, a child of the host, attaches to it with what the panel takes: its lanes, its pixel format, video or command mode, and its timing. It then sends its own commands through the host, those of its power sequence and its settings, as DCS or generic packets on its virtual channel. In video mode, the host streams the pixels a display controller feeds it. In command mode, the panel keeps the image in its frame memory, and the host, as the Display bridge of the display controller, sends it a frame on each refresh.

ret = pbl_mipi_dsi_attach(&s_dsi);
#define PBL_MIPI_DCS_EXIT_SLEEP_MODE
Definition mipi_dcs.h:16
int pbl_mipi_dsi_attach(const struct pbl_mipi_dsi_device *dsi)
Set the link up for a device and start it.
int pbl_mipi_dsi_dcs_write(const struct pbl_mipi_dsi_device *dsi, uint8_t cmd, const uint8_t *data, size_t len)
Send a DCS command with its parameters, as the shortest packet that holds them.

Data Structure Documentation

◆ pbl_mipi_dsi_device

struct pbl_mipi_dsi_device

A panel on a host.

Data Fields
uint8_t channel Virtual channel, 0 to 3.
enum pbl_mipi_dsi_pixel_format format Pixel format.
const struct pbl_mipi_dsi_host * host Host.
uint8_t lanes Data lanes.
uint32_t mode_flags Mode flags, PBL_MIPI_DSI_MODE_*.
const struct pbl_panel_timing * timing Timing, the clock being the pixel clock.

◆ pbl_mipi_dsi_msg

struct pbl_mipi_dsi_msg

A packet to send, and what to read back.

Data Fields
uint8_t channel Virtual channel.
bool lpm Send in low power.
uint8_t * rx_buf Buffer for the response to a read, or NULL.
size_t rx_len Bytes to read back.
const uint8_t * tx_buf Payload, the parameters of a short packet or the data of a long one.
size_t tx_len Payload length.
uint8_t type Data type.

◆ pbl_mipi_dsi_host

struct pbl_mipi_dsi_host

Host.

Data Fields
struct pbl_device dev Device.
const struct pbl_mipi_dsi_host_ops * ops Driver operations.

Macro Definition Documentation

◆ PBL_MIPI_DSI_DCS_LONG_WRITE

#define PBL_MIPI_DSI_DCS_LONG_WRITE   0x39U

◆ PBL_MIPI_DSI_DCS_MAX_PARAMS

#define PBL_MIPI_DSI_DCS_MAX_PARAMS   63U

Most parameters of a DCS command pbl_mipi_dsi_dcs_write() sends.

◆ PBL_MIPI_DSI_DCS_READ

#define PBL_MIPI_DSI_DCS_READ   0x06U

◆ PBL_MIPI_DSI_DCS_SHORT_WRITE

#define PBL_MIPI_DSI_DCS_SHORT_WRITE   0x05U

◆ PBL_MIPI_DSI_DCS_SHORT_WRITE_PARAM

#define PBL_MIPI_DSI_DCS_SHORT_WRITE_PARAM   0x15U

◆ PBL_MIPI_DSI_GENERIC_LONG_WRITE

#define PBL_MIPI_DSI_GENERIC_LONG_WRITE   0x29U

◆ PBL_MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM

#define PBL_MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM   0x04U

◆ PBL_MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM

#define PBL_MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM   0x14U

◆ PBL_MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM

#define PBL_MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM   0x24U

◆ PBL_MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM

#define PBL_MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM   0x03U

◆ PBL_MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM

#define PBL_MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM   0x13U

◆ PBL_MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM

#define PBL_MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM   0x23U

◆ PBL_MIPI_DSI_HOST_INIT

#define PBL_MIPI_DSI_HOST_INIT (   sym,
  _name,
  _init,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, &pbl_mipi_dsi_class), \
.ops = (_ops), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153

Initializer of a host.

Parameters
symSymbol of the host.
_nameName.
_initDevice initialization function, or NULL.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_MIPI_DSI_MODE_LPM

#define PBL_MIPI_DSI_MODE_LPM   PBL_BIT(3)

Commands in low power, else at high speed.

◆ PBL_MIPI_DSI_MODE_VIDEO

#define PBL_MIPI_DSI_MODE_VIDEO   PBL_BIT(0)

Video mode: the host streams pixels, else the panel has its own frame memory.

◆ PBL_MIPI_DSI_MODE_VIDEO_BURST

#define PBL_MIPI_DSI_MODE_VIDEO_BURST   PBL_BIT(1)

In video mode, lines in bursts at the full rate of the link, low power in between.

◆ PBL_MIPI_DSI_MODE_VIDEO_SYNC_PULSE

#define PBL_MIPI_DSI_MODE_VIDEO_SYNC_PULSE   PBL_BIT(2)

In video mode, sync pulses with their ends, else sync events.

◆ PBL_MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE

#define PBL_MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE   0x37U

Enumeration Type Documentation

◆ pbl_mipi_dsi_pixel_format

Pixel formats of the video stream.

Enumerator
PBL_MIPI_DSI_FMT_RGB888 

24 bits per pixel, 8 per color.

PBL_MIPI_DSI_FMT_RGB666 

18 bits per pixel, each in 3 bytes.

PBL_MIPI_DSI_FMT_RGB666_PACKED 

18 bits per pixel, packed.

PBL_MIPI_DSI_FMT_RGB565 

16 bits per pixel.

Function Documentation

◆ pbl_mipi_dsi_attach()

int pbl_mipi_dsi_attach ( const struct pbl_mipi_dsi_device *  dsi)

Set the link up for a device and start it.

Parameters
dsiDevice.
Returns
0, -ENOTSUP for a setting the host cannot take, or another negative errno.

◆ pbl_mipi_dsi_dcs_read()

int pbl_mipi_dsi_dcs_read ( const struct pbl_mipi_dsi_device *  dsi,
uint8_t  cmd,
uint8_t *  data,
size_t  len 
)

Send a DCS command that reads, and read its response.

Parameters
dsiDevice.
cmdCommand.
dataBuffer for the response.
lenBytes to read.
Returns
0, -EIO for a shorter response, or another negative errno.

◆ pbl_mipi_dsi_dcs_write()

int pbl_mipi_dsi_dcs_write ( const struct pbl_mipi_dsi_device *  dsi,
uint8_t  cmd,
const uint8_t *  data,
size_t  len 
)

Send a DCS command with its parameters, as the shortest packet that holds them.

Parameters
dsiDevice.
cmdCommand.
dataParameters, or NULL.
lenNumber of parameters, up to PBL_MIPI_DSI_DCS_MAX_PARAMS.
Returns
0 or a negative errno.

◆ pbl_mipi_dsi_detach()

int pbl_mipi_dsi_detach ( const struct pbl_mipi_dsi_device *  dsi)

Stop the link of a device.

Parameters
dsiDevice.
Returns
0 or a negative errno.

◆ pbl_mipi_dsi_generic_write()

int pbl_mipi_dsi_generic_write ( const struct pbl_mipi_dsi_device *  dsi,
const uint8_t *  data,
size_t  len 
)

Send generic data, as the shortest packet that holds it.

Parameters
dsiDevice.
dataData.
lenIts length.
Returns
0 or a negative errno.