@@ -72,6 +72,13 @@ struct dp_aud_n_m {
72
72
u16 n ;
73
73
};
74
74
75
+ struct hdmi_aud_ncts {
76
+ int sample_rate ;
77
+ int clock ;
78
+ int n ;
79
+ int cts ;
80
+ };
81
+
75
82
/* Values according to DP 1.4 Table 2-104 */
76
83
static const struct dp_aud_n_m dp_aud_n_m [] = {
77
84
{ 32000 , LC_162M , 1024 , 10125 },
@@ -148,12 +155,7 @@ static const struct {
148
155
#define TMDS_594M 594000
149
156
#define TMDS_593M 593407
150
157
151
- static const struct {
152
- int sample_rate ;
153
- int clock ;
154
- int n ;
155
- int cts ;
156
- } hdmi_aud_ncts [] = {
158
+ static const struct hdmi_aud_ncts hdmi_aud_ncts_24bpp [] = {
157
159
{ 32000 , TMDS_296M , 5824 , 421875 },
158
160
{ 32000 , TMDS_297M , 3072 , 222750 },
159
161
{ 32000 , TMDS_593M , 5824 , 843750 },
@@ -184,6 +186,49 @@ static const struct {
184
186
{ 192000 , TMDS_594M , 24576 , 594000 },
185
187
};
186
188
189
+ /* Appendix C - N & CTS values for deep color from HDMI 2.0 spec*/
190
+ /* HDMI N/CTS table for 10 bit deep color(30 bpp)*/
191
+ #define TMDS_371M 371250
192
+ #define TMDS_370M 370878
193
+
194
+ static const struct hdmi_aud_ncts hdmi_aud_ncts_30bpp [] = {
195
+ { 32000 , TMDS_370M , 5824 , 527344 },
196
+ { 32000 , TMDS_371M , 6144 , 556875 },
197
+ { 44100 , TMDS_370M , 8918 , 585938 },
198
+ { 44100 , TMDS_371M , 4704 , 309375 },
199
+ { 88200 , TMDS_370M , 17836 , 585938 },
200
+ { 88200 , TMDS_371M , 9408 , 309375 },
201
+ { 176400 , TMDS_370M , 35672 , 585938 },
202
+ { 176400 , TMDS_371M , 18816 , 309375 },
203
+ { 48000 , TMDS_370M , 11648 , 703125 },
204
+ { 48000 , TMDS_371M , 5120 , 309375 },
205
+ { 96000 , TMDS_370M , 23296 , 703125 },
206
+ { 96000 , TMDS_371M , 10240 , 309375 },
207
+ { 192000 , TMDS_370M , 46592 , 703125 },
208
+ { 192000 , TMDS_371M , 20480 , 309375 },
209
+ };
210
+
211
+ /* HDMI N/CTS table for 12 bit deep color(36 bpp)*/
212
+ #define TMDS_445_5M 445500
213
+ #define TMDS_445M 445054
214
+
215
+ static const struct hdmi_aud_ncts hdmi_aud_ncts_36bpp [] = {
216
+ { 32000 , TMDS_445M , 5824 , 632813 },
217
+ { 32000 , TMDS_445_5M , 4096 , 445500 },
218
+ { 44100 , TMDS_445M , 8918 , 703125 },
219
+ { 44100 , TMDS_445_5M , 4704 , 371250 },
220
+ { 88200 , TMDS_445M , 17836 , 703125 },
221
+ { 88200 , TMDS_445_5M , 9408 , 371250 },
222
+ { 176400 , TMDS_445M , 35672 , 703125 },
223
+ { 176400 , TMDS_445_5M , 18816 , 371250 },
224
+ { 48000 , TMDS_445M , 5824 , 421875 },
225
+ { 48000 , TMDS_445_5M , 5120 , 371250 },
226
+ { 96000 , TMDS_445M , 11648 , 421875 },
227
+ { 96000 , TMDS_445_5M , 10240 , 371250 },
228
+ { 192000 , TMDS_445M , 23296 , 421875 },
229
+ { 192000 , TMDS_445_5M , 20480 , 371250 },
230
+ };
231
+
187
232
/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
188
233
static u32 audio_config_hdmi_pixel_clock (const struct intel_crtc_state * crtc_state )
189
234
{
@@ -212,12 +257,24 @@ static u32 audio_config_hdmi_pixel_clock(const struct intel_crtc_state *crtc_sta
212
257
static int audio_config_hdmi_get_n (const struct intel_crtc_state * crtc_state ,
213
258
int rate )
214
259
{
215
- int i ;
260
+ const struct hdmi_aud_ncts * hdmi_ncts_table ;
261
+ int i , size ;
262
+
263
+ if (crtc_state -> pipe_bpp == 36 ) {
264
+ hdmi_ncts_table = hdmi_aud_ncts_36bpp ;
265
+ size = ARRAY_SIZE (hdmi_aud_ncts_36bpp );
266
+ } else if (crtc_state -> pipe_bpp == 30 ) {
267
+ hdmi_ncts_table = hdmi_aud_ncts_30bpp ;
268
+ size = ARRAY_SIZE (hdmi_aud_ncts_30bpp );
269
+ } else {
270
+ hdmi_ncts_table = hdmi_aud_ncts_24bpp ;
271
+ size = ARRAY_SIZE (hdmi_aud_ncts_24bpp );
272
+ }
216
273
217
- for (i = 0 ; i < ARRAY_SIZE ( hdmi_aud_ncts ) ; i ++ ) {
218
- if (rate == hdmi_aud_ncts [i ].sample_rate &&
219
- crtc_state -> port_clock == hdmi_aud_ncts [i ].clock ) {
220
- return hdmi_aud_ncts [i ].n ;
274
+ for (i = 0 ; i < size ; i ++ ) {
275
+ if (rate == hdmi_ncts_table [i ].sample_rate &&
276
+ crtc_state -> port_clock == hdmi_ncts_table [i ].clock ) {
277
+ return hdmi_ncts_table [i ].n ;
221
278
}
222
279
}
223
280
return 0 ;
0 commit comments