|
17 | 17 | #include <zephyr/drivers/pinctrl.h> |
18 | 18 | #include <zephyr/drivers/clock_control/stm32_clock_control.h> |
19 | 19 | #include <zephyr/drivers/clock_control.h> |
| 20 | +#include <zephyr/drivers/reset.h> |
20 | 21 | #include <zephyr/pm/device.h> |
21 | 22 | #include <zephyr/sys/barrier.h> |
22 | 23 | #include <zephyr/cache.h> |
@@ -73,6 +74,7 @@ struct display_stm32_ltdc_config { |
73 | 74 | struct gpio_dt_spec disp_on_gpio; |
74 | 75 | struct gpio_dt_spec bl_ctrl_gpio; |
75 | 76 | struct stm32_pclken pclken; |
| 77 | + const struct reset_dt_spec reset; |
76 | 78 | const struct pinctrl_dev_config *pctrl; |
77 | 79 | void (*irq_config_func)(const struct device *dev); |
78 | 80 | const struct device *display_controller; |
@@ -354,8 +356,7 @@ static int stm32_ltdc_init(const struct device *dev) |
354 | 356 | #endif |
355 | 357 |
|
356 | 358 | /* reset LTDC peripheral */ |
357 | | - __HAL_RCC_LTDC_FORCE_RESET(); |
358 | | - __HAL_RCC_LTDC_RELEASE_RESET(); |
| 359 | + (void)reset_line_toggle_dt(&config->reset); |
359 | 360 |
|
360 | 361 | data->current_pixel_format = DISPLAY_INIT_PIXEL_FORMAT; |
361 | 362 | data->current_pixel_size = STM32_LTDC_INIT_PIXEL_SIZE; |
@@ -421,8 +422,7 @@ static int stm32_ltdc_suspend(const struct device *dev) |
421 | 422 | } |
422 | 423 |
|
423 | 424 | /* Reset LTDC peripheral registers */ |
424 | | - __HAL_RCC_LTDC_FORCE_RESET(); |
425 | | - __HAL_RCC_LTDC_RELEASE_RESET(); |
| 425 | + (void)reset_line_toggle_dt(&config->reset); |
426 | 426 |
|
427 | 427 | /* Turn off LTDC peripheral clock */ |
428 | 428 | 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 = { |
601 | 601 | (GPIO_DT_SPEC_INST_GET(inst, disp_on_gpios)), ({ 0 })), \ |
602 | 602 | .bl_ctrl_gpio = COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, bl_ctrl_gpios), \ |
603 | 603 | (GPIO_DT_SPEC_INST_GET(inst, bl_ctrl_gpios)), ({ 0 })), \ |
| 604 | + .reset = RESET_DT_SPEC_INST_GET(0), \ |
604 | 605 | .pclken = { \ |
605 | 606 | .enr = DT_INST_CLOCKS_CELL(inst, bits), \ |
606 | 607 | .bus = DT_INST_CLOCKS_CELL(inst, bus) \ |
|
0 commit comments