drivers: mipi_dsi: configure DSI host using pixelformat from panel
Use the pixelformat information provided by the DSI panel in order to control the color coding of the DSI host. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
This commit is contained in:
committed by
Anas Nashif
parent
73ca8c9f76
commit
d0c45d981a
@@ -21,16 +21,6 @@
|
||||
|
||||
LOG_MODULE_REGISTER(dsi_stm32, CONFIG_MIPI_DSI_LOG_LEVEL);
|
||||
|
||||
#if defined(CONFIG_STM32_LTDC_ARGB8888)
|
||||
#define STM32_DSI_INIT_PIXEL_FORMAT DSI_RGB888
|
||||
#elif defined(CONFIG_STM32_LTDC_RGB888)
|
||||
#define STM32_DSI_INIT_PIXEL_FORMAT DSI_RGB888
|
||||
#elif defined(CONFIG_STM32_LTDC_RGB565)
|
||||
#define STM32_DSI_INIT_PIXEL_FORMAT DSI_RGB565
|
||||
#else
|
||||
#error "Invalid LTDC pixel format chosen"
|
||||
#endif /* CONFIG_STM32_LTDC_ARGB8888 */
|
||||
|
||||
#define MAX_TX_ESC_CLK_KHZ 20000
|
||||
#define MAX_TX_ESC_CLK_DIV 8
|
||||
|
||||
@@ -272,6 +262,21 @@ static int mipi_dsi_stm32_host_init(const struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mipi_dsi_stm32_set_colorcoding(uint32_t pixfmt, uint32_t *colorcoding)
|
||||
{
|
||||
switch (pixfmt) {
|
||||
case MIPI_DSI_PIXFMT_RGB888:
|
||||
*colorcoding = DSI_RGB888;
|
||||
break;
|
||||
case MIPI_DSI_PIXFMT_RGB565:
|
||||
*colorcoding = DSI_RGB565;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mipi_dsi_stm32_attach(const struct device *dev, uint8_t channel,
|
||||
const struct mipi_dsi_device *mdev)
|
||||
@@ -287,7 +292,10 @@ static int mipi_dsi_stm32_attach(const struct device *dev, uint8_t channel,
|
||||
}
|
||||
|
||||
vcfg->VirtualChannelID = channel;
|
||||
vcfg->ColorCoding = STM32_DSI_INIT_PIXEL_FORMAT;
|
||||
if (mipi_dsi_stm32_set_colorcoding(mdev->pixfmt, &vcfg->ColorCoding) < 0) {
|
||||
LOG_ERR("MIPI PIXFMT not supported by the DSI host");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (mdev->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
|
||||
vcfg->Mode = DSI_VID_MODE_BURST;
|
||||
|
||||
Reference in New Issue
Block a user