1# Copyright 2019,2023-2024 NXP
2# Copyright (c) 2022, Basalte bv
3# SPDX-License-Identifier: Apache-2.0
4
5
6menuconfig DISPLAY_MCUX_ELCDIF
7	bool "MCUX eLCDIF driver"
8	default y
9	depends on DT_HAS_NXP_IMX_ELCDIF_ENABLED
10	select PINCTRL
11	help
12	  Enable support for mcux eLCDIF driver.
13
14if DISPLAY_MCUX_ELCDIF
15
16config MCUX_ELCDIF_FB_NUM
17	int "Framebuffers to allocate in driver"
18	default 2
19	range 0 2
20	help
21	  Number of framebuffers to allocate in ELCDIF driver. Driver allocated
22	  framebuffers are required to support partial display updates.
23	  The driver has been validated to support 0 through 2 framebuffers.
24	  Note that hardware will likely perform best if zero driver
25	  framebuffers are allocated by the driver, and the application
26	  implements double framebuffering by always calling display_write with
27	  a buffer equal in size to the connected panel.
28
29	  NOTE: when no framebuffers are allocated, the ELCDIF will be
30	  set to display an empty buffer during initialization. This means
31	  the display will show what is effectively a dump of
32	  system RAM until a new framebuffer is written. If the security
33	  implications of this concern you, leave at least one driver
34	  framebuffer enabled.
35
36config MCUX_ELCDIF_FB_SIZE
37	int "Framebuffer size required by the eLCDIF driver"
38	default 3686400
39	help
40	  eLCDIF driver allocates framebuffers to support partial display updates.
41	  The framebuffer size is computed as : panel_width * panel_height * bpp.
42	  The default value is set to afford for a default resolution of 1280x720 and
43	  4-bytes pixel format, e.g. ARGB8888. Applications should change this value
44	  according to the actual used resolution and format to optimize the heap size.
45
46config MCUX_ELCDIF_PXP
47	bool "Use PXP for display rotation"
48	depends on MCUX_PXP
49	depends on (MCUX_ELCDIF_FB_NUM > 0)
50	help
51	  Use the PXP for display rotation. This requires the LCDIF node
52	  have a "nxp,pxp" devicetree property pointing to the PXP device node.
53	  The ELCDIF will only utilize the PXP to rotate frames if
54	  display_write is called with a framebuffer equal in size to the
55	  display.
56
57if MCUX_ELCDIF_PXP
58
59choice MCUX_ELCDIF_PXP_ROTATE_DIRECTION
60	default MCUX_ELCDIF_PXP_ROTATE_0
61	prompt "Rotation angle of PXP"
62	help
63	  Set rotation angle of PXP. The ELCDIF cannot detect the correct
64	  rotation angle based on the call to display_write, so the user should
65	  configure it here. In order for PXP rotation to work, calls to
66	  display_write MUST supply a framebuffer equal in size to screen width
67	  and height (without rotation applied).  Note that the width and
68	  height settings of the screen in devicetree should not be modified
69	  from their values in the default screen orientation when using this
70	  functionality.
71
72config MCUX_ELCDIF_PXP_ROTATE_0
73	bool "Rotate display by 0 degrees"
74	help
75	  Rotate display by 0 degrees. Primarily useful for testing,
76	  production applications should simply disable the PXP.
77
78config MCUX_ELCDIF_PXP_ROTATE_90
79	bool "Rotate display by 90 degrees"
80	help
81	  Rotate display counter-clockwise by 90 degrees.
82	  For LVGL, this corresponds to a rotation of 270 degrees
83
84config MCUX_ELCDIF_PXP_ROTATE_180
85	bool "Rotate display by 180 degrees"
86	help
87	  Rotate display counter-clockwise by 180 degrees
88
89config MCUX_ELCDIF_PXP_ROTATE_270
90	bool "Rotate display by 270 degrees"
91	help
92	  Rotate display counter-clockwise by 270 degrees
93	  For LVGL, this corresponds to a rotation of 90 degrees
94
95endchoice
96
97choice MCUX_ELCDIF_PXP_FLIP_DIRECTION
98	default MCUX_ELCDIF_PXP_FLIP_DISABLE
99	prompt "Flip direction of PXP"
100	help
101	  Set flip direction of PXP. The ELCDIF cannot detect the correct
102	  rotation angle based on the call to display_write, so the user should
103	  configure it here. In order for PXP flip to work, calls to
104	  display_write MUST supply a framebuffer equal in size to screen width
105	  and height (without flip applied).  Note that the width and
106	  height settings of the screen in devicetree should not be modified
107	  from their values in the default screen orientation when using this
108	  functionality.
109
110config MCUX_ELCDIF_PXP_FLIP_DISABLE
111	bool "Do not flip display"
112
113config MCUX_ELCDIF_PXP_FLIP_HORIZONTAL
114	bool "Flip display horizontally"
115
116config MCUX_ELCDIF_PXP_FLIP_VERTICAL
117	bool "Flip display vertically"
118
119config MCUX_ELCDIF_PXP_FLIP_BOTH
120	bool "Flib display both horizontally and vertically"
121
122endchoice
123
124endif # MCUX_ELCDIF_PXP
125
126endif # DISPLAY_MCUX_ELCDIF
127