Skip to content

Commit

Permalink
drivers: mipi_dsi: dsi_mcux_2l add msg flag for low power mode
Browse files Browse the repository at this point in the history
Previous version of dsi_mcux_2l hardcoded some MIPI DSI
transfers to use high speed mode but others used low power mode.

Now dsi_mcux_2l will use high speed mode by default for all
transfers unless a new msg flag is set to indicate the
transfer must use low power mode. Note that the new flag
is different than the existing MIPI_DSI_MODE_LPM flag, which
so far only applied to cmd messages sent in video mode,
or could be interpreted as for all messages, but would not
allow per message mode control.

This new message flag allows client to control transfer
mode per message transfer.

Signed-off-by: Mike J. Chen <[email protected]>
  • Loading branch information
mjchen0 authored and carlescufi committed Oct 24, 2023
1 parent 1e6866e commit 4844d01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/mipi_dsi/dsi_mcux_2l.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ static int dsi_mcux_tx_color(const struct device *dev, uint8_t channel,
.sendDscCmd = true,
.dscCmd = msg->cmd,
.txDataType = kDSI_TxDataDcsLongWr,
.flags = kDSI_TransferUseHighSpeed,
/* default to high speed unless told to use low power */
.flags = (msg->flags & MIPI_DSI_MSG_USE_LPM) ? 0 : kDSI_TransferUseHighSpeed,
};

/*
Expand Down Expand Up @@ -354,6 +355,8 @@ static ssize_t dsi_mcux_transfer(const struct device *dev, uint8_t channel,
dsi_xfer.txData = msg->tx_buf;
dsi_xfer.rxDataSize = msg->rx_len;
dsi_xfer.rxData = msg->rx_buf;
/* default to high speed unless told to use low power */
dsi_xfer.flags = (msg->flags & MIPI_DSI_MSG_USE_LPM) ? 0 : kDSI_TransferUseHighSpeed;

switch (msg->type) {
case MIPI_DSI_DCS_READ:
Expand All @@ -373,7 +376,6 @@ static ssize_t dsi_mcux_transfer(const struct device *dev, uint8_t channel,
dsi_xfer.sendDscCmd = true;
dsi_xfer.dscCmd = msg->cmd;
dsi_xfer.txDataType = kDSI_TxDataDcsLongWr;
dsi_xfer.flags = kDSI_TransferUseHighSpeed;
if (msg->flags & MCUX_DSI_2L_FB_DATA) {
/*
* Special case- transfer framebuffer data using
Expand Down
6 changes: 6 additions & 0 deletions include/zephyr/drivers/mipi_dsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ struct mipi_dsi_device {
uint32_t mode_flags;
};

/*
* Per message flag to indicate the message must be sent
* using Low Power Mode instead of controller default.
*/
#define MIPI_DSI_MSG_USE_LPM BIT(0x0)

/** MIPI-DSI read/write message. */
struct mipi_dsi_msg {
/** Payload data type. */
Expand Down

0 comments on commit 4844d01

Please sign in to comment.