diff --git a/drivers/display/display_mcux_dcnano_lcdif.c b/drivers/display/display_mcux_dcnano_lcdif.c index b9e90438303..084cb11893e 100644 --- a/drivers/display/display_mcux_dcnano_lcdif.c +++ b/drivers/display/display_mcux_dcnano_lcdif.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 NXP + * Copyright 2023,2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -110,6 +110,11 @@ static int mcux_dcnano_lcdif_write(const struct device *dev, const uint16_t x, (uint32_t)data->active_fb); LCDIF_SetFrameBufferConfig(config->base, 0, &data->fb_config); +#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1 + LCDIF_Start(config->base); + LCDIF_SetUpdateReady(config->base); +#endif + #if CONFIG_MCUX_DCNANO_LCDIF_FB_NUM != 0 /* Update index of active framebuffer */ data->next_idx = (data->next_idx + 1) % CONFIG_MCUX_DCNANO_LCDIF_FB_NUM; @@ -139,7 +144,11 @@ static void mcux_dcnano_lcdif_get_capabilities(const struct device *dev, */ capabilities->current_pixel_format = PIXEL_FORMAT_BGR_565; break; +#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1 + case kLCDIF_PixelFormatARGB8888: +#else case kLCDIF_PixelFormatXRGB8888: +#endif capabilities->current_pixel_format = PIXEL_FORMAT_ARGB_8888; break; default: @@ -185,7 +194,11 @@ static int mcux_dcnano_lcdif_set_pixel_format(const struct device *dev, data->pixel_bytes = 2; break; case PIXEL_FORMAT_ARGB_8888: +#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1 + data->fb_config.format = kLCDIF_PixelFormatARGB8888; +#else data->fb_config.format = kLCDIF_PixelFormatXRGB8888; +#endif data->pixel_bytes = 4; break; default: @@ -228,6 +241,13 @@ static int mcux_dcnano_lcdif_init(const struct device *dev) LCDIF_DpiModeSetConfig(config->base, 0, &config->dpi_config); +#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1 + lcdif_panel_config_t panel_config; + + LCDIF_PanelGetDefaultConfig(&panel_config); + LCDIF_SetPanelConfig(config->base, 0, &panel_config); +#endif + LCDIF_EnableInterrupts(config->base, kLCDIF_Display0FrameDoneInterrupt); config->irq_config_func(dev); @@ -256,7 +276,7 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = { .get_framebuffer = mcux_dcnano_lcdif_get_framebuffer, }; -#define MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) \ +#define MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) \ (DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(n, pixel_format)) / BITS_PER_BYTE) #define MCUX_DCNANO_LCDIF_FB_SIZE(n) DT_INST_PROP(n, width) * \ DT_INST_PROP(n, height) * MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) @@ -278,6 +298,29 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = { #define MCUX_DCNANO_LCDIF_FRAMEBUFFER(n) mcux_dcnano_lcdif_frame_buffer_##n #endif +#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1 +#define MCUX_DCNANO_LCDIF_FB_CONFIG(n) \ + .fb_config = { \ + .enable = true, \ + .inOrder = kLCDIF_PixelInputOrderARGB, \ + .rotateFlipMode = kLCDIF_Rotate0, \ + .alpha.enable = false, \ + .colorkey.enable = false, \ + .topLeftX = 0U, \ + .topLeftY = 0U, \ + .width = DT_INST_PROP(n, width), \ + .height = DT_INST_PROP(n, height), \ + .format = DT_INST_PROP(n, pixel_format), \ + }, +#else +#define MCUX_DCNANO_LCDIF_FB_CONFIG(n) \ + .fb_config = { \ + .enable = true, \ + .enableGamma = false, \ + .format = DT_INST_PROP(n, pixel_format), \ + }, +#endif + #define MCUX_DCNANO_LCDIF_DEVICE_INIT(n) \ static void mcux_dcnano_lcdif_config_func_##n(const struct device *dev) \ { \ @@ -290,11 +333,7 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = { } \ MCUX_DCNANO_LCDIF_FRAMEBUFFER_DECL(n); \ struct mcux_dcnano_lcdif_data mcux_dcnano_lcdif_data_##n = { \ - .fb_config = { \ - .enable = true, \ - .enableGamma = false, \ - .format = DT_INST_PROP(n, pixel_format), \ - }, \ + MCUX_DCNANO_LCDIF_FB_CONFIG(n) \ .next_idx = 0, \ .pixel_bytes = MCUX_DCNANO_LCDIF_PIXEL_BYTES(n), \ }; \ diff --git a/dts/bindings/display/nxp,dcnano-lcdif.yaml b/dts/bindings/display/nxp,dcnano-lcdif.yaml index 154ea323f9a..376b61855ef 100644 --- a/dts/bindings/display/nxp,dcnano-lcdif.yaml +++ b/dts/bindings/display/nxp,dcnano-lcdif.yaml @@ -1,4 +1,4 @@ -# Copyright 2023 NXP +# Copyright 2023,2024 NXP # SPDX-License-Identifier: Apache-2.0 description: NXP DCNano LCDIF (LCD Interface) controller @@ -32,3 +32,11 @@ properties: - "24-bit" # 24 Bit description: LCD data bus width. The default is set to the reset value of 24-bit + + version: + type: string + description: + The version of the ip + enum: + - "DCnano" + - "DC8000"