Merge remote branch 'common/android-2.6.36' into android-tegra-2.6.36
[firefly-linux-kernel-4.4.55.git] / drivers / video / tegra / dc / hdmi.h
1 /*
2  * drivers/video/tegra/dc/hdmi.h
3  *
4  * non-tegra specific HDMI declarations
5  *
6  * Copyright (C) 2010 Google, Inc.
7  * Author: Erik Gilling <konkers@android.com>
8  *
9  * This software is licensed under the terms of the GNU General Public
10  * License version 2, as published by the Free Software Foundation, and
11  * may be copied, distributed, and modified under those terms.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  */
19
20 #ifndef __DRIVERS_VIDEO_TEGRA_DC_HDMI_H
21 #define __DRIVERS_VIDEO_TEGRA_DC_HDMI_H
22
23 #define HDMI_INFOFRAME_TYPE_VENDOR      0x81
24 #define HDMI_INFOFRAME_TYPE_AVI         0x82
25 #define HDMI_INFOFRAME_TYPE_SPD         0x83
26 #define HDMI_INFOFRAME_TYPE_AUDIO       0x84
27 #define HDMI_INFOFRAME_TYPE_MPEG_SRC    0x85
28 #define HDMI_INFOFRAME_TYPE_NTSC_VBI    0x86
29
30 /* all fields little endian */
31 struct hdmi_avi_infoframe {
32         /* PB0 */
33         u8              csum;
34
35         /* PB1 */
36         unsigned        s:2;    /* scan information */
37         unsigned        b:2;    /* bar info data valid */
38         unsigned        a:1;    /* active info present */
39         unsigned        y:2;    /* RGB or YCbCr */
40         unsigned        res1:1;
41
42         /* PB2 */
43         unsigned        r:4;    /* active format aspect ratio */
44         unsigned        m:2;    /* picture aspect ratio */
45         unsigned        c:2;    /* colorimetry */
46
47         /* PB3 */
48         unsigned        sc:2;   /* scan information */
49         unsigned        q:2;    /* quantization range */
50         unsigned        ec:3;   /* extended colorimetry */
51         unsigned        itc:1;  /* it content */
52
53         /* PB4 */
54         unsigned        vic:7;  /* video format id code */
55         unsigned        res4:1;
56
57         /* PB5 */
58         unsigned        pr:4;   /* pixel repetition factor */
59         unsigned        cn:2;   /* it content type*/
60         unsigned        yq:2;   /* ycc quantization range */
61
62         /* PB6-7 */
63         u16             top_bar_end_line;
64
65         /* PB8-9 */
66         u16             bot_bar_start_line;
67
68         /* PB10-11 */
69         u16             left_bar_end_pixel;
70
71         /* PB12-13 */
72         u16             right_bar_start_pixel;
73 } __attribute__((packed));
74
75 #define HDMI_AVI_VERSION                0x02
76
77 #define HDMI_AVI_Y_RGB                  0x0
78 #define HDMI_AVI_Y_YCBCR_422            0x1
79 #define HDMI_AVI_Y_YCBCR_444            0x2
80
81 #define HDMI_AVI_B_VERT                 0x1
82 #define HDMI_AVI_B_HORIZ                0x2
83
84 #define HDMI_AVI_S_NONE                 0x0
85 #define HDMI_AVI_S_OVERSCAN             0x1
86 #define HDMI_AVI_S_UNDERSCAN            0x2
87
88 #define HDMI_AVI_C_NONE                 0x0
89 #define HDMI_AVI_C_SMPTE                0x1
90 #define HDMI_AVI_C_ITU_R                0x2
91 #define HDMI_AVI_C_EXTENDED             0x4
92
93 #define HDMI_AVI_M_4_3                  0x1
94 #define HDMI_AVI_M_16_9                 0x2
95
96 #define HDMI_AVI_R_SAME                 0x8
97 #define HDMI_AVI_R_4_3_CENTER           0x9
98 #define HDMI_AVI_R_16_9_CENTER          0xa
99 #define HDMI_AVI_R_14_9_CENTER          0xb
100
101 /* all fields little endian */
102 struct hdmi_audio_infoframe {
103         /* PB0 */
104         u8              csum;
105
106         /* PB1 */
107         unsigned        cc:3;           /* channel count */
108         unsigned        res1:1;
109         unsigned        ct:4;           /* coding type */
110
111         /* PB2 */
112         unsigned        ss:2;           /* sample size */
113         unsigned        sf:3;           /* sample frequency */
114         unsigned        res2:3;
115
116         /* PB3 */
117         unsigned        cxt:5;          /* coding extention type */
118         unsigned        res3:3;
119
120         /* PB4 */
121         u8              ca;             /* channel/speaker allocation */
122
123         /* PB5 */
124         unsigned        res5:3;
125         unsigned        lsv:4;          /* level shift value */
126         unsigned        dm_inh:1;       /* downmix inhibit */
127
128         /* PB6-10 reserved */
129         u8              res6;
130         u8              res7;
131         u8              res8;
132         u8              res9;
133         u8              res10;
134 } __attribute__((packed));
135
136 #define HDMI_AUDIO_VERSION              0x01
137
138 #define HDMI_AUDIO_CC_STREAM            0x0 /* specified by audio stream */
139 #define HDMI_AUDIO_CC_2                 0x1
140 #define HDMI_AUDIO_CC_3                 0x2
141 #define HDMI_AUDIO_CC_4                 0x3
142 #define HDMI_AUDIO_CC_5                 0x4
143 #define HDMI_AUDIO_CC_6                 0x5
144 #define HDMI_AUDIO_CC_7                 0x6
145 #define HDMI_AUDIO_CC_8                 0x7
146
147 #define HDMI_AUDIO_CT_STREAM            0x0 /* specified by audio stream */
148 #define HDMI_AUDIO_CT_PCM               0x1
149 #define HDMI_AUDIO_CT_AC3               0x2
150 #define HDMI_AUDIO_CT_MPEG1             0x3
151 #define HDMI_AUDIO_CT_MP3               0x4
152 #define HDMI_AUDIO_CT_MPEG2             0x5
153 #define HDMI_AUDIO_CT_AAC_LC            0x6
154 #define HDMI_AUDIO_CT_DTS               0x7
155 #define HDMI_AUDIO_CT_ATRAC             0x8
156 #define HDMI_AUDIO_CT_DSD               0x9
157 #define HDMI_AUDIO_CT_E_AC3             0xa
158 #define HDMI_AUDIO_CT_DTS_HD            0xb
159 #define HDMI_AUDIO_CT_MLP               0xc
160 #define HDMI_AUDIO_CT_DST               0xd
161 #define HDMI_AUDIO_CT_WMA_PRO           0xe
162 #define HDMI_AUDIO_CT_CXT               0xf
163
164 #define HDMI_AUDIO_SF_STREAM            0x0 /* specified by audio stream */
165 #define HDMI_AUIDO_SF_32K               0x1
166 #define HDMI_AUDIO_SF_44_1K             0x2
167 #define HDMI_AUDIO_SF_48K               0x3
168 #define HDMI_AUDIO_SF_88_2K             0x4
169 #define HDMI_AUDIO_SF_96K               0x5
170 #define HDMI_AUDIO_SF_176_4K            0x6
171 #define HDMI_AUDIO_SF_192K              0x7
172
173 #define HDMI_AUDIO_SS_STREAM            0x0 /* specified by audio stream */
174 #define HDMI_AUDIO_SS_16BIT             0x1
175 #define HDMI_AUDIO_SS_20BIT             0x2
176 #define HDMI_AUDIO_SS_24BIT             0x3
177
178 #define HDMI_AUDIO_CXT_CT               0x0 /* refer to coding in CT */
179 #define HDMI_AUDIO_CXT_HE_AAC           0x1
180 #define HDMI_AUDIO_CXT_HE_AAC_V2        0x2
181 #define HDMI_AUDIO_CXT_MPEG_SURROUND    0x3
182
183 struct tegra_dc_hdmi_data;
184
185 unsigned long tegra_hdmi_readl(struct tegra_dc_hdmi_data *hdmi,
186                                 unsigned long reg);
187 void tegra_hdmi_writel(struct tegra_dc_hdmi_data *hdmi,
188                                 unsigned long val, unsigned long reg);
189 #endif