162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Defines for Mobile Industry Processor Interface (MIPI(R))
462306a36Sopenharmony_ci * Display Working Group standards: DSI, DCS, DBI, DPI
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
762306a36Sopenharmony_ci * Copyright (C) 2006 Nokia Corporation
862306a36Sopenharmony_ci * Author: Imre Deak <imre.deak@nokia.com>
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#ifndef MIPI_DISPLAY_H
1162306a36Sopenharmony_ci#define MIPI_DISPLAY_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/* MIPI DSI Processor-to-Peripheral transaction types */
1462306a36Sopenharmony_cienum {
1562306a36Sopenharmony_ci	MIPI_DSI_V_SYNC_START				= 0x01,
1662306a36Sopenharmony_ci	MIPI_DSI_V_SYNC_END				= 0x11,
1762306a36Sopenharmony_ci	MIPI_DSI_H_SYNC_START				= 0x21,
1862306a36Sopenharmony_ci	MIPI_DSI_H_SYNC_END				= 0x31,
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci	MIPI_DSI_COMPRESSION_MODE			= 0x07,
2162306a36Sopenharmony_ci	MIPI_DSI_END_OF_TRANSMISSION			= 0x08,
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	MIPI_DSI_COLOR_MODE_OFF				= 0x02,
2462306a36Sopenharmony_ci	MIPI_DSI_COLOR_MODE_ON				= 0x12,
2562306a36Sopenharmony_ci	MIPI_DSI_SHUTDOWN_PERIPHERAL			= 0x22,
2662306a36Sopenharmony_ci	MIPI_DSI_TURN_ON_PERIPHERAL			= 0x32,
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM		= 0x03,
2962306a36Sopenharmony_ci	MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM		= 0x13,
3062306a36Sopenharmony_ci	MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM		= 0x23,
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci	MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM		= 0x04,
3362306a36Sopenharmony_ci	MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM		= 0x14,
3462306a36Sopenharmony_ci	MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM		= 0x24,
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	MIPI_DSI_DCS_SHORT_WRITE			= 0x05,
3762306a36Sopenharmony_ci	MIPI_DSI_DCS_SHORT_WRITE_PARAM			= 0x15,
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	MIPI_DSI_DCS_READ				= 0x06,
4062306a36Sopenharmony_ci	MIPI_DSI_EXECUTE_QUEUE				= 0x16,
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE		= 0x37,
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci	MIPI_DSI_NULL_PACKET				= 0x09,
4562306a36Sopenharmony_ci	MIPI_DSI_BLANKING_PACKET			= 0x19,
4662306a36Sopenharmony_ci	MIPI_DSI_GENERIC_LONG_WRITE			= 0x29,
4762306a36Sopenharmony_ci	MIPI_DSI_DCS_LONG_WRITE				= 0x39,
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci	MIPI_DSI_PICTURE_PARAMETER_SET			= 0x0a,
5062306a36Sopenharmony_ci	MIPI_DSI_COMPRESSED_PIXEL_STREAM		= 0x0b,
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20	= 0x0c,
5362306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24		= 0x1c,
5462306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16		= 0x2c,
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_30			= 0x0d,
5762306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_36			= 0x1d,
5862306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12		= 0x3d,
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_16			= 0x0e,
6162306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_18			= 0x1e,
6262306a36Sopenharmony_ci	MIPI_DSI_PIXEL_STREAM_3BYTE_18			= 0x2e,
6362306a36Sopenharmony_ci	MIPI_DSI_PACKED_PIXEL_STREAM_24			= 0x3e,
6462306a36Sopenharmony_ci};
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/* MIPI DSI Peripheral-to-Processor transaction types */
6762306a36Sopenharmony_cienum {
6862306a36Sopenharmony_ci	MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT	= 0x02,
6962306a36Sopenharmony_ci	MIPI_DSI_RX_END_OF_TRANSMISSION			= 0x08,
7062306a36Sopenharmony_ci	MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE	= 0x11,
7162306a36Sopenharmony_ci	MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE	= 0x12,
7262306a36Sopenharmony_ci	MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE		= 0x1a,
7362306a36Sopenharmony_ci	MIPI_DSI_RX_DCS_LONG_READ_RESPONSE		= 0x1c,
7462306a36Sopenharmony_ci	MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE	= 0x21,
7562306a36Sopenharmony_ci	MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE	= 0x22,
7662306a36Sopenharmony_ci};
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci/* MIPI DCS commands */
7962306a36Sopenharmony_cienum {
8062306a36Sopenharmony_ci	MIPI_DCS_NOP			= 0x00,
8162306a36Sopenharmony_ci	MIPI_DCS_SOFT_RESET		= 0x01,
8262306a36Sopenharmony_ci	MIPI_DCS_GET_COMPRESSION_MODE	= 0x03,
8362306a36Sopenharmony_ci	MIPI_DCS_GET_DISPLAY_ID		= 0x04,
8462306a36Sopenharmony_ci	MIPI_DCS_GET_ERROR_COUNT_ON_DSI	= 0x05,
8562306a36Sopenharmony_ci	MIPI_DCS_GET_RED_CHANNEL	= 0x06,
8662306a36Sopenharmony_ci	MIPI_DCS_GET_GREEN_CHANNEL	= 0x07,
8762306a36Sopenharmony_ci	MIPI_DCS_GET_BLUE_CHANNEL	= 0x08,
8862306a36Sopenharmony_ci	MIPI_DCS_GET_DISPLAY_STATUS	= 0x09,
8962306a36Sopenharmony_ci	MIPI_DCS_GET_POWER_MODE		= 0x0A,
9062306a36Sopenharmony_ci	MIPI_DCS_GET_ADDRESS_MODE	= 0x0B,
9162306a36Sopenharmony_ci	MIPI_DCS_GET_PIXEL_FORMAT	= 0x0C,
9262306a36Sopenharmony_ci	MIPI_DCS_GET_DISPLAY_MODE	= 0x0D,
9362306a36Sopenharmony_ci	MIPI_DCS_GET_SIGNAL_MODE	= 0x0E,
9462306a36Sopenharmony_ci	MIPI_DCS_GET_DIAGNOSTIC_RESULT	= 0x0F,
9562306a36Sopenharmony_ci	MIPI_DCS_ENTER_SLEEP_MODE	= 0x10,
9662306a36Sopenharmony_ci	MIPI_DCS_EXIT_SLEEP_MODE	= 0x11,
9762306a36Sopenharmony_ci	MIPI_DCS_ENTER_PARTIAL_MODE	= 0x12,
9862306a36Sopenharmony_ci	MIPI_DCS_ENTER_NORMAL_MODE	= 0x13,
9962306a36Sopenharmony_ci	MIPI_DCS_GET_IMAGE_CHECKSUM_RGB	= 0x14,
10062306a36Sopenharmony_ci	MIPI_DCS_GET_IMAGE_CHECKSUM_CT	= 0x15,
10162306a36Sopenharmony_ci	MIPI_DCS_EXIT_INVERT_MODE	= 0x20,
10262306a36Sopenharmony_ci	MIPI_DCS_ENTER_INVERT_MODE	= 0x21,
10362306a36Sopenharmony_ci	MIPI_DCS_SET_GAMMA_CURVE	= 0x26,
10462306a36Sopenharmony_ci	MIPI_DCS_SET_DISPLAY_OFF	= 0x28,
10562306a36Sopenharmony_ci	MIPI_DCS_SET_DISPLAY_ON		= 0x29,
10662306a36Sopenharmony_ci	MIPI_DCS_SET_COLUMN_ADDRESS	= 0x2A,
10762306a36Sopenharmony_ci	MIPI_DCS_SET_PAGE_ADDRESS	= 0x2B,
10862306a36Sopenharmony_ci	MIPI_DCS_WRITE_MEMORY_START	= 0x2C,
10962306a36Sopenharmony_ci	MIPI_DCS_WRITE_LUT		= 0x2D,
11062306a36Sopenharmony_ci	MIPI_DCS_READ_MEMORY_START	= 0x2E,
11162306a36Sopenharmony_ci	MIPI_DCS_SET_PARTIAL_ROWS	= 0x30,		/* MIPI DCS 1.02 - MIPI_DCS_SET_PARTIAL_AREA before that */
11262306a36Sopenharmony_ci	MIPI_DCS_SET_PARTIAL_COLUMNS	= 0x31,
11362306a36Sopenharmony_ci	MIPI_DCS_SET_SCROLL_AREA	= 0x33,
11462306a36Sopenharmony_ci	MIPI_DCS_SET_TEAR_OFF		= 0x34,
11562306a36Sopenharmony_ci	MIPI_DCS_SET_TEAR_ON		= 0x35,
11662306a36Sopenharmony_ci	MIPI_DCS_SET_ADDRESS_MODE	= 0x36,
11762306a36Sopenharmony_ci	MIPI_DCS_SET_SCROLL_START	= 0x37,
11862306a36Sopenharmony_ci	MIPI_DCS_EXIT_IDLE_MODE		= 0x38,
11962306a36Sopenharmony_ci	MIPI_DCS_ENTER_IDLE_MODE	= 0x39,
12062306a36Sopenharmony_ci	MIPI_DCS_SET_PIXEL_FORMAT	= 0x3A,
12162306a36Sopenharmony_ci	MIPI_DCS_WRITE_MEMORY_CONTINUE	= 0x3C,
12262306a36Sopenharmony_ci	MIPI_DCS_SET_3D_CONTROL		= 0x3D,
12362306a36Sopenharmony_ci	MIPI_DCS_READ_MEMORY_CONTINUE	= 0x3E,
12462306a36Sopenharmony_ci	MIPI_DCS_GET_3D_CONTROL		= 0x3F,
12562306a36Sopenharmony_ci	MIPI_DCS_SET_VSYNC_TIMING	= 0x40,
12662306a36Sopenharmony_ci	MIPI_DCS_SET_TEAR_SCANLINE	= 0x44,
12762306a36Sopenharmony_ci	MIPI_DCS_GET_SCANLINE		= 0x45,
12862306a36Sopenharmony_ci	MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 0x51,		/* MIPI DCS 1.3 */
12962306a36Sopenharmony_ci	MIPI_DCS_GET_DISPLAY_BRIGHTNESS = 0x52,		/* MIPI DCS 1.3 */
13062306a36Sopenharmony_ci	MIPI_DCS_WRITE_CONTROL_DISPLAY  = 0x53,		/* MIPI DCS 1.3 */
13162306a36Sopenharmony_ci	MIPI_DCS_GET_CONTROL_DISPLAY	= 0x54,		/* MIPI DCS 1.3 */
13262306a36Sopenharmony_ci	MIPI_DCS_WRITE_POWER_SAVE	= 0x55,		/* MIPI DCS 1.3 */
13362306a36Sopenharmony_ci	MIPI_DCS_GET_POWER_SAVE		= 0x56,		/* MIPI DCS 1.3 */
13462306a36Sopenharmony_ci	MIPI_DCS_SET_CABC_MIN_BRIGHTNESS = 0x5E,	/* MIPI DCS 1.3 */
13562306a36Sopenharmony_ci	MIPI_DCS_GET_CABC_MIN_BRIGHTNESS = 0x5F,	/* MIPI DCS 1.3 */
13662306a36Sopenharmony_ci	MIPI_DCS_READ_DDB_START		= 0xA1,
13762306a36Sopenharmony_ci	MIPI_DCS_READ_PPS_START		= 0xA2,
13862306a36Sopenharmony_ci	MIPI_DCS_READ_DDB_CONTINUE	= 0xA8,
13962306a36Sopenharmony_ci	MIPI_DCS_READ_PPS_CONTINUE	= 0xA9,
14062306a36Sopenharmony_ci};
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci/* MIPI DCS pixel formats */
14362306a36Sopenharmony_ci#define MIPI_DCS_PIXEL_FMT_24BIT	7
14462306a36Sopenharmony_ci#define MIPI_DCS_PIXEL_FMT_18BIT	6
14562306a36Sopenharmony_ci#define MIPI_DCS_PIXEL_FMT_16BIT	5
14662306a36Sopenharmony_ci#define MIPI_DCS_PIXEL_FMT_12BIT	3
14762306a36Sopenharmony_ci#define MIPI_DCS_PIXEL_FMT_8BIT		2
14862306a36Sopenharmony_ci#define MIPI_DCS_PIXEL_FMT_3BIT		1
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci#endif
151