xref: /linux/include/drm/gud.h (revision 83d7b6d5)
140e1a70bSNoralf Trønnes /* SPDX-License-Identifier: MIT */
240e1a70bSNoralf Trønnes /*
340e1a70bSNoralf Trønnes  * Copyright 2020 Noralf Trønnes
440e1a70bSNoralf Trønnes  */
540e1a70bSNoralf Trønnes 
640e1a70bSNoralf Trønnes #ifndef __LINUX_GUD_H
740e1a70bSNoralf Trønnes #define __LINUX_GUD_H
840e1a70bSNoralf Trønnes 
940e1a70bSNoralf Trønnes #include <linux/types.h>
1040e1a70bSNoralf Trønnes 
1140e1a70bSNoralf Trønnes /*
1240e1a70bSNoralf Trønnes  * struct gud_display_descriptor_req - Display descriptor
1340e1a70bSNoralf Trønnes  * @magic: Magic value GUD_DISPLAY_MAGIC
1440e1a70bSNoralf Trønnes  * @version: Protocol version
1540e1a70bSNoralf Trønnes  * @flags: Flags
1640e1a70bSNoralf Trønnes  *         - STATUS_ON_SET: Always do a status request after a SET request.
1740e1a70bSNoralf Trønnes  *                          This is used by the Linux gadget driver since it has
1840e1a70bSNoralf Trønnes  *                          no way to control the status stage of a control OUT
1940e1a70bSNoralf Trønnes  *                          request that has a payload.
2040e1a70bSNoralf Trønnes  *         - FULL_UPDATE:   Always send the entire framebuffer when flushing changes.
2140e1a70bSNoralf Trønnes  *                          The GUD_REQ_SET_BUFFER request will not be sent
2240e1a70bSNoralf Trønnes  *                          before each bulk transfer, it will only be sent if the
2340e1a70bSNoralf Trønnes  *                          previous bulk transfer had failed. This gives the device
2440e1a70bSNoralf Trønnes  *                          a chance to reset its state machine if needed.
2540e1a70bSNoralf Trønnes  *                          This flag can not be used in combination with compression.
2640e1a70bSNoralf Trønnes  * @compression: Supported compression types
2740e1a70bSNoralf Trønnes  *               - GUD_COMPRESSION_LZ4: LZ4 lossless compression.
2840e1a70bSNoralf Trønnes  * @max_buffer_size: Maximum buffer size the device can handle (optional).
2940e1a70bSNoralf Trønnes  *                   This is useful for devices that don't have a big enough
3040e1a70bSNoralf Trønnes  *                   buffer to decompress the entire framebuffer in one go.
3140e1a70bSNoralf Trønnes  * @min_width: Minimum pixel width the controller can handle
3240e1a70bSNoralf Trønnes  * @max_width: Maximum width
3340e1a70bSNoralf Trønnes  * @min_height: Minimum height
3440e1a70bSNoralf Trønnes  * @max_height: Maximum height
3540e1a70bSNoralf Trønnes  *
3640e1a70bSNoralf Trønnes  * Devices that have only one display mode will have min_width == max_width
3740e1a70bSNoralf Trønnes  * and min_height == max_height.
3840e1a70bSNoralf Trønnes  */
3940e1a70bSNoralf Trønnes struct gud_display_descriptor_req {
4040e1a70bSNoralf Trønnes 	__le32 magic;
4140e1a70bSNoralf Trønnes #define GUD_DISPLAY_MAGIC			0x1d50614d
4240e1a70bSNoralf Trønnes 	__u8 version;
4340e1a70bSNoralf Trønnes 	__le32 flags;
4440e1a70bSNoralf Trønnes #define GUD_DISPLAY_FLAG_STATUS_ON_SET		BIT(0)
4540e1a70bSNoralf Trønnes #define GUD_DISPLAY_FLAG_FULL_UPDATE		BIT(1)
4640e1a70bSNoralf Trønnes 	__u8 compression;
4740e1a70bSNoralf Trønnes #define GUD_COMPRESSION_LZ4			BIT(0)
4840e1a70bSNoralf Trønnes 	__le32 max_buffer_size;
4940e1a70bSNoralf Trønnes 	__le32 min_width;
5040e1a70bSNoralf Trønnes 	__le32 max_width;
5140e1a70bSNoralf Trønnes 	__le32 min_height;
5240e1a70bSNoralf Trønnes 	__le32 max_height;
5340e1a70bSNoralf Trønnes } __packed;
5440e1a70bSNoralf Trønnes 
5540e1a70bSNoralf Trønnes /*
5640e1a70bSNoralf Trønnes  * struct gud_property_req - Property
5740e1a70bSNoralf Trønnes  * @prop: Property
5840e1a70bSNoralf Trønnes  * @val: Value
5940e1a70bSNoralf Trønnes  */
6040e1a70bSNoralf Trønnes struct gud_property_req {
6140e1a70bSNoralf Trønnes 	__le16 prop;
6240e1a70bSNoralf Trønnes 	__le64 val;
6340e1a70bSNoralf Trønnes } __packed;
6440e1a70bSNoralf Trønnes 
6540e1a70bSNoralf Trønnes /*
6640e1a70bSNoralf Trønnes  * struct gud_display_mode_req - Display mode
6740e1a70bSNoralf Trønnes  * @clock: Pixel clock in kHz
6840e1a70bSNoralf Trønnes  * @hdisplay: Horizontal display size
6940e1a70bSNoralf Trønnes  * @hsync_start: Horizontal sync start
7040e1a70bSNoralf Trønnes  * @hsync_end: Horizontal sync end
7140e1a70bSNoralf Trønnes  * @htotal: Horizontal total size
7240e1a70bSNoralf Trønnes  * @vdisplay: Vertical display size
7340e1a70bSNoralf Trønnes  * @vsync_start: Vertical sync start
7440e1a70bSNoralf Trønnes  * @vsync_end: Vertical sync end
7540e1a70bSNoralf Trønnes  * @vtotal: Vertical total size
7640e1a70bSNoralf Trønnes  * @flags: Bits 0-13 are the same as in the RandR protocol and also what DRM uses.
7740e1a70bSNoralf Trønnes  *         The deprecated bits are reused for internal protocol flags leaving us
7840e1a70bSNoralf Trønnes  *         free to follow DRM for the other bits in the future.
7940e1a70bSNoralf Trønnes  *         - FLAG_PREFERRED: Set on the preferred display mode.
8040e1a70bSNoralf Trønnes  */
8140e1a70bSNoralf Trønnes struct gud_display_mode_req {
8240e1a70bSNoralf Trønnes 	__le32 clock;
8340e1a70bSNoralf Trønnes 	__le16 hdisplay;
8440e1a70bSNoralf Trønnes 	__le16 hsync_start;
8540e1a70bSNoralf Trønnes 	__le16 hsync_end;
8640e1a70bSNoralf Trønnes 	__le16 htotal;
8740e1a70bSNoralf Trønnes 	__le16 vdisplay;
8840e1a70bSNoralf Trønnes 	__le16 vsync_start;
8940e1a70bSNoralf Trønnes 	__le16 vsync_end;
9040e1a70bSNoralf Trønnes 	__le16 vtotal;
9140e1a70bSNoralf Trønnes 	__le32 flags;
9240e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PHSYNC		BIT(0)
9340e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_NHSYNC		BIT(1)
9440e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PVSYNC		BIT(2)
9540e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_NVSYNC		BIT(3)
9640e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_INTERLACE		BIT(4)
9740e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_DBLSCAN		BIT(5)
9840e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_CSYNC		BIT(6)
9940e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PCSYNC		BIT(7)
10040e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_NCSYNC		BIT(8)
10140e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_HSKEW		BIT(9)
10240e1a70bSNoralf Trønnes /* BCast and PixelMultiplex are deprecated */
10340e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_DBLCLK		BIT(12)
10440e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_CLKDIV2		BIT(13)
10540e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_USER_MASK		\
10640e1a70bSNoralf Trønnes 		(GUD_DISPLAY_MODE_FLAG_PHSYNC | GUD_DISPLAY_MODE_FLAG_NHSYNC | \
10740e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_PVSYNC | GUD_DISPLAY_MODE_FLAG_NVSYNC | \
10840e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_INTERLACE | GUD_DISPLAY_MODE_FLAG_DBLSCAN | \
10940e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_CSYNC | GUD_DISPLAY_MODE_FLAG_PCSYNC | \
11040e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_NCSYNC | GUD_DISPLAY_MODE_FLAG_HSKEW | \
11140e1a70bSNoralf Trønnes 		GUD_DISPLAY_MODE_FLAG_DBLCLK | GUD_DISPLAY_MODE_FLAG_CLKDIV2)
11240e1a70bSNoralf Trønnes /* Internal protocol flags */
11340e1a70bSNoralf Trønnes #define GUD_DISPLAY_MODE_FLAG_PREFERRED		BIT(10)
11440e1a70bSNoralf Trønnes } __packed;
11540e1a70bSNoralf Trønnes 
11640e1a70bSNoralf Trønnes /*
11740e1a70bSNoralf Trønnes  * struct gud_connector_descriptor_req - Connector descriptor
11840e1a70bSNoralf Trønnes  * @connector_type: Connector type (GUD_CONNECTOR_TYPE_*).
11940e1a70bSNoralf Trønnes  *                  If the host doesn't support the type it should fall back to PANEL.
12040e1a70bSNoralf Trønnes  * @flags: Flags
12140e1a70bSNoralf Trønnes  *         - POLL_STATUS: Connector status can change (polled every 10 seconds)
12240e1a70bSNoralf Trønnes  *         - INTERLACE: Interlaced modes are supported
12340e1a70bSNoralf Trønnes  *         - DOUBLESCAN: Doublescan modes are supported
12440e1a70bSNoralf Trønnes  */
12540e1a70bSNoralf Trønnes struct gud_connector_descriptor_req {
12640e1a70bSNoralf Trønnes 	__u8 connector_type;
12740e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_PANEL		0
12840e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_VGA			1
12940e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_COMPOSITE		2
13040e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_SVIDEO		3
13140e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_COMPONENT		4
13240e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_DVI			5
13340e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_DISPLAYPORT		6
13440e1a70bSNoralf Trønnes #define GUD_CONNECTOR_TYPE_HDMI			7
13540e1a70bSNoralf Trønnes 	__le32 flags;
13640e1a70bSNoralf Trønnes #define GUD_CONNECTOR_FLAGS_POLL_STATUS		BIT(0)
13740e1a70bSNoralf Trønnes #define GUD_CONNECTOR_FLAGS_INTERLACE		BIT(1)
13840e1a70bSNoralf Trønnes #define GUD_CONNECTOR_FLAGS_DOUBLESCAN		BIT(2)
13940e1a70bSNoralf Trønnes } __packed;
14040e1a70bSNoralf Trønnes 
14140e1a70bSNoralf Trønnes /*
14240e1a70bSNoralf Trønnes  * struct gud_set_buffer_req - Set buffer transfer info
14340e1a70bSNoralf Trønnes  * @x: X position of rectangle
14440e1a70bSNoralf Trønnes  * @y: Y position
14540e1a70bSNoralf Trønnes  * @width: Pixel width of rectangle
14640e1a70bSNoralf Trønnes  * @height: Pixel height
14740e1a70bSNoralf Trønnes  * @length: Buffer length in bytes
14840e1a70bSNoralf Trønnes  * @compression: Transfer compression
14940e1a70bSNoralf Trønnes  * @compressed_length: Compressed buffer length
15040e1a70bSNoralf Trønnes  *
15140e1a70bSNoralf Trønnes  * This request is issued right before the bulk transfer.
15240e1a70bSNoralf Trønnes  * @x, @y, @width and @height specifies the rectangle where the buffer should be
15340e1a70bSNoralf Trønnes  * placed inside the framebuffer.
15440e1a70bSNoralf Trønnes  */
15540e1a70bSNoralf Trønnes struct gud_set_buffer_req {
15640e1a70bSNoralf Trønnes 	__le32 x;
15740e1a70bSNoralf Trønnes 	__le32 y;
15840e1a70bSNoralf Trønnes 	__le32 width;
15940e1a70bSNoralf Trønnes 	__le32 height;
16040e1a70bSNoralf Trønnes 	__le32 length;
16140e1a70bSNoralf Trønnes 	__u8 compression;
16240e1a70bSNoralf Trønnes 	__le32 compressed_length;
16340e1a70bSNoralf Trønnes } __packed;
16440e1a70bSNoralf Trønnes 
16540e1a70bSNoralf Trønnes /*
16640e1a70bSNoralf Trønnes  * struct gud_state_req - Display state
16740e1a70bSNoralf Trønnes  * @mode: Display mode
16840e1a70bSNoralf Trønnes  * @format: Pixel format GUD_PIXEL_FORMAT_*
16940e1a70bSNoralf Trønnes  * @connector: Connector index
17040e1a70bSNoralf Trønnes  * @properties: Array of properties
17140e1a70bSNoralf Trønnes  *
17240e1a70bSNoralf Trønnes  * The entire state is transferred each time there's a change.
17340e1a70bSNoralf Trønnes  */
17440e1a70bSNoralf Trønnes struct gud_state_req {
17540e1a70bSNoralf Trønnes 	struct gud_display_mode_req mode;
17640e1a70bSNoralf Trønnes 	__u8 format;
17740e1a70bSNoralf Trønnes 	__u8 connector;
17840e1a70bSNoralf Trønnes 	struct gud_property_req properties[];
17940e1a70bSNoralf Trønnes } __packed;
18040e1a70bSNoralf Trønnes 
18140e1a70bSNoralf Trønnes /* List of supported connector properties: */
18240e1a70bSNoralf Trønnes 
18340e1a70bSNoralf Trønnes /* Margins in pixels to deal with overscan, range 0-100 */
18440e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_LEFT_MARGIN			1
18540e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_RIGHT_MARGIN			2
18640e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_TOP_MARGIN			3
18740e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_BOTTOM_MARGIN			4
18840e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_MODE				5
18940e1a70bSNoralf Trønnes /* Brightness in percent, range 0-100 */
19040e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_BRIGHTNESS			6
19140e1a70bSNoralf Trønnes /* Contrast in percent, range 0-100 */
19240e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_CONTRAST			7
19340e1a70bSNoralf Trønnes /* Flicker reduction in percent, range 0-100 */
19440e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_FLICKER_REDUCTION		8
19540e1a70bSNoralf Trønnes /* Overscan in percent, range 0-100 */
19640e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_OVERSCAN			9
19740e1a70bSNoralf Trønnes /* Saturation in percent, range 0-100 */
19840e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_SATURATION			10
19940e1a70bSNoralf Trønnes /* Hue in percent, range 0-100 */
20040e1a70bSNoralf Trønnes #define GUD_PROPERTY_TV_HUE				11
20140e1a70bSNoralf Trønnes 
20240e1a70bSNoralf Trønnes /*
20340e1a70bSNoralf Trønnes  * Backlight brightness is in the range 0-100 inclusive. The value represents the human perceptual
20440e1a70bSNoralf Trønnes  * brightness and not a linear PWM value. 0 is minimum brightness which should not turn the
20540e1a70bSNoralf Trønnes  * backlight completely off. The DPMS connector property should be used to control power which will
20640e1a70bSNoralf Trønnes  * trigger a GUD_REQ_SET_DISPLAY_ENABLE request.
20740e1a70bSNoralf Trønnes  *
20840e1a70bSNoralf Trønnes  * This does not map to a DRM property, it is used with the backlight device.
20940e1a70bSNoralf Trønnes  */
21040e1a70bSNoralf Trønnes #define GUD_PROPERTY_BACKLIGHT_BRIGHTNESS		12
21140e1a70bSNoralf Trønnes 
21240e1a70bSNoralf Trønnes /* List of supported properties that are not connector propeties: */
21340e1a70bSNoralf Trønnes 
21440e1a70bSNoralf Trønnes /*
21540e1a70bSNoralf Trønnes  * Plane rotation. Should return the supported bitmask on
21640e1a70bSNoralf Trønnes  * GUD_REQ_GET_PROPERTIES. GUD_ROTATION_0 is mandatory.
21740e1a70bSNoralf Trønnes  *
21840e1a70bSNoralf Trønnes  * Note: This is not display rotation so 90/270 will need scaling to make it fit (unless squared).
21940e1a70bSNoralf Trønnes  */
22040e1a70bSNoralf Trønnes #define GUD_PROPERTY_ROTATION				50
22140e1a70bSNoralf Trønnes   #define GUD_ROTATION_0			BIT(0)
22240e1a70bSNoralf Trønnes   #define GUD_ROTATION_90			BIT(1)
22340e1a70bSNoralf Trønnes   #define GUD_ROTATION_180			BIT(2)
22440e1a70bSNoralf Trønnes   #define GUD_ROTATION_270			BIT(3)
22540e1a70bSNoralf Trønnes   #define GUD_ROTATION_REFLECT_X		BIT(4)
22640e1a70bSNoralf Trønnes   #define GUD_ROTATION_REFLECT_Y		BIT(5)
22740e1a70bSNoralf Trønnes   #define GUD_ROTATION_MASK			(GUD_ROTATION_0 | GUD_ROTATION_90 | \
22840e1a70bSNoralf Trønnes 						GUD_ROTATION_180 | GUD_ROTATION_270 | \
22940e1a70bSNoralf Trønnes 						GUD_ROTATION_REFLECT_X | GUD_ROTATION_REFLECT_Y)
23040e1a70bSNoralf Trønnes 
23140e1a70bSNoralf Trønnes /* USB Control requests: */
23240e1a70bSNoralf Trønnes 
23340e1a70bSNoralf Trønnes /* Get status from the last GET/SET control request. Value is u8. */
23440e1a70bSNoralf Trønnes #define GUD_REQ_GET_STATUS				0x00
23540e1a70bSNoralf Trønnes   /* Status values: */
23640e1a70bSNoralf Trønnes   #define GUD_STATUS_OK				0x00
23740e1a70bSNoralf Trønnes   #define GUD_STATUS_BUSY			0x01
23840e1a70bSNoralf Trønnes   #define GUD_STATUS_REQUEST_NOT_SUPPORTED	0x02
23940e1a70bSNoralf Trønnes   #define GUD_STATUS_PROTOCOL_ERROR		0x03
24040e1a70bSNoralf Trønnes   #define GUD_STATUS_INVALID_PARAMETER		0x04
24140e1a70bSNoralf Trønnes   #define GUD_STATUS_ERROR			0x05
24240e1a70bSNoralf Trønnes 
24340e1a70bSNoralf Trønnes /* Get display descriptor as a &gud_display_descriptor_req */
24440e1a70bSNoralf Trønnes #define GUD_REQ_GET_DESCRIPTOR				0x01
24540e1a70bSNoralf Trønnes 
24640e1a70bSNoralf Trønnes /* Get supported pixel formats as a byte array of GUD_PIXEL_FORMAT_* */
24740e1a70bSNoralf Trønnes #define GUD_REQ_GET_FORMATS				0x40
24840e1a70bSNoralf Trønnes   #define GUD_FORMATS_MAX_NUM			32
2494cabfedcSNoralf Trønnes   #define GUD_PIXEL_FORMAT_R1			0x01 /* 1-bit monochrome */
2504cabfedcSNoralf Trønnes   #define GUD_PIXEL_FORMAT_R8			0x08 /* 8-bit greyscale */
25140e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_XRGB1111		0x20
2521f25d005SNoralf Trønnes   #define GUD_PIXEL_FORMAT_RGB332		0x30
25340e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_RGB565		0x40
254*83d7b6d5SNoralf Trønnes   #define GUD_PIXEL_FORMAT_RGB888		0x50
25540e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_XRGB8888		0x80
25640e1a70bSNoralf Trønnes   #define GUD_PIXEL_FORMAT_ARGB8888		0x81
25740e1a70bSNoralf Trønnes 
25840e1a70bSNoralf Trønnes /*
25940e1a70bSNoralf Trønnes  * Get supported properties that are not connector propeties as a &gud_property_req array.
26040e1a70bSNoralf Trønnes  * gud_property_req.val often contains the initial value for the property.
26140e1a70bSNoralf Trønnes  */
26240e1a70bSNoralf Trønnes #define GUD_REQ_GET_PROPERTIES				0x41
26340e1a70bSNoralf Trønnes   #define GUD_PROPERTIES_MAX_NUM		32
26440e1a70bSNoralf Trønnes 
26540e1a70bSNoralf Trønnes /* Connector requests have the connector index passed in the wValue field */
26640e1a70bSNoralf Trønnes 
26740e1a70bSNoralf Trønnes /* Get connector descriptors as an array of &gud_connector_descriptor_req */
26840e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTORS				0x50
26940e1a70bSNoralf Trønnes   #define GUD_CONNECTORS_MAX_NUM		32
27040e1a70bSNoralf Trønnes 
27140e1a70bSNoralf Trønnes /*
27240e1a70bSNoralf Trønnes  * Get properties supported by the connector as a &gud_property_req array.
27340e1a70bSNoralf Trønnes  * gud_property_req.val often contains the initial value for the property.
27440e1a70bSNoralf Trønnes  */
27540e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_PROPERTIES		0x51
27640e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_PROPERTIES_MAX_NUM	32
27740e1a70bSNoralf Trønnes 
27840e1a70bSNoralf Trønnes /*
27940e1a70bSNoralf Trønnes  * Issued when there's a TV_MODE property present.
28040e1a70bSNoralf Trønnes  * Gets an array of the supported TV_MODE names each entry of length
28140e1a70bSNoralf Trønnes  * GUD_CONNECTOR_TV_MODE_NAME_LEN. Names must be NUL-terminated.
28240e1a70bSNoralf Trønnes  */
28340e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_TV_MODE_VALUES		0x52
28440e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_TV_MODE_NAME_LEN	16
28540e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_TV_MODE_MAX_NUM		16
28640e1a70bSNoralf Trønnes 
28740e1a70bSNoralf Trønnes /* When userspace checks connector status, this is issued first, not used for poll requests. */
28840e1a70bSNoralf Trønnes #define GUD_REQ_SET_CONNECTOR_FORCE_DETECT		0x53
28940e1a70bSNoralf Trønnes 
29040e1a70bSNoralf Trønnes /*
29140e1a70bSNoralf Trønnes  * Get connector status. Value is u8.
29240e1a70bSNoralf Trønnes  *
29340e1a70bSNoralf Trønnes  * Userspace will get a HOTPLUG uevent if one of the following is true:
29440e1a70bSNoralf Trønnes  * - Connection status has changed since last
29540e1a70bSNoralf Trønnes  * - CHANGED is set
29640e1a70bSNoralf Trønnes  */
29740e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_STATUS			0x54
29840e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_DISCONNECTED	0x00
29940e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_CONNECTED	0x01
30040e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_UNKNOWN		0x02
30140e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_CONNECTED_MASK	0x03
30240e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_STATUS_CHANGED		BIT(7)
30340e1a70bSNoralf Trønnes 
30440e1a70bSNoralf Trønnes /*
30540e1a70bSNoralf Trønnes  * Display modes can be fetched as either EDID data or an array of &gud_display_mode_req.
30640e1a70bSNoralf Trønnes  *
30740e1a70bSNoralf Trønnes  * If GUD_REQ_GET_CONNECTOR_MODES returns zero, EDID is used to create display modes.
30840e1a70bSNoralf Trønnes  * If both display modes and EDID are returned, EDID is just passed on to userspace
30940e1a70bSNoralf Trønnes  * in the EDID connector property.
31040e1a70bSNoralf Trønnes  */
31140e1a70bSNoralf Trønnes 
31240e1a70bSNoralf Trønnes /* Get &gud_display_mode_req array of supported display modes */
31340e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_MODES			0x55
31440e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_MAX_NUM_MODES		128
31540e1a70bSNoralf Trønnes 
31640e1a70bSNoralf Trønnes /* Get Extended Display Identification Data */
31740e1a70bSNoralf Trønnes #define GUD_REQ_GET_CONNECTOR_EDID			0x56
31840e1a70bSNoralf Trønnes   #define GUD_CONNECTOR_MAX_EDID_LEN		2048
31940e1a70bSNoralf Trønnes 
32040e1a70bSNoralf Trønnes /* Set buffer properties before bulk transfer as &gud_set_buffer_req */
32140e1a70bSNoralf Trønnes #define GUD_REQ_SET_BUFFER				0x60
32240e1a70bSNoralf Trønnes 
32340e1a70bSNoralf Trønnes /* Check display configuration as &gud_state_req */
32440e1a70bSNoralf Trønnes #define GUD_REQ_SET_STATE_CHECK				0x61
32540e1a70bSNoralf Trønnes 
32640e1a70bSNoralf Trønnes /* Apply the previous STATE_CHECK configuration */
32740e1a70bSNoralf Trønnes #define GUD_REQ_SET_STATE_COMMIT			0x62
32840e1a70bSNoralf Trønnes 
32940e1a70bSNoralf Trønnes /* Enable/disable the display controller, value is u8: 0/1 */
33040e1a70bSNoralf Trønnes #define GUD_REQ_SET_CONTROLLER_ENABLE			0x63
33140e1a70bSNoralf Trønnes 
33240e1a70bSNoralf Trønnes /* Enable/disable display/output (DPMS), value is u8: 0/1 */
33340e1a70bSNoralf Trønnes #define GUD_REQ_SET_DISPLAY_ENABLE			0x64
33440e1a70bSNoralf Trønnes 
33540e1a70bSNoralf Trønnes #endif
336