Lines Matching +full:gpio +full:- +full:width
5 * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/drivers/gpio.h>
80 uint16_t width; member
95 const struct uc81xx_config *config = dev->config; in uc81xx_busy_wait()
96 int pin = gpio_pin_get_dt(&config->busy_gpio); in uc81xx_busy_wait()
101 pin = gpio_pin_get_dt(&config->busy_gpio); in uc81xx_busy_wait()
108 const struct uc81xx_config *config = dev->config; in uc81xx_write_cmd()
115 err = gpio_pin_set_dt(&config->dc_gpio, 1); in uc81xx_write_cmd()
120 err = spi_write_dt(&config->bus, &buf_set); in uc81xx_write_cmd()
129 err = gpio_pin_set_dt(&config->dc_gpio, 0); in uc81xx_write_cmd()
134 err = spi_write_dt(&config->bus, &buf_set); in uc81xx_write_cmd()
141 spi_release_dt(&config->bus); in uc81xx_write_cmd()
149 const struct uc81xx_config *config = dev->config; in uc81xx_write_cmd_pattern()
157 err = gpio_pin_set_dt(&config->dc_gpio, 1); in uc81xx_write_cmd_pattern()
162 err = spi_write_dt(&config->bus, &buf_set); in uc81xx_write_cmd_pattern()
167 err = gpio_pin_set_dt(&config->dc_gpio, 0); in uc81xx_write_cmd_pattern()
177 err = spi_write_dt(&config->bus, &buf_set); in uc81xx_write_cmd_pattern()
182 len -= buf.len; in uc81xx_write_cmd_pattern()
186 spi_release_dt(&config->bus); in uc81xx_write_cmd_pattern()
199 if (array->len && array->data) { in uc81xx_write_array_opt()
200 return uc81xx_write_cmd(dev, cmd, array->data, array->len); in uc81xx_write_array_opt()
209 const struct uc81xx_config *config = dev->config; in uc81xx_have_profile()
212 config->profiles[type]; in uc81xx_have_profile()
218 const struct uc81xx_config *config = dev->config; in uc81xx_set_profile()
220 struct uc81xx_data *data = dev->data; in uc81xx_set_profile()
228 .hres = sys_cpu_to_be16(config->width), in uc81xx_set_profile()
229 .vres = sys_cpu_to_be16(config->height), in uc81xx_set_profile()
233 return -EINVAL; in uc81xx_set_profile()
237 if (data->profile == type) { in uc81xx_set_profile()
241 p = config->profiles[type]; in uc81xx_set_profile()
242 data->profile = type; in uc81xx_set_profile()
247 LOG_HEXDUMP_DBG(p->pwr.data, p->pwr.len, "PWR"); in uc81xx_set_profile()
248 if (uc81xx_write_array_opt(dev, UC81XX_CMD_PWR, &p->pwr)) { in uc81xx_set_profile()
249 return -EIO; in uc81xx_set_profile()
253 &config->softstart)) { in uc81xx_set_profile()
254 return -EIO; in uc81xx_set_profile()
261 if (p->lutc.len || p->lutww.len || p->lutkw.len || in uc81xx_set_profile()
262 p->lutwk.len || p->lutbd.len) { in uc81xx_set_profile()
271 return -EIO; in uc81xx_set_profile()
278 return -EIO; in uc81xx_set_profile()
282 if (config->quirks->set_cdi(dev, true)) { in uc81xx_set_profile()
283 return -EIO; in uc81xx_set_profile()
294 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTC, &p->lutc)) { in uc81xx_set_profile()
295 return -EIO; in uc81xx_set_profile()
298 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTWW, &p->lutww)) { in uc81xx_set_profile()
299 return -EIO; in uc81xx_set_profile()
302 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTKW, &p->lutkw)) { in uc81xx_set_profile()
303 return -EIO; in uc81xx_set_profile()
306 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTWK, &p->lutwk)) { in uc81xx_set_profile()
307 return -EIO; in uc81xx_set_profile()
310 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTKK, &p->lutkk)) { in uc81xx_set_profile()
311 return -EIO; in uc81xx_set_profile()
314 if (uc81xx_write_array_opt(dev, UC81XX_CMD_LUTBD, &p->lutbd)) { in uc81xx_set_profile()
315 return -EIO; in uc81xx_set_profile()
318 if (p->override_pll) { in uc81xx_set_profile()
319 LOG_DBG("PLL: %#hhx", p->pll); in uc81xx_set_profile()
320 if (uc81xx_write_cmd_uint8(dev, UC81XX_CMD_PLL, p->pll)) { in uc81xx_set_profile()
321 return -EIO; in uc81xx_set_profile()
325 if (p->override_vdcs) { in uc81xx_set_profile()
326 LOG_DBG("VDCS: %#hhx", p->vdcs); in uc81xx_set_profile()
327 if (uc81xx_write_cmd_uint8(dev, UC81XX_CMD_VDCS, p->vdcs)) { in uc81xx_set_profile()
328 return -EIO; in uc81xx_set_profile()
332 if (p->override_tcon) { in uc81xx_set_profile()
333 if (uc81xx_write_cmd_uint8(dev, UC81XX_CMD_TCON, p->tcon)) { in uc81xx_set_profile()
334 return -EIO; in uc81xx_set_profile()
347 return -EIO; in uc81xx_update_display()
353 return -EIO; in uc81xx_update_display()
360 return -EIO; in uc81xx_update_display()
368 struct uc81xx_data *data = dev->data; in uc81xx_blanking_off()
370 if (data->blanking_on) { in uc81xx_blanking_off()
373 return -EIO; in uc81xx_blanking_off()
377 data->blanking_on = false; in uc81xx_blanking_off()
384 struct uc81xx_data *data = dev->data; in uc81xx_blanking_on()
386 if (!data->blanking_on) { in uc81xx_blanking_on()
388 return -EIO; in uc81xx_blanking_on()
392 data->blanking_on = true; in uc81xx_blanking_on()
401 const struct uc81xx_config *config = dev->config; in uc81xx_write()
402 struct uc81xx_data *data = dev->data; in uc81xx_write()
404 uint16_t x_end_idx = x + desc->width - 1; in uc81xx_write()
405 uint16_t y_end_idx = y + desc->height - 1; in uc81xx_write()
414 const uint8_t back_buffer = data->blanking_on ? in uc81xx_write()
417 LOG_DBG("x %u, y %u, height %u, width %u, pitch %u", in uc81xx_write()
418 x, y, desc->height, desc->width, desc->pitch); in uc81xx_write()
420 buf_len = MIN(desc->buf_size, in uc81xx_write()
421 desc->height * desc->width / UC81XX_PIXELS_PER_BYTE); in uc81xx_write()
422 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width"); in uc81xx_write()
425 __ASSERT(!(desc->width % UC81XX_PIXELS_PER_BYTE), in uc81xx_write()
426 "Buffer width not multiple of %d", UC81XX_PIXELS_PER_BYTE); in uc81xx_write()
428 if ((y_end_idx > (config->height - 1)) || in uc81xx_write()
429 (x_end_idx > (config->width - 1))) { in uc81xx_write()
431 return -EINVAL; in uc81xx_write()
434 if (!data->blanking_on) { in uc81xx_write()
442 * This operation becomes a no-op if the profile is in uc81xx_write()
447 return -EIO; in uc81xx_write()
455 return -EIO; in uc81xx_write()
460 return -EIO; in uc81xx_write()
464 return -EIO; in uc81xx_write()
468 if (data->blanking_on == false) { in uc81xx_write()
470 if (config->quirks->set_cdi(dev, false)) { in uc81xx_write()
471 return -EIO; in uc81xx_write()
475 return -EIO; in uc81xx_write()
479 if (config->quirks->set_cdi(dev, true)) { in uc81xx_write()
480 return -EIO; in uc81xx_write()
484 if (!config->quirks->auto_copy) { in uc81xx_write()
492 return -EIO; in uc81xx_write()
497 return -EIO; in uc81xx_write()
502 return -EIO; in uc81xx_write()
512 return -ENOTSUP; in uc81xx_read()
525 return -ENOTSUP; in uc81xx_set_brightness()
531 return -ENOTSUP; in uc81xx_set_contrast()
537 const struct uc81xx_config *config = dev->config; in uc81xx_get_capabilities()
540 caps->x_resolution = config->width; in uc81xx_get_capabilities()
541 caps->y_resolution = config->height; in uc81xx_get_capabilities()
542 caps->supported_pixel_formats = PIXEL_FORMAT_MONO10; in uc81xx_get_capabilities()
543 caps->current_pixel_format = PIXEL_FORMAT_MONO10; in uc81xx_get_capabilities()
544 caps->screen_info = SCREEN_INFO_MONO_MSB_FIRST | SCREEN_INFO_EPD; in uc81xx_get_capabilities()
552 return -ENOTSUP; in uc81xx_set_orientation()
563 return -ENOTSUP; in uc81xx_set_pixel_format()
569 const struct uc81xx_config *config = dev->config; in uc81xx_clear_and_write_buffer()
570 const int size = config->width * config->height in uc81xx_clear_and_write_buffer()
574 return -EIO; in uc81xx_clear_and_write_buffer()
578 return -EIO; in uc81xx_clear_and_write_buffer()
583 return -EIO; in uc81xx_clear_and_write_buffer()
592 const struct uc81xx_config *config = dev->config; in uc81xx_controller_init()
593 struct uc81xx_data *data = dev->data; in uc81xx_controller_init()
595 gpio_pin_set_dt(&config->reset_gpio, 1); in uc81xx_controller_init()
597 gpio_pin_set_dt(&config->reset_gpio, 0); in uc81xx_controller_init()
601 data->blanking_on = true; in uc81xx_controller_init()
602 data->profile = UC81XX_PROFILE_INVALID; in uc81xx_controller_init()
605 return -EIO; in uc81xx_controller_init()
609 return -EIO; in uc81xx_controller_init()
617 const struct uc81xx_config *config = dev->config; in uc81xx_init()
621 if (!spi_is_ready_dt(&config->bus)) { in uc81xx_init()
622 LOG_ERR("SPI bus %s not ready", config->bus.bus->name); in uc81xx_init()
623 return -ENODEV; in uc81xx_init()
626 if (!gpio_is_ready_dt(&config->reset_gpio)) { in uc81xx_init()
627 LOG_ERR("Reset GPIO device not ready"); in uc81xx_init()
628 return -ENODEV; in uc81xx_init()
631 gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_INACTIVE); in uc81xx_init()
633 if (!gpio_is_ready_dt(&config->dc_gpio)) { in uc81xx_init()
634 LOG_ERR("DC GPIO device not ready"); in uc81xx_init()
635 return -ENODEV; in uc81xx_init()
638 gpio_pin_configure_dt(&config->dc_gpio, GPIO_OUTPUT_INACTIVE); in uc81xx_init()
641 if (!gpio_is_ready_dt(&config->busy_gpio)) { in uc81xx_init()
642 LOG_ERR("Busy GPIO device not ready"); in uc81xx_init()
643 return -ENODEV; in uc81xx_init()
646 gpio_pin_configure_dt(&config->busy_gpio, GPIO_INPUT); in uc81xx_init()
648 if (config->width > config->quirks->max_width || in uc81xx_init()
649 config->height > config->quirks->max_height) { in uc81xx_init()
651 return -EINVAL; in uc81xx_init()
660 const struct uc81xx_config *config = dev->config; in uc8176_set_cdi()
661 const struct uc81xx_data *data = dev->data; in uc8176_set_cdi()
662 const struct uc81xx_profile *p = config->profiles[data->profile]; in uc8176_set_cdi()
664 (p ? (p->cdi & UC8176_CDI_CDI_MASK) : 0); in uc8176_set_cdi()
666 if (!p || !p->override_cdi) { in uc8176_set_cdi()
692 const struct uc81xx_config *config = dev->config; in uc8179_set_cdi()
693 const struct uc81xx_data *data = dev->data; in uc8179_set_cdi()
694 const struct uc81xx_profile *p = config->profiles[data->profile]; in uc8179_set_cdi()
697 p ? p->cdi : 0, in uc8179_set_cdi()
700 if (!p || !p->override_cdi) { in uc8179_set_cdi()
796 .width = DT_PROP(n, width), \