xref: /linux/include/drm/gud.h (revision 40e1a70b)
1*40e1a70bSNoralf Trønnes /* SPDX-License-Identifier: MIT */
2*40e1a70bSNoralf Trønnes /*
3*40e1a70bSNoralf Trønnes  * Copyright 2020 Noralf Trønnes
4*40e1a70bSNoralf Trønnes  */
5*40e1a70bSNoralf Trønnes 
6*40e1a70bSNoralf Trønnes #ifndef __LINUX_GUD_H
7*40e1a70bSNoralf Trønnes #define __LINUX_GUD_H
8*40e1a70bSNoralf Trønnes 
9*40e1a70bSNoralf Trønnes #include <linux/types.h>
10*40e1a70bSNoralf Trønnes 
11*40e1a70bSNoralf Trønnes /*
12*40e1a70bSNoralf Trønnes  * struct gud_display_descriptor_req - Display descriptor
13*40e1a70bSNoralf Trønnes  * @magic: Magic value GUD_DISPLAY_MAGIC
14*40e1a70bSNoralf Trønnes  * @version: Protocol version
15*40e1a70bSNoralf Trønnes  * @flags: Flags
16*40e1a70bSNoralf Trønnes  *         - STATUS_ON_SET: Always do a status request after a SET request.
17*40e1a70bSNoralf Trønnes  *                          This is used by the Linux gadget driver since it has
18*40e1a70bSNoralf Trønnes  *                          no way to control the status stage of a control OUT
19*40e1a70bSNoralf Trønnes  *                          request that has a payload.
20*40e1a70bSNoralf Trønnes  *         - FULL_UPDATE:   Always send the entire framebuffer when flushing changes.
21*40e1a70bSNoralf Trønnes  *                          The GUD_REQ_SET_BUFFER request will not be sent
22*40e1a70bSNoralf Trønnes  *                          before each bulk transfer, it will only be sent if the
23*40e1a70bSNoralf Trønnes  *                          previous bulk transfer had failed. This gives the device
24*40e1a70bSNoralf Trønnes  *                          a chance to reset its state machine if needed.
25*40e1a70bSNoralf Trønnes  *                          This flag can not be used in combination with compression.
26*40e1a70bSNoralf Trønnes  * @compression: Supported compression types
27*40e1a70bSNoralf Trønnes  *               - GUD_COMPRESSION_LZ4: LZ4 lossless compression.
28*40e1a70bSNoralf Trønnes  * @max_buffer_size: Maximum buffer size the device can handle (optional).
29*40e1a70bSNoralf Trønnes  *                   This is useful for devices that don't have a big enough
30*40e1a70bSNoralf Trønnes  *                   buffer to decompress the entire framebuffer in one go.
31*40e1a70bSNoralf Trønnes  * @min_width: Minimum pixel width the controller can handle
32*40e1a70bSNoralf Trønnes  * @max_width: Maximum width
33*40e1a70bSNoralf Trønnes  * @min_height: Minimum height
34*40e1a70bSNoralf Trønnes  * @max_height: Maximum height
35*40e1a70bSNoralf Trønnes  *
36*40e1a70bSNoralf Trønnes  * Devices that have only one display mode will have min_width == max_width
37*40e1a70bSNoralf Trønnes  * and min_height == max_height.
38*40e1a70bSNoralf Trønnes  */
39*40e1a70bSNoralf Trønnes struct gud_display_descriptor_req {
40*40e1a70bSNoralf Trønnes 	__le32 magic;
41*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MAGIC			0x1d50614d
42*40e1a70bSNoralf Trønnes 	__u8 version;
43*40e1a70bSNoralf Trønnes 	__le32 flags;
44*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_FLAG_STATUS_ON_SET		BIT(0)
45*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_FLAG_FULL_UPDATE		BIT(1)
46*40e1a70bSNoralf Trønnes 	__u8 compression;
47*40e1a70bSNoralf Trønnes #define GUD_COMPRESSION_LZ4			BIT(0)
48*40e1a70bSNoralf Trønnes 	__le32 max_buffer_size;
49*40e1a70bSNoralf Trønnes 	__le32 min_width;
50*40e1a70bSNoralf Trønnes 	__le32 max_width;
51*40e1a70bSNoralf Trønnes 	__le32 min_height;
52*40e1a70bSNoralf Trønnes 	__le32 max_height;
53*40e1a70bSNoralf Trønnes } __packed;
54*40e1a70bSNoralf Trønnes 
55*40e1a70bSNoralf Trønnes /*
56*40e1a70bSNoralf Trønnes  * struct gud_property_req - Property
57*40e1a70bSNoralf Trønnes  * @prop: Property
58*40e1a70bSNoralf Trønnes  * @val: Value
59*40e1a70bSNoralf Trønnes  */
60*40e1a70bSNoralf Trønnes struct gud_property_req {
61*40e1a70bSNoralf Trønnes 	__le16 prop;
62*40e1a70bSNoralf Trønnes 	__le64 val;
63*40e1a70bSNoralf Trønnes } __packed;
64*40e1a70bSNoralf Trønnes 
65*40e1a70bSNoralf Trønnes /*
66*40e1a70bSNoralf Trønnes  * struct gud_display_mode_req - Display mode
67*40e1a70bSNoralf Trønnes  * @clock: Pixel clock in kHz
68*40e1a70bSNoralf Trønnes  * @hdisplay: Horizontal display size
69*40e1a70bSNoralf Trønnes  * @hsync_start: Horizontal sync start
70*40e1a70bSNoralf Trønnes  * @hsync_end: Horizontal sync end
71*40e1a70bSNoralf Trønnes  * @htotal: Horizontal total size
72*40e1a70bSNoralf Trønnes  * @vdisplay: Vertical display size
73*40e1a70bSNoralf Trønnes  * @vsync_start: Vertical sync start
74*40e1a70bSNoralf Trønnes  * @vsync_end: Vertical sync end
75*40e1a70bSNoralf Trønnes  * @vtotal: Vertical total size
76*40e1a70bSNoralf Trønnes  * @flags: Bits 0-13 are the same as in the RandR protocol and also what DRM uses.
77*40e1a70bSNoralf Trønnes  *         The deprecated bits are reused for internal protocol flags leaving us
78*40e1a70bSNoralf Trønnes  *         free to follow DRM for the other bits in the future.
79*40e1a70bSNoralf Trønnes  *         - FLAG_PREFERRED: Set on the preferred display mode.
80*40e1a70bSNoralf Trønnes  */
81*40e1a70bSNoralf Trønnes struct gud_display_mode_req {
82*40e1a70bSNoralf Trønnes 	__le32 clock;
83*40e1a70bSNoralf Trønnes 	__le16 hdisplay;
84*40e1a70bSNoralf Trønnes 	__le16 hsync_start;
85*40e1a70bSNoralf Trønnes 	__le16 hsync_end;
86*40e1a70bSNoralf Trønnes 	__le16 htotal;
87*40e1a70bSNoralf Trønnes 	__le16 vdisplay;
88*40e1a70bSNoralf Trønnes 	__le16 vsync_start;
89*40e1a70bSNoralf Trønnes 	__le16 vsync_end;
90*40e1a70bSNoralf Trønnes 	__le16 vtotal;
91*40e1a70bSNoralf Trønnes 	__le32 flags;
92*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PHSYNC		BIT(0)
93*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_NHSYNC		BIT(1)
94*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PVSYNC		BIT(2)
95*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_NVSYNC		BIT(3)
96*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_INTERLACE		BIT(4)
97*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_DBLSCAN		BIT(5)
98*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_CSYNC		BIT(6)
99*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PCSYNC		BIT(7)
100*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_NCSYNC		BIT(8)
101*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_HSKEW		BIT(9)
102*40e1a70bSNoralf Trønnes /* BCast and PixelMultiplex are deprecated */
103*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_DBLCLK		BIT(12)
104*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_CLKDIV2		BIT(13)
105*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_USER_MASK		\
106*40e1a70bSNoralf Trønnes 		(GUD_DISPLAY_MODE_FLAG_PHSYNC | GUD_DISPLAY_MODE_FLAG_NHSYNC | \
107*40e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_PVSYNC | GUD_DISPLAY_MODE_FLAG_NVSYNC | \
108*40e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_INTERLACE | GUD_DISPLAY_MODE_FLAG_DBLSCAN | \
109*40e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_CSYNC | GUD_DISPLAY_MODE_FLAG_PCSYNC | \
110*40e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_NCSYNC | GUD_DISPLAY_MODE_FLAG_HSKEW | \
111*40e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_DBLCLK | GUD_DISPLAY_MODE_FLAG_CLKDIV2)
112*40e1a70bSNoralf Trønnes /* Internal protocol flags */
113*40e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PREFERRED		BIT(10)
114*40e1a70bSNoralf Trønnes } __packed;
115*40e1a70bSNoralf Trønnes 
116*40e1a70bSNoralf Trønnes /*
117*40e1a70bSNoralf Trønnes  * struct gud_connector_descriptor_req - Connector descriptor
118*40e1a70bSNoralf Trønnes  * @connector_type: Connector type (GUD_CONNECTOR_TYPE_*).
119*40e1a70bSNoralf Trønnes  *                  If the host doesn't support the type it should fall back to PANEL.
120*40e1a70bSNoralf Trønnes  * @flags: Flags
121*40e1a70bSNoralf Trønnes  *         - POLL_STATUS: Connector status can change (polled every 10 seconds)
122*40e1a70bSNoralf Trønnes  *         - INTERLACE: Interlaced modes are supported
123*40e1a70bSNoralf Trønnes  *         - DOUBLESCAN: Doublescan modes are supported
124*40e1a70bSNoralf Trønnes  */
125*40e1a70bSNoralf Trønnes struct gud_connector_descriptor_req {
126*40e1a70bSNoralf Trønnes 	__u8 connector_type;
127*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_PANEL		0
128*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_VGA			1
129*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_COMPOSITE		2
130*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_SVIDEO		3
131*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_COMPONENT		4
132*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_DVI			5
133*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_DISPLAYPORT		6
134*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_HDMI			7
135*40e1a70bSNoralf Trønnes 	__le32 flags;
136*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_FLAGS_POLL_STATUS		BIT(0)
137*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_FLAGS_INTERLACE		BIT(1)
138*40e1a70bSNoralf Trønnes #define GUD_CONNECTOR_FLAGS_DOUBLESCAN		BIT(2)
139*40e1a70bSNoralf Trønnes } __packed;
140*40e1a70bSNoralf Trønnes 
141*40e1a70bSNoralf Trønnes /*
142*40e1a70bSNoralf Trønnes  * struct gud_set_buffer_req - Set buffer transfer info
143*40e1a70bSNoralf Trønnes  * @x: X position of rectangle
144*40e1a70bSNoralf Trønnes  * @y: Y position
145*40e1a70bSNoralf Trønnes  * @width: Pixel width of rectangle
146*40e1a70bSNoralf Trønnes  * @height: Pixel height
147*40e1a70bSNoralf Trønnes  * @length: Buffer length in bytes
148*40e1a70bSNoralf Trønnes  * @compression: Transfer compression
149*40e1a70bSNoralf Trønnes  * @compressed_length: Compressed buffer length
150*40e1a70bSNoralf Trønnes  *
151*40e1a70bSNoralf Trønnes  * This request is issued right before the bulk transfer.
152*40e1a70bSNoralf Trønnes  * @x, @y, @width and @height specifies the rectangle where the buffer should be
153*40e1a70bSNoralf Trønnes  * placed inside the framebuffer.
154*40e1a70bSNoralf Trønnes  */
155*40e1a70bSNoralf Trønnes struct gud_set_buffer_req {
156*40e1a70bSNoralf Trønnes 	__le32 x;
157*40e1a70bSNoralf Trønnes 	__le32 y;
158*40e1a70bSNoralf Trønnes 	__le32 width;
159*40e1a70bSNoralf Trønnes 	__le32 height;
160*40e1a70bSNoralf Trønnes 	__le32 length;
161*40e1a70bSNoralf Trønnes 	__u8 compression;
162*40e1a70bSNoralf Trønnes 	__le32 compressed_length;
163*40e1a70bSNoralf Trønnes } __packed;
164*40e1a70bSNoralf Trønnes 
165*40e1a70bSNoralf Trønnes /*
166*40e1a70bSNoralf Trønnes  * struct gud_state_req - Display state
167*40e1a70bSNoralf Trønnes  * @mode: Display mode
168*40e1a70bSNoralf Trønnes  * @format: Pixel format GUD_PIXEL_FORMAT_*
169*40e1a70bSNoralf Trønnes  * @connector: Connector index
170*40e1a70bSNoralf Trønnes  * @properties: Array of properties
171*40e1a70bSNoralf Trønnes  *
172*40e1a70bSNoralf Trønnes  * The entire state is transferred each time there's a change.
173*40e1a70bSNoralf Trønnes  */
174*40e1a70bSNoralf Trønnes struct gud_state_req {
175*40e1a70bSNoralf Trønnes 	struct gud_display_mode_req mode;
176*40e1a70bSNoralf Trønnes 	__u8 format;
177*40e1a70bSNoralf Trønnes 	__u8 connector;
178*40e1a70bSNoralf Trønnes 	struct gud_property_req properties[];
179*40e1a70bSNoralf Trønnes } __packed;
180*40e1a70bSNoralf Trønnes 
181*40e1a70bSNoralf Trønnes /* List of supported connector properties: */
182*40e1a70bSNoralf Trønnes 
183*40e1a70bSNoralf Trønnes /* Margins in pixels to deal with overscan, range 0-100 */
184*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_LEFT_MARGIN			1
185*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_RIGHT_MARGIN			2
186*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_TOP_MARGIN			3
187*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_BOTTOM_MARGIN			4
188*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_MODE				5
189*40e1a70bSNoralf Trønnes /* Brightness in percent, range 0-100 */
190*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_BRIGHTNESS			6
191*40e1a70bSNoralf Trønnes /* Contrast in percent, range 0-100 */
192*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_CONTRAST			7
193*40e1a70bSNoralf Trønnes /* Flicker reduction in percent, range 0-100 */
194*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_FLICKER_REDUCTION		8
195*40e1a70bSNoralf Trønnes /* Overscan in percent, range 0-100 */
196*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_OVERSCAN			9
197*40e1a70bSNoralf Trønnes /* Saturation in percent, range 0-100 */
198*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_SATURATION			10
199*40e1a70bSNoralf Trønnes /* Hue in percent, range 0-100 */
200*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_HUE				11
201*40e1a70bSNoralf Trønnes 
202*40e1a70bSNoralf Trønnes /*
203*40e1a70bSNoralf Trønnes  * Backlight brightness is in the range 0-100 inclusive. The value represents the human perceptual
204*40e1a70bSNoralf Trønnes  * brightness and not a linear PWM value. 0 is minimum brightness which should not turn the
205*40e1a70bSNoralf Trønnes  * backlight completely off. The DPMS connector property should be used to control power which will
206*40e1a70bSNoralf Trønnes  * trigger a GUD_REQ_SET_DISPLAY_ENABLE request.
207*40e1a70bSNoralf Trønnes  *
208*40e1a70bSNoralf Trønnes  * This does not map to a DRM property, it is used with the backlight device.
209*40e1a70bSNoralf Trønnes  */
210*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_BACKLIGHT_BRIGHTNESS		12
211*40e1a70bSNoralf Trønnes 
212*40e1a70bSNoralf Trønnes /* List of supported properties that are not connector propeties: */
213*40e1a70bSNoralf Trønnes 
214*40e1a70bSNoralf Trønnes /*
215*40e1a70bSNoralf Trønnes  * Plane rotation. Should return the supported bitmask on
216*40e1a70bSNoralf Trønnes  * GUD_REQ_GET_PROPERTIES. GUD_ROTATION_0 is mandatory.
217*40e1a70bSNoralf Trønnes  *
218*40e1a70bSNoralf Trønnes  * Note: This is not display rotation so 90/270 will need scaling to make it fit (unless squared).
219*40e1a70bSNoralf Trønnes  */
220*40e1a70bSNoralf Trønnes #define GUD_PROPERTY_ROTATION				50
221*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_0			BIT(0)
222*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_90			BIT(1)
223*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_180			BIT(2)
224*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_270			BIT(3)
225*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_REFLECT_X		BIT(4)
226*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_REFLECT_Y		BIT(5)
227*40e1a70bSNoralf Trønnes   #define GUD_ROTATION_MASK			(GUD_ROTATION_0 | GUD_ROTATION_90 | \
228*40e1a70bSNoralf Trønnes 						GUD_ROTATION_180 | GUD_ROTATION_270 | \
229*40e1a70bSNoralf Trønnes 						GUD_ROTATION_REFLECT_X | GUD_ROTATION_REFLECT_Y)
230*40e1a70bSNoralf Trønnes 
231*40e1a70bSNoralf Trønnes /* USB Control requests: */
232*40e1a70bSNoralf Trønnes 
233*40e1a70bSNoralf Trønnes /* Get status from the last GET/SET control request. Value is u8. */
234*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_STATUS				0x00
235*40e1a70bSNoralf Trønnes   /* Status values: */
236*40e1a70bSNoralf Trønnes   #define GUD_STATUS_OK				0x00
237*40e1a70bSNoralf Trønnes   #define GUD_STATUS_BUSY			0x01
238*40e1a70bSNoralf Trønnes   #define GUD_STATUS_REQUEST_NOT_SUPPORTED	0x02
239*40e1a70bSNoralf Trønnes   #define GUD_STATUS_PROTOCOL_ERROR		0x03
240*40e1a70bSNoralf Trønnes   #define GUD_STATUS_INVALID_PARAMETER		0x04
241*40e1a70bSNoralf Trønnes   #define GUD_STATUS_ERROR			0x05
242*40e1a70bSNoralf Trønnes 
243*40e1a70bSNoralf Trønnes /* Get display descriptor as a &gud_display_descriptor_req */
244*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_DESCRIPTOR				0x01
245*40e1a70bSNoralf Trønnes 
246*40e1a70bSNoralf Trønnes /* Get supported pixel formats as a byte array of GUD_PIXEL_FORMAT_* */
247*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_FORMATS				0x40
248*40e1a70bSNoralf Trønnes   #define GUD_FORMATS_MAX_NUM			32
249*40e1a70bSNoralf Trønnes   /* R1 is a 1-bit monochrome transfer format presented to userspace as XRGB8888 */
250*40e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_R1			0x01
251*40e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_XRGB1111		0x20
252*40e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_RGB565		0x40
253*40e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_XRGB8888		0x80
254*40e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_ARGB8888		0x81
255*40e1a70bSNoralf Trønnes 
256*40e1a70bSNoralf Trønnes /*
257*40e1a70bSNoralf Trønnes  * Get supported properties that are not connector propeties as a &gud_property_req array.
258*40e1a70bSNoralf Trønnes  * gud_property_req.val often contains the initial value for the property.
259*40e1a70bSNoralf Trønnes  */
260*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_PROPERTIES				0x41
261*40e1a70bSNoralf Trønnes   #define GUD_PROPERTIES_MAX_NUM		32
262*40e1a70bSNoralf Trønnes 
263*40e1a70bSNoralf Trønnes /* Connector requests have the connector index passed in the wValue field */
264*40e1a70bSNoralf Trønnes 
265*40e1a70bSNoralf Trønnes /* Get connector descriptors as an array of &gud_connector_descriptor_req */
266*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTORS				0x50
267*40e1a70bSNoralf Trønnes   #define GUD_CONNECTORS_MAX_NUM		32
268*40e1a70bSNoralf Trønnes 
269*40e1a70bSNoralf Trønnes /*
270*40e1a70bSNoralf Trønnes  * Get properties supported by the connector as a &gud_property_req array.
271*40e1a70bSNoralf Trønnes  * gud_property_req.val often contains the initial value for the property.
272*40e1a70bSNoralf Trønnes  */
273*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_PROPERTIES		0x51
274*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_PROPERTIES_MAX_NUM	32
275*40e1a70bSNoralf Trønnes 
276*40e1a70bSNoralf Trønnes /*
277*40e1a70bSNoralf Trønnes  * Issued when there's a TV_MODE property present.
278*40e1a70bSNoralf Trønnes  * Gets an array of the supported TV_MODE names each entry of length
279*40e1a70bSNoralf Trønnes  * GUD_CONNECTOR_TV_MODE_NAME_LEN. Names must be NUL-terminated.
280*40e1a70bSNoralf Trønnes  */
281*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_TV_MODE_VALUES		0x52
282*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_TV_MODE_NAME_LEN	16
283*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_TV_MODE_MAX_NUM		16
284*40e1a70bSNoralf Trønnes 
285*40e1a70bSNoralf Trønnes /* When userspace checks connector status, this is issued first, not used for poll requests. */
286*40e1a70bSNoralf Trønnes #define GUD_REQ_SET_CONNECTOR_FORCE_DETECT		0x53
287*40e1a70bSNoralf Trønnes 
288*40e1a70bSNoralf Trønnes /*
289*40e1a70bSNoralf Trønnes  * Get connector status. Value is u8.
290*40e1a70bSNoralf Trønnes  *
291*40e1a70bSNoralf Trønnes  * Userspace will get a HOTPLUG uevent if one of the following is true:
292*40e1a70bSNoralf Trønnes  * - Connection status has changed since last
293*40e1a70bSNoralf Trønnes  * - CHANGED is set
294*40e1a70bSNoralf Trønnes  */
295*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_STATUS			0x54
296*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_DISCONNECTED	0x00
297*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_CONNECTED	0x01
298*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_UNKNOWN		0x02
299*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_CONNECTED_MASK	0x03
300*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_CHANGED		BIT(7)
301*40e1a70bSNoralf Trønnes 
302*40e1a70bSNoralf Trønnes /*
303*40e1a70bSNoralf Trønnes  * Display modes can be fetched as either EDID data or an array of &gud_display_mode_req.
304*40e1a70bSNoralf Trønnes  *
305*40e1a70bSNoralf Trønnes  * If GUD_REQ_GET_CONNECTOR_MODES returns zero, EDID is used to create display modes.
306*40e1a70bSNoralf Trønnes  * If both display modes and EDID are returned, EDID is just passed on to userspace
307*40e1a70bSNoralf Trønnes  * in the EDID connector property.
308*40e1a70bSNoralf Trønnes  */
309*40e1a70bSNoralf Trønnes 
310*40e1a70bSNoralf Trønnes /* Get &gud_display_mode_req array of supported display modes */
311*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_MODES			0x55
312*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_MAX_NUM_MODES		128
313*40e1a70bSNoralf Trønnes 
314*40e1a70bSNoralf Trønnes /* Get Extended Display Identification Data */
315*40e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_EDID			0x56
316*40e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_MAX_EDID_LEN		2048
317*40e1a70bSNoralf Trønnes 
318*40e1a70bSNoralf Trønnes /* Set buffer properties before bulk transfer as &gud_set_buffer_req */
319*40e1a70bSNoralf Trønnes #define GUD_REQ_SET_BUFFER				0x60
320*40e1a70bSNoralf Trønnes 
321*40e1a70bSNoralf Trønnes /* Check display configuration as &gud_state_req */
322*40e1a70bSNoralf Trønnes #define GUD_REQ_SET_STATE_CHECK				0x61
323*40e1a70bSNoralf Trønnes 
324*40e1a70bSNoralf Trønnes /* Apply the previous STATE_CHECK configuration */
325*40e1a70bSNoralf Trønnes #define GUD_REQ_SET_STATE_COMMIT			0x62
326*40e1a70bSNoralf Trønnes 
327*40e1a70bSNoralf Trønnes /* Enable/disable the display controller, value is u8: 0/1 */
328*40e1a70bSNoralf Trønnes #define GUD_REQ_SET_CONTROLLER_ENABLE			0x63
329*40e1a70bSNoralf Trønnes 
330*40e1a70bSNoralf Trønnes /* Enable/disable display/output (DPMS), value is u8: 0/1 */
331*40e1a70bSNoralf Trønnes #define GUD_REQ_SET_DISPLAY_ENABLE			0x64
332*40e1a70bSNoralf Trønnes 
333*40e1a70bSNoralf Trønnes #endif
334