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

6  * SPDX-License-Identifier: Apache-2.0
71 int (*set_ptl)(const struct device *dev, uint16_t x, uint16_t y,
99 const struct uc81xx_config *config = dev->config; in uc81xx_busy_wait()
100 int pin = gpio_pin_get_dt(&config->busy_gpio); in uc81xx_busy_wait()
105 pin = gpio_pin_get_dt(&config->busy_gpio); in uc81xx_busy_wait()
112 const struct uc81xx_config *config = dev->config; in uc81xx_write_cmd()
117 err = mipi_dbi_command_write(config->mipi_dev, &config->dbi_config, in uc81xx_write_cmd()
119 mipi_dbi_release(config->mipi_dev, &config->dbi_config); in uc81xx_write_cmd()
127 const struct uc81xx_config *config = dev->config; in uc81xx_write_cmd_pattern()
134 err = mipi_dbi_command_write(config->mipi_dev, &config->dbi_config, in uc81xx_write_cmd_pattern()
149 MIN(len, sizeof(data)); in uc81xx_write_cmd_pattern()
151 err = mipi_dbi_write_display(config->mipi_dev, in uc81xx_write_cmd_pattern()
152 &config->dbi_config, in uc81xx_write_cmd_pattern()
159 len -= mipi_desc.buf_size; in uc81xx_write_cmd_pattern()
163 mipi_dbi_release(config->mipi_dev, &config->dbi_config); in uc81xx_write_cmd_pattern()
176 if (array->len && array->data) { in uc81xx_write_array_opt()
177 return uc81xx_write_cmd(dev, cmd, array->data, array->len); in uc81xx_write_array_opt()
186 const struct uc81xx_config *config = dev->config; in uc81xx_have_profile()
189 config->profiles[type]; in uc81xx_have_profile()
195 const struct uc81xx_config *config = dev->config; in uc81xx_set_profile()
197 struct uc81xx_data *data = dev->data; in uc81xx_set_profile()
206 return -EINVAL; in uc81xx_set_profile()
210 if (data->profile == type) { in uc81xx_set_profile()
214 p = config->profiles[type]; in uc81xx_set_profile()
215 data->profile = type; in uc81xx_set_profile()
220 LOG_HEXDUMP_DBG(p->pwr.data, p->pwr.len, "PWR"); in uc81xx_set_profile()
221 if (uc81xx_write_array_opt(dev, UC81XX_CMD_PWR, &p->pwr)) { in uc81xx_set_profile()
222 return -EIO; in uc81xx_set_profile()
226 &config->softstart)) { in uc81xx_set_profile()
227 return -EIO; in uc81xx_set_profile()
234 if (p->lutc.len || p->lutww.len || p->lutkw.len || in uc81xx_set_profile()
235 p->lutwk.len || p->lutbd.len) { in uc81xx_set_profile()
244 return -EIO; in uc81xx_set_profile()
248 if (config->quirks->set_tres(dev)) { in uc81xx_set_profile()
249 return -EIO; in uc81xx_set_profile()
253 if (config->quirks->set_cdi(dev, true)) { in uc81xx_set_profile()
254 return -EIO; in uc81xx_set_profile()
265 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTC, &p->lutc)) { in uc81xx_set_profile()
266 return -EIO; in uc81xx_set_profile()
269 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTWW, &p->lutww)) { in uc81xx_set_profile()
270 return -EIO; in uc81xx_set_profile()
273 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTKW, &p->lutkw)) { in uc81xx_set_profile()
274 return -EIO; in uc81xx_set_profile()
277 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTWK, &p->lutwk)) { in uc81xx_set_profile()
278 return -EIO; in uc81xx_set_profile()
281 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTKK, &p->lutkk)) { in uc81xx_set_profile()
282 return -EIO; in uc81xx_set_profile()
285 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTBD, &p->lutbd)) { in uc81xx_set_profile()
286 return -EIO; in uc81xx_set_profile()
289 if (p->override_pll) { in uc81xx_set_profile()
290 LOG_DBG("PLL: %#hhx", p->pll); in uc81xx_set_profile()
291 if (uc81xx_write_cmd_uint8(dev, UC81XX_CMD_PLL, p->pll)) { in uc81xx_set_profile()
292 return -EIO; in uc81xx_set_profile()
296 if (p->override_vdcs) { in uc81xx_set_profile()
297 LOG_DBG("VDCS: %#hhx", p->vdcs); in uc81xx_set_profile()
298 if (uc81xx_write_cmd_uint8(dev, UC81XX_CMD_VDCS, p->vdcs)) { in uc81xx_set_profile()
299 return -EIO; in uc81xx_set_profile()
303 if (p->override_tcon) { in uc81xx_set_profile()
304 if (uc81xx_write_cmd_uint8(dev, UC81XX_CMD_TCON, p->tcon)) { in uc81xx_set_profile()
305 return -EIO; in uc81xx_set_profile()
318 return -EIO; in uc81xx_update_display()
324 return -EIO; in uc81xx_update_display()
331 return -EIO; in uc81xx_update_display()
339 struct uc81xx_data *data = dev->data; in uc81xx_blanking_off()
341 if (data->blanking_on) { in uc81xx_blanking_off()
344 return -EIO; in uc81xx_blanking_off()
348 data->blanking_on = false; in uc81xx_blanking_off()
355 struct uc81xx_data *data = dev->data; in uc81xx_blanking_on()
357 if (!data->blanking_on) { in uc81xx_blanking_on()
359 return -EIO; in uc81xx_blanking_on()
363 data->blanking_on = true; in uc81xx_blanking_on()
368 static int uc81xx_write(const struct device *dev, const uint16_t x, const uint16_t y, in uc81xx_write() argument
372 const struct uc81xx_config *config = dev->config; in uc81xx_write()
373 struct uc81xx_data *data = dev->data; in uc81xx_write()
375 uint16_t x_end_idx = x + desc->width - 1; in uc81xx_write()
376 uint16_t y_end_idx = y + desc->height - 1; in uc81xx_write()
378 const uint8_t back_buffer = data->blanking_on ? in uc81xx_write()
381 LOG_DBG("x %u, y %u, height %u, width %u, pitch %u", in uc81xx_write()
382 x, y, desc->height, desc->width, desc->pitch); in uc81xx_write()
384 buf_len = MIN(desc->buf_size, in uc81xx_write()
385 desc->height * desc->width / UC81XX_PIXELS_PER_BYTE); in uc81xx_write()
386 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width"); in uc81xx_write()
389 __ASSERT(!(desc->width % UC81XX_PIXELS_PER_BYTE), in uc81xx_write()
392 if ((y_end_idx > (config->height - 1)) || in uc81xx_write()
393 (x_end_idx > (config->width - 1))) { in uc81xx_write()
395 return -EINVAL; in uc81xx_write()
398 if (!data->blanking_on) { in uc81xx_write()
406 * This operation becomes a no-op if the profile is in uc81xx_write()
407 * already active in uc81xx_write()
411 return -EIO; in uc81xx_write()
416 return -EIO; in uc81xx_write()
419 if (config->quirks->set_ptl(dev, x, y, x_end_idx, y_end_idx, desc)) { in uc81xx_write()
420 return -EIO; in uc81xx_write()
424 return -EIO; in uc81xx_write()
428 if (data->blanking_on == false) { in uc81xx_write()
430 if (config->quirks->set_cdi(dev, false)) { in uc81xx_write()
431 return -EIO; in uc81xx_write()
435 return -EIO; in uc81xx_write()
439 if (config->quirks->set_cdi(dev, true)) { in uc81xx_write()
440 return -EIO; in uc81xx_write()
444 if (!config->quirks->auto_copy) { in uc81xx_write()
450 if (config->quirks->set_ptl(dev, x, y, x_end_idx, y_end_idx, desc)) { in uc81xx_write()
451 return -EIO; in uc81xx_write()
456 return -EIO; in uc81xx_write()
461 return -EIO; in uc81xx_write()
470 const struct uc81xx_config *config = dev->config; in uc81xx_get_capabilities()
473 caps->x_resolution = config->width; in uc81xx_get_capabilities()
474 caps->y_resolution = config->height; in uc81xx_get_capabilities()
475 caps->supported_pixel_formats = PIXEL_FORMAT_MONO10; in uc81xx_get_capabilities()
476 caps->current_pixel_format = PIXEL_FORMAT_MONO10; in uc81xx_get_capabilities()
477 caps->screen_info = SCREEN_INFO_MONO_MSB_FIRST | SCREEN_INFO_EPD; in uc81xx_get_capabilities()
488 return -ENOTSUP; in uc81xx_set_pixel_format()
494 const struct uc81xx_config *config = dev->config; in uc81xx_clear_and_write_buffer()
495 const int size = config->width * config->height in uc81xx_clear_and_write_buffer()
499 return -EIO; in uc81xx_clear_and_write_buffer()
503 return -EIO; in uc81xx_clear_and_write_buffer()
508 return -EIO; in uc81xx_clear_and_write_buffer()
517 const struct uc81xx_config *config = dev->config; in uc81xx_controller_init()
518 struct uc81xx_data *data = dev->data; in uc81xx_controller_init()
520 mipi_dbi_reset(config->mipi_dev, UC81XX_RESET_DELAY); in uc81xx_controller_init()
524 data->blanking_on = true; in uc81xx_controller_init()
525 data->profile = UC81XX_PROFILE_INVALID; in uc81xx_controller_init()
528 return -EIO; in uc81xx_controller_init()
532 return -EIO; in uc81xx_controller_init()
540 const struct uc81xx_config *config = dev->config; in uc81xx_init()
544 if (!device_is_ready(config->mipi_dev)) { in uc81xx_init()
546 return -ENODEV; in uc81xx_init()
549 if (!gpio_is_ready_dt(&config->busy_gpio)) { in uc81xx_init()
551 return -ENODEV; in uc81xx_init()
554 gpio_pin_configure_dt(&config->busy_gpio, GPIO_INPUT); in uc81xx_init()
556 if (config->width > config->quirks->max_width || in uc81xx_init()
557 config->height > config->quirks->max_height) { in uc81xx_init()
558 LOG_ERR("Display size out of range."); in uc81xx_init()
559 return -EINVAL; in uc81xx_init()
568 const struct uc81xx_config *config = dev->config; in uc81xx_set_tres_8()
570 .hres = config->width, in uc81xx_set_tres_8()
571 .vres = config->height, in uc81xx_set_tres_8()
579 static inline int uc81xx_set_ptl_8(const struct device *dev, uint16_t x, uint16_t y, in uc81xx_set_ptl_8() argument
584 .hrst = x, in uc81xx_set_ptl_8()
601 const struct uc81xx_config *config = dev->config; in uc81xx_set_tres_16()
603 .hres = sys_cpu_to_be16(config->width), in uc81xx_set_tres_16()
604 .vres = sys_cpu_to_be16(config->height), in uc81xx_set_tres_16()
612 static inline int uc81xx_set_ptl_16(const struct device *dev, uint16_t x, uint16_t y, in uc81xx_set_ptl_16() argument
617 .hrst = sys_cpu_to_be16(x), in uc81xx_set_ptl_16()
634 const struct uc81xx_config *config = dev->config; in uc8176_set_cdi()
635 const struct uc81xx_data *data = dev->data; in uc8176_set_cdi()
636 const struct uc81xx_profile *p = config->profiles[data->profile]; in uc8176_set_cdi()
638 (p ? (p->cdi & UC8176_CDI_CDI_MASK) : 0); in uc8176_set_cdi()
640 if (!p || !p->override_cdi) { in uc8176_set_cdi()
683 const struct uc81xx_config *config = dev->config; in uc8179_set_cdi()
684 const struct uc81xx_data *data = dev->data; in uc8179_set_cdi()
685 const struct uc81xx_profile *p = config->profiles[data->profile]; in uc8179_set_cdi()
688 p ? p->cdi : 0, in uc8179_set_cdi()
691 if (!p || !p->override_cdi) { in uc8179_set_cdi()