1
1
/*
2
- * Copyright 2023 NXP
2
+ * Copyright 2023,2024 NXP
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
@@ -110,6 +110,11 @@ static int mcux_dcnano_lcdif_write(const struct device *dev, const uint16_t x,
110
110
(uint32_t )data -> active_fb );
111
111
LCDIF_SetFrameBufferConfig (config -> base , 0 , & data -> fb_config );
112
112
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
+
113
118
#if CONFIG_MCUX_DCNANO_LCDIF_FB_NUM != 0
114
119
/* Update index of active framebuffer */
115
120
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,
139
144
*/
140
145
capabilities -> current_pixel_format = PIXEL_FORMAT_BGR_565 ;
141
146
break ;
147
+ #if DT_ENUM_IDX_OR (DT_NODELABEL (lcdif ), version , 0 ) == 1
148
+ case kLCDIF_PixelFormatARGB8888 :
149
+ #else
142
150
case kLCDIF_PixelFormatXRGB8888 :
151
+ #endif
143
152
capabilities -> current_pixel_format = PIXEL_FORMAT_ARGB_8888 ;
144
153
break ;
145
154
default :
@@ -185,7 +194,11 @@ static int mcux_dcnano_lcdif_set_pixel_format(const struct device *dev,
185
194
data -> pixel_bytes = 2 ;
186
195
break ;
187
196
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
188
200
data -> fb_config .format = kLCDIF_PixelFormatXRGB8888 ;
201
+ #endif
189
202
data -> pixel_bytes = 4 ;
190
203
break ;
191
204
default :
@@ -228,6 +241,13 @@ static int mcux_dcnano_lcdif_init(const struct device *dev)
228
241
229
242
LCDIF_DpiModeSetConfig (config -> base , 0 , & config -> dpi_config );
230
243
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
+
231
251
LCDIF_EnableInterrupts (config -> base , kLCDIF_Display0FrameDoneInterrupt );
232
252
config -> irq_config_func (dev );
233
253
@@ -256,7 +276,7 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = {
256
276
.get_framebuffer = mcux_dcnano_lcdif_get_framebuffer ,
257
277
};
258
278
259
- #define MCUX_DCNANO_LCDIF_PIXEL_BYTES (n ) \
279
+ #define MCUX_DCNANO_LCDIF_PIXEL_BYTES (n ) \
260
280
(DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(n, pixel_format)) / BITS_PER_BYTE)
261
281
#define MCUX_DCNANO_LCDIF_FB_SIZE (n ) DT_INST_PROP(n, width) * \
262
282
DT_INST_PROP(n, height) * MCUX_DCNANO_LCDIF_PIXEL_BYTES(n)
@@ -278,6 +298,29 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = {
278
298
#define MCUX_DCNANO_LCDIF_FRAMEBUFFER (n ) mcux_dcnano_lcdif_frame_buffer_##n
279
299
#endif
280
300
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
+
281
324
#define MCUX_DCNANO_LCDIF_DEVICE_INIT (n ) \
282
325
static void mcux_dcnano_lcdif_config_func_##n(const struct device *dev) \
283
326
{ \
@@ -290,11 +333,7 @@ static DEVICE_API(display, mcux_dcnano_lcdif_api) = {
290
333
} \
291
334
MCUX_DCNANO_LCDIF_FRAMEBUFFER_DECL(n); \
292
335
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) \
298
337
.next_idx = 0, \
299
338
.pixel_bytes = MCUX_DCNANO_LCDIF_PIXEL_BYTES(n), \
300
339
}; \
0 commit comments