Lines Matching +full:active +full:- +full:range +full:- +full:x +full:- +full:min

3  * Copyright (c) 2018-2020 PHYTEC Messtechnik GmbH
6 * SPDX-License-Identifier: Apache-2.0
48 /* Width (bits) of integer type representing an x coordinate */
115 const struct ssd16xx_config *config = dev->config; in ssd16xx_busy_wait()
116 int pin = gpio_pin_get_dt(&config->busy_gpio); in ssd16xx_busy_wait()
121 pin = gpio_pin_get_dt(&config->busy_gpio); in ssd16xx_busy_wait()
128 const struct ssd16xx_config *config = dev->config; in ssd16xx_write_cmd()
133 err = mipi_dbi_command_write(config->mipi_dev, &config->dbi_config, in ssd16xx_write_cmd()
135 mipi_dbi_release(config->mipi_dev, &config->dbi_config); in ssd16xx_write_cmd()
148 const struct ssd16xx_config *config = dev->config; in ssd16xx_read_cmd()
149 const struct ssd16xx_data *dev_data = dev->data; in ssd16xx_read_cmd()
151 if (!dev_data->read_supported) { in ssd16xx_read_cmd()
152 return -ENOTSUP; in ssd16xx_read_cmd()
157 return mipi_dbi_command_read(config->mipi_dev, &config->dbi_config, in ssd16xx_read_cmd()
162 uint8_t *data, uint16_t x) in push_x_param() argument
164 const struct ssd16xx_config *config = dev->config; in push_x_param()
166 if (config->quirks->pp_width_bits == 8) { in push_x_param()
167 data[0] = (uint8_t)x; in push_x_param()
171 if (config->quirks->pp_width_bits == 16) { in push_x_param()
172 sys_put_le16(sys_cpu_to_le16(x), data); in push_x_param()
177 config->quirks->pp_width_bits); in push_x_param()
184 const struct ssd16xx_config *config = dev->config; in push_y_param()
186 if (config->quirks->pp_height_bits == 8) { in push_y_param()
191 if (config->quirks->pp_height_bits == 16) { in push_y_param()
197 config->quirks->pp_height_bits); in push_y_param()
228 static inline int ssd16xx_set_ram_ptr(const struct device *dev, uint16_t x, in ssd16xx_set_ram_ptr() argument
235 len = push_x_param(dev, tmp, x); in ssd16xx_set_ram_ptr()
259 const struct ssd16xx_config *config = dev->config; in ssd16xx_update_display()
260 const struct ssd16xx_data *data = dev->data; in ssd16xx_update_display()
261 const struct ssd16xx_profile *p = config->profiles[data->profile]; in ssd16xx_update_display()
262 const struct ssd16xx_quirks *quirks = config->quirks; in ssd16xx_update_display()
263 const bool load_lut = !p || p->lut.len == 0; in ssd16xx_update_display()
264 const bool load_temp = load_lut && config->tssv; in ssd16xx_update_display()
265 const bool partial = data->profile == SSD16XX_PROFILE_PARTIAL; in ssd16xx_update_display()
271 (partial ? quirks->ctrl2_partial : quirks->ctrl2_full) | in ssd16xx_update_display()
280 struct ssd16xx_data *data = dev->data; in ssd16xx_blanking_off()
282 if (data->blanking_on) { in ssd16xx_blanking_off()
283 data->blanking_on = false; in ssd16xx_blanking_off()
292 struct ssd16xx_data *data = dev->data; in ssd16xx_blanking_on()
294 if (!data->blanking_on) { in ssd16xx_blanking_on()
296 return -EIO; in ssd16xx_blanking_on()
300 data->blanking_on = true; in ssd16xx_blanking_on()
306 const uint16_t x, const uint16_t y, in ssd16xx_set_window() argument
309 const struct ssd16xx_config *config = dev->config; in ssd16xx_set_window()
310 const struct ssd16xx_data *data = dev->data; in ssd16xx_set_window()
316 uint16_t panel_h = config->height - in ssd16xx_set_window()
317 config->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE; in ssd16xx_set_window()
319 if (desc->pitch < desc->width) { in ssd16xx_set_window()
321 return -EINVAL; in ssd16xx_set_window()
324 if (desc->pitch > desc->width) { in ssd16xx_set_window()
326 return -ENOTSUP; in ssd16xx_set_window()
329 if (data->orientation == DISPLAY_ORIENTATION_NORMAL || in ssd16xx_set_window()
330 data->orientation == DISPLAY_ORIENTATION_ROTATED_180) { in ssd16xx_set_window()
331 if ((y + desc->height) > panel_h) { in ssd16xx_set_window()
333 return -EINVAL; in ssd16xx_set_window()
336 if ((x + desc->width) > config->width) { in ssd16xx_set_window()
338 return -EINVAL; in ssd16xx_set_window()
341 if ((desc->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE) != 0U) { in ssd16xx_set_window()
343 return -EINVAL; in ssd16xx_set_window()
348 return -EINVAL; in ssd16xx_set_window()
351 if ((y + desc->height) > config->width) { in ssd16xx_set_window()
353 return -EINVAL; in ssd16xx_set_window()
356 if ((x + desc->width) > panel_h) { in ssd16xx_set_window()
358 return -EINVAL; in ssd16xx_set_window()
361 if ((desc->width % SSD16XX_PIXELS_PER_BYTE) != 0U) { in ssd16xx_set_window()
363 return -EINVAL; in ssd16xx_set_window()
366 if ((x % SSD16XX_PIXELS_PER_BYTE) != 0U) { in ssd16xx_set_window()
367 LOG_ERR("X coordinate not multiple of %d", SSD16XX_PIXELS_PER_BYTE); in ssd16xx_set_window()
368 return -EINVAL; in ssd16xx_set_window()
372 switch (data->orientation) { in ssd16xx_set_window()
374 x_start = (panel_h - 1 - y) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
375 x_end = (panel_h - 1 - (y + desc->height - 1)) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
376 y_start = x; in ssd16xx_set_window()
377 y_end = (x + desc->width - 1); in ssd16xx_set_window()
380 x_start = (panel_h - 1 - x) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
381 x_end = (panel_h - 1 - (x + desc->width - 1)) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
382 y_start = (config->width - 1 - y); in ssd16xx_set_window()
383 y_end = (config->width - 1 - (y + desc->height - 1)); in ssd16xx_set_window()
387 x_end = (y + desc->height - 1) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
388 y_start = (x + desc->width - 1); in ssd16xx_set_window()
389 y_end = x; in ssd16xx_set_window()
392 x_start = x / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
393 x_end = (x + desc->width - 1) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
395 y_end = (y + desc->height - 1); in ssd16xx_set_window()
398 return -EINVAL; in ssd16xx_set_window()
414 static int ssd16xx_write(const struct device *dev, const uint16_t x, in ssd16xx_write() argument
419 const struct ssd16xx_config *config = dev->config; in ssd16xx_write()
420 const struct ssd16xx_data *data = dev->data; in ssd16xx_write()
422 config->profiles[SSD16XX_PROFILE_PARTIAL] != NULL; in ssd16xx_write()
423 const bool partial_refresh = !data->blanking_on && have_partial_refresh; in ssd16xx_write()
424 const size_t buf_len = MIN(desc->buf_size, in ssd16xx_write()
425 desc->height * desc->width / 8); in ssd16xx_write()
430 return -EINVAL; in ssd16xx_write()
436 * a no-op if the profile is already active. in ssd16xx_write()
440 return -EIO; in ssd16xx_write()
444 err = ssd16xx_set_window(dev, x, y, desc); in ssd16xx_write()
455 if (!data->blanking_on) { in ssd16xx_write()
462 if (data->blanking_on && have_partial_refresh) { in ssd16xx_write()
482 * updates work on an up-to-date framebuffer. in ssd16xx_write()
495 const uint16_t x, const uint16_t y, in ssd16xx_read_ram() argument
499 const struct ssd16xx_data *data = dev->data; in ssd16xx_read_ram()
500 const size_t buf_len = MIN(desc->buf_size, in ssd16xx_read_ram()
501 desc->height * desc->width / 8); in ssd16xx_read_ram()
505 if (!data->read_supported) { in ssd16xx_read_ram()
506 return -ENOTSUP; in ssd16xx_read_ram()
519 return -EINVAL; in ssd16xx_read_ram()
524 return -EINVAL; in ssd16xx_read_ram()
527 err = ssd16xx_set_window(dev, x, y, desc); in ssd16xx_read_ram()
548 const uint16_t x, const uint16_t y, in ssd16xx_read() argument
552 return ssd16xx_read_ram(dev, SSD16XX_RAM_BLACK, x, y, desc, buf); in ssd16xx_read()
558 const struct ssd16xx_config *config = dev->config; in ssd16xx_get_capabilities()
559 struct ssd16xx_data *data = dev->data; in ssd16xx_get_capabilities()
562 caps->x_resolution = config->width; in ssd16xx_get_capabilities()
563 caps->y_resolution = config->height - in ssd16xx_get_capabilities()
564 config->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE; in ssd16xx_get_capabilities()
565 caps->supported_pixel_formats = PIXEL_FORMAT_MONO10; in ssd16xx_get_capabilities()
566 caps->current_pixel_format = PIXEL_FORMAT_MONO10; in ssd16xx_get_capabilities()
567 caps->screen_info = SCREEN_INFO_MONO_MSB_FIRST | SCREEN_INFO_EPD; in ssd16xx_get_capabilities()
569 if (data->orientation == DISPLAY_ORIENTATION_NORMAL || in ssd16xx_get_capabilities()
570 data->orientation == DISPLAY_ORIENTATION_ROTATED_180) { in ssd16xx_get_capabilities()
571 caps->screen_info |= SCREEN_INFO_MONO_VTILED; in ssd16xx_get_capabilities()
574 caps->current_orientation = data->orientation; in ssd16xx_get_capabilities()
585 return -ENOTSUP; in ssd16xx_set_pixel_format()
591 struct ssd16xx_data *data = dev->data; in ssd16xx_set_orientation()
595 data->scan_mode = SSD16XX_DATA_ENTRY_XDYIY; in ssd16xx_set_orientation()
597 data->scan_mode = SSD16XX_DATA_ENTRY_XDYDX; in ssd16xx_set_orientation()
599 data->scan_mode = SSD16XX_DATA_ENTRY_XIYDY; in ssd16xx_set_orientation()
601 data->scan_mode = SSD16XX_DATA_ENTRY_XIYIX; in ssd16xx_set_orientation()
604 err = ssd16xx_write_uint8(dev, SSD16XX_CMD_ENTRY_MODE, data->scan_mode); in ssd16xx_set_orientation()
609 data->orientation = orientation; in ssd16xx_set_orientation()
616 const struct ssd16xx_config *config = dev->config; in ssd16xx_clear_cntlr_mem()
617 uint16_t panel_h = config->height / EPD_PANEL_NUMOF_ROWS_PER_PAGE; in ssd16xx_clear_cntlr_mem()
618 uint16_t last_gate = config->width - 1; in ssd16xx_clear_cntlr_mem()
626 if (config->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE) { in ssd16xx_clear_cntlr_mem()
637 panel_h - 1, last_gate, in ssd16xx_clear_cntlr_mem()
650 size_t x = config->width; in ssd16xx_clear_cntlr_mem() local
652 while (x) { in ssd16xx_clear_cntlr_mem()
653 size_t l = MIN(x, sizeof(clear_page)); in ssd16xx_clear_cntlr_mem()
655 x -= l; in ssd16xx_clear_cntlr_mem()
668 const struct ssd16xx_config *config = dev->config; in ssd16xx_load_ws_from_otp_tssv()
676 config->tssv); in ssd16xx_load_ws_from_otp_tssv()
711 const struct ssd16xx_config *config = dev->config; in ssd16xx_load_lut()
713 if (lut && lut->len) { in ssd16xx_load_lut()
714 LOG_DBG("Using user-provided LUT"); in ssd16xx_load_lut()
716 lut->data, lut->len); in ssd16xx_load_lut()
718 if (config->tssv) { in ssd16xx_load_lut()
729 const struct ssd16xx_config *config = dev->config; in ssd16xx_set_profile()
730 struct ssd16xx_data *data = dev->data; in ssd16xx_set_profile()
732 const uint16_t last_gate = config->width - 1; in ssd16xx_set_profile()
738 return -EINVAL; in ssd16xx_set_profile()
741 p = config->profiles[type]; in ssd16xx_set_profile()
748 return -ENOENT; in ssd16xx_set_profile()
751 if (type == data->profile) { in ssd16xx_set_profile()
771 if (config->softstart.len) { in ssd16xx_set_profile()
773 config->softstart.data, in ssd16xx_set_profile()
774 config->softstart.len); in ssd16xx_set_profile()
780 err = ssd16xx_load_lut(dev, p ? &p->lut : NULL); in ssd16xx_set_profile()
785 if (p && p->override_dummy_line) { in ssd16xx_set_profile()
787 p->dummy_line); in ssd16xx_set_profile()
793 if (p && p->override_gate_line_width) { in ssd16xx_set_profile()
795 p->override_gate_line_width); in ssd16xx_set_profile()
801 if (p && p->gdv.len) { in ssd16xx_set_profile()
804 p->gdv.data, p->gdv.len); in ssd16xx_set_profile()
810 if (p && p->sdv.len) { in ssd16xx_set_profile()
813 p->sdv.data, p->sdv.len); in ssd16xx_set_profile()
819 if (p && p->override_vcom) { in ssd16xx_set_profile()
822 &p->vcom, 1); in ssd16xx_set_profile()
828 if (p && p->override_bwf) { in ssd16xx_set_profile()
831 &p->bwf, 1); in ssd16xx_set_profile()
837 err = ssd16xx_write_uint8(dev, SSD16XX_CMD_ENTRY_MODE, data->scan_mode); in ssd16xx_set_profile()
842 data->profile = type; in ssd16xx_set_profile()
849 const struct ssd16xx_config *config = dev->config; in ssd16xx_controller_init()
850 struct ssd16xx_data *data = dev->data; in ssd16xx_controller_init()
856 data->blanking_on = false; in ssd16xx_controller_init()
857 data->profile = SSD16XX_PROFILE_INVALID; in ssd16xx_controller_init()
859 err = mipi_dbi_reset(config->mipi_dev, SSD16XX_RESET_DELAY); in ssd16xx_controller_init()
881 if (config->rotation == 0U) { in ssd16xx_controller_init()
883 } else if (config->rotation == 90U) { in ssd16xx_controller_init()
885 } else if (config->rotation == 180U) { in ssd16xx_controller_init()
906 const struct ssd16xx_config *config = dev->config; in ssd16xx_init()
907 struct ssd16xx_data *data = dev->data; in ssd16xx_init()
912 if (!device_is_ready(config->mipi_dev)) { in ssd16xx_init()
914 return -ENODEV; in ssd16xx_init()
917 data->read_supported = in ssd16xx_init()
918 (config->dbi_config.config.operation & SPI_HALF_DUPLEX) != 0; in ssd16xx_init()
920 if (!gpio_is_ready_dt(&config->busy_gpio)) { in ssd16xx_init()
922 return -ENODEV; in ssd16xx_init()
925 err = gpio_pin_configure_dt(&config->busy_gpio, GPIO_INPUT); in ssd16xx_init()
931 if (config->width > config->quirks->max_width || in ssd16xx_init()
932 config->height > config->quirks->max_height) { in ssd16xx_init()
933 LOG_ERR("Display size out of range."); in ssd16xx_init()
934 return -EINVAL; in ssd16xx_init()