blob: 814ea0e31a378572140b53d820dac7a7149a84d3 [file] [log] [blame]
Dima Zavin36785e32009-01-28 17:26:43 -08001/*
2 * Copyright (c) 2008, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifndef __PLATFORM_MSM7K_MDDI_HW_H
30#define __PLATFORM_MSM7K_MDDI_HW_H
31
32#define MSM_MDDI_BASE 0xAA600000
33
34/* see 80-VA736-2 C pp 776-787 */
35
36#define MDDI_REG(off) (MSM_MDDI_BASE + (off))
37
38#define MDDI_CMD MDDI_REG(0x0000)
39#define MDDI_VERSION MDDI_REG(0x0004)
40#define MDDI_PRI_PTR MDDI_REG(0x0008)
41#define MDDI_SEC_PTR MDDI_REG(0x000C)
42#define MDDI_BPS MDDI_REG(0x0010)
43#define MDDI_SPM MDDI_REG(0x0014)
44#define MDDI_INT MDDI_REG(0x0018)
45
46#define MDDI_INT_PRI_PTR_READ (1 << 0)
47#define MDDI_INT_SEC_PTR_READ (1 << 1)
48#define MDDI_INT_REV_DATA_AVAIL (1 << 2)
49#define MDDI_INT_DISP_REQ (1 << 3)
50#define MDDI_INT_PRI_UNDERFLOW (1 << 4)
51#define MDDI_INT_SEC_UNDERFLOW (1 << 5)
52#define MDDI_INT_REV_OVERFLOW (1 << 6)
53#define MDDI_INT_CRC_ERROR (1 << 7)
54#define MDDI_INT_MDDI_IN (1 << 8)
55#define MDDI_INT_PRI_OVERWRITE (1 << 9)
56#define MDDI_INT_SEC_OVERWRITE (1 << 10)
57#define MDDI_INT_REV_OVERWRITE (1 << 11)
58#define MDDI_INT_DMA_FAILURE (1 << 12)
59#define MDDI_INT_LINK_ACTIVE (1 << 13)
60#define MDDI_INT_IN_HIBERNATION (1 << 14)
61#define MDDI_INT_PRI_LINK_LIST_DONE (1 << 15)
62#define MDDI_INT_SEC_LINK_LIST_DONE (1 << 16)
63#define MDDI_INT_NO_REQ_PKTS_PENDING (1 << 17)
64#define MDDI_INT_RTD_FAILURE (1 << 18)
65#define MDDI_INT_REV_PKT_RECEIVED (1 << 19)
66#define MDDI_INT_REV_PKTS_AVAIL (1 << 20)
67
68#define MDDI_INTEN MDDI_REG(0x001C)
69#define MDDI_REV_PTR MDDI_REG(0x0020)
70#define MDDI_REV_SIZE MDDI_REG(0x0024)
71#define MDDI_STAT MDDI_REG(0x0028)
72
73#define MDDI_STAT_LINK_ACTIVE (1 << 0)
74#define MDDI_STAT_NEW_REV_PTR (1 << 1)
75#define MDDI_STAT_NEW_PRI_PTR (1 << 2)
76#define MDDI_STAT_NEW_SEC_PTR (1 << 3)
77#define MDDI_STAT_IN_HIBERNATION (1 << 4)
78#define MDDI_STAT_PRI_LINK_LIST_DONE (1 << 5)
79#define MDDI_STAT_SEC_LINK_LIST_DONE (1 << 6)
80#define MDDI_STAT_SEND_TIMING_PKT (1 << 7)
81#define MDDI_STAT_SEND_REV_ENCAP_WITH_FLAGS (1 << 8)
82#define MDDI_STAT_SEND_POWER_DOWN (1 << 9)
83#define MDDI_STAT_DO_HANDSHAKE (1 << 10)
84#define MDDI_STAT_RTD_MEAS_FAIL (1 << 11)
85#define MDDI_STAT_CLIENT_WAKEUP_REQ (1 << 12)
86#define MDDI_STAT_DMA_ABORT (1 << 13)
87#define MDDI_STAT_REV_OVERFLOW_RESET (1 << 14)
88#define MDDI_STAT_FORCE_NEW_REV_PTR (1 << 15)
89#define MDDI_STAT_CRC_ERRORS (1 << 16)
90
91#define MDDI_REV_RATE_DIV MDDI_REG(0x002C)
92#define MDDI_REV_CRC_ERR MDDI_REG(0x0030)
93#define MDDI_TA1_LEN MDDI_REG(0x0034)
94#define MDDI_TA2_LEN MDDI_REG(0x0038)
95#define MDDI_TEST_BUS MDDI_REG(0x003C)
96#define MDDI_TEST MDDI_REG(0x0040)
97#define MDDI_REV_PKT_CNT MDDI_REG(0x0044)
98#define MDDI_DRIVE_HI MDDI_REG(0x0048)
99#define MDDI_DRIVE_LO MDDI_REG(0x004C)
100#define MDDI_DISP_WAKE MDDI_REG(0x0050)
101#define MDDI_REV_ENCAP_SZ MDDI_REG(0x0054)
102#define MDDI_RTD_VAL MDDI_REG(0x0058)
103#define MDDI_MDP_VID_FMT_DES MDDI_REG(0x005C)
104#define MDDI_MDP_VID_PIX_ATTR MDDI_REG(0x0060)
105#define MDDI_MDP_VID_CLIENTID MDDI_REG(0x0064)
106#define MDDI_PAD_CTL MDDI_REG(0x0068)
107#define MDDI_DRIVER_START_CNT MDDI_REG(0x006C)
108#define MDDI_NEXT_PRI_PTR MDDI_REG(0x0070)
109#define MDDI_NEXT_SEC_PTR MDDI_REG(0x0074)
110#define MDDI_MISR_CTL MDDI_REG(0x0078)
111#define MDDI_MISR_DATA MDDI_REG(0x007C)
112#define MDDI_SF_CNT MDDI_REG(0x0080)
113#define MDDI_MF_CNT MDDI_REG(0x0084)
114#define MDDI_CURR_REV_PTR MDDI_REG(0x0088)
115#define MDDI_CORE_VER MDDI_REG(0x008C)
116
117#define CMD_POWER_DOWN 0x0100
118#define CMD_POWER_UP 0x0200
119#define CMD_HIBERNATE 0x0300
120#define CMD_RESET 0x0400
121#define CMD_IGNORE 0x0501
122#define CMD_LISTEN 0x0500
123#define CMD_REV_ENC_REQ 0x0600
124#define CMD_RTD_MEASURE 0x0700
125#define CMD_LINK_ACTIVE 0x0900
126#define CMD_PERIODIC_REV_ENC 0x0A00
127#define CMD_FORCE_NEW_REV_PTR 0x0C00
128
129#define CMD_GET_CLIENT_CAP 0x0601
130#define CMD_GET_CLIENT_STATUS 0x0602
131
132#if 1
133#define FORMAT_18BPP 0x5666
134#define FORMAT_24BPP 0x5888
135#define FORMAT_16BPP 0x5565
136#else
137#define FORMAT_MONOCHROME (0 << 13)
138#define FORMAT_PALETTE (1 << 13)
139#define FORMAT_RGB (2 << 13)
140#define FORMAT_YCBCR422 (3 << 13)
141#define FORMAT_BAYER (4 << 13)
142#endif
143
144#define PIXATTR_BOTH_EYES 3
145#define PIXATTR_LEFT_EYE 2
146#define PIXATTR_RIGHT_EYE 1
147#define PIXATTR_ALT_DISPLAY 0
148
149#define PIXATTR_PROGRESSIVE 0
150#define PIXATTR_INTERLACED (1 << 2)
151#define PIXATTR_ALTERNATE (1 << 3)
152
153#define PIXATTR_IGNORE_LRTB (1 << 5)
154
155#define PIXATTR_TO_REFRESH (0 << 6)
156#define PIXATTR_TO_OFFLINE (1 << 6)
157#define PIXATTR_TO_ALL (3 << 6)
158
159#define PIXATTR_LAST_ROW (1 << 15)
160
161#define TYPE_VIDEO_STREAM 16
162#define TYPE_CLIENT_CAPS 66
163#define TYPE_REGISTER_ACCESS 146
164#define TYPE_CLIENT_STATUS 70
165
166typedef struct mddi_video_stream mddi_video_stream;
167typedef struct mddi_register_access mddi_register_access;
168typedef struct mddi_client_caps mddi_client_caps;
169
170typedef struct mddi_llentry mddi_llentry;
171
172struct __attribute__((packed)) mddi_video_stream
173{
174 unsigned short length; /* length in bytes excluding this field */
175 unsigned short type; /* MDDI_TYPE_VIDEO_STREAM */
176 unsigned short client_id; /* set to zero */
177
178 unsigned short format;
179 unsigned short pixattr;
180
181 unsigned short left;
182 unsigned short top;
183 unsigned short right;
184 unsigned short bottom;
185
186 unsigned short start_x;
187 unsigned short start_y;
188
189 unsigned short pixels;
190
191 unsigned short crc;
192 unsigned short reserved;
193};
194
195struct __attribute__((packed)) mddi_register_access
196{
197 unsigned short length;
198 unsigned short type;
199 unsigned short client_id;
200
201 unsigned short rw_info; /* flag below | count of reg_data */
202#define MDDI_WRITE (0 << 14)
203#define MDDI_READ (2 << 14)
204#define MDDI_READ_RESP (3 << 14)
205
206 unsigned reg_addr;
207 unsigned short crc; /* 16 bit crc of the above */
208
209 unsigned reg_data; /* "list" of 3byte data values */
210};
211
212struct __attribute__((packed)) mddi_llentry {
213 unsigned short flags;
214 unsigned short header_count;
215 unsigned short data_count;
216 void *data;
217 mddi_llentry *next;
218 unsigned short reserved;
219 union {
220 mddi_video_stream v;
221 mddi_register_access r;
222 unsigned _[12];
223 } u;
224};
225
226#endif /* __PLATFORM_MSM7K_MDDI_HW_H */