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