@@ -224,16 +224,26 @@ static int mcux_elcdif_write(const struct device *dev, const uint16_t x, const u
224
224
225
225
static int mcux_elcdif_display_blanking_off (const struct device * dev )
226
226
{
227
+ #if DT_ANY_INST_HAS_PROP_STATUS_OKAY (backlight_gpio )
227
228
const struct mcux_elcdif_config * config = dev -> config ;
229
+ if (config -> backlight_gpio .port ) {
230
+ return gpio_pin_set_dt (& config -> backlight_gpio , 1 );
231
+ }
232
+ #endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio) */
228
233
229
- return gpio_pin_set_dt ( & config -> backlight_gpio , 1 ) ;
234
+ return - ENOSYS ;
230
235
}
231
236
232
237
static int mcux_elcdif_display_blanking_on (const struct device * dev )
233
238
{
239
+ #if DT_ANY_INST_HAS_PROP_STATUS_OKAY (backlight_gpio )
234
240
const struct mcux_elcdif_config * config = dev -> config ;
241
+ if (config -> backlight_gpio .port ) {
242
+ return gpio_pin_set_dt (& config -> backlight_gpio , 0 );
243
+ }
244
+ #endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio) */
235
245
236
- return gpio_pin_set_dt ( & config -> backlight_gpio , 0 ) ;
246
+ return - ENOSYS ;
237
247
}
238
248
239
249
static int mcux_elcdif_set_pixel_format (const struct device * dev ,
@@ -328,10 +338,14 @@ static int mcux_elcdif_init(const struct device *dev)
328
338
return err ;
329
339
}
330
340
331
- err = gpio_pin_configure_dt (& config -> backlight_gpio , GPIO_OUTPUT_ACTIVE );
332
- if (err ) {
333
- return err ;
341
+ #if DT_ANY_INST_HAS_PROP_STATUS_OKAY (backlight_gpio )
342
+ if (config -> backlight_gpio .port ) {
343
+ err = gpio_pin_configure_dt (& config -> backlight_gpio , GPIO_OUTPUT_ACTIVE );
344
+ if (err ) {
345
+ return err ;
346
+ }
334
347
}
348
+ #endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) */
335
349
336
350
k_sem_init (& dev_data -> sem , 0 , 1 );
337
351
#ifdef CONFIG_MCUX_ELCDIF_PXP
@@ -398,9 +412,9 @@ static DEVICE_API(display, mcux_elcdif_api) = {
398
412
DT_INST_ENUM_IDX(id, data_bus_width)), \
399
413
}, \
400
414
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id), \
401
- .backlight_gpio = GPIO_DT_SPEC_INST_GET (id, backlight_gpios), \
415
+ .backlight_gpio = GPIO_DT_SPEC_INST_GET_OR (id, backlight_gpios, {0}), \
402
416
IF_ENABLED(CONFIG_MCUX_ELCDIF_PXP, \
403
- (.pxp = DEVICE_DT_GET(DT_INST_PHANDLE(id, nxp_pxp)),))}; \
417
+ (.pxp = DEVICE_DT_GET(DT_INST_PHANDLE(id, nxp_pxp)),))}; \
404
418
static struct mcux_elcdif_data mcux_elcdif_data_##id = { \
405
419
.next_idx = 0, \
406
420
.pixel_format = DT_INST_PROP(id, pixel_format), \
0 commit comments