Skip to content

Commit 058a162

Browse files
KATE-WANG-NXPkartben
authored andcommitted
drivers: display: Update nxp,dcnano-lcdif to support IP change on RT700
Update nxp,dcnano-lcdif to support IP change on RT700. There are extra registers need to be configured for the lcdif on RT700. Add new binding item "version" to tell which version of the IP the SoC has. Signed-off-by: Kate Wang <[email protected]>
1 parent ed63240 commit 058a162

File tree

2 files changed

+55
-8
lines changed

2 files changed

+55
-8
lines changed

drivers/display/display_mcux_dcnano_lcdif.c

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 NXP
2+
* Copyright 2023,2024 NXP
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -110,6 +110,11 @@ static int mcux_dcnano_lcdif_write(const struct device *dev, const uint16_t x,
110110
(uint32_t)data->active_fb);
111111
LCDIF_SetFrameBufferConfig(config->base, 0, &data->fb_config);
112112

113+
#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1
114+
LCDIF_Start(config->base);
115+
LCDIF_SetUpdateReady(config->base);
116+
#endif
117+
113118
#if CONFIG_MCUX_DCNANO_LCDIF_FB_NUM != 0
114119
/* Update index of active framebuffer */
115120
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,
139144
*/
140145
capabilities->current_pixel_format = PIXEL_FORMAT_BGR_565;
141146
break;
147+
#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1
148+
case kLCDIF_PixelFormatARGB8888:
149+
#else
142150
case kLCDIF_PixelFormatXRGB8888:
151+
#endif
143152
capabilities->current_pixel_format = PIXEL_FORMAT_ARGB_8888;
144153
break;
145154
default:
@@ -185,7 +194,11 @@ static int mcux_dcnano_lcdif_set_pixel_format(const struct device *dev,
185194
data->pixel_bytes = 2;
186195
break;
187196
case PIXEL_FORMAT_ARGB_8888:
197+
#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1
198+
data->fb_config.format = kLCDIF_PixelFormatARGB8888;
199+
#else
188200
data->fb_config.format = kLCDIF_PixelFormatXRGB8888;
201+
#endif
189202
data->pixel_bytes = 4;
190203
break;
191204
default:
@@ -228,6 +241,13 @@ static int mcux_dcnano_lcdif_init(const struct device *dev)
228241

229242
LCDIF_DpiModeSetConfig(config->base, 0, &config->dpi_config);
230243

244+
#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1
245+
lcdif_panel_config_t panel_config;
246+
247+
LCDIF_PanelGetDefaultConfig(&panel_config);
248+
LCDIF_SetPanelConfig(config->base, 0, &panel_config);
249+
#endif
250+
231251
LCDIF_EnableInterrupts(config->base, kLCDIF_Display0FrameDoneInterrupt);
232252
config->irq_config_func(dev);
233253

@@ -256,7 +276,7 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = {
256276
.get_framebuffer = mcux_dcnano_lcdif_get_framebuffer,
257277
};
258278

259-
#define MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) \
279+
#define MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) \
260280
(DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(n, pixel_format)) / BITS_PER_BYTE)
261281
#define MCUX_DCNANO_LCDIF_FB_SIZE(n) DT_INST_PROP(n, width) * \
262282
DT_INST_PROP(n, height) * MCUX_DCNANO_LCDIF_PIXEL_BYTES(n)
@@ -278,6 +298,29 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = {
278298
#define MCUX_DCNANO_LCDIF_FRAMEBUFFER(n) mcux_dcnano_lcdif_frame_buffer_##n
279299
#endif
280300

301+
#if DT_ENUM_IDX_OR(DT_NODELABEL(lcdif), version, 0) == 1
302+
#define MCUX_DCNANO_LCDIF_FB_CONFIG(n) \
303+
.fb_config = { \
304+
.enable = true, \
305+
.inOrder = kLCDIF_PixelInputOrderARGB, \
306+
.rotateFlipMode = kLCDIF_Rotate0, \
307+
.alpha.enable = false, \
308+
.colorkey.enable = false, \
309+
.topLeftX = 0U, \
310+
.topLeftY = 0U, \
311+
.width = DT_INST_PROP(n, width), \
312+
.height = DT_INST_PROP(n, height), \
313+
.format = DT_INST_PROP(n, pixel_format), \
314+
},
315+
#else
316+
#define MCUX_DCNANO_LCDIF_FB_CONFIG(n) \
317+
.fb_config = { \
318+
.enable = true, \
319+
.enableGamma = false, \
320+
.format = DT_INST_PROP(n, pixel_format), \
321+
},
322+
#endif
323+
281324
#define MCUX_DCNANO_LCDIF_DEVICE_INIT(n) \
282325
static void mcux_dcnano_lcdif_config_func_##n(const struct device *dev) \
283326
{ \
@@ -290,11 +333,7 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = {
290333
} \
291334
MCUX_DCNANO_LCDIF_FRAMEBUFFER_DECL(n); \
292335
struct mcux_dcnano_lcdif_data mcux_dcnano_lcdif_data_##n = { \
293-
.fb_config = { \
294-
.enable = true, \
295-
.enableGamma = false, \
296-
.format = DT_INST_PROP(n, pixel_format), \
297-
}, \
336+
MCUX_DCNANO_LCDIF_FB_CONFIG(n) \
298337
.next_idx = 0, \
299338
.pixel_bytes = MCUX_DCNANO_LCDIF_PIXEL_BYTES(n), \
300339
}; \

dts/bindings/display/nxp,dcnano-lcdif.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 NXP
1+
# Copyright 2023,2024 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

44
description: NXP DCNano LCDIF (LCD Interface) controller
@@ -32,3 +32,11 @@ properties:
3232
- "24-bit" # 24 Bit
3333
description:
3434
LCD data bus width. The default is set to the reset value of 24-bit
35+
36+
version:
37+
type: string
38+
description:
39+
The version of the ip
40+
enum:
41+
- "DCnano"
42+
- "DC8000"

0 commit comments

Comments
 (0)