Lines Matching +full:count +full:- +full:width
3 * Copyright (c) 2023 Amrith Venkat Kesavamoorthi <amrith@mr-beam.org>
5 * SPDX-License-Identifier: Apache-2.0
11 #include <zephyr/dt-bindings/display/panel.h>
231 const struct gc9x01x_config *config = dev->config; in gc9x01x_transmit()
234 struct spi_buf_set tx_bufs = {.buffers = &tx_buf, .count = 1U}; in gc9x01x_transmit()
236 ret = gpio_pin_set_dt(&config->cmd_data, GC9X01X_GPIO_LEVEL_CMD); in gc9x01x_transmit()
240 ret = spi_write_dt(&config->spi, &tx_bufs); in gc9x01x_transmit()
250 ret = gpio_pin_set_dt(&config->cmd_data, GC9X01X_GPIO_LEVEL_DATA); in gc9x01x_transmit()
254 ret = spi_write_dt(&config->spi, &tx_bufs); in gc9x01x_transmit()
265 const struct gc9x01x_config *config = dev->config; in gc9x01x_regs_init()
266 const struct gc9x01x_regs *regs = config->regs; in gc9x01x_regs_init()
269 /* Enable inter-command mode */ in gc9x01x_regs_init()
289 ret = gc9x01x_transmit(dev, GC9X01X_CMD_PWRCTRL2, regs->pwrctrl2, sizeof(regs->pwrctrl2)); in gc9x01x_regs_init()
293 ret = gc9x01x_transmit(dev, GC9X01X_CMD_PWRCTRL3, regs->pwrctrl3, sizeof(regs->pwrctrl3)); in gc9x01x_regs_init()
297 ret = gc9x01x_transmit(dev, GC9X01X_CMD_PWRCTRL4, regs->pwrctrl4, sizeof(regs->pwrctrl4)); in gc9x01x_regs_init()
301 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA1, regs->gamma1, sizeof(regs->gamma1)); in gc9x01x_regs_init()
305 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA2, regs->gamma2, sizeof(regs->gamma2)); in gc9x01x_regs_init()
309 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA3, regs->gamma3, sizeof(regs->gamma3)); in gc9x01x_regs_init()
313 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA4, regs->gamma4, sizeof(regs->gamma4)); in gc9x01x_regs_init()
317 ret = gc9x01x_transmit(dev, GC9X01X_CMD_FRAMERATE, regs->framerate, in gc9x01x_regs_init()
318 sizeof(regs->framerate)); in gc9x01x_regs_init()
373 const struct gc9x01x_config *config = dev->config; in gc9x01x_hw_reset()
375 if (config->reset.port == NULL) { in gc9x01x_hw_reset()
376 return -ENODEV; in gc9x01x_hw_reset()
379 gpio_pin_set_dt(&config->reset, 1U); in gc9x01x_hw_reset()
381 gpio_pin_set_dt(&config->reset, 0U); in gc9x01x_hw_reset()
402 struct gc9x01x_data *data = dev->data; in gc9x01x_set_pixel_format()
415 return -ENOTSUP; in gc9x01x_set_pixel_format()
423 data->pixel_format = pixel_format; in gc9x01x_set_pixel_format()
424 data->bytes_per_pixel = bytes_per_pixel; in gc9x01x_set_pixel_format()
432 struct gc9x01x_data *data = dev->data; in gc9x01x_set_orientation()
437 /* works 0° - default */ in gc9x01x_set_orientation()
454 data->orientation = orientation; in gc9x01x_set_orientation()
461 const struct gc9x01x_config *config = dev->config; in gc9x01x_configure()
471 ret = gc9x01x_set_pixel_format(dev, config->pixel_format); in gc9x01x_configure()
477 ret = gc9x01x_set_orientation(dev, config->orientation); in gc9x01x_configure()
483 if (config->inversion) { in gc9x01x_configure()
495 const struct gc9x01x_config *config = dev->config; in gc9x01x_init()
498 if (!spi_is_ready_dt(&config->spi)) { in gc9x01x_init()
500 return -ENODEV; in gc9x01x_init()
503 if (!gpio_is_ready_dt(&config->cmd_data)) { in gc9x01x_init()
505 return -ENODEV; in gc9x01x_init()
508 ret = gpio_pin_configure_dt(&config->cmd_data, GPIO_OUTPUT); in gc9x01x_init()
514 if (config->reset.port != NULL) { in gc9x01x_init()
515 if (!device_is_ready(config->reset.port)) { in gc9x01x_init()
517 return -ENODEV; in gc9x01x_init()
520 ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_INACTIVE); in gc9x01x_init()
553 spi_data[1] = sys_cpu_to_be16(x + w - 1U); in gc9x01x_set_mem_area()
560 spi_data[1] = sys_cpu_to_be16(y + h - 1U); in gc9x01x_set_mem_area()
572 const struct gc9x01x_config *config = dev->config; in gc9x01x_write()
573 struct gc9x01x_data *data = dev->data; in gc9x01x_write()
582 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width"); in gc9x01x_write()
583 __ASSERT((desc->pitch * data->bytes_per_pixel * desc->height) <= desc->buf_size, in gc9x01x_write()
586 LOG_DBG("Writing %dx%d (w,h) @ %dx%d (x,y)", desc->width, desc->height, x, y); in gc9x01x_write()
587 ret = gc9x01x_set_mem_area(dev, x, y, desc->width, desc->height); in gc9x01x_write()
592 if (desc->pitch > desc->width) { in gc9x01x_write()
594 nbr_of_writes = desc->height; in gc9x01x_write()
596 write_h = desc->height; in gc9x01x_write()
601 desc->width * data->bytes_per_pixel * write_h); in gc9x01x_write()
607 tx_bufs.count = 1U; in gc9x01x_write()
609 write_data_start += desc->pitch * data->bytes_per_pixel; in gc9x01x_write()
612 tx_buf.len = desc->width * data->bytes_per_pixel * write_h; in gc9x01x_write()
614 ret = spi_write_dt(&config->spi, &tx_bufs); in gc9x01x_write()
619 write_data_start += desc->pitch * data->bytes_per_pixel; in gc9x01x_write()
628 struct gc9x01x_data *data = dev->data; in gc9x01x_get_capabilities()
629 const struct gc9x01x_config *config = dev->config; in gc9x01x_get_capabilities()
633 capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565 | PIXEL_FORMAT_RGB_888; in gc9x01x_get_capabilities()
634 capabilities->current_pixel_format = data->pixel_format; in gc9x01x_get_capabilities()
636 if (data->orientation == DISPLAY_ORIENTATION_NORMAL || in gc9x01x_get_capabilities()
637 data->orientation == DISPLAY_ORIENTATION_ROTATED_180) { in gc9x01x_get_capabilities()
638 capabilities->x_resolution = config->x_resolution; in gc9x01x_get_capabilities()
639 capabilities->y_resolution = config->y_resolution; in gc9x01x_get_capabilities()
641 capabilities->x_resolution = config->y_resolution; in gc9x01x_get_capabilities()
642 capabilities->y_resolution = config->x_resolution; in gc9x01x_get_capabilities()
645 capabilities->current_orientation = data->orientation; in gc9x01x_get_capabilities()
661 ret = -ENOTSUP; in gc9x01x_pm_action()
687 .x_resolution = DT_INST_PROP(inst, width), \