diff options
Diffstat (limited to 'include/asm-powerpc/ps3av.h')
-rw-r--r-- | include/asm-powerpc/ps3av.h | 738 |
1 files changed, 738 insertions, 0 deletions
diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h new file mode 100644 index 000000000000..43e90ea96136 --- /dev/null +++ b/include/asm-powerpc/ps3av.h | |||
@@ -0,0 +1,738 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Sony Computer Entertainment Inc. | ||
3 | * Copyright 2006, 2007 Sony Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published | ||
7 | * by the Free Software Foundation; version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_PS3AV_H_ | ||
19 | #define _ASM_POWERPC_PS3AV_H_ | ||
20 | |||
21 | #include <linux/mutex.h> | ||
22 | |||
23 | /** command for ioctl() **/ | ||
24 | #define PS3AV_VERSION 0x205 /* version of ps3av command */ | ||
25 | |||
26 | #define PS3AV_CID_AV_INIT 0x00000001 | ||
27 | #define PS3AV_CID_AV_FIN 0x00000002 | ||
28 | #define PS3AV_CID_AV_GET_HW_CONF 0x00000003 | ||
29 | #define PS3AV_CID_AV_GET_MONITOR_INFO 0x00000004 | ||
30 | #define PS3AV_CID_AV_ENABLE_EVENT 0x00000006 | ||
31 | #define PS3AV_CID_AV_DISABLE_EVENT 0x00000007 | ||
32 | #define PS3AV_CID_AV_TV_MUTE 0x0000000a | ||
33 | |||
34 | #define PS3AV_CID_AV_VIDEO_CS 0x00010001 | ||
35 | #define PS3AV_CID_AV_VIDEO_MUTE 0x00010002 | ||
36 | #define PS3AV_CID_AV_VIDEO_DISABLE_SIG 0x00010003 | ||
37 | #define PS3AV_CID_AV_AUDIO_PARAM 0x00020001 | ||
38 | #define PS3AV_CID_AV_AUDIO_MUTE 0x00020002 | ||
39 | #define PS3AV_CID_AV_HDMI_MODE 0x00040001 | ||
40 | |||
41 | #define PS3AV_CID_VIDEO_INIT 0x01000001 | ||
42 | #define PS3AV_CID_VIDEO_MODE 0x01000002 | ||
43 | #define PS3AV_CID_VIDEO_FORMAT 0x01000004 | ||
44 | #define PS3AV_CID_VIDEO_PITCH 0x01000005 | ||
45 | |||
46 | #define PS3AV_CID_AUDIO_INIT 0x02000001 | ||
47 | #define PS3AV_CID_AUDIO_MODE 0x02000002 | ||
48 | #define PS3AV_CID_AUDIO_MUTE 0x02000003 | ||
49 | #define PS3AV_CID_AUDIO_ACTIVE 0x02000004 | ||
50 | #define PS3AV_CID_AUDIO_INACTIVE 0x02000005 | ||
51 | #define PS3AV_CID_AUDIO_SPDIF_BIT 0x02000006 | ||
52 | #define PS3AV_CID_AUDIO_CTRL 0x02000007 | ||
53 | |||
54 | #define PS3AV_CID_EVENT_UNPLUGGED 0x10000001 | ||
55 | #define PS3AV_CID_EVENT_PLUGGED 0x10000002 | ||
56 | #define PS3AV_CID_EVENT_HDCP_DONE 0x10000003 | ||
57 | #define PS3AV_CID_EVENT_HDCP_FAIL 0x10000004 | ||
58 | #define PS3AV_CID_EVENT_HDCP_AUTH 0x10000005 | ||
59 | #define PS3AV_CID_EVENT_HDCP_ERROR 0x10000006 | ||
60 | |||
61 | #define PS3AV_CID_AVB_PARAM 0x04000001 | ||
62 | |||
63 | /* max backend ports */ | ||
64 | #define PS3AV_HDMI_MAX 2 /* HDMI_0 HDMI_1 */ | ||
65 | #define PS3AV_AVMULTI_MAX 1 /* AVMULTI_0 */ | ||
66 | #define PS3AV_AV_PORT_MAX (PS3AV_HDMI_MAX + PS3AV_AVMULTI_MAX) | ||
67 | #define PS3AV_OPT_PORT_MAX 1 /* SPDIF0 */ | ||
68 | #define PS3AV_HEAD_MAX 2 /* HEAD_A HEAD_B */ | ||
69 | |||
70 | /* num of pkt for PS3AV_CID_AVB_PARAM */ | ||
71 | #define PS3AV_AVB_NUM_VIDEO PS3AV_HEAD_MAX | ||
72 | #define PS3AV_AVB_NUM_AUDIO 0 /* not supported */ | ||
73 | #define PS3AV_AVB_NUM_AV_VIDEO PS3AV_AV_PORT_MAX | ||
74 | #define PS3AV_AVB_NUM_AV_AUDIO PS3AV_HDMI_MAX | ||
75 | |||
76 | #define PS3AV_MUTE_PORT_MAX 1 /* num of ports in mute pkt */ | ||
77 | |||
78 | /* event_bit */ | ||
79 | #define PS3AV_CMD_EVENT_BIT_UNPLUGGED (1 << 0) | ||
80 | #define PS3AV_CMD_EVENT_BIT_PLUGGED (1 << 1) | ||
81 | #define PS3AV_CMD_EVENT_BIT_HDCP_DONE (1 << 2) | ||
82 | #define PS3AV_CMD_EVENT_BIT_HDCP_FAIL (1 << 3) | ||
83 | #define PS3AV_CMD_EVENT_BIT_HDCP_REAUTH (1 << 4) | ||
84 | #define PS3AV_CMD_EVENT_BIT_HDCP_TOPOLOGY (1 << 5) | ||
85 | |||
86 | /* common params */ | ||
87 | /* mute */ | ||
88 | #define PS3AV_CMD_MUTE_OFF 0x0000 | ||
89 | #define PS3AV_CMD_MUTE_ON 0x0001 | ||
90 | /* avport */ | ||
91 | #define PS3AV_CMD_AVPORT_HDMI_0 0x0000 | ||
92 | #define PS3AV_CMD_AVPORT_HDMI_1 0x0001 | ||
93 | #define PS3AV_CMD_AVPORT_AVMULTI_0 0x0010 | ||
94 | #define PS3AV_CMD_AVPORT_SPDIF_0 0x0020 | ||
95 | #define PS3AV_CMD_AVPORT_SPDIF_1 0x0021 | ||
96 | |||
97 | /* for av backend */ | ||
98 | /* av_mclk */ | ||
99 | #define PS3AV_CMD_AV_MCLK_128 0x0000 | ||
100 | #define PS3AV_CMD_AV_MCLK_256 0x0001 | ||
101 | #define PS3AV_CMD_AV_MCLK_512 0x0003 | ||
102 | /* av_inputlen */ | ||
103 | #define PS3AV_CMD_AV_INPUTLEN_16 0x02 | ||
104 | #define PS3AV_CMD_AV_INPUTLEN_20 0x0a | ||
105 | #define PS3AV_CMD_AV_INPUTLEN_24 0x0b | ||
106 | /* alayout */ | ||
107 | #define PS3AV_CMD_AV_LAYOUT_32 (1 << 0) | ||
108 | #define PS3AV_CMD_AV_LAYOUT_44 (1 << 1) | ||
109 | #define PS3AV_CMD_AV_LAYOUT_48 (1 << 2) | ||
110 | #define PS3AV_CMD_AV_LAYOUT_88 (1 << 3) | ||
111 | #define PS3AV_CMD_AV_LAYOUT_96 (1 << 4) | ||
112 | #define PS3AV_CMD_AV_LAYOUT_176 (1 << 5) | ||
113 | #define PS3AV_CMD_AV_LAYOUT_192 (1 << 6) | ||
114 | /* hdmi_mode */ | ||
115 | #define PS3AV_CMD_AV_HDMI_MODE_NORMAL 0xff | ||
116 | #define PS3AV_CMD_AV_HDMI_HDCP_OFF 0x01 | ||
117 | #define PS3AV_CMD_AV_HDMI_EDID_PASS 0x80 | ||
118 | #define PS3AV_CMD_AV_HDMI_DVI 0x40 | ||
119 | |||
120 | /* for video module */ | ||
121 | /* video_head */ | ||
122 | #define PS3AV_CMD_VIDEO_HEAD_A 0x0000 | ||
123 | #define PS3AV_CMD_VIDEO_HEAD_B 0x0001 | ||
124 | /* video_cs_out video_cs_in */ | ||
125 | #define PS3AV_CMD_VIDEO_CS_NONE 0x0000 | ||
126 | #define PS3AV_CMD_VIDEO_CS_RGB_8 0x0001 | ||
127 | #define PS3AV_CMD_VIDEO_CS_YUV444_8 0x0002 | ||
128 | #define PS3AV_CMD_VIDEO_CS_YUV422_8 0x0003 | ||
129 | #define PS3AV_CMD_VIDEO_CS_XVYCC_8 0x0004 | ||
130 | #define PS3AV_CMD_VIDEO_CS_RGB_10 0x0005 | ||
131 | #define PS3AV_CMD_VIDEO_CS_YUV444_10 0x0006 | ||
132 | #define PS3AV_CMD_VIDEO_CS_YUV422_10 0x0007 | ||
133 | #define PS3AV_CMD_VIDEO_CS_XVYCC_10 0x0008 | ||
134 | #define PS3AV_CMD_VIDEO_CS_RGB_12 0x0009 | ||
135 | #define PS3AV_CMD_VIDEO_CS_YUV444_12 0x000a | ||
136 | #define PS3AV_CMD_VIDEO_CS_YUV422_12 0x000b | ||
137 | #define PS3AV_CMD_VIDEO_CS_XVYCC_12 0x000c | ||
138 | /* video_vid */ | ||
139 | #define PS3AV_CMD_VIDEO_VID_NONE 0x0000 | ||
140 | #define PS3AV_CMD_VIDEO_VID_480I 0x0001 | ||
141 | #define PS3AV_CMD_VIDEO_VID_576I 0x0003 | ||
142 | #define PS3AV_CMD_VIDEO_VID_480P 0x0005 | ||
143 | #define PS3AV_CMD_VIDEO_VID_576P 0x0006 | ||
144 | #define PS3AV_CMD_VIDEO_VID_1080I_60HZ 0x0007 | ||
145 | #define PS3AV_CMD_VIDEO_VID_1080I_50HZ 0x0008 | ||
146 | #define PS3AV_CMD_VIDEO_VID_720P_60HZ 0x0009 | ||
147 | #define PS3AV_CMD_VIDEO_VID_720P_50HZ 0x000a | ||
148 | #define PS3AV_CMD_VIDEO_VID_1080P_60HZ 0x000b | ||
149 | #define PS3AV_CMD_VIDEO_VID_1080P_50HZ 0x000c | ||
150 | #define PS3AV_CMD_VIDEO_VID_WXGA 0x000d | ||
151 | #define PS3AV_CMD_VIDEO_VID_SXGA 0x000e | ||
152 | #define PS3AV_CMD_VIDEO_VID_WUXGA 0x000f | ||
153 | #define PS3AV_CMD_VIDEO_VID_480I_A 0x0010 | ||
154 | /* video_format */ | ||
155 | #define PS3AV_CMD_VIDEO_FORMAT_BLACK 0x0000 | ||
156 | #define PS3AV_CMD_VIDEO_FORMAT_ARGB_8BIT 0x0007 | ||
157 | /* video_order */ | ||
158 | #define PS3AV_CMD_VIDEO_ORDER_RGB 0x0000 | ||
159 | #define PS3AV_CMD_VIDEO_ORDER_BGR 0x0001 | ||
160 | /* video_fmt */ | ||
161 | #define PS3AV_CMD_VIDEO_FMT_X8R8G8B8 0x0000 | ||
162 | /* video_out_format */ | ||
163 | #define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT 0x0000 | ||
164 | /* video_sync */ | ||
165 | #define PS3AV_CMD_VIDEO_SYNC_VSYNC 0x0001 | ||
166 | #define PS3AV_CMD_VIDEO_SYNC_CSYNC 0x0004 | ||
167 | #define PS3AV_CMD_VIDEO_SYNC_HSYNC 0x0010 | ||
168 | |||
169 | /* for audio module */ | ||
170 | /* num_of_ch */ | ||
171 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_2 0x0000 | ||
172 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_3 0x0001 | ||
173 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_4 0x0002 | ||
174 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_5 0x0003 | ||
175 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_6 0x0004 | ||
176 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_7 0x0005 | ||
177 | #define PS3AV_CMD_AUDIO_NUM_OF_CH_8 0x0006 | ||
178 | /* audio_fs */ | ||
179 | #define PS3AV_CMD_AUDIO_FS_32K 0x0001 | ||
180 | #define PS3AV_CMD_AUDIO_FS_44K 0x0002 | ||
181 | #define PS3AV_CMD_AUDIO_FS_48K 0x0003 | ||
182 | #define PS3AV_CMD_AUDIO_FS_88K 0x0004 | ||
183 | #define PS3AV_CMD_AUDIO_FS_96K 0x0005 | ||
184 | #define PS3AV_CMD_AUDIO_FS_176K 0x0006 | ||
185 | #define PS3AV_CMD_AUDIO_FS_192K 0x0007 | ||
186 | /* audio_word_bits */ | ||
187 | #define PS3AV_CMD_AUDIO_WORD_BITS_16 0x0001 | ||
188 | #define PS3AV_CMD_AUDIO_WORD_BITS_20 0x0002 | ||
189 | #define PS3AV_CMD_AUDIO_WORD_BITS_24 0x0003 | ||
190 | /* audio_format */ | ||
191 | #define PS3AV_CMD_AUDIO_FORMAT_PCM 0x0001 | ||
192 | #define PS3AV_CMD_AUDIO_FORMAT_BITSTREAM 0x00ff | ||
193 | /* audio_source */ | ||
194 | #define PS3AV_CMD_AUDIO_SOURCE_SERIAL 0x0000 | ||
195 | #define PS3AV_CMD_AUDIO_SOURCE_SPDIF 0x0001 | ||
196 | /* audio_swap */ | ||
197 | #define PS3AV_CMD_AUDIO_SWAP_0 0x0000 | ||
198 | #define PS3AV_CMD_AUDIO_SWAP_1 0x0000 | ||
199 | /* audio_map */ | ||
200 | #define PS3AV_CMD_AUDIO_MAP_OUTPUT_0 0x0000 | ||
201 | #define PS3AV_CMD_AUDIO_MAP_OUTPUT_1 0x0001 | ||
202 | #define PS3AV_CMD_AUDIO_MAP_OUTPUT_2 0x0002 | ||
203 | #define PS3AV_CMD_AUDIO_MAP_OUTPUT_3 0x0003 | ||
204 | /* audio_layout */ | ||
205 | #define PS3AV_CMD_AUDIO_LAYOUT_2CH 0x0000 | ||
206 | #define PS3AV_CMD_AUDIO_LAYOUT_6CH 0x000b /* LREClr */ | ||
207 | #define PS3AV_CMD_AUDIO_LAYOUT_8CH 0x001f /* LREClrXY */ | ||
208 | /* audio_downmix */ | ||
209 | #define PS3AV_CMD_AUDIO_DOWNMIX_PERMITTED 0x0000 | ||
210 | #define PS3AV_CMD_AUDIO_DOWNMIX_PROHIBITED 0x0001 | ||
211 | |||
212 | /* audio_port */ | ||
213 | #define PS3AV_CMD_AUDIO_PORT_HDMI_0 ( 1 << 0 ) | ||
214 | #define PS3AV_CMD_AUDIO_PORT_HDMI_1 ( 1 << 1 ) | ||
215 | #define PS3AV_CMD_AUDIO_PORT_AVMULTI_0 ( 1 << 10 ) | ||
216 | #define PS3AV_CMD_AUDIO_PORT_SPDIF_0 ( 1 << 20 ) | ||
217 | #define PS3AV_CMD_AUDIO_PORT_SPDIF_1 ( 1 << 21 ) | ||
218 | |||
219 | /* audio_ctrl_id */ | ||
220 | #define PS3AV_CMD_AUDIO_CTRL_ID_DAC_RESET 0x0000 | ||
221 | #define PS3AV_CMD_AUDIO_CTRL_ID_DAC_DE_EMPHASIS 0x0001 | ||
222 | #define PS3AV_CMD_AUDIO_CTRL_ID_AVCLK 0x0002 | ||
223 | /* audio_ctrl_data[0] reset */ | ||
224 | #define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE 0x0000 | ||
225 | #define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT 0x0001 | ||
226 | /* audio_ctrl_data[0] de-emphasis */ | ||
227 | #define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_OFF 0x0000 | ||
228 | #define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_ON 0x0001 | ||
229 | /* audio_ctrl_data[0] avclk */ | ||
230 | #define PS3AV_CMD_AUDIO_CTRL_AVCLK_22 0x0000 | ||
231 | #define PS3AV_CMD_AUDIO_CTRL_AVCLK_18 0x0001 | ||
232 | |||
233 | /* av_vid */ | ||
234 | /* do not use these params directly, use vid_video2av */ | ||
235 | #define PS3AV_CMD_AV_VID_480I 0x0000 | ||
236 | #define PS3AV_CMD_AV_VID_480P 0x0001 | ||
237 | #define PS3AV_CMD_AV_VID_720P_60HZ 0x0002 | ||
238 | #define PS3AV_CMD_AV_VID_1080I_60HZ 0x0003 | ||
239 | #define PS3AV_CMD_AV_VID_1080P_60HZ 0x0004 | ||
240 | #define PS3AV_CMD_AV_VID_576I 0x0005 | ||
241 | #define PS3AV_CMD_AV_VID_576P 0x0006 | ||
242 | #define PS3AV_CMD_AV_VID_720P_50HZ 0x0007 | ||
243 | #define PS3AV_CMD_AV_VID_1080I_50HZ 0x0008 | ||
244 | #define PS3AV_CMD_AV_VID_1080P_50HZ 0x0009 | ||
245 | #define PS3AV_CMD_AV_VID_WXGA 0x000a | ||
246 | #define PS3AV_CMD_AV_VID_SXGA 0x000b | ||
247 | #define PS3AV_CMD_AV_VID_WUXGA 0x000c | ||
248 | /* av_cs_out av_cs_in */ | ||
249 | /* use cs_video2av() */ | ||
250 | #define PS3AV_CMD_AV_CS_RGB_8 0x0000 | ||
251 | #define PS3AV_CMD_AV_CS_YUV444_8 0x0001 | ||
252 | #define PS3AV_CMD_AV_CS_YUV422_8 0x0002 | ||
253 | #define PS3AV_CMD_AV_CS_XVYCC_8 0x0003 | ||
254 | #define PS3AV_CMD_AV_CS_RGB_10 0x0004 | ||
255 | #define PS3AV_CMD_AV_CS_YUV444_10 0x0005 | ||
256 | #define PS3AV_CMD_AV_CS_YUV422_10 0x0006 | ||
257 | #define PS3AV_CMD_AV_CS_XVYCC_10 0x0007 | ||
258 | #define PS3AV_CMD_AV_CS_RGB_12 0x0008 | ||
259 | #define PS3AV_CMD_AV_CS_YUV444_12 0x0009 | ||
260 | #define PS3AV_CMD_AV_CS_YUV422_12 0x000a | ||
261 | #define PS3AV_CMD_AV_CS_XVYCC_12 0x000b | ||
262 | #define PS3AV_CMD_AV_CS_8 0x0000 | ||
263 | #define PS3AV_CMD_AV_CS_10 0x0001 | ||
264 | #define PS3AV_CMD_AV_CS_12 0x0002 | ||
265 | /* dither */ | ||
266 | #define PS3AV_CMD_AV_DITHER_OFF 0x0000 | ||
267 | #define PS3AV_CMD_AV_DITHER_ON 0x0001 | ||
268 | #define PS3AV_CMD_AV_DITHER_8BIT 0x0000 | ||
269 | #define PS3AV_CMD_AV_DITHER_10BIT 0x0002 | ||
270 | #define PS3AV_CMD_AV_DITHER_12BIT 0x0004 | ||
271 | /* super_white */ | ||
272 | #define PS3AV_CMD_AV_SUPER_WHITE_OFF 0x0000 | ||
273 | #define PS3AV_CMD_AV_SUPER_WHITE_ON 0x0001 | ||
274 | /* aspect */ | ||
275 | #define PS3AV_CMD_AV_ASPECT_16_9 0x0000 | ||
276 | #define PS3AV_CMD_AV_ASPECT_4_3 0x0001 | ||
277 | /* video_cs_cnv() */ | ||
278 | #define PS3AV_CMD_VIDEO_CS_RGB 0x0001 | ||
279 | #define PS3AV_CMD_VIDEO_CS_YUV422 0x0002 | ||
280 | #define PS3AV_CMD_VIDEO_CS_YUV444 0x0003 | ||
281 | |||
282 | /* for automode */ | ||
283 | #define PS3AV_RESBIT_720x480P 0x0003 /* 0x0001 | 0x0002 */ | ||
284 | #define PS3AV_RESBIT_720x576P 0x0003 /* 0x0001 | 0x0002 */ | ||
285 | #define PS3AV_RESBIT_1280x720P 0x0004 | ||
286 | #define PS3AV_RESBIT_1920x1080I 0x0008 | ||
287 | #define PS3AV_RESBIT_1920x1080P 0x4000 | ||
288 | #define PS3AV_RES_MASK_60 (PS3AV_RESBIT_720x480P \ | ||
289 | | PS3AV_RESBIT_1280x720P \ | ||
290 | | PS3AV_RESBIT_1920x1080I \ | ||
291 | | PS3AV_RESBIT_1920x1080P) | ||
292 | #define PS3AV_RES_MASK_50 (PS3AV_RESBIT_720x576P \ | ||
293 | | PS3AV_RESBIT_1280x720P \ | ||
294 | | PS3AV_RESBIT_1920x1080I \ | ||
295 | | PS3AV_RESBIT_1920x1080P) | ||
296 | |||
297 | #define PS3AV_MONITOR_TYPE_HDMI 1 /* HDMI */ | ||
298 | #define PS3AV_MONITOR_TYPE_DVI 2 /* DVI */ | ||
299 | #define PS3AV_DEFAULT_HDMI_VID_REG_60 PS3AV_CMD_VIDEO_VID_480P | ||
300 | #define PS3AV_DEFAULT_AVMULTI_VID_REG_60 PS3AV_CMD_VIDEO_VID_480I | ||
301 | #define PS3AV_DEFAULT_HDMI_VID_REG_50 PS3AV_CMD_VIDEO_VID_576P | ||
302 | #define PS3AV_DEFAULT_AVMULTI_VID_REG_50 PS3AV_CMD_VIDEO_VID_576I | ||
303 | #define PS3AV_DEFAULT_DVI_VID PS3AV_CMD_VIDEO_VID_480P | ||
304 | |||
305 | #define PS3AV_REGION_60 0x01 | ||
306 | #define PS3AV_REGION_50 0x02 | ||
307 | #define PS3AV_REGION_RGB 0x10 | ||
308 | |||
309 | #define get_status(buf) (((__u32 *)buf)[2]) | ||
310 | #define PS3AV_HDR_SIZE 4 /* version + size */ | ||
311 | |||
312 | /* for video mode */ | ||
313 | #define PS3AV_MODE_MASK 0x000F | ||
314 | #define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */ | ||
315 | #define PS3AV_MODE_DITHER 0x0800 | ||
316 | #define PS3AV_MODE_FULL 0x0080 | ||
317 | #define PS3AV_MODE_DVI 0x0040 | ||
318 | #define PS3AV_MODE_RGB 0x0020 | ||
319 | |||
320 | |||
321 | /** command packet structure **/ | ||
322 | struct ps3av_send_hdr { | ||
323 | u16 version; | ||
324 | u16 size; /* size of command packet */ | ||
325 | u32 cid; /* command id */ | ||
326 | }; | ||
327 | |||
328 | struct ps3av_reply_hdr { | ||
329 | u16 version; | ||
330 | u16 size; | ||
331 | u32 cid; | ||
332 | u32 status; | ||
333 | }; | ||
334 | |||
335 | /* backend: initialization */ | ||
336 | struct ps3av_pkt_av_init { | ||
337 | struct ps3av_send_hdr send_hdr; | ||
338 | u32 event_bit; | ||
339 | }; | ||
340 | |||
341 | /* backend: finalize */ | ||
342 | struct ps3av_pkt_av_fin { | ||
343 | struct ps3av_send_hdr send_hdr; | ||
344 | /* recv */ | ||
345 | u32 reserved; | ||
346 | }; | ||
347 | |||
348 | /* backend: get port */ | ||
349 | struct ps3av_pkt_av_get_hw_conf { | ||
350 | struct ps3av_send_hdr send_hdr; | ||
351 | /* recv */ | ||
352 | u32 status; | ||
353 | u16 num_of_hdmi; /* out: number of hdmi */ | ||
354 | u16 num_of_avmulti; /* out: number of avmulti */ | ||
355 | u16 num_of_spdif; /* out: number of hdmi */ | ||
356 | u16 reserved; | ||
357 | }; | ||
358 | |||
359 | /* backend: get monitor info */ | ||
360 | struct ps3av_info_resolution { | ||
361 | u32 res_bits; | ||
362 | u32 native; | ||
363 | }; | ||
364 | |||
365 | struct ps3av_info_cs { | ||
366 | u8 rgb; | ||
367 | u8 yuv444; | ||
368 | u8 yuv422; | ||
369 | u8 reserved; | ||
370 | }; | ||
371 | |||
372 | struct ps3av_info_color { | ||
373 | u16 red_x; | ||
374 | u16 red_y; | ||
375 | u16 green_x; | ||
376 | u16 green_y; | ||
377 | u16 blue_x; | ||
378 | u16 blue_y; | ||
379 | u16 white_x; | ||
380 | u16 white_y; | ||
381 | u32 gamma; | ||
382 | }; | ||
383 | |||
384 | struct ps3av_info_audio { | ||
385 | u8 type; | ||
386 | u8 max_num_of_ch; | ||
387 | u8 fs; | ||
388 | u8 sbit; | ||
389 | }; | ||
390 | |||
391 | struct ps3av_info_monitor { | ||
392 | u8 avport; | ||
393 | u8 monitor_id[10]; | ||
394 | u8 monitor_type; | ||
395 | u8 monitor_name[16]; | ||
396 | struct ps3av_info_resolution res_60; | ||
397 | struct ps3av_info_resolution res_50; | ||
398 | struct ps3av_info_resolution res_other; | ||
399 | struct ps3av_info_resolution res_vesa; | ||
400 | struct ps3av_info_cs cs; | ||
401 | struct ps3av_info_color color; | ||
402 | u8 supported_ai; | ||
403 | u8 speaker_info; | ||
404 | u8 num_of_audio_block; | ||
405 | struct ps3av_info_audio audio[0]; /* 0 or more audio blocks */ | ||
406 | u8 reserved[169]; | ||
407 | } __attribute__ ((packed)); | ||
408 | |||
409 | struct ps3av_pkt_av_get_monitor_info { | ||
410 | struct ps3av_send_hdr send_hdr; | ||
411 | u16 avport; /* in: avport */ | ||
412 | u16 reserved; | ||
413 | /* recv */ | ||
414 | struct ps3av_info_monitor info; /* out: monitor info */ | ||
415 | }; | ||
416 | |||
417 | /* backend: enable/disable event */ | ||
418 | struct ps3av_pkt_av_event { | ||
419 | struct ps3av_send_hdr send_hdr; | ||
420 | u32 event_bit; /* in */ | ||
421 | }; | ||
422 | |||
423 | /* backend: video cs param */ | ||
424 | struct ps3av_pkt_av_video_cs { | ||
425 | struct ps3av_send_hdr send_hdr; | ||
426 | u16 avport; /* in: avport */ | ||
427 | u16 av_vid; /* in: video resolution */ | ||
428 | u16 av_cs_out; /* in: output color space */ | ||
429 | u16 av_cs_in; /* in: input color space */ | ||
430 | u8 dither; /* in: dither bit length */ | ||
431 | u8 bitlen_out; /* in: bit length */ | ||
432 | u8 super_white; /* in: super white */ | ||
433 | u8 aspect; /* in: aspect ratio */ | ||
434 | }; | ||
435 | |||
436 | /* backend: video mute */ | ||
437 | struct ps3av_av_mute { | ||
438 | u16 avport; /* in: avport */ | ||
439 | u16 mute; /* in: mute on/off */ | ||
440 | }; | ||
441 | |||
442 | struct ps3av_pkt_av_video_mute { | ||
443 | struct ps3av_send_hdr send_hdr; | ||
444 | struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX]; | ||
445 | }; | ||
446 | |||
447 | /* backend: video disable signal */ | ||
448 | struct ps3av_pkt_av_video_disable_sig { | ||
449 | struct ps3av_send_hdr send_hdr; | ||
450 | u16 avport; /* in: avport */ | ||
451 | u16 reserved; | ||
452 | }; | ||
453 | |||
454 | /* backend: audio param */ | ||
455 | struct ps3av_audio_info_frame { | ||
456 | struct pb1_bit { | ||
457 | u8 ct:4; | ||
458 | u8 rsv:1; | ||
459 | u8 cc:3; | ||
460 | } pb1; | ||
461 | struct pb2_bit { | ||
462 | u8 rsv:3; | ||
463 | u8 sf:3; | ||
464 | u8 ss:2; | ||
465 | } pb2; | ||
466 | u8 pb3; | ||
467 | u8 pb4; | ||
468 | struct pb5_bit { | ||
469 | u8 dm:1; | ||
470 | u8 lsv:4; | ||
471 | u8 rsv:3; | ||
472 | } pb5; | ||
473 | }; | ||
474 | |||
475 | struct ps3av_pkt_av_audio_param { | ||
476 | struct ps3av_send_hdr send_hdr; | ||
477 | u16 avport; /* in: avport */ | ||
478 | u16 reserved; | ||
479 | u8 mclk; /* in: audio mclk */ | ||
480 | u8 ns[3]; /* in: audio ns val */ | ||
481 | u8 enable; /* in: audio enable */ | ||
482 | u8 swaplr; /* in: audio swap */ | ||
483 | u8 fifomap; /* in: audio fifomap */ | ||
484 | u8 inputctrl; /* in: audio input ctrl */ | ||
485 | u8 inputlen; /* in: sample bit size */ | ||
486 | u8 layout; /* in: speaker layout param */ | ||
487 | struct ps3av_audio_info_frame info; /* in: info */ | ||
488 | u8 chstat[5]; /* in: ch stat */ | ||
489 | }; | ||
490 | |||
491 | /* backend: audio_mute */ | ||
492 | struct ps3av_pkt_av_audio_mute { | ||
493 | struct ps3av_send_hdr send_hdr; | ||
494 | struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX]; | ||
495 | }; | ||
496 | |||
497 | /* backend: hdmi_mode */ | ||
498 | struct ps3av_pkt_av_hdmi_mode { | ||
499 | struct ps3av_send_hdr send_hdr; | ||
500 | u8 mode; /* in: hdmi_mode */ | ||
501 | u8 reserved0; | ||
502 | u8 reserved1; | ||
503 | u8 reserved2; | ||
504 | }; | ||
505 | |||
506 | /* backend: tv_mute */ | ||
507 | struct ps3av_pkt_av_tv_mute { | ||
508 | struct ps3av_send_hdr send_hdr; | ||
509 | u16 avport; /* in: avport HDMI only */ | ||
510 | u16 mute; /* in: mute */ | ||
511 | }; | ||
512 | |||
513 | /* video: initialize */ | ||
514 | struct ps3av_pkt_video_init { | ||
515 | struct ps3av_send_hdr send_hdr; | ||
516 | /* recv */ | ||
517 | u32 reserved; | ||
518 | }; | ||
519 | |||
520 | /* video: mode setting */ | ||
521 | struct ps3av_pkt_video_mode { | ||
522 | struct ps3av_send_hdr send_hdr; | ||
523 | u32 video_head; /* in: head */ | ||
524 | u32 reserved; | ||
525 | u32 video_vid; /* in: video resolution */ | ||
526 | u16 reserved1; | ||
527 | u16 width; /* in: width in pixel */ | ||
528 | u16 reserved2; | ||
529 | u16 height; /* in: height in pixel */ | ||
530 | u32 pitch; /* in: line size in byte */ | ||
531 | u32 video_out_format; /* in: out format */ | ||
532 | u32 video_format; /* in: input frame buffer format */ | ||
533 | u8 reserved3; | ||
534 | u8 reserved4; | ||
535 | u16 video_order; /* in: input RGB order */ | ||
536 | u32 reserved5; | ||
537 | }; | ||
538 | |||
539 | /* video: format */ | ||
540 | struct ps3av_pkt_video_format { | ||
541 | struct ps3av_send_hdr send_hdr; | ||
542 | u32 video_head; /* in: head */ | ||
543 | u32 video_format; /* in: frame buffer format */ | ||
544 | u16 reserved; | ||
545 | u16 video_order; /* in: input RGB order */ | ||
546 | }; | ||
547 | |||
548 | /* video: pitch */ | ||
549 | struct ps3av_pkt_video_pitch { | ||
550 | u16 version; | ||
551 | u16 size; /* size of command packet */ | ||
552 | u32 cid; /* command id */ | ||
553 | u32 video_head; /* in: head */ | ||
554 | u32 pitch; /* in: line size in byte */ | ||
555 | }; | ||
556 | |||
557 | /* audio: initialize */ | ||
558 | struct ps3av_pkt_audio_init { | ||
559 | struct ps3av_send_hdr send_hdr; | ||
560 | /* recv */ | ||
561 | u32 reserved; | ||
562 | }; | ||
563 | |||
564 | /* audio: mode setting */ | ||
565 | struct ps3av_pkt_audio_mode { | ||
566 | struct ps3av_send_hdr send_hdr; | ||
567 | u8 avport; /* in: avport */ | ||
568 | u8 reserved0[3]; | ||
569 | u32 mask; /* in: mask */ | ||
570 | u32 audio_num_of_ch; /* in: number of ch */ | ||
571 | u32 audio_fs; /* in: sampling freq */ | ||
572 | u32 audio_word_bits; /* in: sample bit size */ | ||
573 | u32 audio_format; /* in: audio output format */ | ||
574 | u32 audio_source; /* in: audio source */ | ||
575 | u8 audio_enable[4]; /* in: audio enable */ | ||
576 | u8 audio_swap[4]; /* in: audio swap */ | ||
577 | u8 audio_map[4]; /* in: audio map */ | ||
578 | u32 audio_layout; /* in: speaker layout */ | ||
579 | u32 audio_downmix; /* in: audio downmix permission */ | ||
580 | u32 audio_downmix_level; | ||
581 | u8 audio_cs_info[8]; /* in: IEC channel status */ | ||
582 | }; | ||
583 | |||
584 | /* audio: mute */ | ||
585 | struct ps3av_audio_mute { | ||
586 | u8 avport; /* in: opt_port optical */ | ||
587 | u8 reserved[3]; | ||
588 | u32 mute; /* in: mute */ | ||
589 | }; | ||
590 | |||
591 | struct ps3av_pkt_audio_mute { | ||
592 | struct ps3av_send_hdr send_hdr; | ||
593 | struct ps3av_audio_mute mute[PS3AV_OPT_PORT_MAX]; | ||
594 | }; | ||
595 | |||
596 | /* audio: active/inactive */ | ||
597 | struct ps3av_pkt_audio_active { | ||
598 | struct ps3av_send_hdr send_hdr; | ||
599 | u32 audio_port; /* in: audio active/inactive port */ | ||
600 | }; | ||
601 | |||
602 | /* audio: SPDIF user bit */ | ||
603 | struct ps3av_pkt_audio_spdif_bit { | ||
604 | u16 version; | ||
605 | u16 size; /* size of command packet */ | ||
606 | u32 cid; /* command id */ | ||
607 | u8 avport; /* in: avport SPDIF only */ | ||
608 | u8 reserved[3]; | ||
609 | u32 audio_port; /* in: SPDIF only */ | ||
610 | u32 spdif_bit_data[12]; /* in: user bit data */ | ||
611 | }; | ||
612 | |||
613 | /* audio: audio control */ | ||
614 | struct ps3av_pkt_audio_ctrl { | ||
615 | u16 version; | ||
616 | u16 size; /* size of command packet */ | ||
617 | u32 cid; /* command id */ | ||
618 | u32 audio_ctrl_id; /* in: control id */ | ||
619 | u32 audio_ctrl_data[4]; /* in: control data */ | ||
620 | }; | ||
621 | |||
622 | /* avb:param */ | ||
623 | #define PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE \ | ||
624 | (PS3AV_AVB_NUM_VIDEO*sizeof(struct ps3av_pkt_video_mode) + \ | ||
625 | PS3AV_AVB_NUM_AUDIO*sizeof(struct ps3av_pkt_audio_mode) + \ | ||
626 | PS3AV_AVB_NUM_AV_VIDEO*sizeof(struct ps3av_pkt_av_video_cs) + \ | ||
627 | PS3AV_AVB_NUM_AV_AUDIO*sizeof(struct ps3av_pkt_av_audio_param)) | ||
628 | |||
629 | struct ps3av_pkt_avb_param { | ||
630 | struct ps3av_send_hdr send_hdr; | ||
631 | u16 num_of_video_pkt; | ||
632 | u16 num_of_audio_pkt; | ||
633 | u16 num_of_av_video_pkt; | ||
634 | u16 num_of_av_audio_pkt; | ||
635 | /* | ||
636 | * The actual buffer layout depends on the fields above: | ||
637 | * | ||
638 | * struct ps3av_pkt_video_mode video[num_of_video_pkt]; | ||
639 | * struct ps3av_pkt_audio_mode audio[num_of_audio_pkt]; | ||
640 | * struct ps3av_pkt_av_video_cs av_video[num_of_av_video_pkt]; | ||
641 | * struct ps3av_pkt_av_audio_param av_audio[num_of_av_audio_pkt]; | ||
642 | */ | ||
643 | u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE]; | ||
644 | }; | ||
645 | |||
646 | struct ps3av { | ||
647 | int available; | ||
648 | struct semaphore sem; | ||
649 | struct semaphore ping; | ||
650 | struct semaphore pong; | ||
651 | struct mutex mutex; | ||
652 | int open_count; | ||
653 | struct ps3_vuart_port_device *dev; | ||
654 | |||
655 | int region; | ||
656 | struct ps3av_pkt_av_get_hw_conf av_hw_conf; | ||
657 | u32 av_port[PS3AV_AV_PORT_MAX + PS3AV_OPT_PORT_MAX]; | ||
658 | u32 opt_port[PS3AV_OPT_PORT_MAX]; | ||
659 | u32 head[PS3AV_HEAD_MAX]; | ||
660 | u32 audio_port; | ||
661 | int ps3av_mode; | ||
662 | int ps3av_mode_old; | ||
663 | }; | ||
664 | |||
665 | /** command status **/ | ||
666 | #define PS3AV_STATUS_SUCCESS 0x0000 /* success */ | ||
667 | #define PS3AV_STATUS_RECEIVE_VUART_ERROR 0x0001 /* receive vuart error */ | ||
668 | #define PS3AV_STATUS_SYSCON_COMMUNICATE_FAIL 0x0002 /* syscon communication error */ | ||
669 | #define PS3AV_STATUS_INVALID_COMMAND 0x0003 /* obsolete invalid CID */ | ||
670 | #define PS3AV_STATUS_INVALID_PORT 0x0004 /* invalid port number */ | ||
671 | #define PS3AV_STATUS_INVALID_VID 0x0005 /* invalid video format */ | ||
672 | #define PS3AV_STATUS_INVALID_COLOR_SPACE 0x0006 /* invalid video colose space */ | ||
673 | #define PS3AV_STATUS_INVALID_FS 0x0007 /* invalid audio sampling freq */ | ||
674 | #define PS3AV_STATUS_INVALID_AUDIO_CH 0x0008 /* invalid audio channel number */ | ||
675 | #define PS3AV_STATUS_UNSUPPORTED_VERSION 0x0009 /* version mismatch */ | ||
676 | #define PS3AV_STATUS_INVALID_SAMPLE_SIZE 0x000a /* invalid audio sample bit size */ | ||
677 | #define PS3AV_STATUS_FAILURE 0x000b /* other failures */ | ||
678 | #define PS3AV_STATUS_UNSUPPORTED_COMMAND 0x000c /* unsupported cid */ | ||
679 | #define PS3AV_STATUS_BUFFER_OVERFLOW 0x000d /* write buffer overflow */ | ||
680 | #define PS3AV_STATUS_INVALID_VIDEO_PARAM 0x000e /* invalid video param */ | ||
681 | #define PS3AV_STATUS_NO_SEL 0x000f /* not exist selector */ | ||
682 | #define PS3AV_STATUS_INVALID_AV_PARAM 0x0010 /* invalid backend param */ | ||
683 | #define PS3AV_STATUS_INVALID_AUDIO_PARAM 0x0011 /* invalid audio param */ | ||
684 | #define PS3AV_STATUS_UNSUPPORTED_HDMI_MODE 0x0012 /* unsupported hdmi mode */ | ||
685 | #define PS3AV_STATUS_NO_SYNC_HEAD 0x0013 /* sync head failed */ | ||
686 | |||
687 | extern void ps3av_set_hdr(u32, u16, struct ps3av_send_hdr *); | ||
688 | extern int ps3av_do_pkt(u32, u16, size_t, struct ps3av_send_hdr *); | ||
689 | |||
690 | extern int ps3av_cmd_init(void); | ||
691 | extern int ps3av_cmd_fin(void); | ||
692 | extern int ps3av_cmd_av_video_mute(int, u32 *, u32); | ||
693 | extern int ps3av_cmd_av_video_disable_sig(u32); | ||
694 | extern int ps3av_cmd_av_tv_mute(u32, u32); | ||
695 | extern int ps3av_cmd_enable_event(void); | ||
696 | extern int ps3av_cmd_av_hdmi_mode(u8); | ||
697 | extern u32 ps3av_cmd_set_av_video_cs(void *, u32, int, int, int, u32); | ||
698 | extern u32 ps3av_cmd_set_video_mode(void *, u32, int, int, u32); | ||
699 | extern int ps3av_cmd_video_format_black(u32, u32, u32); | ||
700 | extern int ps3av_cmd_av_audio_mute(int, u32 *, u32); | ||
701 | extern u32 ps3av_cmd_set_av_audio_param(void *, u32, | ||
702 | const struct ps3av_pkt_audio_mode *, | ||
703 | u32); | ||
704 | extern void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *, u32, u32, | ||
705 | u32, u32, u32, u32); | ||
706 | extern int ps3av_cmd_audio_mode(struct ps3av_pkt_audio_mode *); | ||
707 | extern int ps3av_cmd_audio_mute(int, u32 *, u32); | ||
708 | extern int ps3av_cmd_audio_active(int, u32); | ||
709 | extern int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *, u32); | ||
710 | extern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *); | ||
711 | #ifdef PS3AV_DEBUG | ||
712 | extern void ps3av_cmd_av_hw_conf_dump(const struct ps3av_pkt_av_get_hw_conf *); | ||
713 | extern void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *); | ||
714 | #else | ||
715 | static inline void ps3av_cmd_av_hw_conf_dump(const struct ps3av_pkt_av_get_hw_conf *hw_conf) {} | ||
716 | static inline void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *monitor_info) {} | ||
717 | #endif | ||
718 | extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, | ||
719 | u32); | ||
720 | |||
721 | extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev, | ||
722 | const void *buf, unsigned long size); | ||
723 | extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf, | ||
724 | unsigned long size, int timeout); | ||
725 | |||
726 | extern int ps3av_set_video_mode(u32, int); | ||
727 | extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32); | ||
728 | extern int ps3av_set_mode(u32, int); | ||
729 | extern int ps3av_get_mode(void); | ||
730 | extern int ps3av_get_scanmode(int); | ||
731 | extern int ps3av_get_refresh_rate(int); | ||
732 | extern int ps3av_video_mode2res(u32, u32 *, u32 *); | ||
733 | extern int ps3av_video_mute(int); | ||
734 | extern int ps3av_audio_mute(int); | ||
735 | extern int ps3av_dev_open(void); | ||
736 | extern int ps3av_dev_close(void); | ||
737 | |||
738 | #endif /* _ASM_POWERPC_PS3AV_H_ */ | ||