1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #define MIPI_DSI_DT_VSYNC_START                 (0x01)
8 #define MIPI_DSI_DT_VSYNC_END                   (0x11)
9 #define MIPI_DSI_DT_HSYNC_START                 (0x21)
10 #define MIPI_DSI_DT_HSYNC_END                   (0x31)
11 #define MIPI_DSI_DT_EOTP                        (0x08)
12 #define MIPI_DSI_DT_COLOR_MODE_OFF              (0x02)
13 #define MIPI_DSI_DT_COLOR_MODE_ON               (0x12)
14 #define MIPI_DSI_DT_PERI_CMD_OFF                (0x22)
15 #define MIPI_DSI_DT_PERI_CMD_ON                 (0x32)
16 #define MIPI_DSI_DT_GEN_SHORT_WRITE_0           (0x03)
17 #define MIPI_DSI_DT_GEN_SHORT_WRITE_1           (0x13)
18 #define MIPI_DSI_DT_GEN_SHORT_WRITE_2           (0x23)
19 #define MIPI_DSI_DT_GEN_SHORT_READ_0            (0x04)
20 #define MIPI_DSI_DT_GEN_SHORT_READ_1            (0x14)
21 #define MIPI_DSI_DT_GEN_SHORT_READ_2            (0x24)
22 #define MIPI_DSI_DT_DCS_SHORT_WRITE_0           (0x05)
23 #define MIPI_DSI_DT_DCS_SHORT_WRITE_1           (0x15)
24 #define MIPI_DSI_DT_DCS_READ_0                  (0x06)
25 #define MIPI_DSI_DT_SET_MAX_RET_PKT             (0x37)
26 #define MIPI_DSI_DT_NULL_PKT                    (0x09)
27 #define MIPI_DSI_DT_BLAKING_PKT                 (0x19)
28 #define MIPI_DSI_DT_GEN_LONG_WRITE              (0x29)
29 #define MIPI_DSI_DT_DCS_LONG_WRITE              (0x39)
30 #define MIPI_DSI_DT_YCbCr_422_20BIT             (0x0C)
31 #define MIPI_DSI_DT_YCbCr_422_24BIT             (0x1C)
32 #define MIPI_DSI_DT_YCbCr_422_16BIT             (0x2C)
33 #define MIPI_DSI_DT_RGB_101010                  (0x0D)
34 #define MIPI_DSI_DT_RGB_121212                  (0x1D)
35 #define MIPI_DSI_DT_YCbCr_420_12BIT             (0x3D)
36 #define MIPI_DSI_DT_RGB_565                     (0x0E)
37 #define MIPI_DSI_DT_RGB_666                     (0x1E)
38 #define MIPI_DSI_DT_RGB_666_L                   (0x2E)
39 #define MIPI_DSI_DT_RGB_888                     (0x3E)
40 #define MIPI_DSI_DT_UNKNOWN                     (0xFF)
41 
42 #define MIPI_DSI_NO_ACK                         (0)
43 #define MIPI_DSI_ACK                            (1)
44 
45 #define VIDEO_MODE                              (0)
46 #define COMMAND_MODE                            (1)
47 
48 #define COMMAND_GEN                             (0)
49 #define COMMAND_DCS                             (1)
50 
51 // MipiDsiCmd flag bit def
52 #define MIPI_DSI_CMD_FLAGS_ACK                  (1 << 0)
53 #define MIPI_DSI_CMD_FLAGS_SET_MAX              (1 << 1)
54 
55 // This is the generic MIPI-DSI comomand structure that
56 // can be used as a IP-independent driver
57 struct MipiDsiCmd {
58     uint8_t             virt_chn_id;
59     uint8_t             dsi_data_type;
60 
61     // TX Direction
62     size_t              pld_size;
63     const uint8_t*      pld_data;
64 
65     // RX Direction
66     size_t              rsp_size;
67     uint8_t*            rsp_data;
68 
69     uint32_t            flags;
70 };
71