Skip to content

drivers: display: elcdif: remove backlight enable pin dependency #88367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions drivers/display/display_mcux_elcdif.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,26 @@ static int mcux_elcdif_write(const struct device *dev, const uint16_t x, const u

static int mcux_elcdif_display_blanking_off(const struct device *dev)
{
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio)
const struct mcux_elcdif_config *config = dev->config;
if (config->backlight_gpio.port) {
return gpio_pin_set_dt(&config->backlight_gpio, 1);
}
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio) */

return gpio_pin_set_dt(&config->backlight_gpio, 1);
return -ENOSYS;
}

static int mcux_elcdif_display_blanking_on(const struct device *dev)
{
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio)
const struct mcux_elcdif_config *config = dev->config;
if (config->backlight_gpio.port) {
return gpio_pin_set_dt(&config->backlight_gpio, 0);
}
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio) */

return gpio_pin_set_dt(&config->backlight_gpio, 0);
return -ENOSYS;
}

static int mcux_elcdif_set_pixel_format(const struct device *dev,
Expand Down Expand Up @@ -327,10 +337,14 @@ static int mcux_elcdif_init(const struct device *dev)
return err;
}

err = gpio_pin_configure_dt(&config->backlight_gpio, GPIO_OUTPUT_ACTIVE);
if (err) {
return err;
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio)
if (config->backlight_gpio.port) {
err = gpio_pin_configure_dt(&config->backlight_gpio, GPIO_OUTPUT_ACTIVE);
if (err) {
return err;
}
}
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) */

k_sem_init(&dev_data->sem, 0, 1);
#ifdef CONFIG_MCUX_ELCDIF_PXP
Expand Down Expand Up @@ -397,9 +411,9 @@ static DEVICE_API(display, mcux_elcdif_api) = {
DT_INST_ENUM_IDX(id, data_bus_width)), \
}, \
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id), \
.backlight_gpio = GPIO_DT_SPEC_INST_GET(id, backlight_gpios), \
.backlight_gpio = GPIO_DT_SPEC_INST_GET_OR(id, backlight_gpios, {0}), \
IF_ENABLED(CONFIG_MCUX_ELCDIF_PXP, \
(.pxp = DEVICE_DT_GET(DT_INST_PHANDLE(id, nxp_pxp)),))}; \
(.pxp = DEVICE_DT_GET(DT_INST_PHANDLE(id, nxp_pxp)),))}; \
static struct mcux_elcdif_data mcux_elcdif_data_##id = { \
.next_idx = 0, \
.pixel_format = DT_INST_PROP(id, pixel_format), \
Expand Down
1 change: 0 additions & 1 deletion dts/bindings/display/nxp,imx-elcdif.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ properties:

backlight-gpios:
type: phandle-array
required: true
description:
LCB backlight control gpio. Driver will initialize this GPIO to active high

Expand Down