Lines Matching +full:display +full:- +full:inversion

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>
12 #include <zephyr/drivers/display.h>
24 /* Display data struct */
39 bool inversion; member
53 * the display controller
223 const struct gc9x01x_config *config = dev->config; in gc9x01x_transmit()
225 return mipi_dbi_command_write(config->mipi_dev, &config->dbi_config, in gc9x01x_transmit()
231 const struct gc9x01x_config *config = dev->config; in gc9x01x_regs_init()
232 const struct gc9x01x_regs *regs = config->regs; in gc9x01x_regs_init()
235 if (!device_is_ready(config->mipi_dev)) { in gc9x01x_regs_init()
236 return -ENODEV; in gc9x01x_regs_init()
239 /* Enable inter-command mode */ in gc9x01x_regs_init()
259 ret = gc9x01x_transmit(dev, GC9X01X_CMD_PWRCTRL2, regs->pwrctrl2, sizeof(regs->pwrctrl2)); in gc9x01x_regs_init()
263 ret = gc9x01x_transmit(dev, GC9X01X_CMD_PWRCTRL3, regs->pwrctrl3, sizeof(regs->pwrctrl3)); in gc9x01x_regs_init()
267 ret = gc9x01x_transmit(dev, GC9X01X_CMD_PWRCTRL4, regs->pwrctrl4, sizeof(regs->pwrctrl4)); in gc9x01x_regs_init()
271 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA1, regs->gamma1, sizeof(regs->gamma1)); in gc9x01x_regs_init()
275 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA2, regs->gamma2, sizeof(regs->gamma2)); in gc9x01x_regs_init()
279 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA3, regs->gamma3, sizeof(regs->gamma3)); in gc9x01x_regs_init()
283 ret = gc9x01x_transmit(dev, GC9X01X_CMD_GAMMA4, regs->gamma4, sizeof(regs->gamma4)); in gc9x01x_regs_init()
287 ret = gc9x01x_transmit(dev, GC9X01X_CMD_FRAMERATE, regs->framerate, in gc9x01x_regs_init()
288 sizeof(regs->framerate)); in gc9x01x_regs_init()
312 * Exit sleepmode and enable display. 30ms on top of the sleepout time to account for in gc9x01x_exit_sleep()
332 * Exit sleepmode and enable display. 30ms on top of the sleepout time to account for in gc9x01x_enter_sleep()
343 const struct gc9x01x_config *config = dev->config; in gc9x01x_hw_reset()
346 ret = mipi_dbi_reset(config->mipi_dev, 100); in gc9x01x_hw_reset()
357 LOG_DBG("Turning display blanking off"); in gc9x01x_display_blanking_off()
363 LOG_DBG("Turning display blanking on"); in gc9x01x_display_blanking_on()
370 struct gc9x01x_data *data = dev->data; in gc9x01x_set_pixel_format()
383 return -ENOTSUP; in gc9x01x_set_pixel_format()
391 data->pixel_format = pixel_format; in gc9x01x_set_pixel_format()
392 data->bytes_per_pixel = bytes_per_pixel; in gc9x01x_set_pixel_format()
400 struct gc9x01x_data *data = dev->data; in gc9x01x_set_orientation()
405 /* works 0° - default */ in gc9x01x_set_orientation()
422 data->orientation = orientation; in gc9x01x_set_orientation()
429 const struct gc9x01x_config *config = dev->config; in gc9x01x_configure()
439 ret = gc9x01x_set_pixel_format(dev, config->pixel_format); in gc9x01x_configure()
445 ret = gc9x01x_set_orientation(dev, config->orientation); in gc9x01x_configure()
450 /* Display inversion mode. */ in gc9x01x_configure()
451 if (config->inversion) { in gc9x01x_configure()
471 LOG_ERR("Could not configure display (%d)", ret); in gc9x01x_init()
491 spi_data[1] = sys_cpu_to_be16(x + w - 1U); in gc9x01x_set_mem_area()
498 spi_data[1] = sys_cpu_to_be16(y + h - 1U); in gc9x01x_set_mem_area()
510 const struct gc9x01x_config *config = dev->config; in gc9x01x_write()
511 struct gc9x01x_data *data = dev->data; in gc9x01x_write()
519 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width"); in gc9x01x_write()
520 __ASSERT((desc->pitch * data->bytes_per_pixel * desc->height) <= desc->buf_size, in gc9x01x_write()
523 LOG_DBG("Writing %dx%d (w,h) @ %dx%d (x,y)", desc->width, desc->height, x, y); in gc9x01x_write()
524 ret = gc9x01x_set_mem_area(dev, x, y, desc->width, desc->height); in gc9x01x_write()
529 if (desc->pitch > desc->width) { in gc9x01x_write()
531 nbr_of_writes = desc->height; in gc9x01x_write()
533 mipi_desc.buf_size = desc->width * data->bytes_per_pixel; in gc9x01x_write()
535 write_h = desc->height; in gc9x01x_write()
536 mipi_desc.height = desc->height; in gc9x01x_write()
537 mipi_desc.buf_size = desc->width * data->bytes_per_pixel * write_h; in gc9x01x_write()
541 mipi_desc.width = desc->width; in gc9x01x_write()
543 mipi_desc.pitch = desc->width; in gc9x01x_write()
544 mipi_desc.frame_incomplete = desc->frame_incomplete; in gc9x01x_write()
552 ret = mipi_dbi_write_display(config->mipi_dev, in gc9x01x_write()
553 &config->dbi_config, in gc9x01x_write()
556 data->pixel_format); in gc9x01x_write()
561 write_data_start += desc->pitch * data->bytes_per_pixel; in gc9x01x_write()
570 struct gc9x01x_data *data = dev->data; in gc9x01x_get_capabilities()
571 const struct gc9x01x_config *config = dev->config; in gc9x01x_get_capabilities()
575 capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565 | PIXEL_FORMAT_RGB_888; in gc9x01x_get_capabilities()
576 capabilities->current_pixel_format = data->pixel_format; in gc9x01x_get_capabilities()
578 if (data->orientation == DISPLAY_ORIENTATION_NORMAL || in gc9x01x_get_capabilities()
579 data->orientation == DISPLAY_ORIENTATION_ROTATED_180) { in gc9x01x_get_capabilities()
580 capabilities->x_resolution = config->x_resolution; in gc9x01x_get_capabilities()
581 capabilities->y_resolution = config->y_resolution; in gc9x01x_get_capabilities()
583 capabilities->x_resolution = config->y_resolution; in gc9x01x_get_capabilities()
584 capabilities->y_resolution = config->x_resolution; in gc9x01x_get_capabilities()
587 capabilities->current_orientation = data->orientation; in gc9x01x_get_capabilities()
603 ret = -ENOTSUP; in gc9x01x_pm_action()
612 static DEVICE_API(display, gc9x01x_api) = {
635 .inversion = DT_INST_PROP(inst, display_inversion), \