1 /*
2  * Copyright (c) 2024 Renesas Electronics Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_DRIVERS_DISPLAY_RENESAS_RA_H_
8 #define ZEPHYR_DRIVERS_DISPLAY_RENESAS_RA_H_
9 
10 #include <zephyr/drivers/display.h>
11 
12 #define INPUT_FORMAT_PIXEL  DT_INST_PROP(0, input_pixel_format)
13 #define OUTPUT_FORMAT_PIXEL DT_INST_PROP(0, output_pixel_format)
14 
15 #if (INPUT_FORMAT_PIXEL == PANEL_PIXEL_FORMAT_RGB_565)
16 #define BYTE_PER_PIXEL                (2)
17 #define DISPLAY_BITS_PER_PIXEL_INPUT0 (16)
18 #elif (INPUT_FORMAT_PIXEL == PANEL_PIXEL_FORMAT_RGB_888)
19 #define BYTE_PER_PIXEL                (4)
20 #define DISPLAY_BITS_PER_PIXEL_INPUT0 (32)
21 #elif (INPUT_FORMAT_PIXEL == PANEL_PIXEL_FORMAT_ARGB_8888)
22 #define BYTE_PER_PIXEL                (4)
23 #define DISPLAY_BITS_PER_PIXEL_INPUT0 (32)
24 #endif
25 
26 #define DISPLAY_BITS_PER_PIXEL_INPUT1 (16)
27 #define DISPLAY_HSIZE                 DT_INST_PROP(0, width)
28 #define DISPLAY_VSIZE                 DT_INST_PROP(0, height)
29 #define DISPLAY_BUFFER_STRIDE_BYTES_INPUT0                                                         \
30 	(((DISPLAY_HSIZE * DISPLAY_BITS_PER_PIXEL_INPUT0 + 0x1FF) >> 9) << 6)
31 #define DISPLAY_BUFFER_STRIDE_PIXELS_INPUT0                                                        \
32 	((DISPLAY_BUFFER_STRIDE_BYTES_INPUT0 * 8) / DISPLAY_BITS_PER_PIXEL_INPUT0)
33 #define DISPLAY_BUFFER_STRIDE_BYTES_INPUT1                                                         \
34 	(((DISPLAY_HSIZE * DISPLAY_BITS_PER_PIXEL_INPUT1 + 0x1FF) >> 9) << 6)
35 #define DISPLAY_BUFFER_STRIDE_PIXELS_INPUT1                                                        \
36 	((DISPLAY_BUFFER_STRIDE_BYTES_INPUT1 * 8) / DISPLAY_BITS_PER_PIXEL_INPUT1)
37 
38 #define LAYER_GREEN          (255)
39 #define LAYER_RED            (255)
40 #define LAYER_BLUE           (255)
41 #define LAYER_ALPHA          (255)
42 #define OUTPUT_GREEN         (0)
43 #define OUTPUT_RED           (0)
44 #define OUTPUT_BLUE          (0)
45 #define OUTPUT_ALPHA         (255)
46 #define GLCDC_BRIGHTNESS_MAX (1023U)
47 #define BRIGHTNESS_MAX       (255U)
48 #define GLCDC_CONTRAST_MAX   (255U)
49 
50 #endif /* ZEPHYR_DRIVERS_DISPLAY_RENESAS_RA_H_ */
51