drivers: display: stm32_ltdc: fix for stm32f429i_disc1
Display is not working on STM32F429i-DISC1 board because display_blanking_off() needs to be sent to ILI9341 device, but it's sent to LTDC instead which does not implement it. This patch adds a LTDC DT property that provides the pHandle of the display's own controller so that display_blanking_off/on are forwarded to it when they are called by an application. Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
This commit is contained in:
parent
c4d05b5f9e
commit
32fd2f57b1
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Linaro Limited
|
||||
* Copyright (c) 2024 STMicroelectronics
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -234,6 +235,7 @@
|
|||
<dc_hsync_pc6 <dc_vsync_pa4>;
|
||||
pinctrl-names = "default";
|
||||
ext-sdram = <&sdram2>;
|
||||
display-controller = <&ili9341>;
|
||||
status = "okay";
|
||||
|
||||
width = <240>;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Byte-Lab d.o.o. <dev@byte-lab.com>
|
||||
* Copyright 2023 NXP
|
||||
* Copyright (c) 2024 STMicroelectronics
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -74,6 +75,7 @@ struct display_stm32_ltdc_config {
|
|||
struct stm32_pclken pclken;
|
||||
const struct pinctrl_dev_config *pctrl;
|
||||
void (*irq_config_func)(const struct device *dev);
|
||||
const struct device *display_controller;
|
||||
};
|
||||
|
||||
static void stm32_ltdc_global_isr(const struct device *dev)
|
||||
|
@ -245,6 +247,40 @@ static int stm32_ltdc_read(const struct device *dev, const uint16_t x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int stm32_ltdc_display_blanking_off(const struct device *dev)
|
||||
{
|
||||
const struct display_stm32_ltdc_config *config = dev->config;
|
||||
const struct device *display_dev = config->display_controller;
|
||||
|
||||
if (display_dev == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!device_is_ready(display_dev)) {
|
||||
LOG_ERR("Display device %s not ready", display_dev->name);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return display_blanking_off(display_dev);
|
||||
}
|
||||
|
||||
static int stm32_ltdc_display_blanking_on(const struct device *dev)
|
||||
{
|
||||
const struct display_stm32_ltdc_config *config = dev->config;
|
||||
const struct device *display_dev = config->display_controller;
|
||||
|
||||
if (display_dev == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!device_is_ready(config->display_controller)) {
|
||||
LOG_ERR("Display device %s not ready", display_dev->name);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return display_blanking_on(display_dev);
|
||||
}
|
||||
|
||||
static int stm32_ltdc_init(const struct device *dev)
|
||||
{
|
||||
int err;
|
||||
|
@ -424,7 +460,9 @@ static const struct display_driver_api stm32_ltdc_display_api = {
|
|||
.read = stm32_ltdc_read,
|
||||
.get_capabilities = stm32_ltdc_get_capabilities,
|
||||
.set_pixel_format = stm32_ltdc_set_pixel_format,
|
||||
.set_orientation = stm32_ltdc_set_orientation
|
||||
.set_orientation = stm32_ltdc_set_orientation,
|
||||
.blanking_off = stm32_ltdc_display_blanking_off,
|
||||
.blanking_on = stm32_ltdc_display_blanking_on,
|
||||
};
|
||||
|
||||
#if DT_INST_NODE_HAS_PROP(0, ext_sdram)
|
||||
|
@ -569,6 +607,8 @@ static const struct display_driver_api stm32_ltdc_display_api = {
|
|||
}, \
|
||||
.pctrl = STM32_LTDC_DEVICE_PINCTRL_GET(inst), \
|
||||
.irq_config_func = stm32_ltdc_irq_config_func_##inst, \
|
||||
.display_controller = DEVICE_DT_GET_OR_NULL( \
|
||||
DT_INST_PHANDLE(inst, display_controller)), \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(inst, \
|
||||
&stm32_ltdc_init, \
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright (c) 2022, Byte-Lab d.o.o. <dev@byte-lab.com>
|
||||
# Copyright (c) 2024 STMicroelectronics
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: STM32 LCD-TFT display controller
|
||||
|
@ -64,3 +65,9 @@ properties:
|
|||
window0-y1:
|
||||
type: int
|
||||
description: Last pixel in y direction on layer 0. Defaults to height.
|
||||
|
||||
display-controller:
|
||||
type: phandle
|
||||
description: |
|
||||
Phandle of the display's controller. When provided, it's used to forward some of the
|
||||
configuration calls (e.g. blanking on/off) sent to LTDC device.
|
||||
|
|
Loading…
Reference in a new issue