1# Copyright 2019,2023 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	help
11	  Enable support for mcux eLCDIF driver.
12
13if DISPLAY_MCUX_ELCDIF
14
15config MCUX_ELCDIF_FB_NUM
16	int "Framebuffers to allocate in driver"
17	default 2
18	range 0 2
19	help
20	  Number of framebuffers to allocate in ELCDIF driver. Driver allocated
21	  framebuffers are required to support partial display updates.
22	  The driver has been validated to support 0 through 2 framebuffers.
23	  Note that hardware will likely perform best if zero driver
24	  framebuffers are allocated by the driver, and the application
25	  implements double framebuffering by always calling display_write with
26	  a buffer equal in size to the connected panel.
27
28	  NOTE: when no framebuffers are allocated, the ELCDIF will be
29	  set to display an empty buffer during initialization. This means
30	  the display will show what is effectively a dump of
31	  system RAM until a new framebuffer is written. If the security
32	  implications of this concern you, leave at least one driver
33	  framebuffer enabled.
34
35config MCUX_ELCDIF_FB_SIZE
36	int "Framebuffer size required by the eLCDIF driver"
37	default 3686400
38	help
39	  eLCDIF driver allocates framebuffers to support partial display updates.
40	  The framebuffer size is computed as : panel_width * panel_height * bpp.
41	  The default value is set to afford for a default resolution of 1280x720 and
42	  4-bytes pixel format, e.g. ARGB8888. Applications should change this value
43	  according to the actual used resolution and format to optimize the heap size.
44
45config MCUX_ELCDIF_PXP
46	bool "Use PXP for display rotation"
47	depends on MCUX_PXP
48	depends on (MCUX_ELCDIF_FB_NUM > 0)
49	help
50	  Use the PXP for display rotation. This requires the LCDIF node
51	  have a "nxp,pxp" devicetree property pointing to the PXP device node.
52	  The ELCDIF will only utilize the PXP to rotate frames if
53	  display_write is called with a framebuffer equal in size to the
54	  display.
55
56config MCUX_ELCDIF_LP
57	bool "ELCDIF low power"
58	help
59	  This option, when enabled, will enable CUR_FRAME_DONE_IRQ at the display
60	  write function and disable it at the interruption handler for each new frame.
61	  Disabling the interrupt when no new frame needs to be sent gives the CPU the
62	  possibility to enter low-power mode, thus saving energy.
63	  This option, when disabled, CUR_FRAME_DONE_IRQ will be enabled only
64	  once at initialization. This option should be disabled when the application's
65	  frame rate is close to the display's refresh rate to avoid introducing
66	  additional latency caused by frequently enabling and disabling CUR_FRAME_DONE_IRQ.
67
68if MCUX_ELCDIF_PXP
69
70choice MCUX_ELCDIF_PXP_ROTATE_DIRECTION
71	default MCUX_ELCDIF_PXP_ROTATE_0
72	prompt "Rotation angle of PXP"
73	help
74	  Set rotation angle of PXP. The ELCDIF cannot detect the correct
75	  rotation angle based on the call to display_write, so the user should
76	  configure it here. In order for PXP rotation to work, calls to
77	  display_write MUST supply a framebuffer equal in size to screen width
78	  and height (without rotation applied).  Note that the width and
79	  height settings of the screen in devicetree should not be modified
80	  from their values in the default screen orientation when using this
81	  functionality.
82
83config MCUX_ELCDIF_PXP_ROTATE_0
84	bool "Rotate display by 0 degrees"
85	help
86	  Rotate display by 0 degrees. Primarily useful for testing,
87	  production applications should simply disable the PXP.
88
89config MCUX_ELCDIF_PXP_ROTATE_90
90	bool "Rotate display by 90 degrees"
91	help
92	  Rotate display counter-clockwise by 90 degrees.
93	  For LVGL, this corresponds to a rotation of 270 degrees
94
95config MCUX_ELCDIF_PXP_ROTATE_180
96	bool "Rotate display by 180 degrees"
97	help
98	  Rotate display counter-clockwise by 180 degrees
99
100config MCUX_ELCDIF_PXP_ROTATE_270
101	bool "Rotate display by 270 degrees"
102	help
103	  Rotate display counter-clockwise by 270 degrees
104	  For LVGL, this corresponds to a rotation of 90 degrees
105
106endchoice
107
108endif # MCUX_ELCDIF_PXP
109
110endif # DISPLAY_MCUX_ELCDIF
111