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.

(cherry picked from commit 4844d01)

Original-Signed-off-by: Mike J. Chen <mjchen@google.com>
GitOrigin-RevId: 4844d01
Change-Id: Iae8c9974a85b4d6bf1320afe29250548e17719b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4971827
Commit-Queue: Al Semjonovs <asemjonovs@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Tested-by: Al Semjonovs <asemjonovs@google.com>
  • Loading branch information
mjchen0 authored and Chromeos LUCI committed Oct 24, 2023
1 parent 0ae2a17 commit 8a86ab9
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 8a86ab9

Please sign in to comment.