Skip to content

Commit fe82353

Browse files
djiatsaf-stnashif
authored andcommitted
drivers: display: use zephyr reset api for diyplay
Replace direct HAL api by zephyr reset api framework for display peripheral block reset. Signed-off-by: Fabrice DJIATSA <[email protected]>
1 parent 07cdeba commit fe82353

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/display/display_stm32_ltdc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <zephyr/drivers/pinctrl.h>
1818
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
1919
#include <zephyr/drivers/clock_control.h>
20+
#include <zephyr/drivers/reset.h>
2021
#include <zephyr/pm/device.h>
2122
#include <zephyr/sys/barrier.h>
2223
#include <zephyr/cache.h>
@@ -73,6 +74,7 @@ struct display_stm32_ltdc_config {
7374
struct gpio_dt_spec disp_on_gpio;
7475
struct gpio_dt_spec bl_ctrl_gpio;
7576
struct stm32_pclken pclken;
77+
const struct reset_dt_spec reset;
7678
const struct pinctrl_dev_config *pctrl;
7779
void (*irq_config_func)(const struct device *dev);
7880
const struct device *display_controller;
@@ -354,8 +356,7 @@ static int stm32_ltdc_init(const struct device *dev)
354356
#endif
355357

356358
/* reset LTDC peripheral */
357-
__HAL_RCC_LTDC_FORCE_RESET();
358-
__HAL_RCC_LTDC_RELEASE_RESET();
359+
(void)reset_line_toggle_dt(&config->reset);
359360

360361
data->current_pixel_format = DISPLAY_INIT_PIXEL_FORMAT;
361362
data->current_pixel_size = STM32_LTDC_INIT_PIXEL_SIZE;
@@ -421,8 +422,7 @@ static int stm32_ltdc_suspend(const struct device *dev)
421422
}
422423

423424
/* Reset LTDC peripheral registers */
424-
__HAL_RCC_LTDC_FORCE_RESET();
425-
__HAL_RCC_LTDC_RELEASE_RESET();
425+
(void)reset_line_toggle_dt(&config->reset);
426426

427427
/* Turn off LTDC peripheral clock */
428428
err = clock_control_off(DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE),
@@ -601,6 +601,7 @@ static const struct display_driver_api stm32_ltdc_display_api = {
601601
(GPIO_DT_SPEC_INST_GET(inst, disp_on_gpios)), ({ 0 })), \
602602
.bl_ctrl_gpio = COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, bl_ctrl_gpios), \
603603
(GPIO_DT_SPEC_INST_GET(inst, bl_ctrl_gpios)), ({ 0 })), \
604+
.reset = RESET_DT_SPEC_INST_GET(0), \
604605
.pclken = { \
605606
.enr = DT_INST_CLOCKS_CELL(inst, bits), \
606607
.bus = DT_INST_CLOCKS_CELL(inst, bus) \

0 commit comments

Comments
 (0)