drivers: mipi_dsi: dsi_mcux_2l add msg flag for low power mode

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 <mjchen@google.com>
This commit is contained in:
Mike J. Chen 2023-10-06 12:23:04 -07:00 committed by Carles Cufí
parent 1e6866ed0b
commit 4844d015a4
2 changed files with 10 additions and 2 deletions

View File

@ -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,
};
/*
@ -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:
@ -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

View File

@ -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. */