Skip to content

Commit

Permalink
drivers: mipi_dsi: dsi_mcux_2l set SMARDMA slot from dev pixfmt
Browse files Browse the repository at this point in the history
Previous version hardcoded the SMARTDMA slot to either
RGB565 or RGB565_SWAP, but that would be incorrect
if the pixfmt was RGB888. Use the mipi device
pixfmt to set the slot.

(cherry picked from commit 1e6866e)

Original-Signed-off-by: Mike J. Chen <mjchen@google.com>
GitOrigin-RevId: 1e6866e
Change-Id: I545bc22a496086ed614f97b63351005515536605
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4971826
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Commit-Queue: Al Semjonovs <asemjonovs@google.com>
Tested-by: Al Semjonovs <asemjonovs@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
  • Loading branch information
mjchen0 authored and Chromeos LUCI committed Oct 24, 2023
1 parent 2190c31 commit 0ae2a17
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions drivers/mipi_dsi/dsi_mcux_2l.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ struct mcux_mipi_dsi_config {
struct mcux_mipi_dsi_data {
dsi_handle_t mipi_handle;
struct k_sem transfer_sem;
#ifdef CONFIG_MIPI_DSI_MCUX_2L_SMARTDMA
uint8_t dma_slot;
#endif
};


Expand Down Expand Up @@ -105,11 +108,7 @@ static int dsi_mcux_tx_color(const struct device *dev, uint8_t channel,
dma_cfg.user_data = (struct device *)dev;
dma_cfg.head_block = &block;
dma_cfg.block_count = 1;
if (IS_ENABLED(CONFIG_MIPI_DSI_MCUX_2L_SWAP16)) {
dma_cfg.dma_slot = DMA_SMARTDMA_MIPI_RGB565_DMA_SWAP;
} else {
dma_cfg.dma_slot = DMA_SMARTDMA_MIPI_RGB565_DMA;
}
dma_cfg.dma_slot = data->dma_slot;
dma_cfg.channel_direction = MEMORY_TO_PERIPHERAL;
ret = dma_config(config->smart_dma, 0, &dma_cfg);
if (ret < 0) {
Expand Down Expand Up @@ -241,6 +240,25 @@ static int dsi_mcux_attach(const struct device *dev,
if (!device_is_ready(config->smart_dma)) {
return -ENODEV;
}

struct mcux_mipi_dsi_data *data = dev->data;

switch (mdev->pixfmt) {
case MIPI_DSI_PIXFMT_RGB888:
data->dma_slot = DMA_SMARTDMA_MIPI_RGB888_DMA;
break;
case MIPI_DSI_PIXFMT_RGB565:
if (IS_ENABLED(CONFIG_MIPI_DSI_MCUX_2L_SWAP16)) {
data->dma_slot = DMA_SMARTDMA_MIPI_RGB565_DMA_SWAP;
} else {
data->dma_slot = DMA_SMARTDMA_MIPI_RGB565_DMA;
}
break;
default:
LOG_ERR("SMARTDMA does not support pixel_format %u",
mdev->pixfmt);
return -ENODEV;
}
#else
struct mcux_mipi_dsi_data *data = dev->data;

Expand Down

0 comments on commit 0ae2a17

Please sign in to comment.