18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  PS3 AV backend support.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2007 Sony Computer Entertainment Inc.
68c2ecf20Sopenharmony_ci *  Copyright 2007 Sony Corp.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_PS3AV_H_
108c2ecf20Sopenharmony_ci#define _ASM_POWERPC_PS3AV_H_
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/** command for ioctl() **/
138c2ecf20Sopenharmony_ci#define PS3AV_VERSION 0x205	/* version of ps3av command */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_INIT              0x00000001
168c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_FIN               0x00000002
178c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_GET_HW_CONF       0x00000003
188c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_GET_MONITOR_INFO  0x00000004
198c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_ENABLE_EVENT      0x00000006
208c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_DISABLE_EVENT     0x00000007
218c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_TV_MUTE           0x0000000a
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_VIDEO_CS          0x00010001
248c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_VIDEO_MUTE        0x00010002
258c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_VIDEO_DISABLE_SIG 0x00010003
268c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_AUDIO_PARAM       0x00020001
278c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_AUDIO_MUTE        0x00020002
288c2ecf20Sopenharmony_ci#define PS3AV_CID_AV_HDMI_MODE         0x00040001
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define PS3AV_CID_VIDEO_INIT           0x01000001
318c2ecf20Sopenharmony_ci#define PS3AV_CID_VIDEO_MODE           0x01000002
328c2ecf20Sopenharmony_ci#define PS3AV_CID_VIDEO_FORMAT         0x01000004
338c2ecf20Sopenharmony_ci#define PS3AV_CID_VIDEO_PITCH          0x01000005
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_INIT           0x02000001
368c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_MODE           0x02000002
378c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_MUTE           0x02000003
388c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_ACTIVE         0x02000004
398c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_INACTIVE       0x02000005
408c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_SPDIF_BIT      0x02000006
418c2ecf20Sopenharmony_ci#define PS3AV_CID_AUDIO_CTRL           0x02000007
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define PS3AV_CID_EVENT_UNPLUGGED      0x10000001
448c2ecf20Sopenharmony_ci#define PS3AV_CID_EVENT_PLUGGED        0x10000002
458c2ecf20Sopenharmony_ci#define PS3AV_CID_EVENT_HDCP_DONE      0x10000003
468c2ecf20Sopenharmony_ci#define PS3AV_CID_EVENT_HDCP_FAIL      0x10000004
478c2ecf20Sopenharmony_ci#define PS3AV_CID_EVENT_HDCP_AUTH      0x10000005
488c2ecf20Sopenharmony_ci#define PS3AV_CID_EVENT_HDCP_ERROR     0x10000006
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define PS3AV_CID_AVB_PARAM            0x04000001
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* max backend ports */
538c2ecf20Sopenharmony_ci#define PS3AV_HDMI_MAX                 2	/* HDMI_0 HDMI_1 */
548c2ecf20Sopenharmony_ci#define PS3AV_AVMULTI_MAX              1	/* AVMULTI_0 */
558c2ecf20Sopenharmony_ci#define PS3AV_AV_PORT_MAX              (PS3AV_HDMI_MAX + PS3AV_AVMULTI_MAX)
568c2ecf20Sopenharmony_ci#define PS3AV_OPT_PORT_MAX             1	/* SPDIF0 */
578c2ecf20Sopenharmony_ci#define PS3AV_HEAD_MAX                 2	/* HEAD_A HEAD_B */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* num of pkt for PS3AV_CID_AVB_PARAM */
608c2ecf20Sopenharmony_ci#define PS3AV_AVB_NUM_VIDEO            PS3AV_HEAD_MAX
618c2ecf20Sopenharmony_ci#define PS3AV_AVB_NUM_AUDIO            0	/* not supported */
628c2ecf20Sopenharmony_ci#define PS3AV_AVB_NUM_AV_VIDEO         PS3AV_AV_PORT_MAX
638c2ecf20Sopenharmony_ci#define PS3AV_AVB_NUM_AV_AUDIO         PS3AV_HDMI_MAX
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define PS3AV_MUTE_PORT_MAX            1	/* num of ports in mute pkt */
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* event_bit */
688c2ecf20Sopenharmony_ci#define PS3AV_CMD_EVENT_BIT_UNPLUGGED			(1 << 0)
698c2ecf20Sopenharmony_ci#define PS3AV_CMD_EVENT_BIT_PLUGGED			(1 << 1)
708c2ecf20Sopenharmony_ci#define PS3AV_CMD_EVENT_BIT_HDCP_DONE			(1 << 2)
718c2ecf20Sopenharmony_ci#define PS3AV_CMD_EVENT_BIT_HDCP_FAIL			(1 << 3)
728c2ecf20Sopenharmony_ci#define PS3AV_CMD_EVENT_BIT_HDCP_REAUTH			(1 << 4)
738c2ecf20Sopenharmony_ci#define PS3AV_CMD_EVENT_BIT_HDCP_TOPOLOGY		(1 << 5)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* common params */
768c2ecf20Sopenharmony_ci/* mute */
778c2ecf20Sopenharmony_ci#define PS3AV_CMD_MUTE_OFF				0x0000
788c2ecf20Sopenharmony_ci#define PS3AV_CMD_MUTE_ON				0x0001
798c2ecf20Sopenharmony_ci/* avport */
808c2ecf20Sopenharmony_ci#define PS3AV_CMD_AVPORT_HDMI_0				0x0000
818c2ecf20Sopenharmony_ci#define PS3AV_CMD_AVPORT_HDMI_1				0x0001
828c2ecf20Sopenharmony_ci#define PS3AV_CMD_AVPORT_AVMULTI_0			0x0010
838c2ecf20Sopenharmony_ci#define PS3AV_CMD_AVPORT_SPDIF_0			0x0020
848c2ecf20Sopenharmony_ci#define PS3AV_CMD_AVPORT_SPDIF_1			0x0021
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* for av backend */
878c2ecf20Sopenharmony_ci/* av_mclk */
888c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_MCLK_128				0x0000
898c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_MCLK_256				0x0001
908c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_MCLK_512				0x0003
918c2ecf20Sopenharmony_ci/* av_inputlen */
928c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_INPUTLEN_16			0x02
938c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_INPUTLEN_20			0x0a
948c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_INPUTLEN_24			0x0b
958c2ecf20Sopenharmony_ci/* av_layout */
968c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_32				(1 << 0)
978c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_44				(1 << 1)
988c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_48				(1 << 2)
998c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_88				(1 << 3)
1008c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_96				(1 << 4)
1018c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_176				(1 << 5)
1028c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_LAYOUT_192				(1 << 6)
1038c2ecf20Sopenharmony_ci/* hdmi_mode */
1048c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_HDMI_MODE_NORMAL			0xff
1058c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_HDMI_HDCP_OFF			0x01
1068c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_HDMI_EDID_PASS			0x80
1078c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_HDMI_DVI				0x40
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* for video module */
1108c2ecf20Sopenharmony_ci/* video_head */
1118c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_HEAD_A				0x0000
1128c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_HEAD_B				0x0001
1138c2ecf20Sopenharmony_ci/* video_cs_out video_cs_in */
1148c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_NONE				0x0000
1158c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_RGB_8			0x0001
1168c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV444_8			0x0002
1178c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV422_8			0x0003
1188c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_XVYCC_8			0x0004
1198c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_RGB_10			0x0005
1208c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV444_10			0x0006
1218c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV422_10			0x0007
1228c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_XVYCC_10			0x0008
1238c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_RGB_12			0x0009
1248c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV444_12			0x000a
1258c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV422_12			0x000b
1268c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_XVYCC_12			0x000c
1278c2ecf20Sopenharmony_ci/* video_vid */
1288c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_NONE			0x0000
1298c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_480I			0x0001
1308c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_576I			0x0003
1318c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_480P			0x0005
1328c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_576P			0x0006
1338c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_1080I_60HZ			0x0007
1348c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_1080I_50HZ			0x0008
1358c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_720P_60HZ			0x0009
1368c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_720P_50HZ			0x000a
1378c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_1080P_60HZ			0x000b
1388c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_1080P_50HZ			0x000c
1398c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_WXGA			0x000d
1408c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_SXGA			0x000e
1418c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_WUXGA			0x000f
1428c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_VID_480I_A			0x0010
1438c2ecf20Sopenharmony_ci/* video_format */
1448c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_FORMAT_BLACK			0x0000
1458c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_FORMAT_ARGB_8BIT		0x0007
1468c2ecf20Sopenharmony_ci/* video_order */
1478c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_ORDER_RGB			0x0000
1488c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_ORDER_BGR			0x0001
1498c2ecf20Sopenharmony_ci/* video_fmt */
1508c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_FMT_X8R8G8B8			0x0000
1518c2ecf20Sopenharmony_ci/* video_out_format */
1528c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT		0x0000
1538c2ecf20Sopenharmony_ci/* video_cl_cnv */
1548c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CL_CNV_ENABLE_LUT		0x0000
1558c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CL_CNV_DISABLE_LUT		0x0010
1568c2ecf20Sopenharmony_ci/* video_sync */
1578c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_SYNC_VSYNC			0x0001
1588c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_SYNC_CSYNC			0x0004
1598c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_SYNC_HSYNC			0x0010
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/* for audio module */
1628c2ecf20Sopenharmony_ci/* num_of_ch */
1638c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_2			0x0000
1648c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_3			0x0001
1658c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_4			0x0002
1668c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_5			0x0003
1678c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_6			0x0004
1688c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_7			0x0005
1698c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_NUM_OF_CH_8			0x0006
1708c2ecf20Sopenharmony_ci/* audio_fs */
1718c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_32K				0x0001
1728c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_44K				0x0002
1738c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_48K				0x0003
1748c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_88K				0x0004
1758c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_96K				0x0005
1768c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_176K				0x0006
1778c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FS_192K				0x0007
1788c2ecf20Sopenharmony_ci/* audio_word_bits */
1798c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_WORD_BITS_16			0x0001
1808c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_WORD_BITS_20			0x0002
1818c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_WORD_BITS_24			0x0003
1828c2ecf20Sopenharmony_ci/* audio_format */
1838c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FORMAT_PCM			0x0001
1848c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_FORMAT_BITSTREAM		0x00ff
1858c2ecf20Sopenharmony_ci/* audio_source */
1868c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_SOURCE_SERIAL			0x0000
1878c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_SOURCE_SPDIF			0x0001
1888c2ecf20Sopenharmony_ci/* audio_swap */
1898c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_SWAP_0				0x0000
1908c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_SWAP_1				0x0000
1918c2ecf20Sopenharmony_ci/* audio_map */
1928c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_MAP_OUTPUT_0			0x0000
1938c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_MAP_OUTPUT_1			0x0001
1948c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_MAP_OUTPUT_2			0x0002
1958c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_MAP_OUTPUT_3			0x0003
1968c2ecf20Sopenharmony_ci/* audio_layout */
1978c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_LAYOUT_2CH			0x0000
1988c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_LAYOUT_6CH			0x000b	/* LREClr */
1998c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_LAYOUT_8CH			0x001f	/* LREClrXY */
2008c2ecf20Sopenharmony_ci/* audio_downmix */
2018c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_DOWNMIX_PERMITTED		0x0000
2028c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_DOWNMIX_PROHIBITED		0x0001
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* audio_port */
2058c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_PORT_HDMI_0			( 1 << 0 )
2068c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_PORT_HDMI_1			( 1 << 1 )
2078c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_PORT_AVMULTI_0			( 1 << 10 )
2088c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_PORT_SPDIF_0			( 1 << 20 )
2098c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_PORT_SPDIF_1			( 1 << 21 )
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci/* audio_ctrl_id */
2128c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_ID_DAC_RESET		0x0000
2138c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_ID_DAC_DE_EMPHASIS		0x0001
2148c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_ID_AVCLK			0x0002
2158c2ecf20Sopenharmony_ci/* audio_ctrl_data[0] reset */
2168c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE		0x0000
2178c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT		0x0001
2188c2ecf20Sopenharmony_ci/* audio_ctrl_data[0] de-emphasis */
2198c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_OFF		0x0000
2208c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_ON		0x0001
2218c2ecf20Sopenharmony_ci/* audio_ctrl_data[0] avclk */
2228c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_AVCLK_22			0x0000
2238c2ecf20Sopenharmony_ci#define PS3AV_CMD_AUDIO_CTRL_AVCLK_18			0x0001
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* av_vid */
2268c2ecf20Sopenharmony_ci/* do not use these params directly, use vid_video2av */
2278c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_480I				0x0000
2288c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_480P				0x0001
2298c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_720P_60HZ			0x0002
2308c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_1080I_60HZ			0x0003
2318c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_1080P_60HZ			0x0004
2328c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_576I				0x0005
2338c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_576P				0x0006
2348c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_720P_50HZ			0x0007
2358c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_1080I_50HZ			0x0008
2368c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_1080P_50HZ			0x0009
2378c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_WXGA				0x000a
2388c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_SXGA				0x000b
2398c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_VID_WUXGA				0x000c
2408c2ecf20Sopenharmony_ci/* av_cs_out av_cs_in */
2418c2ecf20Sopenharmony_ci/* use cs_video2av() */
2428c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_RGB_8				0x0000
2438c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_YUV444_8			0x0001
2448c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_YUV422_8			0x0002
2458c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_XVYCC_8				0x0003
2468c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_RGB_10				0x0004
2478c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_YUV444_10			0x0005
2488c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_YUV422_10			0x0006
2498c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_XVYCC_10			0x0007
2508c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_RGB_12				0x0008
2518c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_YUV444_12			0x0009
2528c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_YUV422_12			0x000a
2538c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_XVYCC_12			0x000b
2548c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_8				0x0000
2558c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_10				0x0001
2568c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_CS_12				0x0002
2578c2ecf20Sopenharmony_ci/* dither */
2588c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_DITHER_OFF				0x0000
2598c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_DITHER_ON				0x0001
2608c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_DITHER_8BIT			0x0000
2618c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_DITHER_10BIT			0x0002
2628c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_DITHER_12BIT			0x0004
2638c2ecf20Sopenharmony_ci/* super_white */
2648c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_SUPER_WHITE_OFF			0x0000
2658c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_SUPER_WHITE_ON			0x0001
2668c2ecf20Sopenharmony_ci/* aspect */
2678c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_ASPECT_16_9			0x0000
2688c2ecf20Sopenharmony_ci#define PS3AV_CMD_AV_ASPECT_4_3				0x0001
2698c2ecf20Sopenharmony_ci/* video_cs_cnv() */
2708c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_RGB				0x0001
2718c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV422			0x0002
2728c2ecf20Sopenharmony_ci#define PS3AV_CMD_VIDEO_CS_YUV444			0x0003
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci/* for broadcast automode */
2758c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_720x480P			0x0003	/* 0x0001 | 0x0002 */
2768c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_720x576P			0x0003	/* 0x0001 | 0x0002 */
2778c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_1280x720P			0x0004
2788c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_1920x1080I			0x0008
2798c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_1920x1080P			0x4000
2808c2ecf20Sopenharmony_ci#define PS3AV_RES_MASK_60			(PS3AV_RESBIT_720x480P \
2818c2ecf20Sopenharmony_ci						| PS3AV_RESBIT_1280x720P \
2828c2ecf20Sopenharmony_ci						| PS3AV_RESBIT_1920x1080I \
2838c2ecf20Sopenharmony_ci						| PS3AV_RESBIT_1920x1080P)
2848c2ecf20Sopenharmony_ci#define PS3AV_RES_MASK_50			(PS3AV_RESBIT_720x576P \
2858c2ecf20Sopenharmony_ci						| PS3AV_RESBIT_1280x720P \
2868c2ecf20Sopenharmony_ci						| PS3AV_RESBIT_1920x1080I \
2878c2ecf20Sopenharmony_ci						| PS3AV_RESBIT_1920x1080P)
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/* for VESA automode */
2908c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_VGA			0x0001
2918c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_WXGA			0x0002
2928c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_SXGA			0x0004
2938c2ecf20Sopenharmony_ci#define PS3AV_RESBIT_WUXGA			0x0008
2948c2ecf20Sopenharmony_ci#define PS3AV_RES_MASK_VESA			(PS3AV_RESBIT_WXGA |\
2958c2ecf20Sopenharmony_ci						 PS3AV_RESBIT_SXGA |\
2968c2ecf20Sopenharmony_ci						 PS3AV_RESBIT_WUXGA)
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci#define PS3AV_MONITOR_TYPE_HDMI			1	/* HDMI */
2998c2ecf20Sopenharmony_ci#define PS3AV_MONITOR_TYPE_DVI			2	/* DVI */
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/* for video mode */
3038c2ecf20Sopenharmony_cienum ps3av_mode_num {
3048c2ecf20Sopenharmony_ci	PS3AV_MODE_AUTO				= 0,
3058c2ecf20Sopenharmony_ci	PS3AV_MODE_480I				= 1,
3068c2ecf20Sopenharmony_ci	PS3AV_MODE_480P				= 2,
3078c2ecf20Sopenharmony_ci	PS3AV_MODE_720P60			= 3,
3088c2ecf20Sopenharmony_ci	PS3AV_MODE_1080I60			= 4,
3098c2ecf20Sopenharmony_ci	PS3AV_MODE_1080P60			= 5,
3108c2ecf20Sopenharmony_ci	PS3AV_MODE_576I				= 6,
3118c2ecf20Sopenharmony_ci	PS3AV_MODE_576P				= 7,
3128c2ecf20Sopenharmony_ci	PS3AV_MODE_720P50			= 8,
3138c2ecf20Sopenharmony_ci	PS3AV_MODE_1080I50			= 9,
3148c2ecf20Sopenharmony_ci	PS3AV_MODE_1080P50			= 10,
3158c2ecf20Sopenharmony_ci	PS3AV_MODE_WXGA				= 11,
3168c2ecf20Sopenharmony_ci	PS3AV_MODE_SXGA				= 12,
3178c2ecf20Sopenharmony_ci	PS3AV_MODE_WUXGA			= 13,
3188c2ecf20Sopenharmony_ci};
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci#define PS3AV_MODE_MASK				0x000F
3218c2ecf20Sopenharmony_ci#define PS3AV_MODE_HDCP_OFF			0x1000	/* Retail PS3 product doesn't support this */
3228c2ecf20Sopenharmony_ci#define PS3AV_MODE_DITHER			0x0800
3238c2ecf20Sopenharmony_ci#define PS3AV_MODE_COLOR			0x0400
3248c2ecf20Sopenharmony_ci#define PS3AV_MODE_WHITE			0x0200
3258c2ecf20Sopenharmony_ci#define PS3AV_MODE_FULL				0x0080
3268c2ecf20Sopenharmony_ci#define PS3AV_MODE_DVI				0x0040
3278c2ecf20Sopenharmony_ci#define PS3AV_MODE_RGB				0x0020
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_60	PS3AV_MODE_480P
3318c2ecf20Sopenharmony_ci#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_60	PS3AV_MODE_480I
3328c2ecf20Sopenharmony_ci#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_50	PS3AV_MODE_576P
3338c2ecf20Sopenharmony_ci#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_50	PS3AV_MODE_576I
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci#define PS3AV_REGION_60				0x01
3368c2ecf20Sopenharmony_ci#define PS3AV_REGION_50				0x02
3378c2ecf20Sopenharmony_ci#define PS3AV_REGION_RGB			0x10
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci#define get_status(buf)				(((__u32 *)buf)[2])
3408c2ecf20Sopenharmony_ci#define PS3AV_HDR_SIZE				4	/* version + size */
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci/** command packet structure **/
3448c2ecf20Sopenharmony_cistruct ps3av_send_hdr {
3458c2ecf20Sopenharmony_ci	u16 version;
3468c2ecf20Sopenharmony_ci	u16 size;		/* size of command packet */
3478c2ecf20Sopenharmony_ci	u32 cid;		/* command id */
3488c2ecf20Sopenharmony_ci};
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_cistruct ps3av_reply_hdr {
3518c2ecf20Sopenharmony_ci	u16 version;
3528c2ecf20Sopenharmony_ci	u16 size;
3538c2ecf20Sopenharmony_ci	u32 cid;
3548c2ecf20Sopenharmony_ci	u32 status;
3558c2ecf20Sopenharmony_ci};
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* backend: initialization */
3588c2ecf20Sopenharmony_cistruct ps3av_pkt_av_init {
3598c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
3608c2ecf20Sopenharmony_ci	u32 event_bit;
3618c2ecf20Sopenharmony_ci};
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci/* backend: finalize */
3648c2ecf20Sopenharmony_cistruct ps3av_pkt_av_fin {
3658c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
3668c2ecf20Sopenharmony_ci	/* recv */
3678c2ecf20Sopenharmony_ci	u32 reserved;
3688c2ecf20Sopenharmony_ci};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci/* backend: get port */
3718c2ecf20Sopenharmony_cistruct ps3av_pkt_av_get_hw_conf {
3728c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
3738c2ecf20Sopenharmony_ci	/* recv */
3748c2ecf20Sopenharmony_ci	u32 status;
3758c2ecf20Sopenharmony_ci	u16 num_of_hdmi;	/* out: number of hdmi */
3768c2ecf20Sopenharmony_ci	u16 num_of_avmulti;	/* out: number of avmulti */
3778c2ecf20Sopenharmony_ci	u16 num_of_spdif;	/* out: number of hdmi */
3788c2ecf20Sopenharmony_ci	u16 reserved;
3798c2ecf20Sopenharmony_ci};
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci/* backend: get monitor info */
3828c2ecf20Sopenharmony_cistruct ps3av_info_resolution {
3838c2ecf20Sopenharmony_ci	u32 res_bits;
3848c2ecf20Sopenharmony_ci	u32 native;
3858c2ecf20Sopenharmony_ci};
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_cistruct ps3av_info_cs {
3888c2ecf20Sopenharmony_ci	u8 rgb;
3898c2ecf20Sopenharmony_ci	u8 yuv444;
3908c2ecf20Sopenharmony_ci	u8 yuv422;
3918c2ecf20Sopenharmony_ci	u8 reserved;
3928c2ecf20Sopenharmony_ci};
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_cistruct ps3av_info_color {
3958c2ecf20Sopenharmony_ci	u16 red_x;
3968c2ecf20Sopenharmony_ci	u16 red_y;
3978c2ecf20Sopenharmony_ci	u16 green_x;
3988c2ecf20Sopenharmony_ci	u16 green_y;
3998c2ecf20Sopenharmony_ci	u16 blue_x;
4008c2ecf20Sopenharmony_ci	u16 blue_y;
4018c2ecf20Sopenharmony_ci	u16 white_x;
4028c2ecf20Sopenharmony_ci	u16 white_y;
4038c2ecf20Sopenharmony_ci	u32 gamma;
4048c2ecf20Sopenharmony_ci};
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_cistruct ps3av_info_audio {
4078c2ecf20Sopenharmony_ci	u8 type;
4088c2ecf20Sopenharmony_ci	u8 max_num_of_ch;
4098c2ecf20Sopenharmony_ci	u8 fs;
4108c2ecf20Sopenharmony_ci	u8 sbit;
4118c2ecf20Sopenharmony_ci};
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_cistruct ps3av_info_monitor {
4148c2ecf20Sopenharmony_ci	u8 avport;
4158c2ecf20Sopenharmony_ci	u8 monitor_id[10];
4168c2ecf20Sopenharmony_ci	u8 monitor_type;
4178c2ecf20Sopenharmony_ci	u8 monitor_name[16];
4188c2ecf20Sopenharmony_ci	struct ps3av_info_resolution res_60;
4198c2ecf20Sopenharmony_ci	struct ps3av_info_resolution res_50;
4208c2ecf20Sopenharmony_ci	struct ps3av_info_resolution res_other;
4218c2ecf20Sopenharmony_ci	struct ps3av_info_resolution res_vesa;
4228c2ecf20Sopenharmony_ci	struct ps3av_info_cs cs;
4238c2ecf20Sopenharmony_ci	struct ps3av_info_color color;
4248c2ecf20Sopenharmony_ci	u8 supported_ai;
4258c2ecf20Sopenharmony_ci	u8 speaker_info;
4268c2ecf20Sopenharmony_ci	u8 num_of_audio_block;
4278c2ecf20Sopenharmony_ci	struct ps3av_info_audio audio[0];	/* 0 or more audio blocks */
4288c2ecf20Sopenharmony_ci	u8 reserved[169];
4298c2ecf20Sopenharmony_ci} __attribute__ ((packed));
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_cistruct ps3av_pkt_av_get_monitor_info {
4328c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
4338c2ecf20Sopenharmony_ci	u16 avport;		/* in: avport */
4348c2ecf20Sopenharmony_ci	u16 reserved;
4358c2ecf20Sopenharmony_ci	/* recv */
4368c2ecf20Sopenharmony_ci	struct ps3av_info_monitor info;	/* out: monitor info */
4378c2ecf20Sopenharmony_ci};
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci/* backend: enable/disable event */
4408c2ecf20Sopenharmony_cistruct ps3av_pkt_av_event {
4418c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
4428c2ecf20Sopenharmony_ci	u32 event_bit;		/* in */
4438c2ecf20Sopenharmony_ci};
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/* backend: video cs param */
4468c2ecf20Sopenharmony_cistruct ps3av_pkt_av_video_cs {
4478c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
4488c2ecf20Sopenharmony_ci	u16 avport;		/* in: avport */
4498c2ecf20Sopenharmony_ci	u16 av_vid;		/* in: video resolution */
4508c2ecf20Sopenharmony_ci	u16 av_cs_out;		/* in: output color space */
4518c2ecf20Sopenharmony_ci	u16 av_cs_in;		/* in: input color space */
4528c2ecf20Sopenharmony_ci	u8 dither;		/* in: dither bit length */
4538c2ecf20Sopenharmony_ci	u8 bitlen_out;		/* in: bit length */
4548c2ecf20Sopenharmony_ci	u8 super_white;		/* in: super white */
4558c2ecf20Sopenharmony_ci	u8 aspect;		/* in: aspect ratio */
4568c2ecf20Sopenharmony_ci};
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/* backend: video mute */
4598c2ecf20Sopenharmony_cistruct ps3av_av_mute {
4608c2ecf20Sopenharmony_ci	u16 avport;		/* in: avport */
4618c2ecf20Sopenharmony_ci	u16 mute;		/* in: mute on/off */
4628c2ecf20Sopenharmony_ci};
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_cistruct ps3av_pkt_av_video_mute {
4658c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
4668c2ecf20Sopenharmony_ci	struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX];
4678c2ecf20Sopenharmony_ci};
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci/* backend: video disable signal */
4708c2ecf20Sopenharmony_cistruct ps3av_pkt_av_video_disable_sig {
4718c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
4728c2ecf20Sopenharmony_ci	u16 avport;		/* in: avport */
4738c2ecf20Sopenharmony_ci	u16 reserved;
4748c2ecf20Sopenharmony_ci};
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci/* backend: audio param */
4778c2ecf20Sopenharmony_cistruct ps3av_audio_info_frame {
4788c2ecf20Sopenharmony_ci	struct pb1_bit {
4798c2ecf20Sopenharmony_ci		u8 ct:4;
4808c2ecf20Sopenharmony_ci		u8 rsv:1;
4818c2ecf20Sopenharmony_ci		u8 cc:3;
4828c2ecf20Sopenharmony_ci	} pb1;
4838c2ecf20Sopenharmony_ci	struct pb2_bit {
4848c2ecf20Sopenharmony_ci		u8 rsv:3;
4858c2ecf20Sopenharmony_ci		u8 sf:3;
4868c2ecf20Sopenharmony_ci		u8 ss:2;
4878c2ecf20Sopenharmony_ci	} pb2;
4888c2ecf20Sopenharmony_ci	u8 pb3;
4898c2ecf20Sopenharmony_ci	u8 pb4;
4908c2ecf20Sopenharmony_ci	struct pb5_bit {
4918c2ecf20Sopenharmony_ci		u8 dm:1;
4928c2ecf20Sopenharmony_ci		u8 lsv:4;
4938c2ecf20Sopenharmony_ci		u8 rsv:3;
4948c2ecf20Sopenharmony_ci	} pb5;
4958c2ecf20Sopenharmony_ci};
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_cistruct ps3av_pkt_av_audio_param {
4988c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
4998c2ecf20Sopenharmony_ci	u16 avport;		/* in: avport */
5008c2ecf20Sopenharmony_ci	u16 reserved;
5018c2ecf20Sopenharmony_ci	u8 mclk;		/* in: audio mclk */
5028c2ecf20Sopenharmony_ci	u8 ns[3];		/* in: audio ns val */
5038c2ecf20Sopenharmony_ci	u8 enable;		/* in: audio enable */
5048c2ecf20Sopenharmony_ci	u8 swaplr;		/* in: audio swap */
5058c2ecf20Sopenharmony_ci	u8 fifomap;		/* in: audio fifomap */
5068c2ecf20Sopenharmony_ci	u8 inputctrl;		/* in: audio input ctrl */
5078c2ecf20Sopenharmony_ci	u8 inputlen;		/* in: sample bit size */
5088c2ecf20Sopenharmony_ci	u8 layout;		/* in: speaker layout param */
5098c2ecf20Sopenharmony_ci	struct ps3av_audio_info_frame info;	/* in: info */
5108c2ecf20Sopenharmony_ci	u8 chstat[5];		/* in: ch stat */
5118c2ecf20Sopenharmony_ci};
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci/* backend: audio_mute */
5148c2ecf20Sopenharmony_cistruct ps3av_pkt_av_audio_mute {
5158c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5168c2ecf20Sopenharmony_ci	struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX];
5178c2ecf20Sopenharmony_ci};
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_ci/* backend: hdmi_mode */
5208c2ecf20Sopenharmony_cistruct ps3av_pkt_av_hdmi_mode {
5218c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5228c2ecf20Sopenharmony_ci	u8 mode;		/* in: hdmi_mode */
5238c2ecf20Sopenharmony_ci	u8 reserved0;
5248c2ecf20Sopenharmony_ci	u8 reserved1;
5258c2ecf20Sopenharmony_ci	u8 reserved2;
5268c2ecf20Sopenharmony_ci};
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_ci/* backend: tv_mute */
5298c2ecf20Sopenharmony_cistruct ps3av_pkt_av_tv_mute {
5308c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5318c2ecf20Sopenharmony_ci	u16 avport;		/* in: avport HDMI only */
5328c2ecf20Sopenharmony_ci	u16 mute;		/* in: mute */
5338c2ecf20Sopenharmony_ci};
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_ci/* video: initialize */
5368c2ecf20Sopenharmony_cistruct ps3av_pkt_video_init {
5378c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5388c2ecf20Sopenharmony_ci	/* recv */
5398c2ecf20Sopenharmony_ci	u32 reserved;
5408c2ecf20Sopenharmony_ci};
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci/* video: mode setting */
5438c2ecf20Sopenharmony_cistruct ps3av_pkt_video_mode {
5448c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5458c2ecf20Sopenharmony_ci	u32 video_head;		/* in: head */
5468c2ecf20Sopenharmony_ci	u32 reserved;
5478c2ecf20Sopenharmony_ci	u32 video_vid;		/* in: video resolution */
5488c2ecf20Sopenharmony_ci	u16 reserved1;
5498c2ecf20Sopenharmony_ci	u16 width;		/* in: width in pixel */
5508c2ecf20Sopenharmony_ci	u16 reserved2;
5518c2ecf20Sopenharmony_ci	u16 height;		/* in: height in pixel */
5528c2ecf20Sopenharmony_ci	u32 pitch;		/* in: line size in byte */
5538c2ecf20Sopenharmony_ci	u32 video_out_format;	/* in: out format */
5548c2ecf20Sopenharmony_ci	u32 video_format;	/* in: input frame buffer format */
5558c2ecf20Sopenharmony_ci	u8 reserved3;
5568c2ecf20Sopenharmony_ci	u8 video_cl_cnv;	/* in: color conversion */
5578c2ecf20Sopenharmony_ci	u16 video_order;	/* in: input RGB order */
5588c2ecf20Sopenharmony_ci	u32 reserved4;
5598c2ecf20Sopenharmony_ci};
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci/* video: format */
5628c2ecf20Sopenharmony_cistruct ps3av_pkt_video_format {
5638c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5648c2ecf20Sopenharmony_ci	u32 video_head;		/* in: head */
5658c2ecf20Sopenharmony_ci	u32 video_format;	/* in: frame buffer format */
5668c2ecf20Sopenharmony_ci	u8 reserved;
5678c2ecf20Sopenharmony_ci	u8 video_cl_cnv;	/* in: color conversion */
5688c2ecf20Sopenharmony_ci	u16 video_order;	/* in: input RGB order */
5698c2ecf20Sopenharmony_ci};
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci/* video: pitch */
5728c2ecf20Sopenharmony_cistruct ps3av_pkt_video_pitch {
5738c2ecf20Sopenharmony_ci	u16 version;
5748c2ecf20Sopenharmony_ci	u16 size;		/* size of command packet */
5758c2ecf20Sopenharmony_ci	u32 cid;		/* command id */
5768c2ecf20Sopenharmony_ci	u32 video_head;		/* in: head */
5778c2ecf20Sopenharmony_ci	u32 pitch;		/* in: line size in byte */
5788c2ecf20Sopenharmony_ci};
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci/* audio: initialize */
5818c2ecf20Sopenharmony_cistruct ps3av_pkt_audio_init {
5828c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5838c2ecf20Sopenharmony_ci	/* recv */
5848c2ecf20Sopenharmony_ci	u32 reserved;
5858c2ecf20Sopenharmony_ci};
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ci/* audio: mode setting */
5888c2ecf20Sopenharmony_cistruct ps3av_pkt_audio_mode {
5898c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
5908c2ecf20Sopenharmony_ci	u8 avport;		/* in: avport */
5918c2ecf20Sopenharmony_ci	u8 reserved0[3];
5928c2ecf20Sopenharmony_ci	u32 mask;		/* in: mask */
5938c2ecf20Sopenharmony_ci	u32 audio_num_of_ch;	/* in: number of ch */
5948c2ecf20Sopenharmony_ci	u32 audio_fs;		/* in: sampling freq */
5958c2ecf20Sopenharmony_ci	u32 audio_word_bits;	/* in: sample bit size */
5968c2ecf20Sopenharmony_ci	u32 audio_format;	/* in: audio output format */
5978c2ecf20Sopenharmony_ci	u32 audio_source;	/* in: audio source */
5988c2ecf20Sopenharmony_ci	u8 audio_enable[4];	/* in: audio enable */
5998c2ecf20Sopenharmony_ci	u8 audio_swap[4];	/* in: audio swap */
6008c2ecf20Sopenharmony_ci	u8 audio_map[4];	/* in: audio map */
6018c2ecf20Sopenharmony_ci	u32 audio_layout;	/* in: speaker layout */
6028c2ecf20Sopenharmony_ci	u32 audio_downmix;	/* in: audio downmix permission */
6038c2ecf20Sopenharmony_ci	u32 audio_downmix_level;
6048c2ecf20Sopenharmony_ci	u8 audio_cs_info[8];	/* in: IEC channel status */
6058c2ecf20Sopenharmony_ci};
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci/* audio: mute */
6088c2ecf20Sopenharmony_cistruct ps3av_audio_mute {
6098c2ecf20Sopenharmony_ci	u8 avport;		/* in: opt_port optical */
6108c2ecf20Sopenharmony_ci	u8 reserved[3];
6118c2ecf20Sopenharmony_ci	u32 mute;		/* in: mute */
6128c2ecf20Sopenharmony_ci};
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_cistruct ps3av_pkt_audio_mute {
6158c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
6168c2ecf20Sopenharmony_ci	struct ps3av_audio_mute mute[PS3AV_OPT_PORT_MAX];
6178c2ecf20Sopenharmony_ci};
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci/* audio: active/inactive */
6208c2ecf20Sopenharmony_cistruct ps3av_pkt_audio_active {
6218c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
6228c2ecf20Sopenharmony_ci	u32 audio_port;		/* in: audio active/inactive port */
6238c2ecf20Sopenharmony_ci};
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci/* audio: SPDIF user bit */
6268c2ecf20Sopenharmony_cistruct ps3av_pkt_audio_spdif_bit {
6278c2ecf20Sopenharmony_ci	u16 version;
6288c2ecf20Sopenharmony_ci	u16 size;		/* size of command packet */
6298c2ecf20Sopenharmony_ci	u32 cid;		/* command id */
6308c2ecf20Sopenharmony_ci	u8 avport;		/* in: avport SPDIF only */
6318c2ecf20Sopenharmony_ci	u8 reserved[3];
6328c2ecf20Sopenharmony_ci	u32 audio_port;		/* in: SPDIF only */
6338c2ecf20Sopenharmony_ci	u32 spdif_bit_data[12];	/* in: user bit data */
6348c2ecf20Sopenharmony_ci};
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci/* audio: audio control */
6378c2ecf20Sopenharmony_cistruct ps3av_pkt_audio_ctrl {
6388c2ecf20Sopenharmony_ci	u16 version;
6398c2ecf20Sopenharmony_ci	u16 size;		/* size of command packet */
6408c2ecf20Sopenharmony_ci	u32 cid;		/* command id */
6418c2ecf20Sopenharmony_ci	u32 audio_ctrl_id;	/* in: control id */
6428c2ecf20Sopenharmony_ci	u32 audio_ctrl_data[4];	/* in: control data */
6438c2ecf20Sopenharmony_ci};
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci/* avb:param */
6468c2ecf20Sopenharmony_ci#define PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE	\
6478c2ecf20Sopenharmony_ci	(PS3AV_AVB_NUM_VIDEO*sizeof(struct ps3av_pkt_video_mode) + \
6488c2ecf20Sopenharmony_ci	 PS3AV_AVB_NUM_AUDIO*sizeof(struct ps3av_pkt_audio_mode) + \
6498c2ecf20Sopenharmony_ci	 PS3AV_AVB_NUM_AV_VIDEO*sizeof(struct ps3av_pkt_av_video_cs) + \
6508c2ecf20Sopenharmony_ci	 PS3AV_AVB_NUM_AV_AUDIO*sizeof(struct ps3av_pkt_av_audio_param))
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_cistruct ps3av_pkt_avb_param {
6538c2ecf20Sopenharmony_ci	struct ps3av_send_hdr send_hdr;
6548c2ecf20Sopenharmony_ci	u16 num_of_video_pkt;
6558c2ecf20Sopenharmony_ci	u16 num_of_audio_pkt;
6568c2ecf20Sopenharmony_ci	u16 num_of_av_video_pkt;
6578c2ecf20Sopenharmony_ci	u16 num_of_av_audio_pkt;
6588c2ecf20Sopenharmony_ci	/*
6598c2ecf20Sopenharmony_ci	 * The actual buffer layout depends on the fields above:
6608c2ecf20Sopenharmony_ci	 *
6618c2ecf20Sopenharmony_ci	 * struct ps3av_pkt_video_mode video[num_of_video_pkt];
6628c2ecf20Sopenharmony_ci	 * struct ps3av_pkt_audio_mode audio[num_of_audio_pkt];
6638c2ecf20Sopenharmony_ci	 * struct ps3av_pkt_av_video_cs av_video[num_of_av_video_pkt];
6648c2ecf20Sopenharmony_ci	 * struct ps3av_pkt_av_audio_param av_audio[num_of_av_audio_pkt];
6658c2ecf20Sopenharmony_ci	 */
6668c2ecf20Sopenharmony_ci	u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE];
6678c2ecf20Sopenharmony_ci};
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci/* channel status */
6708c2ecf20Sopenharmony_ciextern u8 ps3av_mode_cs_info[];
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci/** command status **/
6738c2ecf20Sopenharmony_ci#define PS3AV_STATUS_SUCCESS			0x0000	/* success */
6748c2ecf20Sopenharmony_ci#define PS3AV_STATUS_RECEIVE_VUART_ERROR	0x0001	/* receive vuart error */
6758c2ecf20Sopenharmony_ci#define PS3AV_STATUS_SYSCON_COMMUNICATE_FAIL	0x0002	/* syscon communication error */
6768c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_COMMAND		0x0003	/* obsolete invalid CID */
6778c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_PORT		0x0004	/* invalid port number */
6788c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_VID		0x0005	/* invalid video format */
6798c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_COLOR_SPACE	0x0006	/* invalid video colose space */
6808c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_FS			0x0007	/* invalid audio sampling freq */
6818c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_AUDIO_CH		0x0008	/* invalid audio channel number */
6828c2ecf20Sopenharmony_ci#define PS3AV_STATUS_UNSUPPORTED_VERSION	0x0009	/* version mismatch  */
6838c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_SAMPLE_SIZE	0x000a	/* invalid audio sample bit size */
6848c2ecf20Sopenharmony_ci#define PS3AV_STATUS_FAILURE			0x000b	/* other failures */
6858c2ecf20Sopenharmony_ci#define PS3AV_STATUS_UNSUPPORTED_COMMAND	0x000c	/* unsupported cid */
6868c2ecf20Sopenharmony_ci#define PS3AV_STATUS_BUFFER_OVERFLOW		0x000d	/* write buffer overflow */
6878c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_VIDEO_PARAM	0x000e	/* invalid video param */
6888c2ecf20Sopenharmony_ci#define PS3AV_STATUS_NO_SEL			0x000f	/* not exist selector */
6898c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_AV_PARAM		0x0010	/* invalid backend param */
6908c2ecf20Sopenharmony_ci#define PS3AV_STATUS_INVALID_AUDIO_PARAM	0x0011	/* invalid audio param */
6918c2ecf20Sopenharmony_ci#define PS3AV_STATUS_UNSUPPORTED_HDMI_MODE	0x0012	/* unsupported hdmi mode */
6928c2ecf20Sopenharmony_ci#define PS3AV_STATUS_NO_SYNC_HEAD		0x0013	/* sync head failed */
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_ciextern void ps3av_set_hdr(u32, u16, struct ps3av_send_hdr *);
6958c2ecf20Sopenharmony_ciextern int ps3av_do_pkt(u32, u16, size_t, struct ps3av_send_hdr *);
6968c2ecf20Sopenharmony_ci
6978c2ecf20Sopenharmony_ciextern int ps3av_cmd_init(void);
6988c2ecf20Sopenharmony_ciextern int ps3av_cmd_fin(void);
6998c2ecf20Sopenharmony_ciextern int ps3av_cmd_av_video_mute(int, u32 *, u32);
7008c2ecf20Sopenharmony_ciextern int ps3av_cmd_av_video_disable_sig(u32);
7018c2ecf20Sopenharmony_ciextern int ps3av_cmd_av_tv_mute(u32, u32);
7028c2ecf20Sopenharmony_ciextern int ps3av_cmd_enable_event(void);
7038c2ecf20Sopenharmony_ciextern int ps3av_cmd_av_hdmi_mode(u8);
7048c2ecf20Sopenharmony_ciextern u32 ps3av_cmd_set_av_video_cs(void *, u32, int, int, int, u32);
7058c2ecf20Sopenharmony_ciextern u32 ps3av_cmd_set_video_mode(void *, u32, int, int, u32);
7068c2ecf20Sopenharmony_ciextern int ps3av_cmd_video_format_black(u32, u32, u32);
7078c2ecf20Sopenharmony_ciextern int ps3av_cmd_av_audio_mute(int, u32 *, u32);
7088c2ecf20Sopenharmony_ciextern u32 ps3av_cmd_set_av_audio_param(void *, u32,
7098c2ecf20Sopenharmony_ci					const struct ps3av_pkt_audio_mode *,
7108c2ecf20Sopenharmony_ci					u32);
7118c2ecf20Sopenharmony_ciextern void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *, u32, u32,
7128c2ecf20Sopenharmony_ci				     u32, u32, u32, u32);
7138c2ecf20Sopenharmony_ciextern int ps3av_cmd_audio_mode(struct ps3av_pkt_audio_mode *);
7148c2ecf20Sopenharmony_ciextern int ps3av_cmd_audio_mute(int, u32 *, u32);
7158c2ecf20Sopenharmony_ciextern int ps3av_cmd_audio_active(int, u32);
7168c2ecf20Sopenharmony_ciextern int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *, u32);
7178c2ecf20Sopenharmony_ciextern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *);
7188c2ecf20Sopenharmony_ciextern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
7198c2ecf20Sopenharmony_ci					    u32);
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ciextern int ps3av_set_video_mode(int);
7228c2ecf20Sopenharmony_ciextern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
7238c2ecf20Sopenharmony_ciextern int ps3av_get_auto_mode(void);
7248c2ecf20Sopenharmony_ciextern int ps3av_get_mode(void);
7258c2ecf20Sopenharmony_ciextern int ps3av_video_mode2res(u32, u32 *, u32 *);
7268c2ecf20Sopenharmony_ciextern int ps3av_video_mute(int);
7278c2ecf20Sopenharmony_ciextern int ps3av_audio_mute(int);
7288c2ecf20Sopenharmony_ciextern int ps3av_audio_mute_analog(int);
7298c2ecf20Sopenharmony_ciextern int ps3av_dev_open(void);
7308c2ecf20Sopenharmony_ciextern int ps3av_dev_close(void);
7318c2ecf20Sopenharmony_ci#endif	/* _ASM_POWERPC_PS3AV_H_ */
732