Lines Matching +full:reset +full:- +full:pulse +full:- +full:length

2  * Copyright (c) 2022 Byte-Lab d.o.o. <dev@byte-lab.com>
6 * SPDX-License-Identifier: Apache-2.0
20 #include <zephyr/drivers/reset.h>
28 /* Horizontal synchronization pulse polarity */
32 /* Vertical synchronization pulse polarity */
36 /* Data enable pulse polarity */
77 const struct reset_dt_spec reset; member
85 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_global_isr()
87 if (__HAL_LTDC_GET_FLAG(&data->hltdc, LTDC_FLAG_LI) && in stm32_ltdc_global_isr()
88 __HAL_LTDC_GET_IT_SOURCE(&data->hltdc, LTDC_IT_LI)) { in stm32_ltdc_global_isr()
89 if (data->front_buf != data->pend_buf) { in stm32_ltdc_global_isr()
90 data->front_buf = data->pend_buf; in stm32_ltdc_global_isr()
92 LTDC_LAYER(&data->hltdc, LTDC_LAYER_1)->CFBAR = (uint32_t)data->front_buf; in stm32_ltdc_global_isr()
93 __HAL_LTDC_RELOAD_CONFIG(&data->hltdc); in stm32_ltdc_global_isr()
95 k_sem_give(&data->sem); in stm32_ltdc_global_isr()
98 __HAL_LTDC_CLEAR_FLAG(&data->hltdc, LTDC_FLAG_LI); in stm32_ltdc_global_isr()
106 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_set_pixel_format()
110 err = HAL_LTDC_SetPixelFormat(&data->hltdc, LTDC_PIXEL_FORMAT_RGB565, 0); in stm32_ltdc_set_pixel_format()
111 data->current_pixel_format = PIXEL_FORMAT_RGB_565; in stm32_ltdc_set_pixel_format()
112 data->current_pixel_size = 2u; in stm32_ltdc_set_pixel_format()
115 err = HAL_LTDC_SetPixelFormat(&data->hltdc, LTDC_PIXEL_FORMAT_RGB888, 0); in stm32_ltdc_set_pixel_format()
116 data->current_pixel_format = PIXEL_FORMAT_RGB_888; in stm32_ltdc_set_pixel_format()
117 data->current_pixel_size = 3u; in stm32_ltdc_set_pixel_format()
120 err = HAL_LTDC_SetPixelFormat(&data->hltdc, LTDC_PIXEL_FORMAT_ARGB8888, 0); in stm32_ltdc_set_pixel_format()
121 data->current_pixel_format = PIXEL_FORMAT_ARGB_8888; in stm32_ltdc_set_pixel_format()
122 data->current_pixel_size = 4u; in stm32_ltdc_set_pixel_format()
124 err = -ENOTSUP; in stm32_ltdc_set_pixel_format()
140 return -ENOTSUP; in stm32_ltdc_set_orientation()
146 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_get_capabilities()
150 capabilities->x_resolution = data->hltdc.LayerCfg[0].WindowX1 - in stm32_ltdc_get_capabilities()
151 data->hltdc.LayerCfg[0].WindowX0; in stm32_ltdc_get_capabilities()
152 capabilities->y_resolution = data->hltdc.LayerCfg[0].WindowY1 - in stm32_ltdc_get_capabilities()
153 data->hltdc.LayerCfg[0].WindowY0; in stm32_ltdc_get_capabilities()
154 capabilities->supported_pixel_formats = PIXEL_FORMAT_ARGB_8888 | in stm32_ltdc_get_capabilities()
157 capabilities->screen_info = 0; in stm32_ltdc_get_capabilities()
159 capabilities->current_pixel_format = data->current_pixel_format; in stm32_ltdc_get_capabilities()
160 capabilities->current_orientation = DISPLAY_ORIENTATION_NORMAL; in stm32_ltdc_get_capabilities()
168 const struct display_stm32_ltdc_config *config = dev->config; in stm32_ltdc_write()
169 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_write()
176 (desc->width == config->width) && in stm32_ltdc_write()
177 (desc->height == config->height) && in stm32_ltdc_write()
178 (desc->pitch == desc->width)) { in stm32_ltdc_write()
179 /* Use buf as ltdc frame buffer directly if it length same as ltdc frame buffer. */ in stm32_ltdc_write()
184 return -ENOTSUP; in stm32_ltdc_write()
187 dst = data->frame_buffer; in stm32_ltdc_write()
190 if (data->front_buf == data->frame_buffer) { in stm32_ltdc_write()
191 dst = data->frame_buffer + data->frame_buffer_len; in stm32_ltdc_write()
194 memcpy(dst, data->front_buf, data->frame_buffer_len); in stm32_ltdc_write()
202 dst += (x * data->current_pixel_size); in stm32_ltdc_write()
203 dst += (y * config->width * data->current_pixel_size); in stm32_ltdc_write()
205 for (row = 0; row < desc->height; row++) { in stm32_ltdc_write()
206 (void) memcpy(dst, src, desc->width * data->current_pixel_size); in stm32_ltdc_write()
207 sys_cache_data_flush_range(dst, desc->width * data->current_pixel_size); in stm32_ltdc_write()
208 dst += (config->width * data->current_pixel_size); in stm32_ltdc_write()
209 src += (desc->pitch * data->current_pixel_size); in stm32_ltdc_write()
214 if (data->front_buf == pend_buf) { in stm32_ltdc_write()
218 k_sem_reset(&data->sem); in stm32_ltdc_write()
220 data->pend_buf = pend_buf; in stm32_ltdc_write()
222 k_sem_take(&data->sem, K_FOREVER); in stm32_ltdc_write()
232 const struct display_stm32_ltdc_config *config = dev->config; in stm32_ltdc_read()
233 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_read()
235 const uint8_t *src = data->front_buf; in stm32_ltdc_read()
239 src += (x * data->current_pixel_size); in stm32_ltdc_read()
240 src += (y * config->width * data->current_pixel_size); in stm32_ltdc_read()
242 for (row = 0; row < desc->height; row++) { in stm32_ltdc_read()
243 (void) memcpy(dst, src, desc->width * data->current_pixel_size); in stm32_ltdc_read()
244 sys_cache_data_flush_range(dst, desc->width * data->current_pixel_size); in stm32_ltdc_read()
245 src += (config->width * data->current_pixel_size); in stm32_ltdc_read()
246 dst += (desc->pitch * data->current_pixel_size); in stm32_ltdc_read()
254 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_get_framebuffer()
256 return ((void *)data->front_buf); in stm32_ltdc_get_framebuffer()
261 const struct display_stm32_ltdc_config *config = dev->config; in stm32_ltdc_display_blanking_off()
262 const struct device *display_dev = config->display_controller; in stm32_ltdc_display_blanking_off()
267 return -ENOSYS; in stm32_ltdc_display_blanking_off()
271 LOG_ERR("Display device %s not ready", display_dev->name); in stm32_ltdc_display_blanking_off()
272 return -ENODEV; in stm32_ltdc_display_blanking_off()
280 const struct display_stm32_ltdc_config *config = dev->config; in stm32_ltdc_display_blanking_on()
281 const struct device *display_dev = config->display_controller; in stm32_ltdc_display_blanking_on()
286 return -ENOSYS; in stm32_ltdc_display_blanking_on()
290 LOG_ERR("Display device %s not ready", display_dev->name); in stm32_ltdc_display_blanking_on()
291 return -ENODEV; in stm32_ltdc_display_blanking_on()
300 const struct display_stm32_ltdc_config *config = dev->config; in stm32_ltdc_init()
301 struct display_stm32_ltdc_data *data = dev->data; in stm32_ltdc_init()
304 if (config->disp_on_gpio.port) { in stm32_ltdc_init()
305 err = gpio_pin_configure_dt(&config->disp_on_gpio, GPIO_OUTPUT_ACTIVE); in stm32_ltdc_init()
313 if (config->bl_ctrl_gpio.port) { in stm32_ltdc_init()
314 err = gpio_pin_configure_dt(&config->bl_ctrl_gpio, GPIO_OUTPUT_ACTIVE); in stm32_ltdc_init()
323 err = pinctrl_apply_state(config->pctrl, PINCTRL_STATE_DEFAULT); in stm32_ltdc_init()
332 return -ENODEV; in stm32_ltdc_init()
337 (clock_control_subsys_t) &config->pclken); in stm32_ltdc_init()
369 /* reset LTDC peripheral */ in stm32_ltdc_init()
370 (void)reset_line_toggle_dt(&config->reset); in stm32_ltdc_init()
372 data->current_pixel_format = DISPLAY_INIT_PIXEL_FORMAT; in stm32_ltdc_init()
373 data->current_pixel_size = STM32_LTDC_INIT_PIXEL_SIZE; in stm32_ltdc_init()
375 k_sem_init(&data->sem, 0, 1); in stm32_ltdc_init()
377 config->irq_config_func(dev); in stm32_ltdc_init()
382 FMC_Bank1->BTCR[0] &= ~(0x0000000D); in stm32_ltdc_init()
384 FMC_Bank1_R->BTCR[0] &= ~(0x0000000D); in stm32_ltdc_init()
389 err = HAL_LTDC_Init(&data->hltdc); in stm32_ltdc_init()
396 err = HAL_LTDC_ConfigLayer(&data->hltdc, &data->hltdc.LayerCfg[0], LTDC_LAYER_1); in stm32_ltdc_init()
402 __HAL_LTDC_LAYER_DISABLE(&data->hltdc, LTDC_LAYER_2); in stm32_ltdc_init()
405 LTDC->LIPCR = 0U; in stm32_ltdc_init()
407 __HAL_LTDC_CLEAR_FLAG(&data->hltdc, LTDC_FLAG_LI); in stm32_ltdc_init()
408 __HAL_LTDC_ENABLE_IT(&data->hltdc, LTDC_IT_LI); in stm32_ltdc_init()
416 const struct display_stm32_ltdc_config *config = dev->config; in stm32_ltdc_suspend()
420 if (config->disp_on_gpio.port) { in stm32_ltdc_suspend()
421 err = gpio_pin_set_dt(&config->disp_on_gpio, 0); in stm32_ltdc_suspend()
428 if (config->bl_ctrl_gpio.port) { in stm32_ltdc_suspend()
429 err = gpio_pin_set_dt(&config->bl_ctrl_gpio, 0); in stm32_ltdc_suspend()
435 /* Reset LTDC peripheral registers */ in stm32_ltdc_suspend()
436 (void)reset_line_toggle_dt(&config->reset); in stm32_ltdc_suspend()
440 (clock_control_subsys_t) &config->pclken); in stm32_ltdc_suspend()
458 return -ENOTSUP; in stm32_ltdc_pm_action()
462 LOG_ERR("%s: failed to set power mode", dev->name); in stm32_ltdc_pm_action()
487 #error "LTDC ext-sdram property in device tree does not reference SDRAM1 or SDRAM2 node"
543 display_timings), hsync_len) - 1, \
545 display_timings), vsync_len) - 1, \
549 display_timings), hsync_len) - 1, \
553 display_timings), vsync_len) - 1, \
558 DT_INST_PROP(inst, width) - 1, \
563 DT_INST_PROP(inst, height) - 1, \
570 display_timings), hfront_porch) - 1, \
577 display_timings), vfront_porch) - 1, \
616 .reset = RESET_DT_SPEC_INST_GET(0), \