drivers: display: elcdif: remove backlight enable pin dependency
The driver no longer requires a backlight enable GPIO pin to be defined, which allows compatibility with displays that do not provide such a pin. Signed-off-by: Isaev Denis <anelderlyfox@yahoo.com>
This commit is contained in:
parent
a250e91396
commit
d34ed32846
2 changed files with 21 additions and 8 deletions
|
@ -224,17 +224,27 @@ 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)
|
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;
|
const struct mcux_elcdif_config *config = dev->config;
|
||||||
|
if (config->backlight_gpio.port) {
|
||||||
return gpio_pin_set_dt(&config->backlight_gpio, 1);
|
return gpio_pin_set_dt(&config->backlight_gpio, 1);
|
||||||
}
|
}
|
||||||
|
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio) */
|
||||||
|
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
static int mcux_elcdif_display_blanking_on(const struct device *dev)
|
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;
|
const struct mcux_elcdif_config *config = dev->config;
|
||||||
|
if (config->backlight_gpio.port) {
|
||||||
return gpio_pin_set_dt(&config->backlight_gpio, 0);
|
return gpio_pin_set_dt(&config->backlight_gpio, 0);
|
||||||
}
|
}
|
||||||
|
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpio) */
|
||||||
|
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
static int mcux_elcdif_set_pixel_format(const struct device *dev,
|
static int mcux_elcdif_set_pixel_format(const struct device *dev,
|
||||||
const enum display_pixel_format pixel_format)
|
const enum display_pixel_format pixel_format)
|
||||||
|
@ -328,10 +338,14 @@ static int mcux_elcdif_init(const struct device *dev)
|
||||||
return 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);
|
err = gpio_pin_configure_dt(&config->backlight_gpio, GPIO_OUTPUT_ACTIVE);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) */
|
||||||
|
|
||||||
k_sem_init(&dev_data->sem, 0, 1);
|
k_sem_init(&dev_data->sem, 0, 1);
|
||||||
#ifdef CONFIG_MCUX_ELCDIF_PXP
|
#ifdef CONFIG_MCUX_ELCDIF_PXP
|
||||||
|
@ -398,7 +412,7 @@ static DEVICE_API(display, mcux_elcdif_api) = {
|
||||||
DT_INST_ENUM_IDX(id, data_bus_width)), \
|
DT_INST_ENUM_IDX(id, data_bus_width)), \
|
||||||
}, \
|
}, \
|
||||||
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id), \
|
.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, \
|
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 = { \
|
static struct mcux_elcdif_data mcux_elcdif_data_##id = { \
|
||||||
|
|
|
@ -27,7 +27,6 @@ properties:
|
||||||
|
|
||||||
backlight-gpios:
|
backlight-gpios:
|
||||||
type: phandle-array
|
type: phandle-array
|
||||||
required: true
|
|
||||||
description:
|
description:
|
||||||
LCB backlight control gpio. Driver will initialize this GPIO to active high
|
LCB backlight control gpio. Driver will initialize this GPIO to active high
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue